diff --git a/.github/workflows/rust.yaml b/.github/workflows/rust.yaml index c1304551..add326b5 100644 --- a/.github/workflows/rust.yaml +++ b/.github/workflows/rust.yaml @@ -38,7 +38,7 @@ jobs: - run: cargo fmt --all -- --check - name: Download DuckDB run: | - wget https://github.com/duckdb/duckdb/releases/download/v0.3.2/libduckdb-linux-amd64.zip -O libduckdb.zip + wget https://github.com/duckdb/duckdb/releases/download/v0.3.3/libduckdb-linux-amd64.zip -O libduckdb.zip unzip libduckdb.zip -d libduckdb # - run: cargo clippy --all-targets --workspace --features bundled --features modern-full -- -D warnings -A clippy::redundant-closure - run: cargo clippy --all-targets --workspace --features buildtime_bindgen --features modern-full -- -D warnings -A clippy::redundant-closure diff --git a/Cargo.toml b/Cargo.toml index 9fbdca3d..a2f765cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "duckdb" -version = "0.3.2" +version = "0.3.3" authors = ["wangfenjin "] edition = "2021" description = "Ergonomic wrapper for DuckDB" @@ -68,7 +68,7 @@ tempdir = "0.3.7" [dependencies.libduckdb-sys] path = "libduckdb-sys" -version = "0.3.2" +version = "0.3.3" [package.metadata.docs.rs] features = [] diff --git a/libduckdb-sys/Cargo.toml b/libduckdb-sys/Cargo.toml index 0970aefa..06fd7ed1 100644 --- a/libduckdb-sys/Cargo.toml +++ b/libduckdb-sys/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libduckdb-sys" -version = "0.3.2" +version = "0.3.3" authors = ["wangfenjin "] edition = "2021" build = "build.rs" diff --git a/libduckdb-sys/duckdb/bindgen_bundled_version.rs b/libduckdb-sys/duckdb/bindgen_bundled_version.rs index 12eecb6c..6aa345c7 100644 --- a/libduckdb-sys/duckdb/bindgen_bundled_version.rs +++ b/libduckdb-sys/duckdb/bindgen_bundled_version.rs @@ -106,6 +106,7 @@ pub const __DARWIN_NO_LONG_LONG: u32 = 0; pub const _DARWIN_FEATURE_64_BIT_INODE: u32 = 1; pub const _DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE: u32 = 1; pub const _DARWIN_FEATURE_UNIX_CONFORMANCE: u32 = 3; +pub const __has_ptrcheck: u32 = 0; pub const __PTHREAD_SIZE__: u32 = 8176; pub const __PTHREAD_ATTR_SIZE__: u32 = 56; pub const __PTHREAD_MUTEXATTR_SIZE__: u32 = 8; @@ -202,6 +203,8 @@ pub const __MAC_11_5: u32 = 110500; pub const __MAC_11_6: u32 = 110600; pub const __MAC_12_0: u32 = 120000; pub const __MAC_12_1: u32 = 120100; +pub const __MAC_12_2: u32 = 120200; +pub const __MAC_12_3: u32 = 120300; pub const __IPHONE_2_0: u32 = 20000; pub const __IPHONE_2_1: u32 = 20100; pub const __IPHONE_2_2: u32 = 20200; @@ -260,6 +263,8 @@ pub const __IPHONE_14_8: u32 = 140800; pub const __IPHONE_15_0: u32 = 150000; pub const __IPHONE_15_1: u32 = 150100; pub const __IPHONE_15_2: u32 = 150200; +pub const __IPHONE_15_3: u32 = 150300; +pub const __IPHONE_15_4: u32 = 150400; pub const __TVOS_9_0: u32 = 90000; pub const __TVOS_9_1: u32 = 90100; pub const __TVOS_9_2: u32 = 90200; @@ -291,6 +296,8 @@ pub const __TVOS_14_7: u32 = 140700; pub const __TVOS_15_0: u32 = 150000; pub const __TVOS_15_1: u32 = 150100; pub const __TVOS_15_2: u32 = 150200; +pub const __TVOS_15_3: u32 = 150300; +pub const __TVOS_15_4: u32 = 150400; pub const __WATCHOS_1_0: u32 = 10000; pub const __WATCHOS_2_0: u32 = 20000; pub const __WATCHOS_2_1: u32 = 20100; @@ -320,6 +327,8 @@ pub const __WATCHOS_7_6: u32 = 70600; pub const __WATCHOS_8_0: u32 = 80000; pub const __WATCHOS_8_1: u32 = 80100; pub const __WATCHOS_8_3: u32 = 80300; +pub const __WATCHOS_8_4: u32 = 80400; +pub const __WATCHOS_8_5: u32 = 80500; pub const MAC_OS_X_VERSION_10_0: u32 = 1000; pub const MAC_OS_X_VERSION_10_1: u32 = 1010; pub const MAC_OS_X_VERSION_10_2: u32 = 1020; @@ -357,7 +366,7 @@ pub const MAC_OS_VERSION_12_0: u32 = 120000; pub const __DRIVERKIT_19_0: u32 = 190000; pub const __DRIVERKIT_20_0: u32 = 200000; pub const __DRIVERKIT_21_0: u32 = 210000; -pub const __MAC_OS_X_VERSION_MAX_ALLOWED: u32 = 120100; +pub const __MAC_OS_X_VERSION_MAX_ALLOWED: u32 = 120300; pub const __ENABLE_LEGACY_MAC_AVAILABILITY: u32 = 1; pub const __DARWIN_WCHAR_MIN: i32 = -2147483648; pub const _FORTIFY_SOURCE: u32 = 2; @@ -10390,6 +10399,16 @@ pub const DUCKDB_TYPE_DUCKDB_TYPE_INTERVAL: DUCKDB_TYPE = 15; pub const DUCKDB_TYPE_DUCKDB_TYPE_HUGEINT: DUCKDB_TYPE = 16; pub const DUCKDB_TYPE_DUCKDB_TYPE_VARCHAR: DUCKDB_TYPE = 17; pub const DUCKDB_TYPE_DUCKDB_TYPE_BLOB: DUCKDB_TYPE = 18; +pub const DUCKDB_TYPE_DUCKDB_TYPE_DECIMAL: DUCKDB_TYPE = 19; +pub const DUCKDB_TYPE_DUCKDB_TYPE_TIMESTAMP_S: DUCKDB_TYPE = 20; +pub const DUCKDB_TYPE_DUCKDB_TYPE_TIMESTAMP_MS: DUCKDB_TYPE = 21; +pub const DUCKDB_TYPE_DUCKDB_TYPE_TIMESTAMP_NS: DUCKDB_TYPE = 22; +pub const DUCKDB_TYPE_DUCKDB_TYPE_ENUM: DUCKDB_TYPE = 23; +pub const DUCKDB_TYPE_DUCKDB_TYPE_LIST: DUCKDB_TYPE = 24; +pub const DUCKDB_TYPE_DUCKDB_TYPE_STRUCT: DUCKDB_TYPE = 25; +pub const DUCKDB_TYPE_DUCKDB_TYPE_MAP: DUCKDB_TYPE = 26; +pub const DUCKDB_TYPE_DUCKDB_TYPE_UUID: DUCKDB_TYPE = 27; +pub const DUCKDB_TYPE_DUCKDB_TYPE_JSON: DUCKDB_TYPE = 28; pub type DUCKDB_TYPE = ::std::os::raw::c_uint; pub use self::DUCKDB_TYPE as duckdb_type; #[doc = "! Days are stored as days since 1970-01-01"] @@ -10701,6 +10720,41 @@ fn bindgen_test_layout_duckdb_hugeint() { } #[repr(C)] #[derive(Debug, Copy, Clone)] +pub struct duckdb_decimal { + pub width: u8, + pub scale: u8, + pub value: duckdb_hugeint, +} +#[test] +fn bindgen_test_layout_duckdb_decimal() { + assert_eq!( + ::std::mem::size_of::(), + 24usize, + concat!("Size of: ", stringify!(duckdb_decimal)) + ); + assert_eq!( + ::std::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(duckdb_decimal)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).width as *const _ as usize }, + 0usize, + concat!("Offset of field: ", stringify!(duckdb_decimal), "::", stringify!(width)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).scale as *const _ as usize }, + 1usize, + concat!("Offset of field: ", stringify!(duckdb_decimal), "::", stringify!(scale)) + ); + assert_eq!( + unsafe { &(*(::std::ptr::null::())).value as *const _ as usize }, + 8usize, + concat!("Offset of field: ", stringify!(duckdb_decimal), "::", stringify!(value)) + ); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] pub struct duckdb_blob { pub data: *mut ::std::os::raw::c_void, pub size: idx_t, @@ -10891,6 +10945,10 @@ pub type duckdb_arrow = *mut ::std::os::raw::c_void; pub type duckdb_config = *mut ::std::os::raw::c_void; pub type duckdb_arrow_schema = *mut ::std::os::raw::c_void; pub type duckdb_arrow_array = *mut ::std::os::raw::c_void; +pub type duckdb_logical_type = *mut ::std::os::raw::c_void; +pub type duckdb_data_chunk = *mut ::std::os::raw::c_void; +pub type duckdb_vector = *mut ::std::os::raw::c_void; +pub type duckdb_value = *mut ::std::os::raw::c_void; pub const duckdb_state_DuckDBSuccess: duckdb_state = 0; pub const duckdb_state_DuckDBError: duckdb_state = 1; pub type duckdb_state = ::std::os::raw::c_uint; @@ -11046,6 +11104,18 @@ extern "C" { #[doc = " returns: The column type of the specified column."] pub fn duckdb_column_type(result: *mut duckdb_result, col: idx_t) -> duckdb_type; } +extern "C" { + #[doc = "Returns the logical column type of the specified column."] + #[doc = ""] + #[doc = "The return type of this call should be destroyed with `duckdb_destroy_logical_type`."] + #[doc = ""] + #[doc = "Returns `NULL` if the column is out of range."] + #[doc = ""] + #[doc = " result: The result object to fetch the column type from."] + #[doc = " col: The column index."] + #[doc = " returns: The logical column type of the specified column."] + pub fn duckdb_column_logical_type(result: *mut duckdb_result, col: idx_t) -> duckdb_logical_type; +} extern "C" { #[doc = "Returns the number of columns present in a the result object."] #[doc = ""] @@ -11069,9 +11139,9 @@ extern "C" { pub fn duckdb_rows_changed(result: *mut duckdb_result) -> idx_t; } extern "C" { - #[doc = "Returns the data of a specific column of a result in columnar format. This is the fastest way of accessing data in a"] - #[doc = "query result, as no conversion or type checking must be performed (outside of the original switch). If performance"] - #[doc = "is a concern, it is recommended to use this API over the `duckdb_value` functions."] + #[doc = "DEPRECATED**: Prefer using `duckdb_result_get_chunk` instead."] + #[doc = ""] + #[doc = "Returns the data of a specific column of a result in columnar format."] #[doc = ""] #[doc = "The function returns a dense array which contains the result data. The exact type stored in the array depends on the"] #[doc = "corresponding duckdb_type (as provided by `duckdb_column_type`). For the exact type by which the data should be"] @@ -11089,6 +11159,8 @@ extern "C" { pub fn duckdb_column_data(result: *mut duckdb_result, col: idx_t) -> *mut ::std::os::raw::c_void; } extern "C" { + #[doc = "DEPRECATED**: Prefer using `duckdb_result_get_chunk` instead."] + #[doc = ""] #[doc = "Returns the nullmask of a specific column of a result in columnar format. The nullmask indicates for every row"] #[doc = "whether or not the corresponding row is `NULL`. If a row is `NULL`, the values present in the array provided"] #[doc = "by `duckdb_column_data` are undefined."] @@ -11115,7 +11187,30 @@ extern "C" { #[doc = ""] #[doc = " result: The result object to fetch the nullmask from."] #[doc = " returns: The error of the result."] - pub fn duckdb_result_error(result: *mut duckdb_result) -> *mut ::std::os::raw::c_char; + pub fn duckdb_result_error(result: *mut duckdb_result) -> *const ::std::os::raw::c_char; +} +extern "C" { + #[doc = "Fetches a data chunk from the duckdb_result. This function should be called repeatedly until the result is exhausted."] + #[doc = ""] + #[doc = "This function supersedes all `duckdb_value` functions, as well as the `duckdb_column_data` and `duckdb_nullmask_data`"] + #[doc = "functions. It results in significantly better performance, and should be preferred in newer code-bases."] + #[doc = ""] + #[doc = "If this function is used, none of the other result functions can be used and vice versa (i.e. this function cannot be"] + #[doc = "mixed with the legacy result functions)."] + #[doc = ""] + #[doc = "Use `duckdb_result_chunk_count` to figure out how many chunks there are in the result."] + #[doc = ""] + #[doc = " result: The result object to fetch the data chunk from."] + #[doc = " chunk_index: The chunk index to fetch from."] + #[doc = " returns: The resulting data chunk. Returns `NULL` if the chunk index is out of bounds."] + pub fn duckdb_result_get_chunk(result: duckdb_result, chunk_index: idx_t) -> duckdb_data_chunk; +} +extern "C" { + #[doc = "Returns the number of data chunks present in the result."] + #[doc = ""] + #[doc = " result: The result object"] + #[doc = " returns: The resulting data chunk. Returns `NULL` if the chunk index is out of bounds."] + pub fn duckdb_result_chunk_count(result: duckdb_result) -> idx_t; } extern "C" { #[doc = " returns: The boolean value at the specified location, or false if the value cannot be converted."] @@ -11141,6 +11236,10 @@ extern "C" { #[doc = " returns: The duckdb_hugeint value at the specified location, or 0 if the value cannot be converted."] pub fn duckdb_value_hugeint(result: *mut duckdb_result, col: idx_t, row: idx_t) -> duckdb_hugeint; } +extern "C" { + #[doc = " returns: The duckdb_decimal value at the specified location, or 0 if the value cannot be converted."] + pub fn duckdb_value_decimal(result: *mut duckdb_result, col: idx_t, row: idx_t) -> duckdb_decimal; +} extern "C" { #[doc = " returns: The uint8_t value at the specified location, or 0 if the value cannot be converted."] pub fn duckdb_value_uint8(result: *mut duckdb_result, col: idx_t, row: idx_t) -> u8; @@ -11220,6 +11319,13 @@ extern "C" { #[doc = " ptr: The memory region to de-allocate."] pub fn duckdb_free(ptr: *mut ::std::os::raw::c_void); } +extern "C" { + #[doc = "The internal vector size used by DuckDB."] + #[doc = "This is the amount of tuples that will fit into a data chunk created by `duckdb_create_data_chunk`."] + #[doc = ""] + #[doc = " returns: The vector size."] + pub fn duckdb_vector_size() -> idx_t; +} extern "C" { #[doc = "Decompose a `duckdb_date` object into year, month and date (stored as `duckdb_date_struct`)."] #[doc = ""] @@ -11278,6 +11384,13 @@ extern "C" { #[doc = " returns: The converted `duckdb_hugeint` element."] pub fn duckdb_double_to_hugeint(val: f64) -> duckdb_hugeint; } +extern "C" { + #[doc = "Converts a duckdb_decimal object (as obtained from a `DUCKDB_TYPE_DECIMAL` column) into a double."] + #[doc = ""] + #[doc = " val: The decimal value."] + #[doc = " returns: The converted `double` element."] + pub fn duckdb_decimal_to_double(val: duckdb_decimal) -> f64; +} extern "C" { #[doc = "Create a prepared statement object from a query."] #[doc = ""] @@ -11297,7 +11410,7 @@ extern "C" { ) -> duckdb_state; } extern "C" { - #[doc = "Closes the prepared statement and de-allocates all memory allocated for that connection."] + #[doc = "Closes the prepared statement and de-allocates all memory allocated for the statement."] #[doc = ""] #[doc = " prepared_statement: The prepared statement to destroy."] pub fn duckdb_destroy_prepare(prepared_statement: *mut duckdb_prepared_statement); @@ -11493,6 +11606,625 @@ extern "C" { out_result: *mut duckdb_arrow, ) -> duckdb_state; } +extern "C" { + #[doc = "Destroys the value and de-allocates all memory allocated for that type."] + #[doc = ""] + #[doc = " value: The value to destroy."] + pub fn duckdb_destroy_value(value: *mut duckdb_value); +} +extern "C" { + #[doc = "Creates a value from a null-terminated string"] + #[doc = ""] + #[doc = " value: The null-terminated string"] + #[doc = " returns: The value. This must be destroyed with `duckdb_destroy_value`."] + pub fn duckdb_create_varchar(text: *const ::std::os::raw::c_char) -> duckdb_value; +} +extern "C" { + #[doc = "Creates a value from a string"] + #[doc = ""] + #[doc = " value: The text"] + #[doc = " length: The length of the text"] + #[doc = " returns: The value. This must be destroyed with `duckdb_destroy_value`."] + pub fn duckdb_create_varchar_length(text: *const ::std::os::raw::c_char, length: idx_t) -> duckdb_value; +} +extern "C" { + #[doc = "Creates a value from an int64"] + #[doc = ""] + #[doc = " value: The bigint value"] + #[doc = " returns: The value. This must be destroyed with `duckdb_destroy_value`."] + pub fn duckdb_create_int64(val: i64) -> duckdb_value; +} +extern "C" { + #[doc = "Obtains a string representation of the given value."] + #[doc = "The result must be destroyed with `duckdb_free`."] + #[doc = ""] + #[doc = " value: The value"] + #[doc = " returns: The string value. This must be destroyed with `duckdb_free`."] + pub fn duckdb_get_varchar(value: duckdb_value) -> *mut ::std::os::raw::c_char; +} +extern "C" { + #[doc = "Obtains an int64 of the given value."] + #[doc = ""] + #[doc = " value: The value"] + #[doc = " returns: The int64 value, or 0 if no conversion is possible"] + pub fn duckdb_get_int64(value: duckdb_value) -> i64; +} +extern "C" { + #[doc = "Creates a `duckdb_logical_type` from a standard primitive type."] + #[doc = "The resulting type should be destroyed with `duckdb_destroy_logical_type`."] + #[doc = ""] + #[doc = "This should not be used with `DUCKDB_TYPE_DECIMAL`."] + #[doc = ""] + #[doc = " type: The primitive type to create."] + #[doc = " returns: The logical type."] + pub fn duckdb_create_logical_type(type_: duckdb_type) -> duckdb_logical_type; +} +extern "C" { + #[doc = "Creates a `duckdb_logical_type` of type decimal with the specified width and scale"] + #[doc = "The resulting type should be destroyed with `duckdb_destroy_logical_type`."] + #[doc = ""] + #[doc = " width: The width of the decimal type"] + #[doc = " scale: The scale of the decimal type"] + #[doc = " returns: The logical type."] + pub fn duckdb_create_decimal_type(width: u8, scale: u8) -> duckdb_logical_type; +} +extern "C" { + #[doc = "Retrieves the type class of a `duckdb_logical_type`."] + #[doc = ""] + #[doc = " type: The logical type object"] + #[doc = " returns: The type id"] + pub fn duckdb_get_type_id(type_: duckdb_logical_type) -> duckdb_type; +} +extern "C" { + #[doc = "Retrieves the width of a decimal type."] + #[doc = ""] + #[doc = " type: The logical type object"] + #[doc = " returns: The width of the decimal type"] + pub fn duckdb_decimal_width(type_: duckdb_logical_type) -> u8; +} +extern "C" { + #[doc = "Retrieves the scale of a decimal type."] + #[doc = ""] + #[doc = " type: The logical type object"] + #[doc = " returns: The scale of the decimal type"] + pub fn duckdb_decimal_scale(type_: duckdb_logical_type) -> u8; +} +extern "C" { + #[doc = "Retrieves the internal storage type of a decimal type."] + #[doc = ""] + #[doc = " type: The logical type object"] + #[doc = " returns: The internal type of the decimal type"] + pub fn duckdb_decimal_internal_type(type_: duckdb_logical_type) -> duckdb_type; +} +extern "C" { + #[doc = "Retrieves the internal storage type of an enum type."] + #[doc = ""] + #[doc = " type: The logical type object"] + #[doc = " returns: The internal type of the enum type"] + pub fn duckdb_enum_internal_type(type_: duckdb_logical_type) -> duckdb_type; +} +extern "C" { + #[doc = "Retrieves the dictionary size of the enum type"] + #[doc = ""] + #[doc = " type: The logical type object"] + #[doc = " returns: The dictionary size of the enum type"] + pub fn duckdb_enum_dictionary_size(type_: duckdb_logical_type) -> u32; +} +extern "C" { + #[doc = "Retrieves the dictionary value at the specified position from the enum."] + #[doc = ""] + #[doc = "The result must be freed with `duckdb_free`"] + #[doc = ""] + #[doc = " type: The logical type object"] + #[doc = " index: The index in the dictionary"] + #[doc = " returns: The string value of the enum type. Must be freed with `duckdb_free`."] + pub fn duckdb_enum_dictionary_value(type_: duckdb_logical_type, index: idx_t) -> *mut ::std::os::raw::c_char; +} +extern "C" { + #[doc = "Retrieves the child type of the given list type."] + #[doc = ""] + #[doc = "The result must be freed with `duckdb_destroy_logical_type`"] + #[doc = ""] + #[doc = " type: The logical type object"] + #[doc = " returns: The child type of the list type. Must be destroyed with `duckdb_destroy_logical_type`."] + pub fn duckdb_list_type_child_type(type_: duckdb_logical_type) -> duckdb_logical_type; +} +extern "C" { + #[doc = "Returns the number of children of a struct type."] + #[doc = ""] + #[doc = " type: The logical type object"] + #[doc = " returns: The number of children of a struct type."] + pub fn duckdb_struct_type_child_count(type_: duckdb_logical_type) -> idx_t; +} +extern "C" { + #[doc = "Retrieves the name of the struct child."] + #[doc = ""] + #[doc = "The result must be freed with `duckdb_free`"] + #[doc = ""] + #[doc = " type: The logical type object"] + #[doc = " index: The child index"] + #[doc = " returns: The name of the struct type. Must be freed with `duckdb_free`."] + pub fn duckdb_struct_type_child_name(type_: duckdb_logical_type, index: idx_t) -> *mut ::std::os::raw::c_char; +} +extern "C" { + #[doc = "Retrieves the child type of the given struct type at the specified index."] + #[doc = ""] + #[doc = "The result must be freed with `duckdb_destroy_logical_type`"] + #[doc = ""] + #[doc = " type: The logical type object"] + #[doc = " index: The child index"] + #[doc = " returns: The child type of the struct type. Must be destroyed with `duckdb_destroy_logical_type`."] + pub fn duckdb_struct_type_child_type(type_: duckdb_logical_type, index: idx_t) -> duckdb_logical_type; +} +extern "C" { + #[doc = "Destroys the logical type and de-allocates all memory allocated for that type."] + #[doc = ""] + #[doc = " type: The logical type to destroy."] + pub fn duckdb_destroy_logical_type(type_: *mut duckdb_logical_type); +} +extern "C" { + #[doc = "Creates an empty DataChunk with the specified set of types."] + #[doc = ""] + #[doc = " types: An array of types of the data chunk."] + #[doc = " column_count: The number of columns."] + #[doc = " returns: The data chunk."] + pub fn duckdb_create_data_chunk(types: *mut duckdb_logical_type, column_count: idx_t) -> duckdb_data_chunk; +} +extern "C" { + #[doc = "Destroys the data chunk and de-allocates all memory allocated for that chunk."] + #[doc = ""] + #[doc = " chunk: The data chunk to destroy."] + pub fn duckdb_destroy_data_chunk(chunk: *mut duckdb_data_chunk); +} +extern "C" { + #[doc = "Resets a data chunk, clearing the validity masks and setting the cardinality of the data chunk to 0."] + #[doc = ""] + #[doc = " chunk: The data chunk to reset."] + pub fn duckdb_data_chunk_reset(chunk: duckdb_data_chunk); +} +extern "C" { + #[doc = "Retrieves the number of columns in a data chunk."] + #[doc = ""] + #[doc = " chunk: The data chunk to get the data from"] + #[doc = " returns: The number of columns in the data chunk"] + pub fn duckdb_data_chunk_get_column_count(chunk: duckdb_data_chunk) -> idx_t; +} +extern "C" { + #[doc = "Retrieves the vector at the specified column index in the data chunk."] + #[doc = ""] + #[doc = "The pointer to the vector is valid for as long as the chunk is alive."] + #[doc = "It does NOT need to be destroyed."] + #[doc = ""] + #[doc = " chunk: The data chunk to get the data from"] + #[doc = " returns: The vector"] + pub fn duckdb_data_chunk_get_vector(chunk: duckdb_data_chunk, col_idx: idx_t) -> duckdb_vector; +} +extern "C" { + #[doc = "Retrieves the current number of tuples in a data chunk."] + #[doc = ""] + #[doc = " chunk: The data chunk to get the data from"] + #[doc = " returns: The number of tuples in the data chunk"] + pub fn duckdb_data_chunk_get_size(chunk: duckdb_data_chunk) -> idx_t; +} +extern "C" { + #[doc = "Sets the current number of tuples in a data chunk."] + #[doc = ""] + #[doc = " chunk: The data chunk to set the size in"] + #[doc = " size: The number of tuples in the data chunk"] + pub fn duckdb_data_chunk_set_size(chunk: duckdb_data_chunk, size: idx_t); +} +extern "C" { + #[doc = "Retrieves the column type of the specified vector."] + #[doc = ""] + #[doc = "The result must be destroyed with `duckdb_destroy_logical_type`."] + #[doc = ""] + #[doc = " vector: The vector get the data from"] + #[doc = " returns: The type of the vector"] + pub fn duckdb_vector_get_column_type(vector: duckdb_vector) -> duckdb_logical_type; +} +extern "C" { + #[doc = "Retrieves the data pointer of the vector."] + #[doc = ""] + #[doc = "The data pointer can be used to read or write values from the vector."] + #[doc = "How to read or write values depends on the type of the vector."] + #[doc = ""] + #[doc = " vector: The vector to get the data from"] + #[doc = " returns: The data pointer"] + pub fn duckdb_vector_get_data(vector: duckdb_vector) -> *mut ::std::os::raw::c_void; +} +extern "C" { + #[doc = "Retrieves the validity mask pointer of the specified vector."] + #[doc = ""] + #[doc = "If all values are valid, this function MIGHT return NULL!"] + #[doc = ""] + #[doc = "The validity mask is a bitset that signifies null-ness within the data chunk."] + #[doc = "It is a series of uint64_t values, where each uint64_t value contains validity for 64 tuples."] + #[doc = "The bit is set to 1 if the value is valid (i.e. not NULL) or 0 if the value is invalid (i.e. NULL)."] + #[doc = ""] + #[doc = "Validity of a specific value can be obtained like this:"] + #[doc = ""] + #[doc = "idx_t entry_idx = row_idx / 64;"] + #[doc = "idx_t idx_in_entry = row_idx % 64;"] + #[doc = "bool is_valid = validity_mask[entry_idx] & (1 << idx_in_entry);"] + #[doc = ""] + #[doc = "Alternatively, the (slower) duckdb_validity_row_is_valid function can be used."] + #[doc = ""] + #[doc = " vector: The vector to get the data from"] + #[doc = " returns: The pointer to the validity mask, or NULL if no validity mask is present"] + pub fn duckdb_vector_get_validity(vector: duckdb_vector) -> *mut u64; +} +extern "C" { + #[doc = "Ensures the validity mask is writable by allocating it."] + #[doc = ""] + #[doc = "After this function is called, `duckdb_vector_get_validity` will ALWAYS return non-NULL."] + #[doc = "This allows null values to be written to the vector, regardless of whether a validity mask was present before."] + #[doc = ""] + #[doc = " vector: The vector to alter"] + pub fn duckdb_vector_ensure_validity_writable(vector: duckdb_vector); +} +extern "C" { + #[doc = "Assigns a string element in the vector at the specified location."] + #[doc = ""] + #[doc = " vector: The vector to alter"] + #[doc = " index: The row position in the vector to assign the string to"] + #[doc = " str: The null-terminated string"] + pub fn duckdb_vector_assign_string_element( + vector: duckdb_vector, + index: idx_t, + str_: *const ::std::os::raw::c_char, + ); +} +extern "C" { + #[doc = "Assigns a string element in the vector at the specified location."] + #[doc = ""] + #[doc = " vector: The vector to alter"] + #[doc = " index: The row position in the vector to assign the string to"] + #[doc = " str: The string"] + #[doc = " str_len: The length of the string (in bytes)"] + pub fn duckdb_vector_assign_string_element_len( + vector: duckdb_vector, + index: idx_t, + str_: *const ::std::os::raw::c_char, + str_len: idx_t, + ); +} +extern "C" { + #[doc = "Retrieves the child vector of a list vector."] + #[doc = ""] + #[doc = "The resulting vector is valid as long as the parent vector is valid."] + #[doc = ""] + #[doc = " vector: The vector"] + #[doc = " returns: The child vector"] + pub fn duckdb_list_vector_get_child(vector: duckdb_vector) -> duckdb_vector; +} +extern "C" { + #[doc = "Returns the size of the child vector of the list"] + #[doc = ""] + #[doc = " vector: The vector"] + #[doc = " returns: The size of the child list"] + pub fn duckdb_list_vector_get_size(vector: duckdb_vector) -> idx_t; +} +extern "C" { + #[doc = "Retrieves the child vector of a struct vector."] + #[doc = ""] + #[doc = "The resulting vector is valid as long as the parent vector is valid."] + #[doc = ""] + #[doc = " vector: The vector"] + #[doc = " index: The child index"] + #[doc = " returns: The child vector"] + pub fn duckdb_struct_vector_get_child(vector: duckdb_vector, index: idx_t) -> duckdb_vector; +} +extern "C" { + #[doc = "Returns whether or not a row is valid (i.e. not NULL) in the given validity mask."] + #[doc = ""] + #[doc = " validity: The validity mask, as obtained through `duckdb_data_chunk_get_validity`"] + #[doc = " row: The row index"] + #[doc = " returns: true if the row is valid, false otherwise"] + pub fn duckdb_validity_row_is_valid(validity: *mut u64, row: idx_t) -> bool; +} +extern "C" { + #[doc = "In a validity mask, sets a specific row to either valid or invalid."] + #[doc = ""] + #[doc = "Note that `duckdb_data_chunk_ensure_validity_writable` should be called before calling `duckdb_data_chunk_get_validity`,"] + #[doc = "to ensure that there is a validity mask to write to."] + #[doc = ""] + #[doc = " validity: The validity mask, as obtained through `duckdb_data_chunk_get_validity`."] + #[doc = " row: The row index"] + #[doc = " valid: Whether or not to set the row to valid, or invalid"] + pub fn duckdb_validity_set_row_validity(validity: *mut u64, row: idx_t, valid: bool); +} +extern "C" { + #[doc = "In a validity mask, sets a specific row to invalid."] + #[doc = ""] + #[doc = "Equivalent to `duckdb_validity_set_row_validity` with valid set to false."] + #[doc = ""] + #[doc = " validity: The validity mask"] + #[doc = " row: The row index"] + pub fn duckdb_validity_set_row_invalid(validity: *mut u64, row: idx_t); +} +extern "C" { + #[doc = "In a validity mask, sets a specific row to valid."] + #[doc = ""] + #[doc = "Equivalent to `duckdb_validity_set_row_validity` with valid set to true."] + #[doc = ""] + #[doc = " validity: The validity mask"] + #[doc = " row: The row index"] + pub fn duckdb_validity_set_row_valid(validity: *mut u64, row: idx_t); +} +pub type duckdb_table_function = *mut ::std::os::raw::c_void; +pub type duckdb_bind_info = *mut ::std::os::raw::c_void; +pub type duckdb_init_info = *mut ::std::os::raw::c_void; +pub type duckdb_function_info = *mut ::std::os::raw::c_void; +pub type duckdb_table_function_bind_t = ::std::option::Option; +pub type duckdb_table_function_init_t = ::std::option::Option; +pub type duckdb_table_function_t = + ::std::option::Option; +pub type duckdb_delete_callback_t = ::std::option::Option; +extern "C" { + #[doc = "Creates a new empty table function."] + #[doc = ""] + #[doc = "The return value should be destroyed with `duckdb_destroy_table_function`."] + #[doc = ""] + #[doc = " returns: The table function object."] + pub fn duckdb_create_table_function() -> duckdb_table_function; +} +extern "C" { + #[doc = "Destroys the given table function object."] + #[doc = ""] + #[doc = " table_function: The table function to destroy"] + pub fn duckdb_destroy_table_function(table_function: *mut duckdb_table_function); +} +extern "C" { + #[doc = "Sets the name of the given table function."] + #[doc = ""] + #[doc = " table_function: The table function"] + #[doc = " name: The name of the table function"] + pub fn duckdb_table_function_set_name(table_function: duckdb_table_function, name: *const ::std::os::raw::c_char); +} +extern "C" { + #[doc = "Adds a parameter to the table function."] + #[doc = ""] + #[doc = " table_function: The table function"] + #[doc = " type: The type of the parameter to add."] + pub fn duckdb_table_function_add_parameter(table_function: duckdb_table_function, type_: duckdb_logical_type); +} +extern "C" { + #[doc = "Assigns extra information to the table function that can be fetched during binding, etc."] + #[doc = ""] + #[doc = " table_function: The table function"] + #[doc = " extra_info: The extra information"] + #[doc = " destroy: The callback that will be called to destroy the bind data (if any)"] + pub fn duckdb_table_function_set_extra_info( + table_function: duckdb_table_function, + extra_info: *mut ::std::os::raw::c_void, + destroy: duckdb_delete_callback_t, + ); +} +extern "C" { + #[doc = "Sets the bind function of the table function"] + #[doc = ""] + #[doc = " table_function: The table function"] + #[doc = " bind: The bind function"] + pub fn duckdb_table_function_set_bind(table_function: duckdb_table_function, bind: duckdb_table_function_bind_t); +} +extern "C" { + #[doc = "Sets the init function of the table function"] + #[doc = ""] + #[doc = " table_function: The table function"] + #[doc = " init: The init function"] + pub fn duckdb_table_function_set_init(table_function: duckdb_table_function, init: duckdb_table_function_init_t); +} +extern "C" { + #[doc = "Sets the main function of the table function"] + #[doc = ""] + #[doc = " table_function: The table function"] + #[doc = " function: The function"] + pub fn duckdb_table_function_set_function(table_function: duckdb_table_function, function: duckdb_table_function_t); +} +extern "C" { + #[doc = "Sets whether or not the given table function supports projection pushdown."] + #[doc = ""] + #[doc = "If this is set to true, the system will provide a list of all required columns in the `init` stage through"] + #[doc = "the `duckdb_init_get_column_count` and `duckdb_init_get_column_index` functions."] + #[doc = "If this is set to false (the default), the system will expect all columns to be projected."] + #[doc = ""] + #[doc = " table_function: The table function"] + #[doc = " pushdown: True if the table function supports projection pushdown, false otherwise."] + pub fn duckdb_table_function_supports_projection_pushdown(table_function: duckdb_table_function, pushdown: bool); +} +extern "C" { + #[doc = "Register the table function object within the given connection."] + #[doc = ""] + #[doc = "The function requires at least a name, a bind function, an init function and a main function."] + #[doc = ""] + #[doc = "If the function is incomplete or a function with this name already exists DuckDBError is returned."] + #[doc = ""] + #[doc = " con: The connection to register it in."] + #[doc = " function: The function pointer"] + #[doc = " returns: Whether or not the registration was successful."] + pub fn duckdb_register_table_function(con: duckdb_connection, function: duckdb_table_function) -> duckdb_state; +} +extern "C" { + #[doc = "Retrieves the extra info of the function as set in `duckdb_table_function_set_extra_info`"] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " returns: The extra info"] + pub fn duckdb_bind_get_extra_info(info: duckdb_bind_info) -> *mut ::std::os::raw::c_void; +} +extern "C" { + #[doc = "Adds a result column to the output of the table function."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " name: The name of the column"] + #[doc = " type: The logical type of the column"] + pub fn duckdb_bind_add_result_column( + info: duckdb_bind_info, + name: *const ::std::os::raw::c_char, + type_: duckdb_logical_type, + ); +} +extern "C" { + #[doc = "Retrieves the number of regular (non-named) parameters to the function."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " returns: The number of parameters"] + pub fn duckdb_bind_get_parameter_count(info: duckdb_bind_info) -> idx_t; +} +extern "C" { + #[doc = "Retrieves the parameter at the given index."] + #[doc = ""] + #[doc = "The result must be destroyed with `duckdb_destroy_value`."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " index: The index of the parameter to get"] + #[doc = " returns: The value of the parameter. Must be destroyed with `duckdb_destroy_value`."] + pub fn duckdb_bind_get_parameter(info: duckdb_bind_info, index: idx_t) -> duckdb_value; +} +extern "C" { + #[doc = "Sets the user-provided bind data in the bind object. This object can be retrieved again during execution."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " extra_data: The bind data object."] + #[doc = " destroy: The callback that will be called to destroy the bind data (if any)"] + pub fn duckdb_bind_set_bind_data( + info: duckdb_bind_info, + bind_data: *mut ::std::os::raw::c_void, + destroy: duckdb_delete_callback_t, + ); +} +extern "C" { + #[doc = "Report that an error has occurred while calling bind."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " error: The error message"] + pub fn duckdb_bind_set_error(info: duckdb_bind_info, error: *const ::std::os::raw::c_char); +} +extern "C" { + #[doc = "Retrieves the extra info of the function as set in `duckdb_table_function_set_extra_info`"] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " returns: The extra info"] + pub fn duckdb_init_get_extra_info(info: duckdb_init_info) -> *mut ::std::os::raw::c_void; +} +extern "C" { + #[doc = "Gets the bind data set by `duckdb_bind_set_bind_data` during the bind."] + #[doc = ""] + #[doc = "Note that the bind data should be considered as read-only."] + #[doc = "For tracking state, use the init data instead."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " returns: The bind data object"] + pub fn duckdb_init_get_bind_data(info: duckdb_init_info) -> *mut ::std::os::raw::c_void; +} +extern "C" { + #[doc = "Sets the user-provided init data in the init object. This object can be retrieved again during execution."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " extra_data: The init data object."] + #[doc = " destroy: The callback that will be called to destroy the init data (if any)"] + pub fn duckdb_init_set_init_data( + info: duckdb_init_info, + init_data: *mut ::std::os::raw::c_void, + destroy: duckdb_delete_callback_t, + ); +} +extern "C" { + #[doc = "Returns the number of projected columns."] + #[doc = ""] + #[doc = "This function must be used if projection pushdown is enabled to figure out which columns to emit."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " returns: The number of projected columns."] + pub fn duckdb_init_get_column_count(info: duckdb_init_info) -> idx_t; +} +extern "C" { + #[doc = "Returns the column index of the projected column at the specified position."] + #[doc = ""] + #[doc = "This function must be used if projection pushdown is enabled to figure out which columns to emit."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " column_index: The index at which to get the projected column index, from 0..duckdb_init_get_column_count(info)"] + #[doc = " returns: The column index of the projected column."] + pub fn duckdb_init_get_column_index(info: duckdb_init_info, column_index: idx_t) -> idx_t; +} +extern "C" { + #[doc = "Report that an error has occurred while calling init."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " error: The error message"] + pub fn duckdb_init_set_error(info: duckdb_init_info, error: *const ::std::os::raw::c_char); +} +extern "C" { + #[doc = "Retrieves the extra info of the function as set in `duckdb_table_function_set_extra_info`"] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " returns: The extra info"] + pub fn duckdb_function_get_extra_info(info: duckdb_function_info) -> *mut ::std::os::raw::c_void; +} +extern "C" { + #[doc = "Gets the bind data set by `duckdb_bind_set_bind_data` during the bind."] + #[doc = ""] + #[doc = "Note that the bind data should be considered as read-only."] + #[doc = "For tracking state, use the init data instead."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " returns: The bind data object"] + pub fn duckdb_function_get_bind_data(info: duckdb_function_info) -> *mut ::std::os::raw::c_void; +} +extern "C" { + #[doc = "Gets the init data set by `duckdb_bind_set_init_data` during the bind."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " returns: The init data object"] + pub fn duckdb_function_get_init_data(info: duckdb_function_info) -> *mut ::std::os::raw::c_void; +} +extern "C" { + #[doc = "Report that an error has occurred while executing the function."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " error: The error message"] + pub fn duckdb_function_set_error(info: duckdb_function_info, error: *const ::std::os::raw::c_char); +} +pub type duckdb_replacement_scan_info = *mut ::std::os::raw::c_void; +pub type duckdb_replacement_callback_t = ::std::option::Option< + unsafe extern "C" fn( + info: duckdb_replacement_scan_info, + table_name: *const ::std::os::raw::c_char, + data: *mut ::std::os::raw::c_void, + ), +>; +extern "C" { + #[doc = "Add a replacement scan definition to the specified database"] + #[doc = ""] + #[doc = " db: The database object to add the replacement scan to"] + #[doc = " replacement: The replacement scan callback"] + #[doc = " extra_data: Extra data that is passed back into the specified callback"] + #[doc = " delete_callback: The delete callback to call on the extra data, if any"] + pub fn duckdb_add_replacement_scan( + db: duckdb_database, + replacement: duckdb_replacement_callback_t, + extra_data: *mut ::std::os::raw::c_void, + delete_callback: duckdb_delete_callback_t, + ); +} +extern "C" { + #[doc = "Sets the replacement function name to use. If this function is called in the replacement callback,"] + #[doc = "the replacement scan is performed. If it is not called, the replacement callback is not performed."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " function_name: The function name to substitute."] + pub fn duckdb_replacement_scan_set_function_name( + info: duckdb_replacement_scan_info, + function_name: *const ::std::os::raw::c_char, + ); +} +extern "C" { + #[doc = "Adds a parameter to the replacement scan function."] + #[doc = ""] + #[doc = " info: The info object"] + #[doc = " parameter: The parameter to add."] + pub fn duckdb_replacement_scan_add_parameter(info: duckdb_replacement_scan_info, parameter: duckdb_value); +} extern "C" { #[doc = "Creates an appender object."] #[doc = ""] @@ -11645,6 +12377,18 @@ extern "C" { #[doc = "Append a NULL value to the appender (of any type)."] pub fn duckdb_append_null(appender: duckdb_appender) -> duckdb_state; } +extern "C" { + #[doc = "Appends a pre-filled data chunk to the specified appender."] + #[doc = ""] + #[doc = "The types of the data chunk must exactly match the types of the table, no casting is performed."] + #[doc = "If the types do not match or the appender is in an invalid state, DuckDBError is returned."] + #[doc = "If the append is successful, DuckDBSuccess is returned."] + #[doc = ""] + #[doc = " appender: The appender to append to."] + #[doc = " chunk: The data chunk to append."] + #[doc = " returns: The return state."] + pub fn duckdb_append_data_chunk(appender: duckdb_appender, chunk: duckdb_data_chunk) -> duckdb_state; +} extern "C" { #[doc = "Executes a SQL query within a connection and stores the full (materialized) result in an arrow structure."] #[doc = "If the query fails to execute, DuckDBError is returned and the error message can be retrieved by calling"] diff --git a/libduckdb-sys/duckdb/duckdb.cpp b/libduckdb-sys/duckdb/duckdb.cpp index 4789c3dc..f83ee6be 100644 --- a/libduckdb-sys/duckdb/duckdb.cpp +++ b/libduckdb-sys/duckdb/duckdb.cpp @@ -393,6 +393,17 @@ class IndexCatalogEntry : public StandardEntry { +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/parsed_data/create_macro_info.hpp +// +// +//===----------------------------------------------------------------------===// + + + + //===----------------------------------------------------------------------===// // DuckDB // @@ -402,48 +413,82 @@ class IndexCatalogEntry : public StandardEntry { //===----------------------------------------------------------------------===// +//! The SelectStatement of the view + + + + + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/expression/constant_expression.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + +namespace duckdb { + +//! ConstantExpression represents a constant value in the query +class ConstantExpression : public ParsedExpression { +public: + DUCKDB_API explicit ConstantExpression(Value val); + + //! The constant value referenced + Value value; + +public: + string ToString() const override; + static bool Equals(const ConstantExpression *a, const ConstantExpression *b); + hash_t Hash() const override; + unique_ptr Copy() const override; + void Serialize(FieldWriter &writer) const override; + static unique_ptr Deserialize(ExpressionType type, FieldReader &source); +}; +} // namespace duckdb namespace duckdb { -class MacroCatalogEntry; +enum class MacroType : uint8_t { VOID_MACRO = 0, TABLE_MACRO = 1, SCALAR_MACRO = 2 }; class MacroFunction { public: - explicit MacroFunction(unique_ptr expression); + // explicit MacroFunction(unique_ptr expression); + MacroFunction(MacroType type); - //! Check whether the supplied arguments are valid - static string ValidateArguments(MacroCatalogEntry ¯o_func, FunctionExpression &function_expr, - vector> &positionals, - unordered_map> &defaults); - //! The macro expression - unique_ptr expression; + // MacroFunction(void); + // The type + MacroType type; //! The positional parameters vector> parameters; //! The default parameters and their associated values unordered_map> default_parameters; public: - unique_ptr Copy(); -}; - -} // namespace duckdb - -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/parsed_data/create_macro_info.hpp -// -// -//===----------------------------------------------------------------------===// + virtual ~MacroFunction() { + } + void CopyProperties(MacroFunction &other); + virtual unique_ptr Copy() = 0; + static string ValidateArguments(MacroFunction ¯o_function, const string &name, + FunctionExpression &function_expr, + vector> &positionals, + unordered_map> &defaults); +}; +} // namespace duckdb namespace duckdb { @@ -452,6 +497,9 @@ struct CreateMacroInfo : public CreateFunctionInfo { CreateMacroInfo() : CreateFunctionInfo(CatalogType::MACRO_ENTRY, INVALID_SCHEMA) { } + CreateMacroInfo(CatalogType type) : CreateFunctionInfo(type, INVALID_SCHEMA) { + } + unique_ptr function; public: @@ -466,6 +514,20 @@ struct CreateMacroInfo : public CreateFunctionInfo { } // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + + namespace duckdb { @@ -473,13 +535,27 @@ namespace duckdb { class MacroCatalogEntry : public StandardEntry { public: MacroCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateMacroInfo *info); - //! The macro function unique_ptr function; public: - //! Serialize the meta information of the MacroCatalogEntry a serializer - virtual void Serialize(Serializer &serializer); + //! Serialize the meta information + virtual void Serialize(Serializer &serializer) = 0; +}; + +} // namespace duckdb + + +namespace duckdb { + +//! A macro function in the catalog +class ScalarMacroCatalogEntry : public MacroCatalogEntry { +public: + ScalarMacroCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateMacroInfo *info); + +public: + //! Serialize the meta information of the ScalarMacroCatalogEntry + void Serialize(Serializer &serializer) override; //! Deserializes to a CreateMacroInfo static unique_ptr Deserialize(Deserializer &source); }; @@ -888,12 +964,15 @@ namespace duckdb { //! Represents a function call class FunctionExpression : public ParsedExpression { public: - FunctionExpression(string schema_name, const string &function_name, vector> children, - unique_ptr filter = nullptr, unique_ptr order_bys = nullptr, - bool distinct = false, bool is_operator = false); - FunctionExpression(const string &function_name, vector> children, - unique_ptr filter = nullptr, unique_ptr order_bys = nullptr, - bool distinct = false, bool is_operator = false); + DUCKDB_API FunctionExpression(string schema_name, const string &function_name, + vector> children, + unique_ptr filter = nullptr, + unique_ptr order_bys = nullptr, bool distinct = false, + bool is_operator = false, bool export_state = false); + DUCKDB_API FunctionExpression(const string &function_name, vector> children, + unique_ptr filter = nullptr, + unique_ptr order_bys = nullptr, bool distinct = false, + bool is_operator = false, bool export_state = false); //! Schema of the function string schema; @@ -909,6 +988,8 @@ class FunctionExpression : public ParsedExpression { unique_ptr filter; //! Modifier representing an ORDER BY, only used for aggregates unique_ptr order_bys; + //! whether this function should export its state or not + bool export_state; public: string ToString() const override; @@ -920,6 +1001,63 @@ class FunctionExpression : public ParsedExpression { void Serialize(FieldWriter &writer) const override; static unique_ptr Deserialize(ExpressionType type, FieldReader &source); + + void Verify() const override; + +public: + template + static string ToString(const T &entry, const string &schema, const string &function_name, bool is_operator = false, + bool distinct = false, BASE *filter = nullptr, OrderModifier *order_bys = nullptr, + bool export_state = false) { + if (is_operator) { + // built-in operator + D_ASSERT(!distinct); + if (entry.children.size() == 1) { + if (StringUtil::Contains(function_name, "__postfix")) { + return "(" + entry.children[0]->ToString() + ")" + + StringUtil::Replace(function_name, "__postfix", ""); + } else { + return function_name + "(" + entry.children[0]->ToString() + ")"; + } + } else if (entry.children.size() == 2) { + return "(" + entry.children[0]->ToString() + " " + function_name + " " + entry.children[1]->ToString() + + ")"; + } + } + // standard function call + string result = schema.empty() ? function_name : schema + "." + function_name; + result += "("; + if (distinct) { + result += "DISTINCT "; + } + result += StringUtil::Join(entry.children, entry.children.size(), ", ", + [](const unique_ptr &child) { return child->ToString(); }); + // ordered aggregate + if (order_bys && !order_bys->orders.empty()) { + if (entry.children.empty()) { + result += ") WITHIN GROUP ("; + } + result += " ORDER BY "; + for (idx_t i = 0; i < order_bys->orders.size(); i++) { + if (i > 0) { + result += ", "; + } + result += order_bys->orders[i].ToString(); + } + } + result += ")"; + + // filtered aggregate + if (filter) { + result += " FILTER (WHERE " + filter->ToString() + ")"; + } + + if (export_state) { + result += " EXPORT_STATE"; + } + + return result; + } }; } // namespace duckdb @@ -2353,11 +2491,18 @@ class Transaction; struct IndexLock; +enum IndexConstraintType : uint8_t { + NONE = 0, // index is an index don't built to any constraint + UNIQUE = 1, // index is an index built to enforce a UNIQUE constraint + PRIMARY = 2, // index is an index built to enforce a PRIMARY KEY constraint + FOREIGN = 3 // index is an index built to enforce a FOREIGN KEY constraint +}; + //! The index is an abstract base class that serves as the basis for indexes class Index { public: Index(IndexType type, const vector &column_ids, const vector> &unbound_expressions, - bool is_unique, bool is_primary); + IndexConstraintType constraint_type); virtual ~Index() = default; //! The type of the index @@ -2372,10 +2517,8 @@ class Index { vector types; //! The logical types of the expressions vector logical_types; - //! Whether or not the index is an index built to enforce a UNIQUE or PRIMARY KEY constraint - bool is_unique; - //! Whether or not the index is an index built to enforce a PRIMARY KEY constraint - bool is_primary; + // ! constraint type + IndexConstraintType constraint_type; public: //! Initialize a scan on the index with the given expression and column ids @@ -2399,6 +2542,10 @@ class Index { bool Append(DataChunk &entries, Vector &row_identifiers); //! Verify that data can be appended to the index virtual void VerifyAppend(DataChunk &chunk) = 0; + //! Verify that data can be appended to the index for foreign key constraint + virtual void VerifyAppendForeignKey(DataChunk &chunk, string *err_msg_ptr) = 0; + //! Verify that data can be delete from the index for foreign key constraint + virtual void VerifyDeleteForeignKey(DataChunk &chunk, string *err_msg_ptr) = 0; //! Called when data inside the index is Deleted virtual void Delete(IndexLock &state, DataChunk &entries, Vector &row_identifiers) = 0; @@ -2410,6 +2557,19 @@ class Index { //! Returns true if the index is affected by updates on the specified column ids, and false otherwise bool IndexIsUpdated(const vector &column_ids) const; + //! Returns unique flag + bool IsUnique() { + return (constraint_type == IndexConstraintType::UNIQUE || constraint_type == IndexConstraintType::PRIMARY); + } + //! Returns primary flag + bool IsPrimary() { + return (constraint_type == IndexConstraintType::PRIMARY); + } + //! Returns foreign flag + bool IsForeign() { + return (constraint_type == IndexConstraintType::FOREIGN); + } + protected: void ExecuteExpressions(DataChunk &input, DataChunk &result); @@ -2673,7 +2833,7 @@ class BufferManager { //! Allocate an in-memory buffer with a single pin. //! The allocated memory is released when the buffer handle is destroyed. - unique_ptr Allocate(idx_t block_size); + DUCKDB_API unique_ptr Allocate(idx_t block_size); //! Reallocate an in-memory buffer that is pinned. void ReAllocate(shared_ptr &handle, idx_t block_size); @@ -2688,7 +2848,7 @@ class BufferManager { void SetLimit(idx_t limit = (idx_t)-1); static BufferManager &GetBufferManager(ClientContext &context); - static BufferManager &GetBufferManager(DatabaseInstance &db); + DUCKDB_API static BufferManager &GetBufferManager(DatabaseInstance &db); idx_t GetUsedMemory() { return current_memory; @@ -2813,6 +2973,17 @@ struct CompressedSegmentState { } }; +struct UncompressedCompressState : public CompressionState { + explicit UncompressedCompressState(ColumnDataCheckpointer &checkpointer); + + ColumnDataCheckpointer &checkpointer; + unique_ptr current_segment; + + virtual void CreateEmptySegment(idx_t row_start); + void FlushSegment(idx_t segment_size); + void Finalize(idx_t segment_size); +}; + //===--------------------------------------------------------------------===// // Analyze //===--------------------------------------------------------------------===// @@ -3109,6 +3280,8 @@ class TableIndexList { return indexes.size(); } + Index *FindForeignKeyIndex(const vector &fk_keys, ForeignKeyType fk_type); + private: //! Indexes associated with the current table mutex indexes_lock; @@ -3258,9 +3431,11 @@ class DataTable { private: //! Verify constraints with a chunk from the Append containing all columns of the table - void VerifyAppendConstraints(TableCatalogEntry &table, DataChunk &chunk); + void VerifyAppendConstraints(TableCatalogEntry &table, ClientContext &context, DataChunk &chunk); //! Verify constraints with a chunk from the Update containing only the specified column_ids void VerifyUpdateConstraints(TableCatalogEntry &table, DataChunk &chunk, const vector &column_ids); + //! Verify constraints with a chunk from the Delete containing all columns of the table + void VerifyDeleteConstraints(TableCatalogEntry &table, ClientContext &context, DataChunk &chunk); void InitializeScanWithOffset(TableScanState &state, const vector &column_ids, idx_t start_row, idx_t end_row); @@ -3315,6 +3490,46 @@ string IndexCatalogEntry::ToSQL() { } // namespace duckdb + +namespace duckdb { + +PragmaFunctionCatalogEntry::PragmaFunctionCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, + CreatePragmaFunctionInfo *info) + : StandardEntry(CatalogType::PRAGMA_FUNCTION_ENTRY, schema, catalog, info->name), functions(move(info->functions)) { +} + +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/catalog/catalog_entry/macro_catalog_entry.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + + +namespace duckdb { + +//! A macro function in the catalog +class TableMacroCatalogEntry : public MacroCatalogEntry { +public: + TableMacroCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateMacroInfo *info); + +public: + //! Serialize the meta information of the ScalarMacroCatalogEntry + void Serialize(Serializer &serializer) override; + //! Deserializes to a CreateMacroInfo + static unique_ptr Deserialize(Deserializer &source); +}; + +} // namespace duckdb + //===----------------------------------------------------------------------===// // DuckDB // @@ -3572,21 +3787,98 @@ class FieldReader { } // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/function/scalar_macro_function.hpp +// +// +//===----------------------------------------------------------------------===// + + +//! The SelectStatement of the view + + + + + + + + +namespace duckdb { + +class ScalarMacroFunction : public MacroFunction { +public: + ScalarMacroFunction(unique_ptr expression); + + ScalarMacroFunction(void); + //! The macro expression + unique_ptr expression; + +public: + unique_ptr Copy() override; +}; + +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/function/table_macro_function.hpp +// +// +//===----------------------------------------------------------------------===// + + +//! The SelectStatement of the view + + + + + + + + +namespace duckdb { + +class TableMacroFunction : public MacroFunction { +public: + TableMacroFunction(unique_ptr query_node); + + TableMacroFunction(void); + //! The main query node + unique_ptr query_node; + +public: + unique_ptr Copy() override; +}; + +} // namespace duckdb + namespace duckdb { MacroCatalogEntry::MacroCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateMacroInfo *info) - : StandardEntry(CatalogType::MACRO_ENTRY, schema, catalog, info->name), function(move(info->function)) { + : StandardEntry( + (info->function->type == MacroType::SCALAR_MACRO ? CatalogType::MACRO_ENTRY : CatalogType::TABLE_MACRO_ENTRY), + schema, catalog, info->name), + function(move(info->function)) { this->temporary = info->temporary; this->internal = info->internal; } -void MacroCatalogEntry::Serialize(Serializer &main_serializer) { +ScalarMacroCatalogEntry::ScalarMacroCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateMacroInfo *info) + : MacroCatalogEntry(catalog, schema, info) { +} + +void ScalarMacroCatalogEntry::Serialize(Serializer &main_serializer) { D_ASSERT(!internal); + auto &scalar_function = (ScalarMacroFunction &)*function; FieldWriter writer(main_serializer); writer.WriteString(schema->name); writer.WriteString(name); - writer.WriteSerializable(*function->expression); + writer.WriteSerializable(*scalar_function.expression); + // writer.WriteSerializableList(function->parameters); writer.WriteSerializableList(function->parameters); writer.WriteField((uint32_t)function->default_parameters.size()); auto &serializer = writer.GetSerializer(); @@ -3597,14 +3889,14 @@ void MacroCatalogEntry::Serialize(Serializer &main_serializer) { writer.Finalize(); } -unique_ptr MacroCatalogEntry::Deserialize(Deserializer &main_source) { - auto info = make_unique(); - +unique_ptr ScalarMacroCatalogEntry::Deserialize(Deserializer &main_source) { + auto info = make_unique(CatalogType::MACRO_ENTRY); FieldReader reader(main_source); info->schema = reader.ReadRequired(); info->name = reader.ReadRequired(); auto expression = reader.ReadRequiredSerializable(); - info->function = make_unique(move(expression)); + auto func = make_unique(move(expression)); + info->function = move(func); info->function->parameters = reader.ReadRequiredSerializableList(); auto default_param_count = reader.ReadRequired(); auto &source = reader.GetSource(); @@ -3612,20 +3904,53 @@ unique_ptr MacroCatalogEntry::Deserialize(Deserializer &main_so auto name = source.Read(); info->function->default_parameters[name] = ParsedExpression::Deserialize(source); } + // dont like this + // info->type=CatalogType::MACRO_ENTRY; reader.Finalize(); - return info; } -} // namespace duckdb +TableMacroCatalogEntry::TableMacroCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateMacroInfo *info) + : MacroCatalogEntry(catalog, schema, info) { +} +void TableMacroCatalogEntry::Serialize(Serializer &main_serializer) { + D_ASSERT(!internal); + FieldWriter writer(main_serializer); + auto &table_function = (TableMacroFunction &)*function; + writer.WriteString(schema->name); + writer.WriteString(name); + writer.WriteSerializable(*table_function.query_node); + writer.WriteSerializableList(function->parameters); + writer.WriteField((uint32_t)function->default_parameters.size()); + auto &serializer = writer.GetSerializer(); + for (auto &kv : function->default_parameters) { + serializer.WriteString(kv.first); + kv.second->Serialize(serializer); + } + writer.Finalize(); +} -namespace duckdb { +unique_ptr TableMacroCatalogEntry::Deserialize(Deserializer &main_source) { + auto info = make_unique(CatalogType::TABLE_MACRO_ENTRY); + FieldReader reader(main_source); + info->schema = reader.ReadRequired(); + info->name = reader.ReadRequired(); + auto query_node = reader.ReadRequiredSerializable(); + auto table_function = make_unique(move(query_node)); + info->function = move(table_function); + info->function->parameters = reader.ReadRequiredSerializableList(); + auto default_param_count = reader.ReadRequired(); + auto &source = reader.GetSource(); + for (idx_t i = 0; i < default_param_count; i++) { + auto name = source.Read(); + info->function->default_parameters[name] = ParsedExpression::Deserialize(source); + } -PragmaFunctionCatalogEntry::PragmaFunctionCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, - CreatePragmaFunctionInfo *info) - : StandardEntry(CatalogType::PRAGMA_FUNCTION_ENTRY, schema, catalog, info->name), functions(move(info->functions)) { + reader.Finalize(); + + return info; } } // namespace duckdb @@ -3691,15 +4016,25 @@ class TypeCatalogEntry : public StandardEntry { + namespace duckdb { class SchemaCatalogEntry; +struct DefaultMacro { + const char *schema; + const char *name; + const char *parameters[8]; + const char *macro; +}; + class DefaultFunctionGenerator : public DefaultGenerator { public: DefaultFunctionGenerator(Catalog &catalog, SchemaCatalogEntry *schema); SchemaCatalogEntry *schema; + DUCKDB_API static unique_ptr CreateInternalMacroInfo(DefaultMacro &default_macro); + public: unique_ptr CreateDefaultEntry(ClientContext &context, const string &entry_name) override; vector GetDefaultEntries() override; @@ -3752,12 +4087,117 @@ class DefaultViewGenerator : public DefaultGenerator { +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/constraints/bound_foreign_key_constraint.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + +namespace duckdb { + +class BoundForeignKeyConstraint : public BoundConstraint { +public: + BoundForeignKeyConstraint(ForeignKeyInfo info_p, unordered_set pk_key_set_p, + unordered_set fk_key_set_p) + : BoundConstraint(ConstraintType::FOREIGN_KEY), info(move(info_p)), pk_key_set(move(pk_key_set_p)), + fk_key_set(move(fk_key_set_p)) { +#ifdef DEBUG + D_ASSERT(info.pk_keys.size() == pk_key_set.size()); + for (auto &key : info.pk_keys) { + D_ASSERT(pk_key_set.find(key) != pk_key_set.end()); + } + D_ASSERT(info.fk_keys.size() == fk_key_set.size()); + for (auto &key : info.fk_keys) { + D_ASSERT(fk_key_set.find(key) != fk_key_set.end()); + } +#endif + } + + ForeignKeyInfo info; + //! The same keys but stored as an unordered set + unordered_set pk_key_set; + //! The same keys but stored as an unordered set + unordered_set fk_key_set; +}; + +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/constraints/foreign_key_constraint.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + +namespace duckdb { + +class ForeignKeyConstraint : public Constraint { +public: + DUCKDB_API ForeignKeyConstraint(vector pk_columns, vector fk_columns, ForeignKeyInfo info); + + //! The set of main key table's columns + vector pk_columns; + //! The set of foreign key table's columns + vector fk_columns; + ForeignKeyInfo info; + +public: + DUCKDB_API string ToString() const override; + + DUCKDB_API unique_ptr Copy() const override; + + //! Serialize to a stand-alone binary blob + DUCKDB_API void Serialize(FieldWriter &writer) const override; + //! Deserializes a ParsedConstraint + DUCKDB_API static unique_ptr Deserialize(FieldReader &source); +}; + +} // namespace duckdb + + #include #include namespace duckdb { +void FindForeignKeyInformation(CatalogEntry *entry, AlterForeignKeyType alter_fk_type, + vector> &fk_arrays) { + if (entry->type != CatalogType::TABLE_ENTRY) { + return; + } + auto *table_entry = (TableCatalogEntry *)entry; + for (idx_t i = 0; i < table_entry->constraints.size(); i++) { + auto &cond = table_entry->constraints[i]; + if (cond->type != ConstraintType::FOREIGN_KEY) { + continue; + } + auto &fk = (ForeignKeyConstraint &)*cond; + if (fk.info.type == ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE) { + fk_arrays.push_back(make_unique(fk.info.schema, fk.info.table, entry->name, + fk.pk_columns, fk.fk_columns, fk.info.pk_keys, + fk.info.fk_keys, alter_fk_type)); + } else if (fk.info.type == ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE && + alter_fk_type == AlterForeignKeyType::AFT_DELETE) { + throw CatalogException("Could not drop the table because this table is main key table of the table \"%s\"", + fk.info.table); + } + } +} + SchemaCatalogEntry::SchemaCatalogEntry(Catalog *catalog, string name_p, bool internal) : CatalogEntry(CatalogType::SCHEMA_ENTRY, catalog, move(name_p)), tables(*catalog, make_unique(*catalog, this)), indexes(*catalog), table_functions(*catalog), @@ -3823,7 +4263,23 @@ CatalogEntry *SchemaCatalogEntry::CreateType(ClientContext &context, CreateTypeI CatalogEntry *SchemaCatalogEntry::CreateTable(ClientContext &context, BoundCreateTableInfo *info) { auto table = make_unique(catalog, this, info); table->storage->info->cardinality = table->storage->GetTotalRows(); - return AddEntry(context, move(table), info->Base().on_conflict, info->dependencies); + CatalogEntry *entry = AddEntry(context, move(table), info->Base().on_conflict, info->dependencies); + if (!entry) { + return nullptr; + } + // add a foreign key constraint in main key table if there is a foreign key constraint + vector> fk_arrays; + FindForeignKeyInformation(entry, AlterForeignKeyType::AFT_ADD, fk_arrays); + for (idx_t i = 0; i < fk_arrays.size(); i++) { + // alter primary key table + AlterForeignKeyInfo *fk_info = fk_arrays[i].get(); + catalog->Alter(context, fk_info); + + // make a dependency between this table and referenced table + auto &set = GetCatalogSet(CatalogType::TABLE_ENTRY); + info->dependencies.insert(set.GetEntry(context, fk_info->name)); + } + return entry; } CatalogEntry *SchemaCatalogEntry::CreateView(ClientContext &context, CreateViewInfo *info) { @@ -3867,7 +4323,12 @@ CatalogEntry *SchemaCatalogEntry::CreateFunction(ClientContext &context, CreateF break; case CatalogType::MACRO_ENTRY: // create a macro function - function = make_unique_base(catalog, this, (CreateMacroInfo *)info); + function = make_unique_base(catalog, this, (CreateMacroInfo *)info); + break; + + case CatalogType::TABLE_MACRO_ENTRY: + // create a macro function + function = make_unique_base(catalog, this, (CreateMacroInfo *)info); break; case CatalogType::AGGREGATE_FUNCTION_ENTRY: D_ASSERT(info->type == CatalogType::AGGREGATE_FUNCTION_ENTRY); @@ -3927,9 +4388,20 @@ void SchemaCatalogEntry::DropEntry(ClientContext &context, DropInfo *info) { throw CatalogException("Existing object %s is of type %s, trying to replace with type %s", info->name, CatalogTypeToString(existing_entry->type), CatalogTypeToString(info->type)); } + + // if there is a foreign key constraint, get that information + vector> fk_arrays; + FindForeignKeyInformation(existing_entry, AlterForeignKeyType::AFT_DELETE, fk_arrays); + if (!set.DropEntry(context, info->name, info->cascade)) { throw InternalException("Could not drop element because of an internal error"); } + + // remove the foreign key constraint in main key table if main key table's name is valid + for (idx_t i = 0; i < fk_arrays.size(); i++) { + // alter primary key tablee + Catalog::GetCatalog(context).Alter(context, fk_arrays[i].get()); + } } void SchemaCatalogEntry::Alter(ClientContext &context, AlterInfo *info) { @@ -3988,6 +4460,7 @@ CatalogSet &SchemaCatalogEntry::GetCatalogSet(CatalogType type) { case CatalogType::INDEX_ENTRY: return indexes; case CatalogType::TABLE_FUNCTION_ENTRY: + case CatalogType::TABLE_MACRO_ENTRY: return table_functions; case CatalogType::COPY_FUNCTION_ENTRY: return copy_functions; @@ -4192,6 +4665,7 @@ class UniqueConstraint : public Constraint { + //===----------------------------------------------------------------------===// // DuckDB // @@ -4288,6 +4762,7 @@ class BoundCheckConstraint : public BoundConstraint { + //===----------------------------------------------------------------------===// // DuckDB // @@ -4352,6 +4827,10 @@ enum class WALType : uint8_t { DROP_TYPE = 14, ALTER_INFO = 20, + + CREATE_TABLE_MACRO = 21, + DROP_TABLE_MACRO = 22, + // ----------------------------- // Data // ----------------------------- @@ -4371,6 +4850,9 @@ enum class WALType : uint8_t { + + + namespace duckdb { struct AlterInfo; @@ -4380,7 +4862,7 @@ class Catalog; class DatabaseInstance; class SchemaCatalogEntry; class SequenceCatalogEntry; -class MacroCatalogEntry; +class ScalarMacroCatalogEntry; class ViewCatalogEntry; class TypeCatalogEntry; class TableCatalogEntry; @@ -4424,8 +4906,11 @@ class WriteAheadLog { void WriteDropSequence(SequenceCatalogEntry *entry); void WriteSequenceValue(SequenceCatalogEntry *entry, SequenceValue val); - void WriteCreateMacro(MacroCatalogEntry *entry); - void WriteDropMacro(MacroCatalogEntry *entry); + void WriteCreateMacro(ScalarMacroCatalogEntry *entry); + void WriteDropMacro(ScalarMacroCatalogEntry *entry); + + void WriteCreateTableMacro(TableMacroCatalogEntry *entry); + void WriteDropTableMacro(TableMacroCatalogEntry *entry); void WriteCreateType(TypeCatalogEntry *entry); void WriteDropType(TypeCatalogEntry *entry); @@ -4983,10 +5468,16 @@ struct ARTIndexScanState : public IndexScanState { idx_t result_index = 0; }; +enum VerifyExistenceType : uint8_t { + APPEND = 0, // for purpose to append into table + APPEND_FK = 1, // for purpose to append into table has foreign key + DELETE_FK = 2 // for purpose to delete from table related to foreign key +}; + class ART : public Index { public: ART(const vector &column_ids, const vector> &unbound_expressions, - bool is_unique = false, bool is_primary = false); + IndexConstraintType constraint_type); ~ART() override; //! Root of the tree @@ -5013,6 +5504,10 @@ class ART : public Index { bool Append(IndexLock &lock, DataChunk &entries, Vector &row_identifiers) override; //! Verify that data can be appended to the index void VerifyAppend(DataChunk &chunk) override; + //! Verify that data can be appended to the index for foreign key constraint + void VerifyAppendForeignKey(DataChunk &chunk, string *err_msg_ptr) override; + //! Verify that data can be delete from the index for foreign key constraint + void VerifyDeleteForeignKey(DataChunk &chunk, string *err_msg_ptr) override; //! Delete entries in the index void Delete(IndexLock &lock, DataChunk &entries, Vector &row_identifiers) override; //! Insert data into the index. @@ -5057,6 +5552,8 @@ class ART : public Index { vector &result_ids); void GenerateKeys(DataChunk &input, vector> &keys); + + void VerifyExistence(DataChunk &chunk, VerifyExistenceType verify_type, string *err_msg_ptr = NULL); }; } // namespace duckdb @@ -5092,6 +5589,9 @@ class ParsedExpressionIterator { const std::function &child)> &callback); static void EnumerateQueryNodeChildren(QueryNode &node, const std::function &child)> &callback); + + static void EnumerateQueryNodeModifiers(QueryNode &node, + const std::function &child)> &callback); }; } // namespace duckdb @@ -5132,33 +5632,8 @@ class AlterBinder : public ExpressionBinder { } // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/keyword_helper.hpp -// -// -//===----------------------------------------------------------------------===// - - - - - -namespace duckdb { - -class KeywordHelper { -public: - //! Returns true if the given text matches a keyword of the parser - static bool IsKeyword(const string &text); - - //! Returns true if the given string needs to be quoted when written as an identifier - static bool RequiresQuotes(const string &text); - //! Writes a string that is optionally quoted + escaped so it can be used as an identifier - static string WriteOptionallyQuoted(const string &text); -}; -} // namespace duckdb @@ -5183,6 +5658,27 @@ idx_t TableCatalogEntry::GetColumnIndex(string &column_name, bool if_exists) { return idx_t(entry->second); } +void AddDataTableIndex(DataTable *storage, vector &columns, vector &keys, + IndexConstraintType constraint_type) { + // fetch types and create expressions for the index from the columns + vector column_ids; + vector> unbound_expressions; + vector> bound_expressions; + idx_t key_nr = 0; + for (auto &key : keys) { + D_ASSERT(key < columns.size()); + + unbound_expressions.push_back(make_unique(columns[key].name, columns[key].type, + ColumnBinding(0, column_ids.size()))); + + bound_expressions.push_back(make_unique(columns[key].type, key_nr++)); + column_ids.push_back(key); + } + // create an adaptive radix tree around the expressions + auto art = make_unique(column_ids, move(unbound_expressions), constraint_type); + storage->AddIndex(move(art), bound_expressions); +} + TableCatalogEntry::TableCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, BoundCreateTableInfo *info, std::shared_ptr inherited_storage) : StandardEntry(CatalogType::TABLE_ENTRY, schema, catalog, info->Base().table), storage(move(inherited_storage)), @@ -5206,29 +5702,24 @@ TableCatalogEntry::TableCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schem } storage = make_shared(catalog->db, schema->name, name, move(colum_def_copy), move(info->data)); - // create the unique indexes for the UNIQUE and PRIMARY KEY constraints + // create the unique indexes for the UNIQUE and PRIMARY KEY and FOREIGN KEY constraints for (idx_t i = 0; i < bound_constraints.size(); i++) { auto &constraint = bound_constraints[i]; if (constraint->type == ConstraintType::UNIQUE) { // unique constraint: create a unique index auto &unique = (BoundUniqueConstraint &)*constraint; - // fetch types and create expressions for the index from the columns - vector column_ids; - vector> unbound_expressions; - vector> bound_expressions; - idx_t key_nr = 0; - for (auto &key : unique.keys) { - D_ASSERT(key < columns.size()); - - unbound_expressions.push_back(make_unique( - columns[key].name, columns[key].type, ColumnBinding(0, column_ids.size()))); - - bound_expressions.push_back(make_unique(columns[key].type, key_nr++)); - column_ids.push_back(key); + IndexConstraintType constraint_type = IndexConstraintType::UNIQUE; + if (unique.is_primary_key) { + constraint_type = IndexConstraintType::PRIMARY; + } + AddDataTableIndex(storage.get(), columns, unique.keys, constraint_type); + } else if (constraint->type == ConstraintType::FOREIGN_KEY) { + // foreign key constraint: create a foreign key index + auto &bfk = (BoundForeignKeyConstraint &)*constraint; + if (bfk.info.type == ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE || + bfk.info.type == ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE) { + AddDataTableIndex(storage.get(), columns, bfk.info.fk_keys, IndexConstraintType::FOREIGN); } - // create an adaptive radix tree around the expressions - auto art = make_unique(column_ids, move(unbound_expressions), true, unique.is_primary_key); - storage->AddIndex(move(art), bound_expressions); } } } @@ -5271,6 +5762,10 @@ unique_ptr TableCatalogEntry::AlterEntry(ClientContext &context, A auto change_type_info = (ChangeColumnTypeInfo *)table_info; return ChangeColumnType(context, *change_type_info); } + case AlterTableType::FOREIGN_KEY_CONSTRAINT: { + auto foreign_key_constraint_info = (AlterForeignKeyInfo *)table_info; + return SetForeignKeyConstraint(context, *foreign_key_constraint_info); + } default: throw InternalException("Unrecognized alter table type!"); } @@ -5321,6 +5816,26 @@ unique_ptr TableCatalogEntry::RenameColumn(ClientContext &context, } break; } + case ConstraintType::FOREIGN_KEY: { + // FOREIGN KEY constraint: possibly need to rename columns + auto &fk = (ForeignKeyConstraint &)*copy; + vector columns = fk.pk_columns; + if (fk.info.type == ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE) { + columns = fk.fk_columns; + } else if (fk.info.type == ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE) { + for (idx_t i = 0; i < fk.fk_columns.size(); i++) { + columns.push_back(fk.fk_columns[i]); + } + } + for (idx_t i = 0; i < columns.size(); i++) { + if (columns[i] == info.old_name) { + throw CatalogException( + "Cannot rename column \"%s\" because this is involved in the foreign key constraint", + info.old_name); + } + } + break; + } default: throw InternalException("Unsupported constraint for entry!"); } @@ -5417,6 +5932,27 @@ unique_ptr TableCatalogEntry::RemoveColumn(ClientContext &context, create_info->constraints.push_back(move(copy)); break; } + case ConstraintType::FOREIGN_KEY: { + auto copy = constraint->Copy(); + auto &fk = (ForeignKeyConstraint &)*copy; + vector columns = fk.pk_columns; + if (fk.info.type == ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE) { + columns = fk.fk_columns; + } else if (fk.info.type == ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE) { + for (idx_t i = 0; i < fk.fk_columns.size(); i++) { + columns.push_back(fk.fk_columns[i]); + } + } + for (idx_t i = 0; i < columns.size(); i++) { + if (columns[i] == info.removed_column) { + throw CatalogException( + "Cannot drop column \"%s\" because there is a FOREIGN KEY constraint that depends on it", + info.removed_column); + } + } + create_info->constraints.push_back(move(copy)); + break; + } default: throw InternalException("Unsupported constraint for entry!"); } @@ -5452,6 +5988,15 @@ unique_ptr TableCatalogEntry::SetDefault(ClientContext &context, S } unique_ptr TableCatalogEntry::ChangeColumnType(ClientContext &context, ChangeColumnTypeInfo &info) { + if (info.target_type.id() == LogicalTypeId::USER) { + auto &user_type_name = UserType::GetTypeName(info.target_type); + auto user_type_catalog = (TypeCatalogEntry *)context.db->GetCatalog().GetEntry( + context, CatalogType::TYPE_ENTRY, schema->name, user_type_name, true); + if (!user_type_catalog) { + throw NotImplementedException("DataType %s not supported yet...\n", user_type_name); + } + info.target_type = user_type_catalog->user_type; + } auto create_info = make_unique(schema->name, name); idx_t change_idx = GetColumnIndex(info.column_name); for (idx_t i = 0; i < columns.size(); i++) { @@ -5483,6 +6028,21 @@ unique_ptr TableCatalogEntry::ChangeColumnType(ClientContext &cont } break; } + case ConstraintType::FOREIGN_KEY: { + auto &bfk = (BoundForeignKeyConstraint &)*bound_constraints[i]; + unordered_set key_set = bfk.pk_key_set; + if (bfk.info.type == ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE) { + key_set = bfk.fk_key_set; + } else if (bfk.info.type == ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE) { + for (idx_t i = 0; i < bfk.info.fk_keys.size(); i++) { + key_set.insert(bfk.info.fk_keys[i]); + } + } + if (key_set.find(change_idx) != key_set.end()) { + throw BinderException("Cannot change the type of a column that has a FOREIGN KEY constraint specified"); + } + break; + } default: throw InternalException("Unsupported constraint for entry!"); } @@ -5506,6 +6066,39 @@ unique_ptr TableCatalogEntry::ChangeColumnType(ClientContext &cont new_storage); } +unique_ptr TableCatalogEntry::SetForeignKeyConstraint(ClientContext &context, AlterForeignKeyInfo &info) { + auto create_info = make_unique(schema->name, name); + + for (idx_t i = 0; i < columns.size(); i++) { + create_info->columns.push_back(columns[i].Copy()); + } + for (idx_t i = 0; i < constraints.size(); i++) { + auto constraint = constraints[i]->Copy(); + if (constraint->type == ConstraintType::FOREIGN_KEY) { + ForeignKeyConstraint &fk = (ForeignKeyConstraint &)*constraint; + if (fk.info.type == ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE && fk.info.table == info.fk_table) { + continue; + } + } + create_info->constraints.push_back(move(constraint)); + } + if (info.type == AlterForeignKeyType::AFT_ADD) { + ForeignKeyInfo fk_info; + fk_info.type = ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE; + fk_info.schema = info.schema; + fk_info.table = info.fk_table; + fk_info.pk_keys = info.pk_keys; + fk_info.fk_keys = info.fk_keys; + create_info->constraints.push_back( + make_unique(info.pk_columns, info.fk_columns, move(fk_info))); + } + + auto binder = Binder::CreateBinder(context); + auto bound_create_info = binder->BindCreateTableInfo(move(create_info)); + + return make_unique(catalog, schema, (BoundCreateTableInfo *)bound_create_info.get(), storage); +} + ColumnDefinition &TableCatalogEntry::GetColumn(const string &name) { auto entry = name_map.find(name); if (entry == name_map.end() || entry->second == COLUMN_IDENTIFIER_ROW_ID) { @@ -5587,6 +6180,12 @@ string TableCatalogEntry::ToSQL() { } extra_constraints.push_back(constraint->ToString()); } + } else if (constraint->type == ConstraintType::FOREIGN_KEY) { + auto &fk = (ForeignKeyConstraint &)*constraint; + if (fk.info.type == ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE || + fk.info.type == ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE) { + extra_constraints.push_back(constraint->ToString()); + } } else { extra_constraints.push_back(constraint->ToString()); } @@ -5598,14 +6197,7 @@ string TableCatalogEntry::ToSQL() { } auto &column = columns[i]; ss << KeywordHelper::WriteOptionallyQuoted(column.name) << " "; - switch (column.type.id()) { - case LogicalTypeId::ENUM: - ss << KeywordHelper::WriteOptionallyQuoted(column.type.ToString()); - break; - default: - ss << column.type.ToString(); - break; - } + ss << column.type.ToString(); bool not_null = not_null_columns.find(column.oid) != not_null_columns.end(); bool is_single_key_pk = pk_columns.find(column.oid) != pk_columns.end(); bool is_multi_key_pk = multi_key_pks.find(column.name) != multi_key_pks.end(); @@ -6066,42 +6658,6 @@ class TransactionManager { -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/expression/constant_expression.hpp -// -// -//===----------------------------------------------------------------------===// - - - - - - -namespace duckdb { - -//! ConstantExpression represents a constant value in the query -class ConstantExpression : public ParsedExpression { -public: - explicit ConstantExpression(Value val); - - //! The constant value referenced - Value value; - -public: - string ToString() const override; - - static bool Equals(const ConstantExpression *a, const ConstantExpression *b); - hash_t Hash() const override; - - unique_ptr Copy() const override; - - void Serialize(FieldWriter &writer) const override; - static unique_ptr Deserialize(ExpressionType type, FieldReader &source); -}; - -} // namespace duckdb namespace duckdb { @@ -6364,7 +6920,19 @@ void CatalogSet::CleanupEntry(CatalogEntry *catalog_entry) { // delete the entry from the dependency manager, if it is not deleted yet catalog_entry->catalog->dependency_manager->EraseObject(catalog_entry); } - catalog_entry->parent->child = move(catalog_entry->child); + auto parent = catalog_entry->parent; + parent->child = move(catalog_entry->child); + if (parent->deleted && !parent->child && !parent->parent) { + auto mapping_entry = mapping.find(parent->name); + D_ASSERT(mapping_entry != mapping.end()); + auto index = mapping_entry->second->index; + auto entry = entries.find(index); + D_ASSERT(entry != entries.end()); + if (entry->second.get() == parent) { + mapping.erase(mapping_entry); + entries.erase(entry); + } + } } } @@ -6767,8 +7335,8 @@ class Parser { static vector KeywordList(); //! Parses a list of expressions (i.e. the list found in a SELECT clause) - static vector> ParseExpressionList(const string &select_list, - ParserOptions options = ParserOptions()); + DUCKDB_API static vector> ParseExpressionList(const string &select_list, + ParserOptions options = ParserOptions()); //! Parses a list as found in an ORDER BY expression (i.e. including optional ASCENDING/DESCENDING modifiers) static vector ParseOrderList(const string &select_list, ParserOptions options = ParserOptions()); //! Parses an update list (i.e. the list found in the SET clause of an UPDATE statement) @@ -6790,14 +7358,9 @@ class Parser { -namespace duckdb { -struct DefaultMacro { - const char *schema; - const char *name; - const char *parameters[8]; - const char *macro; -}; + +namespace duckdb { static DefaultMacro internal_macros[] = { {DEFAULT_SCHEMA, "current_user", {nullptr}, "'duckdb'"}, // user name of current execution context @@ -6876,29 +7439,78 @@ static DefaultMacro internal_macros[] = { {DEFAULT_SCHEMA, "array_append", {"arr", "el", nullptr}, "list_append(arr, el)"}, {DEFAULT_SCHEMA, "list_prepend", {"e", "l", nullptr}, "list_concat(list_value(e), l)"}, {DEFAULT_SCHEMA, "array_prepend", {"el", "arr", nullptr}, "list_prepend(el, arr)"}, + {DEFAULT_SCHEMA, "array_pop_back", {"arr", nullptr}, "arr[:LEN(arr)-1]"}, + {DEFAULT_SCHEMA, "array_pop_front", {"arr", nullptr}, "arr[2:]"}, + {DEFAULT_SCHEMA, "array_push_back", {"arr", "e", nullptr}, "list_concat(arr, list_value(e))"}, + {DEFAULT_SCHEMA, "array_push_front", {"arr", "e", nullptr}, "list_concat(list_value(e), arr)"}, {DEFAULT_SCHEMA, "generate_subscripts", {"arr", "dim", nullptr}, "unnest(generate_series(1, array_length(arr, dim)))"}, - {nullptr, nullptr, {nullptr}, nullptr}}; + {DEFAULT_SCHEMA, "fdiv", {"x", "y", nullptr}, "floor(x/y)"}, + {DEFAULT_SCHEMA, "fmod", {"x", "y", nullptr}, "(x-y*floor(x/y))"}, + + // algebraic list aggregates + {DEFAULT_SCHEMA, "list_avg", {"l", nullptr}, "list_aggr(l, 'avg')"}, + {DEFAULT_SCHEMA, "list_var_samp", {"l", nullptr}, "list_aggr(l, 'var_samp')"}, + {DEFAULT_SCHEMA, "list_var_pop", {"l", nullptr}, "list_aggr(l, 'var_pop')"}, + {DEFAULT_SCHEMA, "list_stddev_pop", {"l", nullptr}, "list_aggr(l, 'stddev_pop')"}, + {DEFAULT_SCHEMA, "list_stddev_samp", {"l", nullptr}, "list_aggr(l, 'stddev_samp')"}, + {DEFAULT_SCHEMA, "list_sem", {"l", nullptr}, "list_aggr(l, 'sem')"}, + + // distributive list aggregates + {DEFAULT_SCHEMA, "list_approx_count_distinct", {"l", nullptr}, "list_aggr(l, 'approx_count_distinct')"}, + {DEFAULT_SCHEMA, "list_bit_xor", {"l", nullptr}, "list_aggr(l, 'bit_xor')"}, + {DEFAULT_SCHEMA, "list_bit_or", {"l", nullptr}, "list_aggr(l, 'bit_or')"}, + {DEFAULT_SCHEMA, "list_bit_and", {"l", nullptr}, "list_aggr(l, 'bit_and')"}, + {DEFAULT_SCHEMA, "list_bool_and", {"l", nullptr}, "list_aggr(l, 'bool_and')"}, + {DEFAULT_SCHEMA, "list_bool_or", {"l", nullptr}, "list_aggr(l, 'bool_or')"}, + {DEFAULT_SCHEMA, "list_count", {"l", nullptr}, "list_aggr(l, 'count')"}, + {DEFAULT_SCHEMA, "list_entropy", {"l", nullptr}, "list_aggr(l, 'entropy')"}, + {DEFAULT_SCHEMA, "list_last", {"l", nullptr}, "list_aggr(l, 'last')"}, + {DEFAULT_SCHEMA, "list_first", {"l", nullptr}, "list_aggr(l, 'first')"}, + {DEFAULT_SCHEMA, "list_kurtosis", {"l", nullptr}, "list_aggr(l, 'kurtosis')"}, + {DEFAULT_SCHEMA, "list_min", {"l", nullptr}, "list_aggr(l, 'min')"}, + {DEFAULT_SCHEMA, "list_max", {"l", nullptr}, "list_aggr(l, 'max')"}, + {DEFAULT_SCHEMA, "list_product", {"l", nullptr}, "list_aggr(l, 'product')"}, + {DEFAULT_SCHEMA, "list_skewness", {"l", nullptr}, "list_aggr(l, 'skewness')"}, + {DEFAULT_SCHEMA, "list_sum", {"l", nullptr}, "list_aggr(l, 'sum')"}, + {DEFAULT_SCHEMA, "list_string_agg", {"l", nullptr}, "list_aggr(l, 'string_agg')"}, + + // holistic list aggregates + {DEFAULT_SCHEMA, "list_mode", {"l", nullptr}, "list_aggr(l, 'mode')"}, + {DEFAULT_SCHEMA, "list_median", {"l", nullptr}, "list_aggr(l, 'median')"}, + {DEFAULT_SCHEMA, "list_mad", {"l", nullptr}, "list_aggr(l, 'mad')"}, + + // nested list aggregates + {DEFAULT_SCHEMA, "list_histogram", {"l", nullptr}, "list_aggr(l, 'histogram')"}, + + {nullptr, nullptr, {nullptr}, nullptr} + }; -static unique_ptr GetDefaultFunction(const string &schema, const string &name) { - for (idx_t index = 0; internal_macros[index].name != nullptr; index++) { - if (internal_macros[index].schema == schema && internal_macros[index].name == name) { - // parse the expression - auto expressions = Parser::ParseExpressionList(internal_macros[index].macro); - D_ASSERT(expressions.size() == 1); +unique_ptr DefaultFunctionGenerator::CreateInternalMacroInfo(DefaultMacro &default_macro) { + // parse the expression + auto expressions = Parser::ParseExpressionList(default_macro.macro); + D_ASSERT(expressions.size() == 1); - auto result = make_unique(move(expressions[0])); - for (idx_t param_idx = 0; internal_macros[index].parameters[param_idx] != nullptr; param_idx++) { - result->parameters.push_back( - make_unique(internal_macros[index].parameters[param_idx])); - } + auto result = make_unique(move(expressions[0])); + for (idx_t param_idx = 0; default_macro.parameters[param_idx] != nullptr; param_idx++) { + result->parameters.push_back( + make_unique(default_macro.parameters[param_idx])); + } + + auto bind_info = make_unique(); + bind_info->schema = default_macro.schema; + bind_info->name = default_macro.name; + bind_info->temporary = true; + bind_info->internal = true; + bind_info->function = move(result); + return bind_info; +} - auto bind_info = make_unique(); - bind_info->schema = schema; - bind_info->name = internal_macros[index].name; - bind_info->temporary = true; - bind_info->internal = true; - bind_info->function = move(result); - return move(bind_info); +static unique_ptr GetDefaultFunction(const string &input_schema, const string &input_name) { + auto schema = StringUtil::Lower(input_schema); + auto name = StringUtil::Lower(input_name); + for (idx_t index = 0; internal_macros[index].name != nullptr; index++) { + if (internal_macros[index].schema == schema && internal_macros[index].name == name) { + return DefaultFunctionGenerator::CreateInternalMacroInfo(internal_macros[index]); } } return nullptr; @@ -6912,7 +7524,7 @@ unique_ptr DefaultFunctionGenerator::CreateDefaultEntry(ClientCont const string &entry_name) { auto info = GetDefaultFunction(schema->name, entry_name); if (info) { - return make_unique_base(&catalog, schema, (CreateMacroInfo *)info.get()); + return make_unique_base(&catalog, schema, (CreateMacroInfo *)info.get()); } return nullptr; } @@ -6931,6 +7543,7 @@ vector DefaultFunctionGenerator::GetDefaultEntries() { + namespace duckdb { struct DefaultSchema { @@ -6939,7 +7552,8 @@ struct DefaultSchema { static DefaultSchema internal_schemas[] = {{"information_schema"}, {"pg_catalog"}, {nullptr}}; -static bool GetDefaultSchema(const string &schema) { +static bool GetDefaultSchema(const string &input_schema) { + auto schema = StringUtil::Lower(input_schema); for (idx_t index = 0; internal_schemas[index].name != nullptr; index++) { if (internal_schemas[index].name == schema) { return true; @@ -6953,7 +7567,7 @@ DefaultSchemaGenerator::DefaultSchemaGenerator(Catalog &catalog) : DefaultGenera unique_ptr DefaultSchemaGenerator::CreateDefaultEntry(ClientContext &context, const string &entry_name) { if (GetDefaultSchema(entry_name)) { - return make_unique_base(&catalog, entry_name, true); + return make_unique_base(&catalog, StringUtil::Lower(entry_name), true); } return nullptr; } @@ -6974,6 +7588,7 @@ vector DefaultSchemaGenerator::GetDefaultEntries() { + namespace duckdb { struct DefaultView { @@ -7017,7 +7632,9 @@ static DefaultView internal_views[] = { {"information_schema", "tables", "SELECT NULL table_catalog, schema_name table_schema, table_name, CASE WHEN temporary THEN 'LOCAL TEMPORARY' ELSE 'BASE TABLE' END table_type, NULL self_referencing_column_name, NULL reference_generation, NULL user_defined_type_catalog, NULL user_defined_type_schema, NULL user_defined_type_name, 'YES' is_insertable_into, 'NO' is_typed, CASE WHEN temporary THEN 'PRESERVE' ELSE NULL END commit_action FROM duckdb_tables() UNION ALL SELECT NULL table_catalog, schema_name table_schema, view_name table_name, 'VIEW' table_type, NULL self_referencing_column_name, NULL reference_generation, NULL user_defined_type_catalog, NULL user_defined_type_schema, NULL user_defined_type_name, 'NO' is_insertable_into, 'NO' is_typed, NULL commit_action FROM duckdb_views;"}, {nullptr, nullptr, nullptr}}; -static unique_ptr GetDefaultView(const string &schema, const string &name) { +static unique_ptr GetDefaultView(const string &input_schema, const string &input_name) { + auto schema = StringUtil::Lower(input_schema); + auto name = StringUtil::Lower(input_name); for (idx_t index = 0; internal_views[index].name != nullptr; index++) { if (internal_views[index].schema == schema && internal_views[index].name == name) { auto result = make_unique(); @@ -7354,11 +7971,13 @@ data_ptr_t Allocator::ReallocateData(data_ptr_t pointer, idx_t size) { namespace duckdb { class ResultArrowArrayStreamWrapper { public: - explicit ResultArrowArrayStreamWrapper(unique_ptr result, idx_t approx_batch_size); + explicit ResultArrowArrayStreamWrapper(unique_ptr result, idx_t batch_size); ArrowArrayStream stream; unique_ptr result; std::string last_error; - idx_t vectors_per_chunk; + idx_t batch_size; + vector column_types; + vector column_names; private: static int MyStreamGetSchema(struct ArrowArrayStream *stream, struct ArrowSchema *out); @@ -7368,6 +7987,7 @@ class ResultArrowArrayStreamWrapper { }; } // namespace duckdb + namespace duckdb { ArrowSchemaWrapper::~ArrowSchemaWrapper() { @@ -7436,6 +8056,11 @@ int ResultArrowArrayStreamWrapper::MyStreamGetSchema(struct ArrowArrayStream *st return -1; } auto my_stream = (ResultArrowArrayStreamWrapper *)stream->private_data; + if (!my_stream->column_types.empty()) { + QueryResult::ToArrowSchema(out, my_stream->column_types, my_stream->column_names); + return 0; + } + auto &result = *my_stream->result; if (!result.success) { my_stream->last_error = "Query Failed"; @@ -7448,7 +8073,11 @@ int ResultArrowArrayStreamWrapper::MyStreamGetSchema(struct ArrowArrayStream *st return -1; } } - result.ToArrowSchema(out); + if (my_stream->column_types.empty()) { + my_stream->column_types = result.types; + my_stream->column_names = result.names; + } + QueryResult::ToArrowSchema(out, my_stream->column_types, my_stream->column_names); return 0; } @@ -7470,21 +8099,29 @@ int ResultArrowArrayStreamWrapper::MyStreamGetNext(struct ArrowArrayStream *stre return 0; } } + if (my_stream->column_types.empty()) { + my_stream->column_types = result.types; + my_stream->column_names = result.names; + } unique_ptr chunk_result = result.Fetch(); if (!chunk_result) { // Nothing to output out->release = nullptr; return 0; } - for (idx_t i = 1; i < my_stream->vectors_per_chunk; i++) { + unique_ptr agg_chunk_result = make_unique(); + agg_chunk_result->Initialize(chunk_result->GetTypes()); + agg_chunk_result->Append(*chunk_result, true); + + while (agg_chunk_result->size() < my_stream->batch_size) { auto new_chunk = result.Fetch(); if (!new_chunk) { break; } else { - chunk_result->Append(*new_chunk, true); + agg_chunk_result->Append(*new_chunk, true); } } - chunk_result->ToArrowArray(out); + agg_chunk_result->ToArrowArray(out); return 0; } @@ -7504,15 +8141,15 @@ const char *ResultArrowArrayStreamWrapper::MyStreamGetLastError(struct ArrowArra auto my_stream = (ResultArrowArrayStreamWrapper *)stream->private_data; return my_stream->last_error.c_str(); } -ResultArrowArrayStreamWrapper::ResultArrowArrayStreamWrapper(unique_ptr result_p, idx_t approx_batch_size) +ResultArrowArrayStreamWrapper::ResultArrowArrayStreamWrapper(unique_ptr result_p, idx_t batch_size_p) : result(move(result_p)) { //! We first initialize the private data of the stream stream.private_data = this; //! Ceil Approx_Batch_Size/STANDARD_VECTOR_SIZE - if (approx_batch_size == 0) { + if (batch_size_p == 0) { throw std::runtime_error("Approximate Batch Size of Record Batch MUST be higher than 0"); } - vectors_per_chunk = (approx_batch_size + STANDARD_VECTOR_SIZE - 1) / STANDARD_VECTOR_SIZE; + batch_size = batch_size_p; //! We initialize the stream functions stream.get_schema = ResultArrowArrayStreamWrapper::MyStreamGetSchema; stream.get_next = ResultArrowArrayStreamWrapper::MyStreamGetNext; @@ -7520,6 +8157,30 @@ ResultArrowArrayStreamWrapper::ResultArrowArrayStreamWrapper(unique_ptr ArrowUtil::FetchNext(QueryResult &result) { + auto chunk = result.Fetch(); + if (!result.success) { + throw std::runtime_error(result.error); + } + return chunk; +} + +unique_ptr ArrowUtil::FetchChunk(QueryResult *result, idx_t chunk_size) { + + auto data_chunk = FetchNext(*result); + if (!data_chunk) { + return data_chunk; + } + while (data_chunk->size() < chunk_size) { + auto next_chunk = FetchNext(*result); + if (!next_chunk || next_chunk->size() == 0) { + break; + } + data_chunk->Append(*next_chunk, true); + } + return data_chunk; +} + } // namespace duckdb @@ -8234,6 +8895,8 @@ string CatalogTypeToString(CatalogType type) { return "Pragma Function"; case CatalogType::MACRO_ENTRY: return "Macro Function"; + case CatalogType::TABLE_MACRO_ENTRY: + return "Table Macro Function"; case CatalogType::VIEW_ENTRY: return "View"; case CatalogType::INDEX_ENTRY: @@ -8438,6 +9101,8 @@ string ExpressionTypeToString(ExpressionType type) { return "POSITIONAL_REFERENCE"; case ExpressionType::LAMBDA: return "LAMBDA"; + case ExpressionType::ARROW: + return "ARROW"; case ExpressionType::INVALID: break; } @@ -8447,8 +9112,6 @@ string ExpressionTypeToString(ExpressionType type) { string ExpressionTypeToOperator(ExpressionType type) { switch (type) { - case ExpressionType::OPERATOR_NOT: - return "!"; case ExpressionType::COMPARE_EQUAL: return "="; case ExpressionType::COMPARE_NOTEQUAL: @@ -8461,6 +9124,10 @@ string ExpressionTypeToOperator(ExpressionType type) { return "<="; case ExpressionType::COMPARE_GREATERTHANOREQUALTO: return ">="; + case ExpressionType::COMPARE_DISTINCT_FROM: + return "IS DISTINCT FROM"; + case ExpressionType::COMPARE_NOT_DISTINCT_FROM: + return "IS NOT DISTINCT FROM"; case ExpressionType::CONJUNCTION_AND: return "AND"; case ExpressionType::CONJUNCTION_OR: @@ -8812,6 +9479,8 @@ string PhysicalOperatorToString(PhysicalOperatorType type) { return "INDEX_JOIN"; case PhysicalOperatorType::PIECEWISE_MERGE_JOIN: return "PIECEWISE_MERGE_JOIN"; + case PhysicalOperatorType::IE_JOIN: + return "IE_JOIN"; case PhysicalOperatorType::CROSS_PRODUCT: return "CROSS_PRODUCT"; case PhysicalOperatorType::UNION: @@ -14943,6 +15612,7 @@ FMT_END_NAMESPACE // LICENSE_CHANGE_END + namespace duckdb { ExceptionFormatValue::ExceptionFormatValue(double dbl_val) @@ -14951,6 +15621,9 @@ ExceptionFormatValue::ExceptionFormatValue(double dbl_val) ExceptionFormatValue::ExceptionFormatValue(int64_t int_val) : type(ExceptionFormatValueType::FORMAT_VALUE_TYPE_INTEGER), int_val(int_val) { } +ExceptionFormatValue::ExceptionFormatValue(hugeint_t huge_val) + : type(ExceptionFormatValueType::FORMAT_VALUE_TYPE_STRING), str_val(Hugeint::ToString(huge_val)) { +} ExceptionFormatValue::ExceptionFormatValue(string str_val) : type(ExceptionFormatValueType::FORMAT_VALUE_TYPE_STRING), str_val(move(str_val)) { } @@ -14984,6 +15657,10 @@ template <> ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(char *value) { return ExceptionFormatValue(string(value)); } +template <> +ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(hugeint_t value) { + return ExceptionFormatValue(value); +} string ExceptionFormatValue::Format(const string &msg, vector &values) { std::vector> format_args; @@ -16089,7 +16766,7 @@ struct LengthFun { struct LikeFun { static void RegisterFunction(BuiltinFunctions &set); - static bool Glob(const char *s, idx_t slen, const char *pattern, idx_t plen); + DUCKDB_API static bool Glob(const char *s, idx_t slen, const char *pattern, idx_t plen); }; struct LikeEscapeFun { @@ -16389,7 +17066,7 @@ void FileSystem::RemoveDirectory(const string &directory) { throw NotImplementedException("%s: RemoveDirectory is not implemented!", GetName()); } -bool FileSystem::ListFiles(const string &directory, const std::function &callback) { +bool FileSystem::ListFiles(const string &directory, const std::function &callback) { throw NotImplementedException("%s: ListFiles is not implemented!", GetName()); } @@ -16401,6 +17078,10 @@ bool FileSystem::FileExists(const string &filename) { throw NotImplementedException("%s: FileExists is not implemented!", GetName()); } +bool FileSystem::IsPipe(const string &filename) { + throw NotImplementedException("%s: IsPipe is not implemented!", GetName()); +} + void FileSystem::RemoveFile(const string &filename) { throw NotImplementedException("%s: RemoveFile is not implemented!", GetName()); } @@ -16409,10 +17090,14 @@ void FileSystem::FileSync(FileHandle &handle) { throw NotImplementedException("%s: FileSync is not implemented!", GetName()); } -vector FileSystem::Glob(const string &path) { +vector FileSystem::Glob(const string &path, FileOpener *opener) { throw NotImplementedException("%s: Glob is not implemented!", GetName()); } +vector FileSystem::Glob(const string &path, ClientContext &context) { + return Glob(path, GetFileOpener(context)); +} + void FileSystem::RegisterSubSystem(unique_ptr sub_fs) { throw NotImplementedException("%s: Can't register a sub system on a non-virtual file system", GetName()); } @@ -18551,19 +19236,22 @@ class LocalFileSystem : public FileSystem { //! Recursively remove a directory and all files in it void RemoveDirectory(const string &directory) override; //! List files in a directory, invoking the callback method for each one with (filename, is_dir) - bool ListFiles(const string &directory, const std::function &callback) override; + bool ListFiles(const string &directory, const std::function &callback) override; //! Move a file from source path to the target, StorageManager relies on this being an atomic action for ACID //! properties void MoveFile(const string &source, const string &target) override; //! Check if a file exists bool FileExists(const string &filename) override; + + //! Check if path is a pipe + bool IsPipe(const string &filename) override; //! Remove a file from disk void RemoveFile(const string &filename) override; //! Sync a file handle to disk void FileSync(FileHandle &handle) override; //! Runs a glob on the file system, returning a list of matching files - vector Glob(const string &path) override; + vector Glob(const string &path, FileOpener *opener = nullptr) override; bool CanHandleFile(const string &fpath) override { //! Whether or not a sub-system can handle a specific file path @@ -18585,6 +19273,10 @@ class LocalFileSystem : public FileSystem { return "LocalFileSystem"; } + //! Returns the last Win32 error, in string format. Returns an empty string if there is no error, or on non-Windows + //! systems. + static std::string GetLastErrorAsString(); + private: //! Set the file pointer of a file handle to a specified location. Reads and writes will happen from this location void SetFilePointer(FileHandle &handle, idx_t location); @@ -18645,8 +19337,10 @@ class WindowsUtil { } // namespace duckdb #include +#include #ifdef __MINGW32__ +#include // need to manually define this for mingw extern "C" WINBASEAPI BOOL WINAPI GetPhysicallyInstalledSystemMemory(PULONGLONG); #endif @@ -18671,6 +19365,90 @@ static void AssertValidFileFlags(uint8_t flags) { #endif } +#ifdef __MINGW32__ +bool LocalFileSystem::FileExists(const string &filename) { + auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str()); + const wchar_t *wpath = unicode_path.c_str(); + if (_waccess(wpath, 0) == 0) { + struct _stat64i32 status; + _wstat64i32(wpath, &status); + if (status.st_size > 0) { + return true; + } + } + return false; +} +bool LocalFileSystem::IsPipe(const string &filename) { + auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str()); + const wchar_t *wpath = unicode_path.c_str(); + if (_waccess(wpath, 0) == 0) { + struct _stat64i32 status; + _wstat64i32(wpath, &status); + if (status.st_size == 0) { + return true; + } + } + return false; +} + +#else +#ifndef _WIN32 +bool LocalFileSystem::FileExists(const string &filename) { + if (!filename.empty()) { + if (access(filename.c_str(), 0) == 0) { + struct stat status; + stat(filename.c_str(), &status); + if (S_ISREG(status.st_mode)) { + return true; + } + } + } + // if any condition fails + return false; +} + +bool LocalFileSystem::IsPipe(const string &filename) { + if (!filename.empty()) { + if (access(filename.c_str(), 0) == 0) { + struct stat status; + stat(filename.c_str(), &status); + if (S_ISFIFO(status.st_mode)) { + return true; + } + } + } + // if any condition fails + return false; +} + +#else +bool LocalFileSystem::FileExists(const string &filename) { + auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str()); + const wchar_t *wpath = unicode_path.c_str(); + if (_waccess(wpath, 0) == 0) { + struct _stat64i32 status; + _wstat(wpath, &status); + if (status.st_mode & S_IFREG) { + return true; + } + } + return false; +} +bool LocalFileSystem::IsPipe(const string &filename) { + auto unicode_path = WindowsUtil::UTF8ToUnicode(filename.c_str()); + const wchar_t *wpath = unicode_path.c_str(); + if (_waccess(wpath, 0) == 0) { + struct _stat64i32 status; + _wstat(wpath, &status); + if (status.st_mode & _S_IFCHR) { + return true; + } + } + return false; +} +#endif +#endif + #ifndef _WIN32 // somehow sometimes this is missing #ifndef O_CLOEXEC @@ -18907,20 +19685,6 @@ bool LocalFileSystem::DirectoryExists(const string &directory) { return false; } -bool LocalFileSystem::FileExists(const string &filename) { - if (!filename.empty()) { - if (access(filename.c_str(), 0) == 0) { - struct stat status; - stat(filename.c_str(), &status); - if (!(status.st_mode & S_IFDIR)) { - return true; - } - } - } - // if any condition fails - return false; -} - void LocalFileSystem::CreateDirectory(const string &directory) { struct stat st; @@ -18984,7 +19748,7 @@ void LocalFileSystem::RemoveFile(const string &filename) { } } -bool LocalFileSystem::ListFiles(const string &directory, const std::function &callback) { +bool LocalFileSystem::ListFiles(const string &directory, const std::function &callback) { if (!DirectoryExists(directory)) { return false; } @@ -19032,12 +19796,16 @@ void LocalFileSystem::MoveFile(const string &source, const string &target) { } } +std::string LocalFileSystem::GetLastErrorAsString() { + return string(); +} + #else constexpr char PIPE_PREFIX[] = "\\\\.\\pipe\\"; // Returns the last Win32 error, in string format. Returns an empty string if there is no error. -std::string GetLastErrorAsString() { +std::string LocalFileSystem::GetLastErrorAsString() { // Get the error message, if any. DWORD errorMessageID = GetLastError(); if (errorMessageID == 0) @@ -19113,7 +19881,7 @@ unique_ptr LocalFileSystem::OpenFile(const string &path, uint8_t fla HANDLE hFile = CreateFileW(unicode_path.c_str(), desired_access, share_mode, NULL, creation_disposition, flags_and_attributes, NULL); if (hFile == INVALID_HANDLE_VALUE) { - auto error = GetLastErrorAsString(); + auto error = LocalFileSystem::GetLastErrorAsString(); throw IOException("Cannot open file \"%s\": %s", path.c_str(), error); } auto handle = make_unique(*this, path.c_str(), hFile); @@ -19142,7 +19910,7 @@ static DWORD FSInternalRead(FileHandle &handle, HANDLE hFile, void *buffer, int6 ov.hEvent = 0; auto rc = ReadFile(hFile, buffer, (DWORD)nr_bytes, &bytes_read, &ov); if (!rc) { - auto error = GetLastErrorAsString(); + auto error = LocalFileSystem::GetLastErrorAsString(); throw IOException("Could not read file \"%s\" (error in ReadFile): %s", handle.path, error); } return bytes_read; @@ -19176,7 +19944,7 @@ static DWORD FSInternalWrite(FileHandle &handle, HANDLE hFile, void *buffer, int ov.hEvent = 0; auto rc = WriteFile(hFile, buffer, (DWORD)nr_bytes, &bytes_written, &ov); if (!rc) { - auto error = GetLastErrorAsString(); + auto error = LocalFileSystem::GetLastErrorAsString(); throw IOException("Could not write file \"%s\" (error in WriteFile): %s", handle.path, error); } return bytes_written; @@ -19240,7 +20008,7 @@ void LocalFileSystem::Truncate(FileHandle &handle, int64_t new_size) { SetFilePointer(handle, new_size); // now set the end of file position if (!SetEndOfFile(hFile)) { - auto error = GetLastErrorAsString(); + auto error = LocalFileSystem::GetLastErrorAsString(); throw IOException("Failure in SetEndOfFile call on file \"%s\": %s", handle.path, error); } } @@ -19255,11 +20023,6 @@ bool LocalFileSystem::DirectoryExists(const string &directory) { return (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY)); } -bool LocalFileSystem::FileExists(const string &filename) { - DWORD attrs = WindowsGetFileAttributes(filename); - return (attrs != INVALID_FILE_ATTRIBUTES && !(attrs & FILE_ATTRIBUTE_DIRECTORY)); -} - void LocalFileSystem::CreateDirectory(const string &directory) { if (DirectoryExists(directory)) { return; @@ -19299,7 +20062,7 @@ void LocalFileSystem::RemoveFile(const string &filename) { DeleteFileW(unicode_path.c_str()); } -bool LocalFileSystem::ListFiles(const string &directory, const std::function &callback) { +bool LocalFileSystem::ListFiles(const string &directory, const std::function &callback) { string search_dir = JoinPath(directory, "*"); auto unicode_path = WindowsUtil::UTF8ToUnicode(search_dir.c_str()); @@ -19412,15 +20175,15 @@ static void GlobFiles(FileSystem &fs, const string &path, const string &glob, bo }); } -vector LocalFileSystem::Glob(const string &path) { +vector LocalFileSystem::Glob(const string &path, FileOpener *opener) { if (path.empty()) { return vector(); } // first check if the path has a glob at all if (!HasGlob(path)) { - // no glob: return only the file (if it exists) + // no glob: return only the file (if it exists or is a pipe) vector result; - if (FileExists(path)) { + if (FileExists(path) || IsPipe(path)) { result.push_back(path); } return result; @@ -19667,14 +20430,14 @@ class Vector; struct TryCast { template - static inline bool Operation(SRC input, DST &result, bool strict = false) { + DUCKDB_API static inline bool Operation(SRC input, DST &result, bool strict = false) { throw NotImplementedException("Unimplemented type for cast (%s -> %s)", GetTypeId(), GetTypeId()); } }; struct TryCastErrorMessage { template - static inline bool Operation(SRC input, DST &result, string *error_message, bool strict = false) { + DUCKDB_API static inline bool Operation(SRC input, DST &result, string *error_message, bool strict = false) { throw NotImplementedException("Unimplemented type for cast (%s -> %s)", GetTypeId(), GetTypeId()); } }; @@ -19720,459 +20483,459 @@ struct HandleCastError { // Cast bool -> Numeric //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(bool input, bool &result, bool strict); +DUCKDB_API bool TryCast::Operation(bool input, bool &result, bool strict); template <> -bool TryCast::Operation(bool input, int8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(bool input, int8_t &result, bool strict); template <> -bool TryCast::Operation(bool input, int16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(bool input, int16_t &result, bool strict); template <> -bool TryCast::Operation(bool input, int32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(bool input, int32_t &result, bool strict); template <> -bool TryCast::Operation(bool input, int64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(bool input, int64_t &result, bool strict); template <> -bool TryCast::Operation(bool input, hugeint_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(bool input, hugeint_t &result, bool strict); template <> -bool TryCast::Operation(bool input, uint8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(bool input, uint8_t &result, bool strict); template <> -bool TryCast::Operation(bool input, uint16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(bool input, uint16_t &result, bool strict); template <> -bool TryCast::Operation(bool input, uint32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(bool input, uint32_t &result, bool strict); template <> -bool TryCast::Operation(bool input, uint64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(bool input, uint64_t &result, bool strict); template <> -bool TryCast::Operation(bool input, float &result, bool strict); +DUCKDB_API bool TryCast::Operation(bool input, float &result, bool strict); template <> -bool TryCast::Operation(bool input, double &result, bool strict); +DUCKDB_API bool TryCast::Operation(bool input, double &result, bool strict); //===--------------------------------------------------------------------===// // Cast int8_t -> Numeric //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(int8_t input, bool &result, bool strict); +DUCKDB_API bool TryCast::Operation(int8_t input, bool &result, bool strict); template <> -bool TryCast::Operation(int8_t input, int8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int8_t input, int8_t &result, bool strict); template <> -bool TryCast::Operation(int8_t input, int16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int8_t input, int16_t &result, bool strict); template <> -bool TryCast::Operation(int8_t input, int32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int8_t input, int32_t &result, bool strict); template <> -bool TryCast::Operation(int8_t input, int64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int8_t input, int64_t &result, bool strict); template <> -bool TryCast::Operation(int8_t input, hugeint_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int8_t input, hugeint_t &result, bool strict); template <> -bool TryCast::Operation(int8_t input, uint8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int8_t input, uint8_t &result, bool strict); template <> -bool TryCast::Operation(int8_t input, uint16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int8_t input, uint16_t &result, bool strict); template <> -bool TryCast::Operation(int8_t input, uint32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int8_t input, uint32_t &result, bool strict); template <> -bool TryCast::Operation(int8_t input, uint64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int8_t input, uint64_t &result, bool strict); template <> -bool TryCast::Operation(int8_t input, float &result, bool strict); +DUCKDB_API bool TryCast::Operation(int8_t input, float &result, bool strict); template <> -bool TryCast::Operation(int8_t input, double &result, bool strict); +DUCKDB_API bool TryCast::Operation(int8_t input, double &result, bool strict); //===--------------------------------------------------------------------===// // Cast int16_t -> Numeric //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(int16_t input, bool &result, bool strict); +DUCKDB_API bool TryCast::Operation(int16_t input, bool &result, bool strict); template <> -bool TryCast::Operation(int16_t input, int8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int16_t input, int8_t &result, bool strict); template <> -bool TryCast::Operation(int16_t input, int16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int16_t input, int16_t &result, bool strict); template <> -bool TryCast::Operation(int16_t input, int32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int16_t input, int32_t &result, bool strict); template <> -bool TryCast::Operation(int16_t input, int64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int16_t input, int64_t &result, bool strict); template <> -bool TryCast::Operation(int16_t input, hugeint_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int16_t input, hugeint_t &result, bool strict); template <> -bool TryCast::Operation(int16_t input, uint8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int16_t input, uint8_t &result, bool strict); template <> -bool TryCast::Operation(int16_t input, uint16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int16_t input, uint16_t &result, bool strict); template <> -bool TryCast::Operation(int16_t input, uint32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int16_t input, uint32_t &result, bool strict); template <> -bool TryCast::Operation(int16_t input, uint64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int16_t input, uint64_t &result, bool strict); template <> -bool TryCast::Operation(int16_t input, float &result, bool strict); +DUCKDB_API bool TryCast::Operation(int16_t input, float &result, bool strict); template <> -bool TryCast::Operation(int16_t input, double &result, bool strict); +DUCKDB_API bool TryCast::Operation(int16_t input, double &result, bool strict); //===--------------------------------------------------------------------===// // Cast int32_t -> Numeric //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(int32_t input, bool &result, bool strict); +DUCKDB_API bool TryCast::Operation(int32_t input, bool &result, bool strict); template <> -bool TryCast::Operation(int32_t input, int8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int32_t input, int8_t &result, bool strict); template <> -bool TryCast::Operation(int32_t input, int16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int32_t input, int16_t &result, bool strict); template <> -bool TryCast::Operation(int32_t input, int32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int32_t input, int32_t &result, bool strict); template <> -bool TryCast::Operation(int32_t input, int64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int32_t input, int64_t &result, bool strict); template <> -bool TryCast::Operation(int32_t input, hugeint_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int32_t input, hugeint_t &result, bool strict); template <> -bool TryCast::Operation(int32_t input, uint8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int32_t input, uint8_t &result, bool strict); template <> -bool TryCast::Operation(int32_t input, uint16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int32_t input, uint16_t &result, bool strict); template <> -bool TryCast::Operation(int32_t input, uint32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int32_t input, uint32_t &result, bool strict); template <> -bool TryCast::Operation(int32_t input, uint64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int32_t input, uint64_t &result, bool strict); template <> -bool TryCast::Operation(int32_t input, float &result, bool strict); +DUCKDB_API bool TryCast::Operation(int32_t input, float &result, bool strict); template <> -bool TryCast::Operation(int32_t input, double &result, bool strict); +DUCKDB_API bool TryCast::Operation(int32_t input, double &result, bool strict); //===--------------------------------------------------------------------===// // Cast int64_t -> Numeric //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(int64_t input, bool &result, bool strict); +DUCKDB_API bool TryCast::Operation(int64_t input, bool &result, bool strict); template <> -bool TryCast::Operation(int64_t input, int8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int64_t input, int8_t &result, bool strict); template <> -bool TryCast::Operation(int64_t input, int16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int64_t input, int16_t &result, bool strict); template <> -bool TryCast::Operation(int64_t input, int32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int64_t input, int32_t &result, bool strict); template <> -bool TryCast::Operation(int64_t input, int64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int64_t input, int64_t &result, bool strict); template <> -bool TryCast::Operation(int64_t input, hugeint_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int64_t input, hugeint_t &result, bool strict); template <> -bool TryCast::Operation(int64_t input, uint8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int64_t input, uint8_t &result, bool strict); template <> -bool TryCast::Operation(int64_t input, uint16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int64_t input, uint16_t &result, bool strict); template <> -bool TryCast::Operation(int64_t input, uint32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int64_t input, uint32_t &result, bool strict); template <> -bool TryCast::Operation(int64_t input, uint64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(int64_t input, uint64_t &result, bool strict); template <> -bool TryCast::Operation(int64_t input, float &result, bool strict); +DUCKDB_API bool TryCast::Operation(int64_t input, float &result, bool strict); template <> -bool TryCast::Operation(int64_t input, double &result, bool strict); +DUCKDB_API bool TryCast::Operation(int64_t input, double &result, bool strict); //===--------------------------------------------------------------------===// // Cast hugeint_t -> Numeric //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(hugeint_t input, bool &result, bool strict); +DUCKDB_API bool TryCast::Operation(hugeint_t input, bool &result, bool strict); template <> -bool TryCast::Operation(hugeint_t input, int8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(hugeint_t input, int8_t &result, bool strict); template <> -bool TryCast::Operation(hugeint_t input, int16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(hugeint_t input, int16_t &result, bool strict); template <> -bool TryCast::Operation(hugeint_t input, int32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(hugeint_t input, int32_t &result, bool strict); template <> -bool TryCast::Operation(hugeint_t input, int64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(hugeint_t input, int64_t &result, bool strict); template <> -bool TryCast::Operation(hugeint_t input, hugeint_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(hugeint_t input, hugeint_t &result, bool strict); template <> -bool TryCast::Operation(hugeint_t input, uint8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(hugeint_t input, uint8_t &result, bool strict); template <> -bool TryCast::Operation(hugeint_t input, uint16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(hugeint_t input, uint16_t &result, bool strict); template <> -bool TryCast::Operation(hugeint_t input, uint32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(hugeint_t input, uint32_t &result, bool strict); template <> -bool TryCast::Operation(hugeint_t input, uint64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(hugeint_t input, uint64_t &result, bool strict); template <> -bool TryCast::Operation(hugeint_t input, float &result, bool strict); +DUCKDB_API bool TryCast::Operation(hugeint_t input, float &result, bool strict); template <> -bool TryCast::Operation(hugeint_t input, double &result, bool strict); +DUCKDB_API bool TryCast::Operation(hugeint_t input, double &result, bool strict); //===--------------------------------------------------------------------===// // Cast uint8_t -> Numeric //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(uint8_t input, bool &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint8_t input, bool &result, bool strict); template <> -bool TryCast::Operation(uint8_t input, int8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint8_t input, int8_t &result, bool strict); template <> -bool TryCast::Operation(uint8_t input, int16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint8_t input, int16_t &result, bool strict); template <> -bool TryCast::Operation(uint8_t input, int32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint8_t input, int32_t &result, bool strict); template <> -bool TryCast::Operation(uint8_t input, int64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint8_t input, int64_t &result, bool strict); template <> -bool TryCast::Operation(uint8_t input, hugeint_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint8_t input, hugeint_t &result, bool strict); template <> -bool TryCast::Operation(uint8_t input, uint8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint8_t input, uint8_t &result, bool strict); template <> -bool TryCast::Operation(uint8_t input, uint16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint8_t input, uint16_t &result, bool strict); template <> -bool TryCast::Operation(uint8_t input, uint32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint8_t input, uint32_t &result, bool strict); template <> -bool TryCast::Operation(uint8_t input, uint64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint8_t input, uint64_t &result, bool strict); template <> -bool TryCast::Operation(uint8_t input, float &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint8_t input, float &result, bool strict); template <> -bool TryCast::Operation(uint8_t input, double &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint8_t input, double &result, bool strict); //===--------------------------------------------------------------------===// // Cast uint16_t -> Numeric //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(uint16_t input, bool &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint16_t input, bool &result, bool strict); template <> -bool TryCast::Operation(uint16_t input, int8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint16_t input, int8_t &result, bool strict); template <> -bool TryCast::Operation(uint16_t input, int16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint16_t input, int16_t &result, bool strict); template <> -bool TryCast::Operation(uint16_t input, int32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint16_t input, int32_t &result, bool strict); template <> -bool TryCast::Operation(uint16_t input, int64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint16_t input, int64_t &result, bool strict); template <> -bool TryCast::Operation(uint16_t input, hugeint_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint16_t input, hugeint_t &result, bool strict); template <> -bool TryCast::Operation(uint16_t input, uint8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint16_t input, uint8_t &result, bool strict); template <> -bool TryCast::Operation(uint16_t input, uint16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint16_t input, uint16_t &result, bool strict); template <> -bool TryCast::Operation(uint16_t input, uint32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint16_t input, uint32_t &result, bool strict); template <> -bool TryCast::Operation(uint16_t input, uint64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint16_t input, uint64_t &result, bool strict); template <> -bool TryCast::Operation(uint16_t input, float &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint16_t input, float &result, bool strict); template <> -bool TryCast::Operation(uint16_t input, double &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint16_t input, double &result, bool strict); //===--------------------------------------------------------------------===// // Cast uint32_t -> Numeric //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(uint32_t input, bool &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint32_t input, bool &result, bool strict); template <> -bool TryCast::Operation(uint32_t input, int8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint32_t input, int8_t &result, bool strict); template <> -bool TryCast::Operation(uint32_t input, int16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint32_t input, int16_t &result, bool strict); template <> -bool TryCast::Operation(uint32_t input, int32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint32_t input, int32_t &result, bool strict); template <> -bool TryCast::Operation(uint32_t input, int64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint32_t input, int64_t &result, bool strict); template <> -bool TryCast::Operation(uint32_t input, hugeint_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint32_t input, hugeint_t &result, bool strict); template <> -bool TryCast::Operation(uint32_t input, uint8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint32_t input, uint8_t &result, bool strict); template <> -bool TryCast::Operation(uint32_t input, uint16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint32_t input, uint16_t &result, bool strict); template <> -bool TryCast::Operation(uint32_t input, uint32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint32_t input, uint32_t &result, bool strict); template <> -bool TryCast::Operation(uint32_t input, uint64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint32_t input, uint64_t &result, bool strict); template <> -bool TryCast::Operation(uint32_t input, float &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint32_t input, float &result, bool strict); template <> -bool TryCast::Operation(uint32_t input, double &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint32_t input, double &result, bool strict); //===--------------------------------------------------------------------===// // Cast uint64_t -> Numeric //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(uint64_t input, bool &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint64_t input, bool &result, bool strict); template <> -bool TryCast::Operation(uint64_t input, int8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint64_t input, int8_t &result, bool strict); template <> -bool TryCast::Operation(uint64_t input, int16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint64_t input, int16_t &result, bool strict); template <> -bool TryCast::Operation(uint64_t input, int32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint64_t input, int32_t &result, bool strict); template <> -bool TryCast::Operation(uint64_t input, int64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint64_t input, int64_t &result, bool strict); template <> -bool TryCast::Operation(uint64_t input, hugeint_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint64_t input, hugeint_t &result, bool strict); template <> -bool TryCast::Operation(uint64_t input, uint8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint64_t input, uint8_t &result, bool strict); template <> -bool TryCast::Operation(uint64_t input, uint16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint64_t input, uint16_t &result, bool strict); template <> -bool TryCast::Operation(uint64_t input, uint32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint64_t input, uint32_t &result, bool strict); template <> -bool TryCast::Operation(uint64_t input, uint64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint64_t input, uint64_t &result, bool strict); template <> -bool TryCast::Operation(uint64_t input, float &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint64_t input, float &result, bool strict); template <> -bool TryCast::Operation(uint64_t input, double &result, bool strict); +DUCKDB_API bool TryCast::Operation(uint64_t input, double &result, bool strict); //===--------------------------------------------------------------------===// // Cast float -> Numeric //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(float input, bool &result, bool strict); +DUCKDB_API bool TryCast::Operation(float input, bool &result, bool strict); template <> -bool TryCast::Operation(float input, int8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(float input, int8_t &result, bool strict); template <> -bool TryCast::Operation(float input, int16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(float input, int16_t &result, bool strict); template <> -bool TryCast::Operation(float input, int32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(float input, int32_t &result, bool strict); template <> -bool TryCast::Operation(float input, int64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(float input, int64_t &result, bool strict); template <> -bool TryCast::Operation(float input, hugeint_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(float input, hugeint_t &result, bool strict); template <> -bool TryCast::Operation(float input, uint8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(float input, uint8_t &result, bool strict); template <> -bool TryCast::Operation(float input, uint16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(float input, uint16_t &result, bool strict); template <> -bool TryCast::Operation(float input, uint32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(float input, uint32_t &result, bool strict); template <> -bool TryCast::Operation(float input, uint64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(float input, uint64_t &result, bool strict); template <> -bool TryCast::Operation(float input, float &result, bool strict); +DUCKDB_API bool TryCast::Operation(float input, float &result, bool strict); template <> -bool TryCast::Operation(float input, double &result, bool strict); +DUCKDB_API bool TryCast::Operation(float input, double &result, bool strict); //===--------------------------------------------------------------------===// // Cast double -> Numeric //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(double input, bool &result, bool strict); +DUCKDB_API bool TryCast::Operation(double input, bool &result, bool strict); template <> -bool TryCast::Operation(double input, int8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(double input, int8_t &result, bool strict); template <> -bool TryCast::Operation(double input, int16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(double input, int16_t &result, bool strict); template <> -bool TryCast::Operation(double input, int32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(double input, int32_t &result, bool strict); template <> -bool TryCast::Operation(double input, int64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(double input, int64_t &result, bool strict); template <> -bool TryCast::Operation(double input, hugeint_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(double input, hugeint_t &result, bool strict); template <> -bool TryCast::Operation(double input, uint8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(double input, uint8_t &result, bool strict); template <> -bool TryCast::Operation(double input, uint16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(double input, uint16_t &result, bool strict); template <> -bool TryCast::Operation(double input, uint32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(double input, uint32_t &result, bool strict); template <> -bool TryCast::Operation(double input, uint64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(double input, uint64_t &result, bool strict); template <> -bool TryCast::Operation(double input, float &result, bool strict); +DUCKDB_API bool TryCast::Operation(double input, float &result, bool strict); template <> -bool TryCast::Operation(double input, double &result, bool strict); +DUCKDB_API bool TryCast::Operation(double input, double &result, bool strict); //===--------------------------------------------------------------------===// // String -> Numeric Casts //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(string_t input, bool &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, bool &result, bool strict); template <> -bool TryCast::Operation(string_t input, int8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, int8_t &result, bool strict); template <> -bool TryCast::Operation(string_t input, int16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, int16_t &result, bool strict); template <> -bool TryCast::Operation(string_t input, int32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, int32_t &result, bool strict); template <> -bool TryCast::Operation(string_t input, int64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, int64_t &result, bool strict); template <> -bool TryCast::Operation(string_t input, uint8_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, uint8_t &result, bool strict); template <> -bool TryCast::Operation(string_t input, uint16_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, uint16_t &result, bool strict); template <> -bool TryCast::Operation(string_t input, uint32_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, uint32_t &result, bool strict); template <> -bool TryCast::Operation(string_t input, uint64_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, uint64_t &result, bool strict); template <> -bool TryCast::Operation(string_t input, hugeint_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, hugeint_t &result, bool strict); template <> -bool TryCast::Operation(string_t input, float &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, float &result, bool strict); template <> -bool TryCast::Operation(string_t input, double &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, double &result, bool strict); //===--------------------------------------------------------------------===// // Date Casts //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(date_t input, date_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(date_t input, date_t &result, bool strict); template <> -bool TryCast::Operation(date_t input, timestamp_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(date_t input, timestamp_t &result, bool strict); //===--------------------------------------------------------------------===// // Time Casts //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(dtime_t input, dtime_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(dtime_t input, dtime_t &result, bool strict); //===--------------------------------------------------------------------===// // Timestamp Casts //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(timestamp_t input, date_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(timestamp_t input, date_t &result, bool strict); template <> -bool TryCast::Operation(timestamp_t input, dtime_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(timestamp_t input, dtime_t &result, bool strict); template <> -bool TryCast::Operation(timestamp_t input, timestamp_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(timestamp_t input, timestamp_t &result, bool strict); //===--------------------------------------------------------------------===// // Interval Casts //===--------------------------------------------------------------------===// template <> -bool TryCast::Operation(interval_t input, interval_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(interval_t input, interval_t &result, bool strict); //===--------------------------------------------------------------------===// // String -> Date Casts //===--------------------------------------------------------------------===// template <> -bool TryCastErrorMessage::Operation(string_t input, date_t &result, string *error_message, bool strict); +DUCKDB_API bool TryCastErrorMessage::Operation(string_t input, date_t &result, string *error_message, bool strict); template <> -bool TryCast::Operation(string_t input, date_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, date_t &result, bool strict); template <> date_t Cast::Operation(string_t input); //===--------------------------------------------------------------------===// // String -> Time Casts //===--------------------------------------------------------------------===// template <> -bool TryCastErrorMessage::Operation(string_t input, dtime_t &result, string *error_message, bool strict); +DUCKDB_API bool TryCastErrorMessage::Operation(string_t input, dtime_t &result, string *error_message, bool strict); template <> -bool TryCast::Operation(string_t input, dtime_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, dtime_t &result, bool strict); template <> dtime_t Cast::Operation(string_t input); //===--------------------------------------------------------------------===// // String -> Timestamp Casts //===--------------------------------------------------------------------===// template <> -bool TryCastErrorMessage::Operation(string_t input, timestamp_t &result, string *error_message, bool strict); +DUCKDB_API bool TryCastErrorMessage::Operation(string_t input, timestamp_t &result, string *error_message, bool strict); template <> -bool TryCast::Operation(string_t input, timestamp_t &result, bool strict); +DUCKDB_API bool TryCast::Operation(string_t input, timestamp_t &result, bool strict); template <> timestamp_t Cast::Operation(string_t input); //===--------------------------------------------------------------------===// // String -> Interval Casts //===--------------------------------------------------------------------===// template <> -bool TryCastErrorMessage::Operation(string_t input, interval_t &result, string *error_message, bool strict); +DUCKDB_API bool TryCastErrorMessage::Operation(string_t input, interval_t &result, string *error_message, bool strict); //===--------------------------------------------------------------------===// // string -> Non-Standard Timestamps //===--------------------------------------------------------------------===// struct TryCastToTimestampNS { template - static inline bool Operation(SRC input, DST &result, bool strict = false) { + DUCKDB_API static inline bool Operation(SRC input, DST &result, bool strict = false) { throw InternalException("Unsupported type for try cast to timestamp (ns)"); } }; struct TryCastToTimestampMS { template - static inline bool Operation(SRC input, DST &result, bool strict = false) { + DUCKDB_API static inline bool Operation(SRC input, DST &result, bool strict = false) { throw InternalException("Unsupported type for try cast to timestamp (ms)"); } }; struct TryCastToTimestampSec { template - static inline bool Operation(SRC input, DST &result, bool strict = false) { + DUCKDB_API static inline bool Operation(SRC input, DST &result, bool strict = false) { throw InternalException("Unsupported type for try cast to timestamp (s)"); } }; template <> -bool TryCastToTimestampNS::Operation(string_t input, timestamp_t &result, bool strict); +DUCKDB_API bool TryCastToTimestampNS::Operation(string_t input, timestamp_t &result, bool strict); template <> -bool TryCastToTimestampMS::Operation(string_t input, timestamp_t &result, bool strict); +DUCKDB_API bool TryCastToTimestampMS::Operation(string_t input, timestamp_t &result, bool strict); template <> -bool TryCastToTimestampSec::Operation(string_t input, timestamp_t &result, bool strict); +DUCKDB_API bool TryCastToTimestampSec::Operation(string_t input, timestamp_t &result, bool strict); //===--------------------------------------------------------------------===// // Non-Standard Timestamps -> string/standard timestamp @@ -20299,15 +21062,15 @@ duckdb::string_t CastFromUUID::Operation(duckdb::hugeint_t input, Vector &vector struct TryCastToUUID { template - static inline bool Operation(SRC input, DST &result, Vector &result_vector, string *error_message, - bool strict = false) { + DUCKDB_API static inline bool Operation(SRC input, DST &result, Vector &result_vector, string *error_message, + bool strict = false) { throw InternalException("Unsupported type for try cast to uuid"); } }; template <> -bool TryCastToUUID::Operation(string_t input, hugeint_t &result, Vector &result_vector, string *error_message, - bool strict); +DUCKDB_API bool TryCastToUUID::Operation(string_t input, hugeint_t &result, Vector &result_vector, + string *error_message, bool strict); } // namespace duckdb @@ -20333,45 +21096,45 @@ class Vector; struct StringCast { template - static inline string_t Operation(SRC input, Vector &result) { + DUCKDB_API static inline string_t Operation(SRC input, Vector &result) { throw NotImplementedException("Unimplemented type for string cast!"); } }; template <> -duckdb::string_t StringCast::Operation(bool input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(bool input, Vector &result); template <> -duckdb::string_t StringCast::Operation(int8_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(int8_t input, Vector &result); template <> -duckdb::string_t StringCast::Operation(int16_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(int16_t input, Vector &result); template <> -duckdb::string_t StringCast::Operation(int32_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(int32_t input, Vector &result); template <> -duckdb::string_t StringCast::Operation(int64_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(int64_t input, Vector &result); template <> -duckdb::string_t StringCast::Operation(uint8_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(uint8_t input, Vector &result); template <> -duckdb::string_t StringCast::Operation(uint16_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(uint16_t input, Vector &result); template <> -duckdb::string_t StringCast::Operation(uint32_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(uint32_t input, Vector &result); template <> -duckdb::string_t StringCast::Operation(uint64_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(uint64_t input, Vector &result); template <> -duckdb::string_t StringCast::Operation(hugeint_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(hugeint_t input, Vector &result); template <> -duckdb::string_t StringCast::Operation(float input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(float input, Vector &result); template <> -duckdb::string_t StringCast::Operation(double input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(double input, Vector &result); template <> -duckdb::string_t StringCast::Operation(interval_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(interval_t input, Vector &result); template <> -duckdb::string_t StringCast::Operation(duckdb::string_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(duckdb::string_t input, Vector &result); template <> -duckdb::string_t StringCast::Operation(date_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(date_t input, Vector &result); template <> -duckdb::string_t StringCast::Operation(dtime_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(dtime_t input, Vector &result); template <> -duckdb::string_t StringCast::Operation(timestamp_t input, Vector &result); +DUCKDB_API duckdb::string_t StringCast::Operation(timestamp_t input, Vector &result); //! Temporary casting for Time Zone types. TODO: turn casting into functions. struct StringCastTZ { @@ -20403,10 +21166,14 @@ duckdb::string_t StringCastTZ::Operation(timestamp_t input, Vector &result); + namespace duckdb { template static bool TryCastWithOverflowCheck(SRC value, DST &result) { + if (!Value::IsFinite(value)) { + return false; + } if (NumericLimits::IsSigned() != NumericLimits::IsSigned()) { if (NumericLimits::IsSigned()) { // signed to unsigned conversion @@ -20449,40 +21216,58 @@ static bool TryCastWithOverflowCheck(SRC value, DST &result) { } } -template <> -bool TryCastWithOverflowCheck(float value, int32_t &result) { - if (!(value >= -2147483648.0f && value < 2147483648.0f)) { +template +bool TryCastWithOverflowCheckFloat(SRC value, T &result, SRC min, SRC max) { + if (!Value::IsFinite(value)) { return false; } - result = int32_t(value); + if (!(value >= min && value < max)) { + return false; + } + result = T(value); return true; } +template <> +bool TryCastWithOverflowCheck(float value, int32_t &result) { + return TryCastWithOverflowCheckFloat(value, result, -2147483648.0f, 2147483648.0f); +} + template <> bool TryCastWithOverflowCheck(float value, int64_t &result) { - if (!(value >= -9223372036854775808.0f && value < 9223372036854775808.0f)) { - return false; - } - result = int64_t(value); - return true; + return TryCastWithOverflowCheckFloat(value, result, -9223372036854775808.0f, + 9223372036854775808.0f); } template <> bool TryCastWithOverflowCheck(double value, int64_t &result) { - if (!(value >= -9223372036854775808.0 && value < 9223372036854775808.0)) { - return false; - } - result = int64_t(value); + return TryCastWithOverflowCheckFloat(value, result, -9223372036854775808.0, 9223372036854775808.0); +} + +template <> +bool TryCastWithOverflowCheck(float input, float &result) { + result = input; + return true; +} +template <> +bool TryCastWithOverflowCheck(float input, double &result) { + result = double(input); + return true; +} +template <> +bool TryCastWithOverflowCheck(double input, double &result) { + result = input; return true; } template <> bool TryCastWithOverflowCheck(double input, float &result) { - if (input < (double)NumericLimits::Minimum() || input > (double)NumericLimits::Maximum()) { - return false; + if (!Value::IsFinite(input)) { + result = float(input); + return true; } - auto res = (float)input; - if (std::isnan(res) || std::isinf(res)) { + auto res = float(input); + if (!Value::FloatIsFinite(input)) { return false; } result = res; @@ -20785,7 +21570,8 @@ namespace duckdb { //===--------------------------------------------------------------------===// struct TryCastToDecimal { template - static inline bool Operation(SRC input, DST &result, string *error_message, uint8_t width, uint8_t scale) { + DUCKDB_API static inline bool Operation(SRC input, DST &result, string *error_message, uint8_t width, + uint8_t scale) { throw NotImplementedException("Unimplemented type for TryCastToDecimal!"); } }; @@ -20801,13 +21587,17 @@ struct TryCastFromDecimal { // Cast Decimal <-> bool //===--------------------------------------------------------------------===// template <> -bool TryCastToDecimal::Operation(bool input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(bool input, int16_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(bool input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(bool input, int32_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(bool input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(bool input, int64_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(bool input, hugeint_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(bool input, hugeint_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> bool TryCastFromDecimal::Operation(int16_t input, bool &result, string *error_message, uint8_t width, uint8_t scale); @@ -20822,13 +21612,17 @@ bool TryCastFromDecimal::Operation(hugeint_t input, bool &result, string *error_ // Cast Decimal <-> int8_t //===--------------------------------------------------------------------===// template <> -bool TryCastToDecimal::Operation(int8_t input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int8_t input, int16_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(int8_t input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int8_t input, int32_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(int8_t input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int8_t input, int64_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(int8_t input, hugeint_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int8_t input, hugeint_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> bool TryCastFromDecimal::Operation(int16_t input, int8_t &result, string *error_message, uint8_t width, uint8_t scale); @@ -20844,13 +21638,17 @@ bool TryCastFromDecimal::Operation(hugeint_t input, int8_t &result, string *erro // Cast Decimal <-> int16_t //===--------------------------------------------------------------------===// template <> -bool TryCastToDecimal::Operation(int16_t input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int16_t input, int16_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(int16_t input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int16_t input, int32_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(int16_t input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int16_t input, int64_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(int16_t input, hugeint_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int16_t input, hugeint_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> bool TryCastFromDecimal::Operation(int16_t input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); @@ -20866,13 +21664,17 @@ bool TryCastFromDecimal::Operation(hugeint_t input, int16_t &result, string *err // Cast Decimal <-> int32_t //===--------------------------------------------------------------------===// template <> -bool TryCastToDecimal::Operation(int32_t input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int32_t input, int16_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(int32_t input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int32_t input, int32_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(int32_t input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int32_t input, int64_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(int32_t input, hugeint_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int32_t input, hugeint_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> bool TryCastFromDecimal::Operation(int16_t input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); @@ -20888,13 +21690,17 @@ bool TryCastFromDecimal::Operation(hugeint_t input, int32_t &result, string *err // Cast Decimal <-> int64_t //===--------------------------------------------------------------------===// template <> -bool TryCastToDecimal::Operation(int64_t input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int64_t input, int16_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(int64_t input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int64_t input, int32_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(int64_t input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int64_t input, int64_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(int64_t input, hugeint_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(int64_t input, hugeint_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> bool TryCastFromDecimal::Operation(int16_t input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); @@ -20910,14 +21716,17 @@ bool TryCastFromDecimal::Operation(hugeint_t input, int64_t &result, string *err // Cast Decimal <-> hugeint_t //===--------------------------------------------------------------------===// template <> -bool TryCastToDecimal::Operation(hugeint_t input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(hugeint_t input, int16_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(hugeint_t input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(hugeint_t input, int32_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(hugeint_t input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(hugeint_t input, int64_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(hugeint_t input, hugeint_t &result, string *error_message, uint8_t width, - uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(hugeint_t input, hugeint_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> bool TryCastFromDecimal::Operation(int16_t input, hugeint_t &result, string *error_message, uint8_t width, @@ -20936,13 +21745,17 @@ bool TryCastFromDecimal::Operation(hugeint_t input, hugeint_t &result, string *e // Cast Decimal <-> uint8_t //===--------------------------------------------------------------------===// template <> -bool TryCastToDecimal::Operation(uint8_t input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint8_t input, int16_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(uint8_t input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint8_t input, int32_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(uint8_t input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint8_t input, int64_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(uint8_t input, hugeint_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint8_t input, hugeint_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> bool TryCastFromDecimal::Operation(int16_t input, uint8_t &result, string *error_message, uint8_t width, uint8_t scale); @@ -20958,14 +21771,17 @@ bool TryCastFromDecimal::Operation(hugeint_t input, uint8_t &result, string *err // Cast Decimal <-> uint16_t //===--------------------------------------------------------------------===// template <> -bool TryCastToDecimal::Operation(uint16_t input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint16_t input, int16_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(uint16_t input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint16_t input, int32_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(uint16_t input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint16_t input, int64_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(uint16_t input, hugeint_t &result, string *error_message, uint8_t width, - uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint16_t input, hugeint_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> bool TryCastFromDecimal::Operation(int16_t input, uint16_t &result, string *error_message, uint8_t width, @@ -20984,14 +21800,17 @@ bool TryCastFromDecimal::Operation(hugeint_t input, uint16_t &result, string *er // Cast Decimal <-> uint32_t //===--------------------------------------------------------------------===// template <> -bool TryCastToDecimal::Operation(uint32_t input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint32_t input, int16_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(uint32_t input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint32_t input, int32_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(uint32_t input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint32_t input, int64_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(uint32_t input, hugeint_t &result, string *error_message, uint8_t width, - uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint32_t input, hugeint_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> bool TryCastFromDecimal::Operation(int16_t input, uint32_t &result, string *error_message, uint8_t width, @@ -21010,14 +21829,17 @@ bool TryCastFromDecimal::Operation(hugeint_t input, uint32_t &result, string *er // Cast Decimal <-> uint64_t //===--------------------------------------------------------------------===// template <> -bool TryCastToDecimal::Operation(uint64_t input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint64_t input, int16_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(uint64_t input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint64_t input, int32_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(uint64_t input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint64_t input, int64_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(uint64_t input, hugeint_t &result, string *error_message, uint8_t width, - uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(uint64_t input, hugeint_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> bool TryCastFromDecimal::Operation(int16_t input, uint64_t &result, string *error_message, uint8_t width, @@ -21036,13 +21858,17 @@ bool TryCastFromDecimal::Operation(hugeint_t input, uint64_t &result, string *er // Cast Decimal <-> float //===--------------------------------------------------------------------===// template <> -bool TryCastToDecimal::Operation(float input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(float input, int16_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(float input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(float input, int32_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(float input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(float input, int64_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(float input, hugeint_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(float input, hugeint_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> bool TryCastFromDecimal::Operation(int16_t input, float &result, string *error_message, uint8_t width, uint8_t scale); @@ -21057,13 +21883,17 @@ bool TryCastFromDecimal::Operation(hugeint_t input, float &result, string *error // Cast Decimal <-> double //===--------------------------------------------------------------------===// template <> -bool TryCastToDecimal::Operation(double input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(double input, int16_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(double input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(double input, int32_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(double input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(double input, int64_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(double input, hugeint_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(double input, hugeint_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> bool TryCastFromDecimal::Operation(int16_t input, double &result, string *error_message, uint8_t width, uint8_t scale); @@ -21079,14 +21909,17 @@ bool TryCastFromDecimal::Operation(hugeint_t input, double &result, string *erro // Cast Decimal -> VARCHAR //===--------------------------------------------------------------------===// template <> -bool TryCastToDecimal::Operation(string_t input, int16_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(string_t input, int16_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(string_t input, int32_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(string_t input, int32_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(string_t input, int64_t &result, string *error_message, uint8_t width, uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(string_t input, int64_t &result, string *error_message, uint8_t width, + uint8_t scale); template <> -bool TryCastToDecimal::Operation(string_t input, hugeint_t &result, string *error_message, uint8_t width, - uint8_t scale); +DUCKDB_API bool TryCastToDecimal::Operation(string_t input, hugeint_t &result, string *error_message, uint8_t width, + uint8_t scale); struct StringCastFromDecimal { template @@ -21184,6 +22017,11 @@ class NumericHelper { result.Finalize(); return result; } + + template + static std::string ToString(T value) { + return std::to_string(value); + } }; template <> @@ -21195,6 +22033,9 @@ int NumericHelper::UnsignedLength(uint32_t value); template <> int NumericHelper::UnsignedLength(uint64_t value); +template <> +std::string NumericHelper::ToString(hugeint_t value); + struct DecimalToString { template static int DecimalLength(SIGNED value, uint8_t scale) { @@ -21659,6 +22500,2429 @@ struct IntervalToStringCast { +// LICENSE_CHANGE_BEGIN +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #4 +// See the end of this file for a list + +// duckdb_fast_float by Daniel Lemire +// duckdb_fast_float by João Paulo Magalhaes + + +// with contributions from Eugene Golushkov +// with contributions from Maksim Kita +// with contributions from Marcin Wojdyr +// with contributions from Neal Richardson +// with contributions from Tim Paine +// with contributions from Fabio Pellacini + + +// Permission is hereby granted, free of charge, to any +// person obtaining a copy of this software and associated +// documentation files (the "Software"), to deal in the +// Software without restriction, including without +// limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of +// the Software, and to permit persons to whom the Software +// is furnished to do so, subject to the following +// conditions: +// +// The above copyright notice and this permission notice +// shall be included in all copies or substantial portions +// of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +// ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +// SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +// IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + + +#ifndef FASTFLOAT_FAST_FLOAT_H +#define FASTFLOAT_FAST_FLOAT_H + +#include + +namespace duckdb_fast_float { +enum chars_format { + scientific = 1<<0, + fixed = 1<<2, + hex = 1<<3, + general = fixed | scientific +}; + + +struct from_chars_result { + const char *ptr; + std::errc ec; +}; + +/** + * This function parses the character sequence [first,last) for a number. It parses floating-point numbers expecting + * a locale-indepent format equivalent to what is used by std::strtod in the default ("C") locale. + * The resulting floating-point value is the closest floating-point values (using either float or double), + * using the "round to even" convention for values that would otherwise fall right in-between two values. + * That is, we provide exact parsing according to the IEEE standard. + * + * Given a successful parse, the pointer (`ptr`) in the returned value is set to point right after the + * parsed number, and the `value` referenced is set to the parsed value. In case of error, the returned + * `ec` contains a representative error, otherwise the default (`std::errc()`) value is stored. + * + * The implementation does not throw and does not allocate memory (e.g., with `new` or `malloc`). + * + * Like the C++17 standard, the `duckdb_fast_float::from_chars` functions take an optional last argument of + * the type `duckdb_fast_float::chars_format`. It is a bitset value: we check whether + * `fmt & duckdb_fast_float::chars_format::fixed` and `fmt & duckdb_fast_float::chars_format::scientific` are set + * to determine whether we allowe the fixed point and scientific notation respectively. + * The default is `duckdb_fast_float::chars_format::general` which allows both `fixed` and `scientific`. + */ +template +from_chars_result from_chars(const char *first, const char *last, + T &value, chars_format fmt = chars_format::general) noexcept; + +} +#endif // FASTFLOAT_FAST_FLOAT_H + +#ifndef FASTFLOAT_FLOAT_COMMON_H +#define FASTFLOAT_FLOAT_COMMON_H + +#include +#include +#include + +#if (defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) \ + || defined(__amd64) || defined(__aarch64__) || defined(_M_ARM64) \ + || defined(__MINGW64__) \ + || defined(__s390x__) \ + || (defined(__ppc64__) || defined(__PPC64__) || defined(__ppc64le__) || defined(__PPC64LE__)) \ + || defined(__EMSCRIPTEN__)) +#define FASTFLOAT_64BIT +#elif (defined(__i386) || defined(__i386__) || defined(_M_IX86) \ + || defined(__arm__) || defined(_M_ARM) \ + || defined(__MINGW32__)) +#define FASTFLOAT_32BIT +#else + // Need to check incrementally, since SIZE_MAX is a size_t, avoid overflow. + // We can never tell the register width, but the SIZE_MAX is a good approximation. + // UINTPTR_MAX and INTPTR_MAX are optional, so avoid them for max portability. + #if SIZE_MAX == 0xffff + #error Unknown platform (16-bit, unsupported) + #elif SIZE_MAX == 0xffffffff + #define FASTFLOAT_32BIT + #elif SIZE_MAX == 0xffffffffffffffff + #define FASTFLOAT_64BIT + #else + #error Unknown platform (not 32-bit, not 64-bit?) + #endif +#endif + +#if ((defined(_WIN32) || defined(_WIN64)) && !defined(__clang__)) +#include +#endif + +#if defined(_MSC_VER) && !defined(__clang__) +#define FASTFLOAT_VISUAL_STUDIO 1 +#endif + +#ifdef _WIN32 +#define FASTFLOAT_IS_BIG_ENDIAN 0 +#else +#if defined(__APPLE__) || defined(__FreeBSD__) +#include +#elif defined(sun) || defined(__sun) +#include +#else +#include +#endif +# +#ifndef __BYTE_ORDER__ +// safe choice +#define FASTFLOAT_IS_BIG_ENDIAN 0 +#endif +# +#ifndef __ORDER_LITTLE_ENDIAN__ +// safe choice +#define FASTFLOAT_IS_BIG_ENDIAN 0 +#endif +# +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define FASTFLOAT_IS_BIG_ENDIAN 0 +#else +#define FASTFLOAT_IS_BIG_ENDIAN 1 +#endif +#endif + +#ifdef FASTFLOAT_VISUAL_STUDIO +#define fastfloat_really_inline __forceinline +#else +#define fastfloat_really_inline inline __attribute__((always_inline)) +#endif + +namespace duckdb_fast_float { + +// Compares two ASCII strings in a case insensitive manner. +inline bool fastfloat_strncasecmp(const char *input1, const char *input2, + size_t length) { + char running_diff{0}; + for (size_t i = 0; i < length; i++) { + running_diff |= (input1[i] ^ input2[i]); + } + return (running_diff == 0) || (running_diff == 32); +} + +#ifndef FLT_EVAL_METHOD +#error "FLT_EVAL_METHOD should be defined, please include cfloat." +#endif + +namespace { +constexpr uint32_t max_digits = 768; +constexpr uint32_t max_digit_without_overflow = 19; +constexpr int32_t decimal_point_range = 2047; +} // namespace + +struct value128 { + uint64_t low; + uint64_t high; + value128(uint64_t _low, uint64_t _high) : low(_low), high(_high) {} + value128() : low(0), high(0) {} +}; + +/* result might be undefined when input_num is zero */ +fastfloat_really_inline int leading_zeroes(uint64_t input_num) { + assert(input_num > 0); +#ifdef FASTFLOAT_VISUAL_STUDIO + #if defined(_M_X64) || defined(_M_ARM64) + unsigned long leading_zero = 0; + // Search the mask data from most significant bit (MSB) + // to least significant bit (LSB) for a set bit (1). + _BitScanReverse64(&leading_zero, input_num); + return (int)(63 - leading_zero); + #else + int last_bit = 0; + if(input_num & uint64_t(0xffffffff00000000)) input_num >>= 32, last_bit |= 32; + if(input_num & uint64_t( 0xffff0000)) input_num >>= 16, last_bit |= 16; + if(input_num & uint64_t( 0xff00)) input_num >>= 8, last_bit |= 8; + if(input_num & uint64_t( 0xf0)) input_num >>= 4, last_bit |= 4; + if(input_num & uint64_t( 0xc)) input_num >>= 2, last_bit |= 2; + if(input_num & uint64_t( 0x2)) input_num >>= 1, last_bit |= 1; + return 63 - last_bit; + #endif +#else + return __builtin_clzll(input_num); +#endif +} + +#ifdef FASTFLOAT_32BIT + +// slow emulation routine for 32-bit +fastfloat_really_inline uint64_t emulu(uint32_t x, uint32_t y) { + return x * (uint64_t)y; +} + +// slow emulation routine for 32-bit +#if !defined(__MINGW64__) +fastfloat_really_inline uint64_t _umul128(uint64_t ab, uint64_t cd, + uint64_t *hi) { + uint64_t ad = emulu((uint32_t)(ab >> 32), (uint32_t)cd); + uint64_t bd = emulu((uint32_t)ab, (uint32_t)cd); + uint64_t adbc = ad + emulu((uint32_t)ab, (uint32_t)(cd >> 32)); + uint64_t adbc_carry = !!(adbc < ad); + uint64_t lo = bd + (adbc << 32); + *hi = emulu((uint32_t)(ab >> 32), (uint32_t)(cd >> 32)) + (adbc >> 32) + + (adbc_carry << 32) + !!(lo < bd); + return lo; +} +#endif // !__MINGW64__ + +#endif // FASTFLOAT_32BIT + + +// compute 64-bit a*b +fastfloat_really_inline value128 full_multiplication(uint64_t a, + uint64_t b) { + value128 answer; +#ifdef _M_ARM64 + // ARM64 has native support for 64-bit multiplications, no need to emulate + answer.high = __umulh(a, b); + answer.low = a * b; +#elif defined(FASTFLOAT_32BIT) || (defined(_WIN64) && !defined(__clang__)) + answer.low = _umul128(a, b, &answer.high); // _umul128 not available on ARM64 +#elif defined(FASTFLOAT_64BIT) + __uint128_t r = ((__uint128_t)a) * b; + answer.low = uint64_t(r); + answer.high = uint64_t(r >> 64); +#else + #error Not implemented +#endif + return answer; +} + + +struct adjusted_mantissa { + uint64_t mantissa{0}; + int power2{0}; // a negative value indicates an invalid result + adjusted_mantissa() = default; + bool operator==(const adjusted_mantissa &o) const { + return mantissa == o.mantissa && power2 == o.power2; + } + bool operator!=(const adjusted_mantissa &o) const { + return mantissa != o.mantissa || power2 != o.power2; + } +}; + +struct decimal { + uint32_t num_digits{0}; + int32_t decimal_point{0}; + bool negative{false}; + bool truncated{false}; + uint8_t digits[max_digits]; + decimal() = default; + // Copies are not allowed since this is a fat object. + decimal(const decimal &) = delete; + // Copies are not allowed since this is a fat object. + decimal &operator=(const decimal &) = delete; + // Moves are allowed: + decimal(decimal &&) = default; + decimal &operator=(decimal &&other) = default; +}; + +constexpr static double powers_of_ten_double[] = { + 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, + 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, 1e20, 1e21, 1e22}; +constexpr static float powers_of_ten_float[] = {1e0, 1e1, 1e2, 1e3, 1e4, 1e5, + 1e6, 1e7, 1e8, 1e9, 1e10}; + +template struct binary_format { + static inline constexpr int mantissa_explicit_bits(); + static inline constexpr int minimum_exponent(); + static inline constexpr int infinite_power(); + static inline constexpr int sign_index(); + static inline constexpr int min_exponent_fast_path(); + static inline constexpr int max_exponent_fast_path(); + static inline constexpr int max_exponent_round_to_even(); + static inline constexpr int min_exponent_round_to_even(); + static inline constexpr uint64_t max_mantissa_fast_path(); + static inline constexpr int largest_power_of_ten(); + static inline constexpr int smallest_power_of_ten(); + static inline constexpr T exact_power_of_ten(int64_t power); +}; + +template <> inline constexpr int binary_format::mantissa_explicit_bits() { + return 52; +} +template <> inline constexpr int binary_format::mantissa_explicit_bits() { + return 23; +} + +template <> inline constexpr int binary_format::max_exponent_round_to_even() { + return 23; +} + +template <> inline constexpr int binary_format::max_exponent_round_to_even() { + return 10; +} + +template <> inline constexpr int binary_format::min_exponent_round_to_even() { + return -4; +} + +template <> inline constexpr int binary_format::min_exponent_round_to_even() { + return -17; +} + +template <> inline constexpr int binary_format::minimum_exponent() { + return -1023; +} +template <> inline constexpr int binary_format::minimum_exponent() { + return -127; +} + +template <> inline constexpr int binary_format::infinite_power() { + return 0x7FF; +} +template <> inline constexpr int binary_format::infinite_power() { + return 0xFF; +} + +template <> inline constexpr int binary_format::sign_index() { return 63; } +template <> inline constexpr int binary_format::sign_index() { return 31; } + +template <> inline constexpr int binary_format::min_exponent_fast_path() { +#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0) + return 0; +#else + return -22; +#endif +} +template <> inline constexpr int binary_format::min_exponent_fast_path() { +#if (FLT_EVAL_METHOD != 1) && (FLT_EVAL_METHOD != 0) + return 0; +#else + return -10; +#endif +} + +template <> inline constexpr int binary_format::max_exponent_fast_path() { + return 22; +} +template <> inline constexpr int binary_format::max_exponent_fast_path() { + return 10; +} + +template <> inline constexpr uint64_t binary_format::max_mantissa_fast_path() { + return uint64_t(2) << mantissa_explicit_bits(); +} +template <> inline constexpr uint64_t binary_format::max_mantissa_fast_path() { + return uint64_t(2) << mantissa_explicit_bits(); +} + +template <> +inline constexpr double binary_format::exact_power_of_ten(int64_t power) { + return powers_of_ten_double[power]; +} +template <> +inline constexpr float binary_format::exact_power_of_ten(int64_t power) { + + return powers_of_ten_float[power]; +} + + +template <> +inline constexpr int binary_format::largest_power_of_ten() { + return 308; +} +template <> +inline constexpr int binary_format::largest_power_of_ten() { + return 38; +} + +template <> +inline constexpr int binary_format::smallest_power_of_ten() { + return -342; +} +template <> +inline constexpr int binary_format::smallest_power_of_ten() { + return -65; +} + +} // namespace duckdb_fast_float + +// for convenience: +template +inline OStream& operator<<(OStream &out, const duckdb_fast_float::decimal &d) { + out << "0."; + for (size_t i = 0; i < d.num_digits; i++) { + out << int32_t(d.digits[i]); + } + out << " * 10 ** " << d.decimal_point; + return out; +} + +#endif + + +#ifndef FASTFLOAT_ASCII_NUMBER_H +#define FASTFLOAT_ASCII_NUMBER_H + +#include +#include +#include +#include + + +namespace duckdb_fast_float { + +// Next function can be micro-optimized, but compilers are entirely +// able to optimize it well. +fastfloat_really_inline bool is_integer(char c) noexcept { return c >= '0' && c <= '9'; } + +fastfloat_really_inline uint64_t byteswap(uint64_t val) { + return (val & 0xFF00000000000000) >> 56 + | (val & 0x00FF000000000000) >> 40 + | (val & 0x0000FF0000000000) >> 24 + | (val & 0x000000FF00000000) >> 8 + | (val & 0x00000000FF000000) << 8 + | (val & 0x0000000000FF0000) << 24 + | (val & 0x000000000000FF00) << 40 + | (val & 0x00000000000000FF) << 56; +} + +fastfloat_really_inline uint64_t read_u64(const char *chars) { + uint64_t val; + ::memcpy(&val, chars, sizeof(uint64_t)); +#if FASTFLOAT_IS_BIG_ENDIAN == 1 + // Need to read as-if the number was in little-endian order. + val = byteswap(val); +#endif + return val; +} + +fastfloat_really_inline void write_u64(uint8_t *chars, uint64_t val) { +#if FASTFLOAT_IS_BIG_ENDIAN == 1 + // Need to read as-if the number was in little-endian order. + val = byteswap(val); +#endif + ::memcpy(chars, &val, sizeof(uint64_t)); +} + +// credit @aqrit +fastfloat_really_inline uint32_t parse_eight_digits_unrolled(uint64_t val) { + const uint64_t mask = 0x000000FF000000FF; + const uint64_t mul1 = 0x000F424000000064; // 100 + (1000000ULL << 32) + const uint64_t mul2 = 0x0000271000000001; // 1 + (10000ULL << 32) + val -= 0x3030303030303030; + val = (val * 10) + (val >> 8); // val = (val * 2561) >> 8; + val = (((val & mask) * mul1) + (((val >> 16) & mask) * mul2)) >> 32; + return uint32_t(val); +} + +fastfloat_really_inline uint32_t parse_eight_digits_unrolled(const char *chars) noexcept { + return parse_eight_digits_unrolled(read_u64(chars)); +} + +// credit @aqrit +fastfloat_really_inline bool is_made_of_eight_digits_fast(uint64_t val) noexcept { + return !((((val + 0x4646464646464646) | (val - 0x3030303030303030)) & + 0x8080808080808080)); +} + +fastfloat_really_inline bool is_made_of_eight_digits_fast(const char *chars) noexcept { + return is_made_of_eight_digits_fast(read_u64(chars)); +} + +struct parsed_number_string { + int64_t exponent; + uint64_t mantissa; + const char *lastmatch; + bool negative; + bool valid; + bool too_many_digits; +}; + + +// Assuming that you use no more than 19 digits, this will +// parse an ASCII string. +fastfloat_really_inline +parsed_number_string parse_number_string(const char *p, const char *pend, chars_format fmt) noexcept { + parsed_number_string answer; + answer.valid = false; + answer.too_many_digits = false; + answer.negative = (*p == '-'); + if (*p == '-') { // C++17 20.19.3.(7.1) explicitly forbids '+' sign here + ++p; + if (p == pend) { + return answer; + } + if (!is_integer(*p) && (*p != '.')) { // a sign must be followed by an integer or the dot + return answer; + } + } + const char *const start_digits = p; + + uint64_t i = 0; // an unsigned int avoids signed overflows (which are bad) + + while ((p != pend) && is_integer(*p)) { + // a multiplication by 10 is cheaper than an arbitrary integer + // multiplication + i = 10 * i + + uint64_t(*p - '0'); // might overflow, we will handle the overflow later + ++p; + } + const char *const end_of_integer_part = p; + int64_t digit_count = int64_t(end_of_integer_part - start_digits); + int64_t exponent = 0; + if ((p != pend) && (*p == '.')) { + ++p; + // Fast approach only tested under little endian systems + if ((p + 8 <= pend) && is_made_of_eight_digits_fast(p)) { + i = i * 100000000 + parse_eight_digits_unrolled(p); // in rare cases, this will overflow, but that's ok + p += 8; + if ((p + 8 <= pend) && is_made_of_eight_digits_fast(p)) { + i = i * 100000000 + parse_eight_digits_unrolled(p); // in rare cases, this will overflow, but that's ok + p += 8; + } + } + while ((p != pend) && is_integer(*p)) { + uint8_t digit = uint8_t(*p - '0'); + ++p; + i = i * 10 + digit; // in rare cases, this will overflow, but that's ok + } + exponent = end_of_integer_part + 1 - p; + digit_count -= exponent; + } + // we must have encountered at least one integer! + if (digit_count == 0) { + return answer; + } + int64_t exp_number = 0; // explicit exponential part + if ((fmt & chars_format::scientific) && (p != pend) && (('e' == *p) || ('E' == *p))) { + const char * location_of_e = p; + ++p; + bool neg_exp = false; + if ((p != pend) && ('-' == *p)) { + neg_exp = true; + ++p; + } else if ((p != pend) && ('+' == *p)) { // '+' on exponent is allowed by C++17 20.19.3.(7.1) + ++p; + } + if ((p == pend) || !is_integer(*p)) { + if(!(fmt & chars_format::fixed)) { + // We are in error. + return answer; + } + // Otherwise, we will be ignoring the 'e'. + p = location_of_e; + } else { + while ((p != pend) && is_integer(*p)) { + uint8_t digit = uint8_t(*p - '0'); + if (exp_number < 0x10000) { + exp_number = 10 * exp_number + digit; + } + ++p; + } + if(neg_exp) { exp_number = - exp_number; } + exponent += exp_number; + } + } else { + // If it scientific and not fixed, we have to bail out. + if((fmt & chars_format::scientific) && !(fmt & chars_format::fixed)) { return answer; } + } + answer.lastmatch = p; + answer.valid = true; + + // If we frequently had to deal with long strings of digits, + // we could extend our code by using a 128-bit integer instead + // of a 64-bit integer. However, this is uncommon. + // + // We can deal with up to 19 digits. + if (digit_count > 19) { // this is uncommon + // It is possible that the integer had an overflow. + // We have to handle the case where we have 0.0000somenumber. + // We need to be mindful of the case where we only have zeroes... + // E.g., 0.000000000...000. + const char *start = start_digits; + while ((start != pend) && (*start == '0' || *start == '.')) { + if(*start == '0') { digit_count --; } + start++; + } + if (digit_count > 19) { + answer.too_many_digits = true; + // Let us start again, this time, avoiding overflows. + i = 0; + p = start_digits; + const uint64_t minimal_nineteen_digit_integer{1000000000000000000}; + while((i < minimal_nineteen_digit_integer) && (p != pend) && is_integer(*p)) { + i = i * 10 + uint64_t(*p - '0'); + ++p; + } + if (i >= minimal_nineteen_digit_integer) { // We have a big integers + exponent = end_of_integer_part - p + exp_number; + } else { // We have a value with a fractional component. + p++; // skip the '.' + const char *first_after_period = p; + while((i < minimal_nineteen_digit_integer) && (p != pend) && is_integer(*p)) { + i = i * 10 + uint64_t(*p - '0'); + ++p; + } + exponent = first_after_period - p + exp_number; + } + // We have now corrected both exponent and i, to a truncated value + } + } + answer.exponent = exponent; + answer.mantissa = i; + return answer; +} + + +// This should always succeed since it follows a call to parse_number_string +// This function could be optimized. In particular, we could stop after 19 digits +// and try to bail out. Furthermore, we should be able to recover the computed +// exponent from the pass in parse_number_string. +fastfloat_really_inline decimal parse_decimal(const char *p, const char *pend) noexcept { + decimal answer; + answer.num_digits = 0; + answer.decimal_point = 0; + answer.truncated = false; + answer.negative = (*p == '-'); + if (*p == '-') { // C++17 20.19.3.(7.1) explicitly forbids '+' sign here + ++p; + } + // skip leading zeroes + while ((p != pend) && (*p == '0')) { + ++p; + } + while ((p != pend) && is_integer(*p)) { + if (answer.num_digits < max_digits) { + answer.digits[answer.num_digits] = uint8_t(*p - '0'); + } + answer.num_digits++; + ++p; + } + if ((p != pend) && (*p == '.')) { + ++p; + const char *first_after_period = p; + // if we have not yet encountered a zero, we have to skip it as well + if(answer.num_digits == 0) { + // skip zeros + while ((p != pend) && (*p == '0')) { + ++p; + } + } + // We expect that this loop will often take the bulk of the running time + // because when a value has lots of digits, these digits often + while ((p + 8 <= pend) && (answer.num_digits + 8 < max_digits)) { + uint64_t val = read_u64(p); + if(! is_made_of_eight_digits_fast(val)) { break; } + // We have eight digits, process them in one go! + val -= 0x3030303030303030; + write_u64(answer.digits + answer.num_digits, val); + answer.num_digits += 8; + p += 8; + } + while ((p != pend) && is_integer(*p)) { + if (answer.num_digits < max_digits) { + answer.digits[answer.num_digits] = uint8_t(*p - '0'); + } + answer.num_digits++; + ++p; + } + answer.decimal_point = int32_t(first_after_period - p); + } + // We want num_digits to be the number of significant digits, excluding + // leading *and* trailing zeros! Otherwise the truncated flag later is + // going to be misleading. + if(answer.num_digits > 0) { + // We potentially need the answer.num_digits > 0 guard because we + // prune leading zeros. So with answer.num_digits > 0, we know that + // we have at least one non-zero digit. + const char *preverse = p - 1; + int32_t trailing_zeros = 0; + while ((*preverse == '0') || (*preverse == '.')) { + if(*preverse == '0') { trailing_zeros++; }; + --preverse; + } + answer.decimal_point += int32_t(answer.num_digits); + answer.num_digits -= uint32_t(trailing_zeros); + } + if(answer.num_digits > max_digits) { + answer.truncated = true; + answer.num_digits = max_digits; + } + if ((p != pend) && (('e' == *p) || ('E' == *p))) { + ++p; + bool neg_exp = false; + if ((p != pend) && ('-' == *p)) { + neg_exp = true; + ++p; + } else if ((p != pend) && ('+' == *p)) { // '+' on exponent is allowed by C++17 20.19.3.(7.1) + ++p; + } + int32_t exp_number = 0; // exponential part + while ((p != pend) && is_integer(*p)) { + uint8_t digit = uint8_t(*p - '0'); + if (exp_number < 0x10000) { + exp_number = 10 * exp_number + digit; + } + ++p; + } + answer.decimal_point += (neg_exp ? -exp_number : exp_number); + } + // In very rare cases, we may have fewer than 19 digits, we want to be able to reliably + // assume that all digits up to max_digit_without_overflow have been initialized. + for(uint32_t i = answer.num_digits; i < max_digit_without_overflow; i++) { answer.digits[i] = 0; } + + return answer; +} +} // namespace duckdb_fast_float + +#endif + + +#ifndef FASTFLOAT_FAST_TABLE_H +#define FASTFLOAT_FAST_TABLE_H +#include + +namespace duckdb_fast_float { + +/** + * When mapping numbers from decimal to binary, + * we go from w * 10^q to m * 2^p but we have + * 10^q = 5^q * 2^q, so effectively + * we are trying to match + * w * 2^q * 5^q to m * 2^p. Thus the powers of two + * are not a concern since they can be represented + * exactly using the binary notation, only the powers of five + * affect the binary significand. + */ + +/** + * The smallest non-zero float (binary64) is 2^−1074. + * We take as input numbers of the form w x 10^q where w < 2^64. + * We have that w * 10^-343 < 2^(64-344) 5^-343 < 2^-1076. + * However, we have that + * (2^64-1) * 10^-342 = (2^64-1) * 2^-342 * 5^-342 > 2^−1074. + * Thus it is possible for a number of the form w * 10^-342 where + * w is a 64-bit value to be a non-zero floating-point number. + ********* + * Any number of form w * 10^309 where w>= 1 is going to be + * infinite in binary64 so we never need to worry about powers + * of 5 greater than 308. + */ +template +struct powers_template { + +constexpr static int smallest_power_of_five = binary_format::smallest_power_of_ten(); +constexpr static int largest_power_of_five = binary_format::largest_power_of_ten(); +constexpr static int number_of_entries = 2 * (largest_power_of_five - smallest_power_of_five + 1); +// Powers of five from 5^-342 all the way to 5^308 rounded toward one. +static const uint64_t power_of_five_128[number_of_entries]; +}; + +template +const uint64_t powers_template::power_of_five_128[number_of_entries] = { + 0xeef453d6923bd65a,0x113faa2906a13b3f, + 0x9558b4661b6565f8,0x4ac7ca59a424c507, + 0xbaaee17fa23ebf76,0x5d79bcf00d2df649, + 0xe95a99df8ace6f53,0xf4d82c2c107973dc, + 0x91d8a02bb6c10594,0x79071b9b8a4be869, + 0xb64ec836a47146f9,0x9748e2826cdee284, + 0xe3e27a444d8d98b7,0xfd1b1b2308169b25, + 0x8e6d8c6ab0787f72,0xfe30f0f5e50e20f7, + 0xb208ef855c969f4f,0xbdbd2d335e51a935, + 0xde8b2b66b3bc4723,0xad2c788035e61382, + 0x8b16fb203055ac76,0x4c3bcb5021afcc31, + 0xaddcb9e83c6b1793,0xdf4abe242a1bbf3d, + 0xd953e8624b85dd78,0xd71d6dad34a2af0d, + 0x87d4713d6f33aa6b,0x8672648c40e5ad68, + 0xa9c98d8ccb009506,0x680efdaf511f18c2, + 0xd43bf0effdc0ba48,0x212bd1b2566def2, + 0x84a57695fe98746d,0x14bb630f7604b57, + 0xa5ced43b7e3e9188,0x419ea3bd35385e2d, + 0xcf42894a5dce35ea,0x52064cac828675b9, + 0x818995ce7aa0e1b2,0x7343efebd1940993, + 0xa1ebfb4219491a1f,0x1014ebe6c5f90bf8, + 0xca66fa129f9b60a6,0xd41a26e077774ef6, + 0xfd00b897478238d0,0x8920b098955522b4, + 0x9e20735e8cb16382,0x55b46e5f5d5535b0, + 0xc5a890362fddbc62,0xeb2189f734aa831d, + 0xf712b443bbd52b7b,0xa5e9ec7501d523e4, + 0x9a6bb0aa55653b2d,0x47b233c92125366e, + 0xc1069cd4eabe89f8,0x999ec0bb696e840a, + 0xf148440a256e2c76,0xc00670ea43ca250d, + 0x96cd2a865764dbca,0x380406926a5e5728, + 0xbc807527ed3e12bc,0xc605083704f5ecf2, + 0xeba09271e88d976b,0xf7864a44c633682e, + 0x93445b8731587ea3,0x7ab3ee6afbe0211d, + 0xb8157268fdae9e4c,0x5960ea05bad82964, + 0xe61acf033d1a45df,0x6fb92487298e33bd, + 0x8fd0c16206306bab,0xa5d3b6d479f8e056, + 0xb3c4f1ba87bc8696,0x8f48a4899877186c, + 0xe0b62e2929aba83c,0x331acdabfe94de87, + 0x8c71dcd9ba0b4925,0x9ff0c08b7f1d0b14, + 0xaf8e5410288e1b6f,0x7ecf0ae5ee44dd9, + 0xdb71e91432b1a24a,0xc9e82cd9f69d6150, + 0x892731ac9faf056e,0xbe311c083a225cd2, + 0xab70fe17c79ac6ca,0x6dbd630a48aaf406, + 0xd64d3d9db981787d,0x92cbbccdad5b108, + 0x85f0468293f0eb4e,0x25bbf56008c58ea5, + 0xa76c582338ed2621,0xaf2af2b80af6f24e, + 0xd1476e2c07286faa,0x1af5af660db4aee1, + 0x82cca4db847945ca,0x50d98d9fc890ed4d, + 0xa37fce126597973c,0xe50ff107bab528a0, + 0xcc5fc196fefd7d0c,0x1e53ed49a96272c8, + 0xff77b1fcbebcdc4f,0x25e8e89c13bb0f7a, + 0x9faacf3df73609b1,0x77b191618c54e9ac, + 0xc795830d75038c1d,0xd59df5b9ef6a2417, + 0xf97ae3d0d2446f25,0x4b0573286b44ad1d, + 0x9becce62836ac577,0x4ee367f9430aec32, + 0xc2e801fb244576d5,0x229c41f793cda73f, + 0xf3a20279ed56d48a,0x6b43527578c1110f, + 0x9845418c345644d6,0x830a13896b78aaa9, + 0xbe5691ef416bd60c,0x23cc986bc656d553, + 0xedec366b11c6cb8f,0x2cbfbe86b7ec8aa8, + 0x94b3a202eb1c3f39,0x7bf7d71432f3d6a9, + 0xb9e08a83a5e34f07,0xdaf5ccd93fb0cc53, + 0xe858ad248f5c22c9,0xd1b3400f8f9cff68, + 0x91376c36d99995be,0x23100809b9c21fa1, + 0xb58547448ffffb2d,0xabd40a0c2832a78a, + 0xe2e69915b3fff9f9,0x16c90c8f323f516c, + 0x8dd01fad907ffc3b,0xae3da7d97f6792e3, + 0xb1442798f49ffb4a,0x99cd11cfdf41779c, + 0xdd95317f31c7fa1d,0x40405643d711d583, + 0x8a7d3eef7f1cfc52,0x482835ea666b2572, + 0xad1c8eab5ee43b66,0xda3243650005eecf, + 0xd863b256369d4a40,0x90bed43e40076a82, + 0x873e4f75e2224e68,0x5a7744a6e804a291, + 0xa90de3535aaae202,0x711515d0a205cb36, + 0xd3515c2831559a83,0xd5a5b44ca873e03, + 0x8412d9991ed58091,0xe858790afe9486c2, + 0xa5178fff668ae0b6,0x626e974dbe39a872, + 0xce5d73ff402d98e3,0xfb0a3d212dc8128f, + 0x80fa687f881c7f8e,0x7ce66634bc9d0b99, + 0xa139029f6a239f72,0x1c1fffc1ebc44e80, + 0xc987434744ac874e,0xa327ffb266b56220, + 0xfbe9141915d7a922,0x4bf1ff9f0062baa8, + 0x9d71ac8fada6c9b5,0x6f773fc3603db4a9, + 0xc4ce17b399107c22,0xcb550fb4384d21d3, + 0xf6019da07f549b2b,0x7e2a53a146606a48, + 0x99c102844f94e0fb,0x2eda7444cbfc426d, + 0xc0314325637a1939,0xfa911155fefb5308, + 0xf03d93eebc589f88,0x793555ab7eba27ca, + 0x96267c7535b763b5,0x4bc1558b2f3458de, + 0xbbb01b9283253ca2,0x9eb1aaedfb016f16, + 0xea9c227723ee8bcb,0x465e15a979c1cadc, + 0x92a1958a7675175f,0xbfacd89ec191ec9, + 0xb749faed14125d36,0xcef980ec671f667b, + 0xe51c79a85916f484,0x82b7e12780e7401a, + 0x8f31cc0937ae58d2,0xd1b2ecb8b0908810, + 0xb2fe3f0b8599ef07,0x861fa7e6dcb4aa15, + 0xdfbdcece67006ac9,0x67a791e093e1d49a, + 0x8bd6a141006042bd,0xe0c8bb2c5c6d24e0, + 0xaecc49914078536d,0x58fae9f773886e18, + 0xda7f5bf590966848,0xaf39a475506a899e, + 0x888f99797a5e012d,0x6d8406c952429603, + 0xaab37fd7d8f58178,0xc8e5087ba6d33b83, + 0xd5605fcdcf32e1d6,0xfb1e4a9a90880a64, + 0x855c3be0a17fcd26,0x5cf2eea09a55067f, + 0xa6b34ad8c9dfc06f,0xf42faa48c0ea481e, + 0xd0601d8efc57b08b,0xf13b94daf124da26, + 0x823c12795db6ce57,0x76c53d08d6b70858, + 0xa2cb1717b52481ed,0x54768c4b0c64ca6e, + 0xcb7ddcdda26da268,0xa9942f5dcf7dfd09, + 0xfe5d54150b090b02,0xd3f93b35435d7c4c, + 0x9efa548d26e5a6e1,0xc47bc5014a1a6daf, + 0xc6b8e9b0709f109a,0x359ab6419ca1091b, + 0xf867241c8cc6d4c0,0xc30163d203c94b62, + 0x9b407691d7fc44f8,0x79e0de63425dcf1d, + 0xc21094364dfb5636,0x985915fc12f542e4, + 0xf294b943e17a2bc4,0x3e6f5b7b17b2939d, + 0x979cf3ca6cec5b5a,0xa705992ceecf9c42, + 0xbd8430bd08277231,0x50c6ff782a838353, + 0xece53cec4a314ebd,0xa4f8bf5635246428, + 0x940f4613ae5ed136,0x871b7795e136be99, + 0xb913179899f68584,0x28e2557b59846e3f, + 0xe757dd7ec07426e5,0x331aeada2fe589cf, + 0x9096ea6f3848984f,0x3ff0d2c85def7621, + 0xb4bca50b065abe63,0xfed077a756b53a9, + 0xe1ebce4dc7f16dfb,0xd3e8495912c62894, + 0x8d3360f09cf6e4bd,0x64712dd7abbbd95c, + 0xb080392cc4349dec,0xbd8d794d96aacfb3, + 0xdca04777f541c567,0xecf0d7a0fc5583a0, + 0x89e42caaf9491b60,0xf41686c49db57244, + 0xac5d37d5b79b6239,0x311c2875c522ced5, + 0xd77485cb25823ac7,0x7d633293366b828b, + 0x86a8d39ef77164bc,0xae5dff9c02033197, + 0xa8530886b54dbdeb,0xd9f57f830283fdfc, + 0xd267caa862a12d66,0xd072df63c324fd7b, + 0x8380dea93da4bc60,0x4247cb9e59f71e6d, + 0xa46116538d0deb78,0x52d9be85f074e608, + 0xcd795be870516656,0x67902e276c921f8b, + 0x806bd9714632dff6,0xba1cd8a3db53b6, + 0xa086cfcd97bf97f3,0x80e8a40eccd228a4, + 0xc8a883c0fdaf7df0,0x6122cd128006b2cd, + 0xfad2a4b13d1b5d6c,0x796b805720085f81, + 0x9cc3a6eec6311a63,0xcbe3303674053bb0, + 0xc3f490aa77bd60fc,0xbedbfc4411068a9c, + 0xf4f1b4d515acb93b,0xee92fb5515482d44, + 0x991711052d8bf3c5,0x751bdd152d4d1c4a, + 0xbf5cd54678eef0b6,0xd262d45a78a0635d, + 0xef340a98172aace4,0x86fb897116c87c34, + 0x9580869f0e7aac0e,0xd45d35e6ae3d4da0, + 0xbae0a846d2195712,0x8974836059cca109, + 0xe998d258869facd7,0x2bd1a438703fc94b, + 0x91ff83775423cc06,0x7b6306a34627ddcf, + 0xb67f6455292cbf08,0x1a3bc84c17b1d542, + 0xe41f3d6a7377eeca,0x20caba5f1d9e4a93, + 0x8e938662882af53e,0x547eb47b7282ee9c, + 0xb23867fb2a35b28d,0xe99e619a4f23aa43, + 0xdec681f9f4c31f31,0x6405fa00e2ec94d4, + 0x8b3c113c38f9f37e,0xde83bc408dd3dd04, + 0xae0b158b4738705e,0x9624ab50b148d445, + 0xd98ddaee19068c76,0x3badd624dd9b0957, + 0x87f8a8d4cfa417c9,0xe54ca5d70a80e5d6, + 0xa9f6d30a038d1dbc,0x5e9fcf4ccd211f4c, + 0xd47487cc8470652b,0x7647c3200069671f, + 0x84c8d4dfd2c63f3b,0x29ecd9f40041e073, + 0xa5fb0a17c777cf09,0xf468107100525890, + 0xcf79cc9db955c2cc,0x7182148d4066eeb4, + 0x81ac1fe293d599bf,0xc6f14cd848405530, + 0xa21727db38cb002f,0xb8ada00e5a506a7c, + 0xca9cf1d206fdc03b,0xa6d90811f0e4851c, + 0xfd442e4688bd304a,0x908f4a166d1da663, + 0x9e4a9cec15763e2e,0x9a598e4e043287fe, + 0xc5dd44271ad3cdba,0x40eff1e1853f29fd, + 0xf7549530e188c128,0xd12bee59e68ef47c, + 0x9a94dd3e8cf578b9,0x82bb74f8301958ce, + 0xc13a148e3032d6e7,0xe36a52363c1faf01, + 0xf18899b1bc3f8ca1,0xdc44e6c3cb279ac1, + 0x96f5600f15a7b7e5,0x29ab103a5ef8c0b9, + 0xbcb2b812db11a5de,0x7415d448f6b6f0e7, + 0xebdf661791d60f56,0x111b495b3464ad21, + 0x936b9fcebb25c995,0xcab10dd900beec34, + 0xb84687c269ef3bfb,0x3d5d514f40eea742, + 0xe65829b3046b0afa,0xcb4a5a3112a5112, + 0x8ff71a0fe2c2e6dc,0x47f0e785eaba72ab, + 0xb3f4e093db73a093,0x59ed216765690f56, + 0xe0f218b8d25088b8,0x306869c13ec3532c, + 0x8c974f7383725573,0x1e414218c73a13fb, + 0xafbd2350644eeacf,0xe5d1929ef90898fa, + 0xdbac6c247d62a583,0xdf45f746b74abf39, + 0x894bc396ce5da772,0x6b8bba8c328eb783, + 0xab9eb47c81f5114f,0x66ea92f3f326564, + 0xd686619ba27255a2,0xc80a537b0efefebd, + 0x8613fd0145877585,0xbd06742ce95f5f36, + 0xa798fc4196e952e7,0x2c48113823b73704, + 0xd17f3b51fca3a7a0,0xf75a15862ca504c5, + 0x82ef85133de648c4,0x9a984d73dbe722fb, + 0xa3ab66580d5fdaf5,0xc13e60d0d2e0ebba, + 0xcc963fee10b7d1b3,0x318df905079926a8, + 0xffbbcfe994e5c61f,0xfdf17746497f7052, + 0x9fd561f1fd0f9bd3,0xfeb6ea8bedefa633, + 0xc7caba6e7c5382c8,0xfe64a52ee96b8fc0, + 0xf9bd690a1b68637b,0x3dfdce7aa3c673b0, + 0x9c1661a651213e2d,0x6bea10ca65c084e, + 0xc31bfa0fe5698db8,0x486e494fcff30a62, + 0xf3e2f893dec3f126,0x5a89dba3c3efccfa, + 0x986ddb5c6b3a76b7,0xf89629465a75e01c, + 0xbe89523386091465,0xf6bbb397f1135823, + 0xee2ba6c0678b597f,0x746aa07ded582e2c, + 0x94db483840b717ef,0xa8c2a44eb4571cdc, + 0xba121a4650e4ddeb,0x92f34d62616ce413, + 0xe896a0d7e51e1566,0x77b020baf9c81d17, + 0x915e2486ef32cd60,0xace1474dc1d122e, + 0xb5b5ada8aaff80b8,0xd819992132456ba, + 0xe3231912d5bf60e6,0x10e1fff697ed6c69, + 0x8df5efabc5979c8f,0xca8d3ffa1ef463c1, + 0xb1736b96b6fd83b3,0xbd308ff8a6b17cb2, + 0xddd0467c64bce4a0,0xac7cb3f6d05ddbde, + 0x8aa22c0dbef60ee4,0x6bcdf07a423aa96b, + 0xad4ab7112eb3929d,0x86c16c98d2c953c6, + 0xd89d64d57a607744,0xe871c7bf077ba8b7, + 0x87625f056c7c4a8b,0x11471cd764ad4972, + 0xa93af6c6c79b5d2d,0xd598e40d3dd89bcf, + 0xd389b47879823479,0x4aff1d108d4ec2c3, + 0x843610cb4bf160cb,0xcedf722a585139ba, + 0xa54394fe1eedb8fe,0xc2974eb4ee658828, + 0xce947a3da6a9273e,0x733d226229feea32, + 0x811ccc668829b887,0x806357d5a3f525f, + 0xa163ff802a3426a8,0xca07c2dcb0cf26f7, + 0xc9bcff6034c13052,0xfc89b393dd02f0b5, + 0xfc2c3f3841f17c67,0xbbac2078d443ace2, + 0x9d9ba7832936edc0,0xd54b944b84aa4c0d, + 0xc5029163f384a931,0xa9e795e65d4df11, + 0xf64335bcf065d37d,0x4d4617b5ff4a16d5, + 0x99ea0196163fa42e,0x504bced1bf8e4e45, + 0xc06481fb9bcf8d39,0xe45ec2862f71e1d6, + 0xf07da27a82c37088,0x5d767327bb4e5a4c, + 0x964e858c91ba2655,0x3a6a07f8d510f86f, + 0xbbe226efb628afea,0x890489f70a55368b, + 0xeadab0aba3b2dbe5,0x2b45ac74ccea842e, + 0x92c8ae6b464fc96f,0x3b0b8bc90012929d, + 0xb77ada0617e3bbcb,0x9ce6ebb40173744, + 0xe55990879ddcaabd,0xcc420a6a101d0515, + 0x8f57fa54c2a9eab6,0x9fa946824a12232d, + 0xb32df8e9f3546564,0x47939822dc96abf9, + 0xdff9772470297ebd,0x59787e2b93bc56f7, + 0x8bfbea76c619ef36,0x57eb4edb3c55b65a, + 0xaefae51477a06b03,0xede622920b6b23f1, + 0xdab99e59958885c4,0xe95fab368e45eced, + 0x88b402f7fd75539b,0x11dbcb0218ebb414, + 0xaae103b5fcd2a881,0xd652bdc29f26a119, + 0xd59944a37c0752a2,0x4be76d3346f0495f, + 0x857fcae62d8493a5,0x6f70a4400c562ddb, + 0xa6dfbd9fb8e5b88e,0xcb4ccd500f6bb952, + 0xd097ad07a71f26b2,0x7e2000a41346a7a7, + 0x825ecc24c873782f,0x8ed400668c0c28c8, + 0xa2f67f2dfa90563b,0x728900802f0f32fa, + 0xcbb41ef979346bca,0x4f2b40a03ad2ffb9, + 0xfea126b7d78186bc,0xe2f610c84987bfa8, + 0x9f24b832e6b0f436,0xdd9ca7d2df4d7c9, + 0xc6ede63fa05d3143,0x91503d1c79720dbb, + 0xf8a95fcf88747d94,0x75a44c6397ce912a, + 0x9b69dbe1b548ce7c,0xc986afbe3ee11aba, + 0xc24452da229b021b,0xfbe85badce996168, + 0xf2d56790ab41c2a2,0xfae27299423fb9c3, + 0x97c560ba6b0919a5,0xdccd879fc967d41a, + 0xbdb6b8e905cb600f,0x5400e987bbc1c920, + 0xed246723473e3813,0x290123e9aab23b68, + 0x9436c0760c86e30b,0xf9a0b6720aaf6521, + 0xb94470938fa89bce,0xf808e40e8d5b3e69, + 0xe7958cb87392c2c2,0xb60b1d1230b20e04, + 0x90bd77f3483bb9b9,0xb1c6f22b5e6f48c2, + 0xb4ecd5f01a4aa828,0x1e38aeb6360b1af3, + 0xe2280b6c20dd5232,0x25c6da63c38de1b0, + 0x8d590723948a535f,0x579c487e5a38ad0e, + 0xb0af48ec79ace837,0x2d835a9df0c6d851, + 0xdcdb1b2798182244,0xf8e431456cf88e65, + 0x8a08f0f8bf0f156b,0x1b8e9ecb641b58ff, + 0xac8b2d36eed2dac5,0xe272467e3d222f3f, + 0xd7adf884aa879177,0x5b0ed81dcc6abb0f, + 0x86ccbb52ea94baea,0x98e947129fc2b4e9, + 0xa87fea27a539e9a5,0x3f2398d747b36224, + 0xd29fe4b18e88640e,0x8eec7f0d19a03aad, + 0x83a3eeeef9153e89,0x1953cf68300424ac, + 0xa48ceaaab75a8e2b,0x5fa8c3423c052dd7, + 0xcdb02555653131b6,0x3792f412cb06794d, + 0x808e17555f3ebf11,0xe2bbd88bbee40bd0, + 0xa0b19d2ab70e6ed6,0x5b6aceaeae9d0ec4, + 0xc8de047564d20a8b,0xf245825a5a445275, + 0xfb158592be068d2e,0xeed6e2f0f0d56712, + 0x9ced737bb6c4183d,0x55464dd69685606b, + 0xc428d05aa4751e4c,0xaa97e14c3c26b886, + 0xf53304714d9265df,0xd53dd99f4b3066a8, + 0x993fe2c6d07b7fab,0xe546a8038efe4029, + 0xbf8fdb78849a5f96,0xde98520472bdd033, + 0xef73d256a5c0f77c,0x963e66858f6d4440, + 0x95a8637627989aad,0xdde7001379a44aa8, + 0xbb127c53b17ec159,0x5560c018580d5d52, + 0xe9d71b689dde71af,0xaab8f01e6e10b4a6, + 0x9226712162ab070d,0xcab3961304ca70e8, + 0xb6b00d69bb55c8d1,0x3d607b97c5fd0d22, + 0xe45c10c42a2b3b05,0x8cb89a7db77c506a, + 0x8eb98a7a9a5b04e3,0x77f3608e92adb242, + 0xb267ed1940f1c61c,0x55f038b237591ed3, + 0xdf01e85f912e37a3,0x6b6c46dec52f6688, + 0x8b61313bbabce2c6,0x2323ac4b3b3da015, + 0xae397d8aa96c1b77,0xabec975e0a0d081a, + 0xd9c7dced53c72255,0x96e7bd358c904a21, + 0x881cea14545c7575,0x7e50d64177da2e54, + 0xaa242499697392d2,0xdde50bd1d5d0b9e9, + 0xd4ad2dbfc3d07787,0x955e4ec64b44e864, + 0x84ec3c97da624ab4,0xbd5af13bef0b113e, + 0xa6274bbdd0fadd61,0xecb1ad8aeacdd58e, + 0xcfb11ead453994ba,0x67de18eda5814af2, + 0x81ceb32c4b43fcf4,0x80eacf948770ced7, + 0xa2425ff75e14fc31,0xa1258379a94d028d, + 0xcad2f7f5359a3b3e,0x96ee45813a04330, + 0xfd87b5f28300ca0d,0x8bca9d6e188853fc, + 0x9e74d1b791e07e48,0x775ea264cf55347e, + 0xc612062576589dda,0x95364afe032a819e, + 0xf79687aed3eec551,0x3a83ddbd83f52205, + 0x9abe14cd44753b52,0xc4926a9672793543, + 0xc16d9a0095928a27,0x75b7053c0f178294, + 0xf1c90080baf72cb1,0x5324c68b12dd6339, + 0x971da05074da7bee,0xd3f6fc16ebca5e04, + 0xbce5086492111aea,0x88f4bb1ca6bcf585, + 0xec1e4a7db69561a5,0x2b31e9e3d06c32e6, + 0x9392ee8e921d5d07,0x3aff322e62439fd0, + 0xb877aa3236a4b449,0x9befeb9fad487c3, + 0xe69594bec44de15b,0x4c2ebe687989a9b4, + 0x901d7cf73ab0acd9,0xf9d37014bf60a11, + 0xb424dc35095cd80f,0x538484c19ef38c95, + 0xe12e13424bb40e13,0x2865a5f206b06fba, + 0x8cbccc096f5088cb,0xf93f87b7442e45d4, + 0xafebff0bcb24aafe,0xf78f69a51539d749, + 0xdbe6fecebdedd5be,0xb573440e5a884d1c, + 0x89705f4136b4a597,0x31680a88f8953031, + 0xabcc77118461cefc,0xfdc20d2b36ba7c3e, + 0xd6bf94d5e57a42bc,0x3d32907604691b4d, + 0x8637bd05af6c69b5,0xa63f9a49c2c1b110, + 0xa7c5ac471b478423,0xfcf80dc33721d54, + 0xd1b71758e219652b,0xd3c36113404ea4a9, + 0x83126e978d4fdf3b,0x645a1cac083126ea, + 0xa3d70a3d70a3d70a,0x3d70a3d70a3d70a4, + 0xcccccccccccccccc,0xcccccccccccccccd, + 0x8000000000000000,0x0, + 0xa000000000000000,0x0, + 0xc800000000000000,0x0, + 0xfa00000000000000,0x0, + 0x9c40000000000000,0x0, + 0xc350000000000000,0x0, + 0xf424000000000000,0x0, + 0x9896800000000000,0x0, + 0xbebc200000000000,0x0, + 0xee6b280000000000,0x0, + 0x9502f90000000000,0x0, + 0xba43b74000000000,0x0, + 0xe8d4a51000000000,0x0, + 0x9184e72a00000000,0x0, + 0xb5e620f480000000,0x0, + 0xe35fa931a0000000,0x0, + 0x8e1bc9bf04000000,0x0, + 0xb1a2bc2ec5000000,0x0, + 0xde0b6b3a76400000,0x0, + 0x8ac7230489e80000,0x0, + 0xad78ebc5ac620000,0x0, + 0xd8d726b7177a8000,0x0, + 0x878678326eac9000,0x0, + 0xa968163f0a57b400,0x0, + 0xd3c21bcecceda100,0x0, + 0x84595161401484a0,0x0, + 0xa56fa5b99019a5c8,0x0, + 0xcecb8f27f4200f3a,0x0, + 0x813f3978f8940984,0x4000000000000000, + 0xa18f07d736b90be5,0x5000000000000000, + 0xc9f2c9cd04674ede,0xa400000000000000, + 0xfc6f7c4045812296,0x4d00000000000000, + 0x9dc5ada82b70b59d,0xf020000000000000, + 0xc5371912364ce305,0x6c28000000000000, + 0xf684df56c3e01bc6,0xc732000000000000, + 0x9a130b963a6c115c,0x3c7f400000000000, + 0xc097ce7bc90715b3,0x4b9f100000000000, + 0xf0bdc21abb48db20,0x1e86d40000000000, + 0x96769950b50d88f4,0x1314448000000000, + 0xbc143fa4e250eb31,0x17d955a000000000, + 0xeb194f8e1ae525fd,0x5dcfab0800000000, + 0x92efd1b8d0cf37be,0x5aa1cae500000000, + 0xb7abc627050305ad,0xf14a3d9e40000000, + 0xe596b7b0c643c719,0x6d9ccd05d0000000, + 0x8f7e32ce7bea5c6f,0xe4820023a2000000, + 0xb35dbf821ae4f38b,0xdda2802c8a800000, + 0xe0352f62a19e306e,0xd50b2037ad200000, + 0x8c213d9da502de45,0x4526f422cc340000, + 0xaf298d050e4395d6,0x9670b12b7f410000, + 0xdaf3f04651d47b4c,0x3c0cdd765f114000, + 0x88d8762bf324cd0f,0xa5880a69fb6ac800, + 0xab0e93b6efee0053,0x8eea0d047a457a00, + 0xd5d238a4abe98068,0x72a4904598d6d880, + 0x85a36366eb71f041,0x47a6da2b7f864750, + 0xa70c3c40a64e6c51,0x999090b65f67d924, + 0xd0cf4b50cfe20765,0xfff4b4e3f741cf6d, + 0x82818f1281ed449f,0xbff8f10e7a8921a4, + 0xa321f2d7226895c7,0xaff72d52192b6a0d, + 0xcbea6f8ceb02bb39,0x9bf4f8a69f764490, + 0xfee50b7025c36a08,0x2f236d04753d5b4, + 0x9f4f2726179a2245,0x1d762422c946590, + 0xc722f0ef9d80aad6,0x424d3ad2b7b97ef5, + 0xf8ebad2b84e0d58b,0xd2e0898765a7deb2, + 0x9b934c3b330c8577,0x63cc55f49f88eb2f, + 0xc2781f49ffcfa6d5,0x3cbf6b71c76b25fb, + 0xf316271c7fc3908a,0x8bef464e3945ef7a, + 0x97edd871cfda3a56,0x97758bf0e3cbb5ac, + 0xbde94e8e43d0c8ec,0x3d52eeed1cbea317, + 0xed63a231d4c4fb27,0x4ca7aaa863ee4bdd, + 0x945e455f24fb1cf8,0x8fe8caa93e74ef6a, + 0xb975d6b6ee39e436,0xb3e2fd538e122b44, + 0xe7d34c64a9c85d44,0x60dbbca87196b616, + 0x90e40fbeea1d3a4a,0xbc8955e946fe31cd, + 0xb51d13aea4a488dd,0x6babab6398bdbe41, + 0xe264589a4dcdab14,0xc696963c7eed2dd1, + 0x8d7eb76070a08aec,0xfc1e1de5cf543ca2, + 0xb0de65388cc8ada8,0x3b25a55f43294bcb, + 0xdd15fe86affad912,0x49ef0eb713f39ebe, + 0x8a2dbf142dfcc7ab,0x6e3569326c784337, + 0xacb92ed9397bf996,0x49c2c37f07965404, + 0xd7e77a8f87daf7fb,0xdc33745ec97be906, + 0x86f0ac99b4e8dafd,0x69a028bb3ded71a3, + 0xa8acd7c0222311bc,0xc40832ea0d68ce0c, + 0xd2d80db02aabd62b,0xf50a3fa490c30190, + 0x83c7088e1aab65db,0x792667c6da79e0fa, + 0xa4b8cab1a1563f52,0x577001b891185938, + 0xcde6fd5e09abcf26,0xed4c0226b55e6f86, + 0x80b05e5ac60b6178,0x544f8158315b05b4, + 0xa0dc75f1778e39d6,0x696361ae3db1c721, + 0xc913936dd571c84c,0x3bc3a19cd1e38e9, + 0xfb5878494ace3a5f,0x4ab48a04065c723, + 0x9d174b2dcec0e47b,0x62eb0d64283f9c76, + 0xc45d1df942711d9a,0x3ba5d0bd324f8394, + 0xf5746577930d6500,0xca8f44ec7ee36479, + 0x9968bf6abbe85f20,0x7e998b13cf4e1ecb, + 0xbfc2ef456ae276e8,0x9e3fedd8c321a67e, + 0xefb3ab16c59b14a2,0xc5cfe94ef3ea101e, + 0x95d04aee3b80ece5,0xbba1f1d158724a12, + 0xbb445da9ca61281f,0x2a8a6e45ae8edc97, + 0xea1575143cf97226,0xf52d09d71a3293bd, + 0x924d692ca61be758,0x593c2626705f9c56, + 0xb6e0c377cfa2e12e,0x6f8b2fb00c77836c, + 0xe498f455c38b997a,0xb6dfb9c0f956447, + 0x8edf98b59a373fec,0x4724bd4189bd5eac, + 0xb2977ee300c50fe7,0x58edec91ec2cb657, + 0xdf3d5e9bc0f653e1,0x2f2967b66737e3ed, + 0x8b865b215899f46c,0xbd79e0d20082ee74, + 0xae67f1e9aec07187,0xecd8590680a3aa11, + 0xda01ee641a708de9,0xe80e6f4820cc9495, + 0x884134fe908658b2,0x3109058d147fdcdd, + 0xaa51823e34a7eede,0xbd4b46f0599fd415, + 0xd4e5e2cdc1d1ea96,0x6c9e18ac7007c91a, + 0x850fadc09923329e,0x3e2cf6bc604ddb0, + 0xa6539930bf6bff45,0x84db8346b786151c, + 0xcfe87f7cef46ff16,0xe612641865679a63, + 0x81f14fae158c5f6e,0x4fcb7e8f3f60c07e, + 0xa26da3999aef7749,0xe3be5e330f38f09d, + 0xcb090c8001ab551c,0x5cadf5bfd3072cc5, + 0xfdcb4fa002162a63,0x73d9732fc7c8f7f6, + 0x9e9f11c4014dda7e,0x2867e7fddcdd9afa, + 0xc646d63501a1511d,0xb281e1fd541501b8, + 0xf7d88bc24209a565,0x1f225a7ca91a4226, + 0x9ae757596946075f,0x3375788de9b06958, + 0xc1a12d2fc3978937,0x52d6b1641c83ae, + 0xf209787bb47d6b84,0xc0678c5dbd23a49a, + 0x9745eb4d50ce6332,0xf840b7ba963646e0, + 0xbd176620a501fbff,0xb650e5a93bc3d898, + 0xec5d3fa8ce427aff,0xa3e51f138ab4cebe, + 0x93ba47c980e98cdf,0xc66f336c36b10137, + 0xb8a8d9bbe123f017,0xb80b0047445d4184, + 0xe6d3102ad96cec1d,0xa60dc059157491e5, + 0x9043ea1ac7e41392,0x87c89837ad68db2f, + 0xb454e4a179dd1877,0x29babe4598c311fb, + 0xe16a1dc9d8545e94,0xf4296dd6fef3d67a, + 0x8ce2529e2734bb1d,0x1899e4a65f58660c, + 0xb01ae745b101e9e4,0x5ec05dcff72e7f8f, + 0xdc21a1171d42645d,0x76707543f4fa1f73, + 0x899504ae72497eba,0x6a06494a791c53a8, + 0xabfa45da0edbde69,0x487db9d17636892, + 0xd6f8d7509292d603,0x45a9d2845d3c42b6, + 0x865b86925b9bc5c2,0xb8a2392ba45a9b2, + 0xa7f26836f282b732,0x8e6cac7768d7141e, + 0xd1ef0244af2364ff,0x3207d795430cd926, + 0x8335616aed761f1f,0x7f44e6bd49e807b8, + 0xa402b9c5a8d3a6e7,0x5f16206c9c6209a6, + 0xcd036837130890a1,0x36dba887c37a8c0f, + 0x802221226be55a64,0xc2494954da2c9789, + 0xa02aa96b06deb0fd,0xf2db9baa10b7bd6c, + 0xc83553c5c8965d3d,0x6f92829494e5acc7, + 0xfa42a8b73abbf48c,0xcb772339ba1f17f9, + 0x9c69a97284b578d7,0xff2a760414536efb, + 0xc38413cf25e2d70d,0xfef5138519684aba, + 0xf46518c2ef5b8cd1,0x7eb258665fc25d69, + 0x98bf2f79d5993802,0xef2f773ffbd97a61, + 0xbeeefb584aff8603,0xaafb550ffacfd8fa, + 0xeeaaba2e5dbf6784,0x95ba2a53f983cf38, + 0x952ab45cfa97a0b2,0xdd945a747bf26183, + 0xba756174393d88df,0x94f971119aeef9e4, + 0xe912b9d1478ceb17,0x7a37cd5601aab85d, + 0x91abb422ccb812ee,0xac62e055c10ab33a, + 0xb616a12b7fe617aa,0x577b986b314d6009, + 0xe39c49765fdf9d94,0xed5a7e85fda0b80b, + 0x8e41ade9fbebc27d,0x14588f13be847307, + 0xb1d219647ae6b31c,0x596eb2d8ae258fc8, + 0xde469fbd99a05fe3,0x6fca5f8ed9aef3bb, + 0x8aec23d680043bee,0x25de7bb9480d5854, + 0xada72ccc20054ae9,0xaf561aa79a10ae6a, + 0xd910f7ff28069da4,0x1b2ba1518094da04, + 0x87aa9aff79042286,0x90fb44d2f05d0842, + 0xa99541bf57452b28,0x353a1607ac744a53, + 0xd3fa922f2d1675f2,0x42889b8997915ce8, + 0x847c9b5d7c2e09b7,0x69956135febada11, + 0xa59bc234db398c25,0x43fab9837e699095, + 0xcf02b2c21207ef2e,0x94f967e45e03f4bb, + 0x8161afb94b44f57d,0x1d1be0eebac278f5, + 0xa1ba1ba79e1632dc,0x6462d92a69731732, + 0xca28a291859bbf93,0x7d7b8f7503cfdcfe, + 0xfcb2cb35e702af78,0x5cda735244c3d43e, + 0x9defbf01b061adab,0x3a0888136afa64a7, + 0xc56baec21c7a1916,0x88aaa1845b8fdd0, + 0xf6c69a72a3989f5b,0x8aad549e57273d45, + 0x9a3c2087a63f6399,0x36ac54e2f678864b, + 0xc0cb28a98fcf3c7f,0x84576a1bb416a7dd, + 0xf0fdf2d3f3c30b9f,0x656d44a2a11c51d5, + 0x969eb7c47859e743,0x9f644ae5a4b1b325, + 0xbc4665b596706114,0x873d5d9f0dde1fee, + 0xeb57ff22fc0c7959,0xa90cb506d155a7ea, + 0x9316ff75dd87cbd8,0x9a7f12442d588f2, + 0xb7dcbf5354e9bece,0xc11ed6d538aeb2f, + 0xe5d3ef282a242e81,0x8f1668c8a86da5fa, + 0x8fa475791a569d10,0xf96e017d694487bc, + 0xb38d92d760ec4455,0x37c981dcc395a9ac, + 0xe070f78d3927556a,0x85bbe253f47b1417, + 0x8c469ab843b89562,0x93956d7478ccec8e, + 0xaf58416654a6babb,0x387ac8d1970027b2, + 0xdb2e51bfe9d0696a,0x6997b05fcc0319e, + 0x88fcf317f22241e2,0x441fece3bdf81f03, + 0xab3c2fddeeaad25a,0xd527e81cad7626c3, + 0xd60b3bd56a5586f1,0x8a71e223d8d3b074, + 0x85c7056562757456,0xf6872d5667844e49, + 0xa738c6bebb12d16c,0xb428f8ac016561db, + 0xd106f86e69d785c7,0xe13336d701beba52, + 0x82a45b450226b39c,0xecc0024661173473, + 0xa34d721642b06084,0x27f002d7f95d0190, + 0xcc20ce9bd35c78a5,0x31ec038df7b441f4, + 0xff290242c83396ce,0x7e67047175a15271, + 0x9f79a169bd203e41,0xf0062c6e984d386, + 0xc75809c42c684dd1,0x52c07b78a3e60868, + 0xf92e0c3537826145,0xa7709a56ccdf8a82, + 0x9bbcc7a142b17ccb,0x88a66076400bb691, + 0xc2abf989935ddbfe,0x6acff893d00ea435, + 0xf356f7ebf83552fe,0x583f6b8c4124d43, + 0x98165af37b2153de,0xc3727a337a8b704a, + 0xbe1bf1b059e9a8d6,0x744f18c0592e4c5c, + 0xeda2ee1c7064130c,0x1162def06f79df73, + 0x9485d4d1c63e8be7,0x8addcb5645ac2ba8, + 0xb9a74a0637ce2ee1,0x6d953e2bd7173692, + 0xe8111c87c5c1ba99,0xc8fa8db6ccdd0437, + 0x910ab1d4db9914a0,0x1d9c9892400a22a2, + 0xb54d5e4a127f59c8,0x2503beb6d00cab4b, + 0xe2a0b5dc971f303a,0x2e44ae64840fd61d, + 0x8da471a9de737e24,0x5ceaecfed289e5d2, + 0xb10d8e1456105dad,0x7425a83e872c5f47, + 0xdd50f1996b947518,0xd12f124e28f77719, + 0x8a5296ffe33cc92f,0x82bd6b70d99aaa6f, + 0xace73cbfdc0bfb7b,0x636cc64d1001550b, + 0xd8210befd30efa5a,0x3c47f7e05401aa4e, + 0x8714a775e3e95c78,0x65acfaec34810a71, + 0xa8d9d1535ce3b396,0x7f1839a741a14d0d, + 0xd31045a8341ca07c,0x1ede48111209a050, + 0x83ea2b892091e44d,0x934aed0aab460432, + 0xa4e4b66b68b65d60,0xf81da84d5617853f, + 0xce1de40642e3f4b9,0x36251260ab9d668e, + 0x80d2ae83e9ce78f3,0xc1d72b7c6b426019, + 0xa1075a24e4421730,0xb24cf65b8612f81f, + 0xc94930ae1d529cfc,0xdee033f26797b627, + 0xfb9b7cd9a4a7443c,0x169840ef017da3b1, + 0x9d412e0806e88aa5,0x8e1f289560ee864e, + 0xc491798a08a2ad4e,0xf1a6f2bab92a27e2, + 0xf5b5d7ec8acb58a2,0xae10af696774b1db, + 0x9991a6f3d6bf1765,0xacca6da1e0a8ef29, + 0xbff610b0cc6edd3f,0x17fd090a58d32af3, + 0xeff394dcff8a948e,0xddfc4b4cef07f5b0, + 0x95f83d0a1fb69cd9,0x4abdaf101564f98e, + 0xbb764c4ca7a4440f,0x9d6d1ad41abe37f1, + 0xea53df5fd18d5513,0x84c86189216dc5ed, + 0x92746b9be2f8552c,0x32fd3cf5b4e49bb4, + 0xb7118682dbb66a77,0x3fbc8c33221dc2a1, + 0xe4d5e82392a40515,0xfabaf3feaa5334a, + 0x8f05b1163ba6832d,0x29cb4d87f2a7400e, + 0xb2c71d5bca9023f8,0x743e20e9ef511012, + 0xdf78e4b2bd342cf6,0x914da9246b255416, + 0x8bab8eefb6409c1a,0x1ad089b6c2f7548e, + 0xae9672aba3d0c320,0xa184ac2473b529b1, + 0xda3c0f568cc4f3e8,0xc9e5d72d90a2741e, + 0x8865899617fb1871,0x7e2fa67c7a658892, + 0xaa7eebfb9df9de8d,0xddbb901b98feeab7, + 0xd51ea6fa85785631,0x552a74227f3ea565, + 0x8533285c936b35de,0xd53a88958f87275f, + 0xa67ff273b8460356,0x8a892abaf368f137, + 0xd01fef10a657842c,0x2d2b7569b0432d85, + 0x8213f56a67f6b29b,0x9c3b29620e29fc73, + 0xa298f2c501f45f42,0x8349f3ba91b47b8f, + 0xcb3f2f7642717713,0x241c70a936219a73, + 0xfe0efb53d30dd4d7,0xed238cd383aa0110, + 0x9ec95d1463e8a506,0xf4363804324a40aa, + 0xc67bb4597ce2ce48,0xb143c6053edcd0d5, + 0xf81aa16fdc1b81da,0xdd94b7868e94050a, + 0x9b10a4e5e9913128,0xca7cf2b4191c8326, + 0xc1d4ce1f63f57d72,0xfd1c2f611f63a3f0, + 0xf24a01a73cf2dccf,0xbc633b39673c8cec, + 0x976e41088617ca01,0xd5be0503e085d813, + 0xbd49d14aa79dbc82,0x4b2d8644d8a74e18, + 0xec9c459d51852ba2,0xddf8e7d60ed1219e, + 0x93e1ab8252f33b45,0xcabb90e5c942b503, + 0xb8da1662e7b00a17,0x3d6a751f3b936243, + 0xe7109bfba19c0c9d,0xcc512670a783ad4, + 0x906a617d450187e2,0x27fb2b80668b24c5, + 0xb484f9dc9641e9da,0xb1f9f660802dedf6, + 0xe1a63853bbd26451,0x5e7873f8a0396973, + 0x8d07e33455637eb2,0xdb0b487b6423e1e8, + 0xb049dc016abc5e5f,0x91ce1a9a3d2cda62, + 0xdc5c5301c56b75f7,0x7641a140cc7810fb, + 0x89b9b3e11b6329ba,0xa9e904c87fcb0a9d, + 0xac2820d9623bf429,0x546345fa9fbdcd44, + 0xd732290fbacaf133,0xa97c177947ad4095, + 0x867f59a9d4bed6c0,0x49ed8eabcccc485d, + 0xa81f301449ee8c70,0x5c68f256bfff5a74, + 0xd226fc195c6a2f8c,0x73832eec6fff3111, + 0x83585d8fd9c25db7,0xc831fd53c5ff7eab, + 0xa42e74f3d032f525,0xba3e7ca8b77f5e55, + 0xcd3a1230c43fb26f,0x28ce1bd2e55f35eb, + 0x80444b5e7aa7cf85,0x7980d163cf5b81b3, + 0xa0555e361951c366,0xd7e105bcc332621f, + 0xc86ab5c39fa63440,0x8dd9472bf3fefaa7, + 0xfa856334878fc150,0xb14f98f6f0feb951, + 0x9c935e00d4b9d8d2,0x6ed1bf9a569f33d3, + 0xc3b8358109e84f07,0xa862f80ec4700c8, + 0xf4a642e14c6262c8,0xcd27bb612758c0fa, + 0x98e7e9cccfbd7dbd,0x8038d51cb897789c, + 0xbf21e44003acdd2c,0xe0470a63e6bd56c3, + 0xeeea5d5004981478,0x1858ccfce06cac74, + 0x95527a5202df0ccb,0xf37801e0c43ebc8, + 0xbaa718e68396cffd,0xd30560258f54e6ba, + 0xe950df20247c83fd,0x47c6b82ef32a2069, + 0x91d28b7416cdd27e,0x4cdc331d57fa5441, + 0xb6472e511c81471d,0xe0133fe4adf8e952, + 0xe3d8f9e563a198e5,0x58180fddd97723a6, + 0x8e679c2f5e44ff8f,0x570f09eaa7ea7648,}; +using powers = powers_template<>; + +} + +#endif + +#ifndef FASTFLOAT_DECIMAL_TO_BINARY_H +#define FASTFLOAT_DECIMAL_TO_BINARY_H + +#include +#include +#include +#include +#include +#include +#include + +namespace duckdb_fast_float { + +// This will compute or rather approximate w * 5**q and return a pair of 64-bit words approximating +// the result, with the "high" part corresponding to the most significant bits and the +// low part corresponding to the least significant bits. +// +template +fastfloat_really_inline +value128 compute_product_approximation(int64_t q, uint64_t w) { + const int index = 2 * int(q - powers::smallest_power_of_five); + // For small values of q, e.g., q in [0,27], the answer is always exact because + // The line value128 firstproduct = full_multiplication(w, power_of_five_128[index]); + // gives the exact answer. + value128 firstproduct = full_multiplication(w, powers::power_of_five_128[index]); + static_assert((bit_precision >= 0) && (bit_precision <= 64), " precision should be in (0,64]"); + constexpr uint64_t precision_mask = (bit_precision < 64) ? + (uint64_t(0xFFFFFFFFFFFFFFFF) >> bit_precision) + : uint64_t(0xFFFFFFFFFFFFFFFF); + if((firstproduct.high & precision_mask) == precision_mask) { // could further guard with (lower + w < lower) + // regarding the second product, we only need secondproduct.high, but our expectation is that the compiler will optimize this extra work away if needed. + value128 secondproduct = full_multiplication(w, powers::power_of_five_128[index + 1]); + firstproduct.low += secondproduct.high; + if(secondproduct.high > firstproduct.low) { + firstproduct.high++; + } + } + return firstproduct; +} + +namespace detail { +/** + * For q in (0,350), we have that + * f = (((152170 + 65536) * q ) >> 16); + * is equal to + * floor(p) + q + * where + * p = log(5**q)/log(2) = q * log(5)/log(2) + * + * For negative values of q in (-400,0), we have that + * f = (((152170 + 65536) * q ) >> 16); + * is equal to + * -ceil(p) + q + * where + * p = log(5**-q)/log(2) = -q * log(5)/log(2) + */ + fastfloat_really_inline int power(int q) noexcept { + return (((152170 + 65536) * q) >> 16) + 63; + } +} // namespace detail + + +// w * 10 ** q +// The returned value should be a valid ieee64 number that simply need to be packed. +// However, in some very rare cases, the computation will fail. In such cases, we +// return an adjusted_mantissa with a negative power of 2: the caller should recompute +// in such cases. +template +fastfloat_really_inline +adjusted_mantissa compute_float(int64_t q, uint64_t w) noexcept { + adjusted_mantissa answer; + if ((w == 0) || (q < binary::smallest_power_of_ten())) { + answer.power2 = 0; + answer.mantissa = 0; + // result should be zero + return answer; + } + if (q > binary::largest_power_of_ten()) { + // we want to get infinity: + answer.power2 = binary::infinite_power(); + answer.mantissa = 0; + return answer; + } + // At this point in time q is in [powers::smallest_power_of_five, powers::largest_power_of_five]. + + // We want the most significant bit of i to be 1. Shift if needed. + int lz = leading_zeroes(w); + w <<= lz; + + // The required precision is binary::mantissa_explicit_bits() + 3 because + // 1. We need the implicit bit + // 2. We need an extra bit for rounding purposes + // 3. We might lose a bit due to the "upperbit" routine (result too small, requiring a shift) + + value128 product = compute_product_approximation(q, w); + if(product.low == 0xFFFFFFFFFFFFFFFF) { // could guard it further + // In some very rare cases, this could happen, in which case we might need a more accurate + // computation that what we can provide cheaply. This is very, very unlikely. + // + const bool inside_safe_exponent = (q >= -27) && (q <= 55); // always good because 5**q <2**128 when q>=0, + // and otherwise, for q<0, we have 5**-q<2**64 and the 128-bit reciprocal allows for exact computation. + if(!inside_safe_exponent) { + answer.power2 = -1; // This (a negative value) indicates an error condition. + return answer; + } + } + // The "compute_product_approximation" function can be slightly slower than a branchless approach: + // value128 product = compute_product(q, w); + // but in practice, we can win big with the compute_product_approximation if its additional branch + // is easily predicted. Which is best is data specific. + int upperbit = int(product.high >> 63); + + answer.mantissa = product.high >> (upperbit + 64 - binary::mantissa_explicit_bits() - 3); + + answer.power2 = int(detail::power(int(q)) + upperbit - lz - binary::minimum_exponent()); + if (answer.power2 <= 0) { // we have a subnormal? + // Here have that answer.power2 <= 0 so -answer.power2 >= 0 + if(-answer.power2 + 1 >= 64) { // if we have more than 64 bits below the minimum exponent, you have a zero for sure. + answer.power2 = 0; + answer.mantissa = 0; + // result should be zero + return answer; + } + // next line is safe because -answer.power2 + 1 < 64 + answer.mantissa >>= -answer.power2 + 1; + // Thankfully, we can't have both "round-to-even" and subnormals because + // "round-to-even" only occurs for powers close to 0. + answer.mantissa += (answer.mantissa & 1); // round up + answer.mantissa >>= 1; + // There is a weird scenario where we don't have a subnormal but just. + // Suppose we start with 2.2250738585072013e-308, we end up + // with 0x3fffffffffffff x 2^-1023-53 which is technically subnormal + // whereas 0x40000000000000 x 2^-1023-53 is normal. Now, we need to round + // up 0x3fffffffffffff x 2^-1023-53 and once we do, we are no longer + // subnormal, but we can only know this after rounding. + // So we only declare a subnormal if we are smaller than the threshold. + answer.power2 = (answer.mantissa < (uint64_t(1) << binary::mantissa_explicit_bits())) ? 0 : 1; + return answer; + } + + // usually, we round *up*, but if we fall right in between and and we have an + // even basis, we need to round down + // We are only concerned with the cases where 5**q fits in single 64-bit word. + if ((product.low <= 1) && (q >= binary::min_exponent_round_to_even()) && (q <= binary::max_exponent_round_to_even()) && + ((answer.mantissa & 3) == 1) ) { // we may fall between two floats! + // To be in-between two floats we need that in doing + // answer.mantissa = product.high >> (upperbit + 64 - binary::mantissa_explicit_bits() - 3); + // ... we dropped out only zeroes. But if this happened, then we can go back!!! + if((answer.mantissa << (upperbit + 64 - binary::mantissa_explicit_bits() - 3)) == product.high) { + answer.mantissa &= ~uint64_t(1); // flip it so that we do not round up + } + } + + answer.mantissa += (answer.mantissa & 1); // round up + answer.mantissa >>= 1; + if (answer.mantissa >= (uint64_t(2) << binary::mantissa_explicit_bits())) { + answer.mantissa = (uint64_t(1) << binary::mantissa_explicit_bits()); + answer.power2++; // undo previous addition + } + + answer.mantissa &= ~(uint64_t(1) << binary::mantissa_explicit_bits()); + if (answer.power2 >= binary::infinite_power()) { // infinity + answer.power2 = binary::infinite_power(); + answer.mantissa = 0; + } + return answer; +} + + +} // namespace duckdb_fast_float + +#endif + + +#ifndef FASTFLOAT_ASCII_NUMBER_H +#define FASTFLOAT_ASCII_NUMBER_H + +#include +#include +#include +#include + + +namespace duckdb_fast_float { + +// Next function can be micro-optimized, but compilers are entirely +// able to optimize it well. +fastfloat_really_inline bool is_integer(char c) noexcept { return c >= '0' && c <= '9'; } + +fastfloat_really_inline uint64_t byteswap(uint64_t val) { + return (val & 0xFF00000000000000) >> 56 + | (val & 0x00FF000000000000) >> 40 + | (val & 0x0000FF0000000000) >> 24 + | (val & 0x000000FF00000000) >> 8 + | (val & 0x00000000FF000000) << 8 + | (val & 0x0000000000FF0000) << 24 + | (val & 0x000000000000FF00) << 40 + | (val & 0x00000000000000FF) << 56; +} + +fastfloat_really_inline uint64_t read_u64(const char *chars) { + uint64_t val; + ::memcpy(&val, chars, sizeof(uint64_t)); +#if FASTFLOAT_IS_BIG_ENDIAN == 1 + // Need to read as-if the number was in little-endian order. + val = byteswap(val); +#endif + return val; +} + +fastfloat_really_inline void write_u64(uint8_t *chars, uint64_t val) { +#if FASTFLOAT_IS_BIG_ENDIAN == 1 + // Need to read as-if the number was in little-endian order. + val = byteswap(val); +#endif + ::memcpy(chars, &val, sizeof(uint64_t)); +} + +// credit @aqrit +fastfloat_really_inline uint32_t parse_eight_digits_unrolled(uint64_t val) { + const uint64_t mask = 0x000000FF000000FF; + const uint64_t mul1 = 0x000F424000000064; // 100 + (1000000ULL << 32) + const uint64_t mul2 = 0x0000271000000001; // 1 + (10000ULL << 32) + val -= 0x3030303030303030; + val = (val * 10) + (val >> 8); // val = (val * 2561) >> 8; + val = (((val & mask) * mul1) + (((val >> 16) & mask) * mul2)) >> 32; + return uint32_t(val); +} + +fastfloat_really_inline uint32_t parse_eight_digits_unrolled(const char *chars) noexcept { + return parse_eight_digits_unrolled(read_u64(chars)); +} + +// credit @aqrit +fastfloat_really_inline bool is_made_of_eight_digits_fast(uint64_t val) noexcept { + return !((((val + 0x4646464646464646) | (val - 0x3030303030303030)) & + 0x8080808080808080)); +} + +fastfloat_really_inline bool is_made_of_eight_digits_fast(const char *chars) noexcept { + return is_made_of_eight_digits_fast(read_u64(chars)); +} + +struct parsed_number_string { + int64_t exponent; + uint64_t mantissa; + const char *lastmatch; + bool negative; + bool valid; + bool too_many_digits; +}; + + +// Assuming that you use no more than 19 digits, this will +// parse an ASCII string. +fastfloat_really_inline +parsed_number_string parse_number_string(const char *p, const char *pend, chars_format fmt) noexcept { + parsed_number_string answer; + answer.valid = false; + answer.too_many_digits = false; + answer.negative = (*p == '-'); + if (*p == '-') { // C++17 20.19.3.(7.1) explicitly forbids '+' sign here + ++p; + if (p == pend) { + return answer; + } + if (!is_integer(*p) && (*p != '.')) { // a sign must be followed by an integer or the dot + return answer; + } + } + const char *const start_digits = p; + + uint64_t i = 0; // an unsigned int avoids signed overflows (which are bad) + + while ((p != pend) && is_integer(*p)) { + // a multiplication by 10 is cheaper than an arbitrary integer + // multiplication + i = 10 * i + + uint64_t(*p - '0'); // might overflow, we will handle the overflow later + ++p; + } + const char *const end_of_integer_part = p; + int64_t digit_count = int64_t(end_of_integer_part - start_digits); + int64_t exponent = 0; + if ((p != pend) && (*p == '.')) { + ++p; + // Fast approach only tested under little endian systems + if ((p + 8 <= pend) && is_made_of_eight_digits_fast(p)) { + i = i * 100000000 + parse_eight_digits_unrolled(p); // in rare cases, this will overflow, but that's ok + p += 8; + if ((p + 8 <= pend) && is_made_of_eight_digits_fast(p)) { + i = i * 100000000 + parse_eight_digits_unrolled(p); // in rare cases, this will overflow, but that's ok + p += 8; + } + } + while ((p != pend) && is_integer(*p)) { + uint8_t digit = uint8_t(*p - '0'); + ++p; + i = i * 10 + digit; // in rare cases, this will overflow, but that's ok + } + exponent = end_of_integer_part + 1 - p; + digit_count -= exponent; + } + // we must have encountered at least one integer! + if (digit_count == 0) { + return answer; + } + int64_t exp_number = 0; // explicit exponential part + if ((fmt & chars_format::scientific) && (p != pend) && (('e' == *p) || ('E' == *p))) { + const char * location_of_e = p; + ++p; + bool neg_exp = false; + if ((p != pend) && ('-' == *p)) { + neg_exp = true; + ++p; + } else if ((p != pend) && ('+' == *p)) { // '+' on exponent is allowed by C++17 20.19.3.(7.1) + ++p; + } + if ((p == pend) || !is_integer(*p)) { + if(!(fmt & chars_format::fixed)) { + // We are in error. + return answer; + } + // Otherwise, we will be ignoring the 'e'. + p = location_of_e; + } else { + while ((p != pend) && is_integer(*p)) { + uint8_t digit = uint8_t(*p - '0'); + if (exp_number < 0x10000) { + exp_number = 10 * exp_number + digit; + } + ++p; + } + if(neg_exp) { exp_number = - exp_number; } + exponent += exp_number; + } + } else { + // If it scientific and not fixed, we have to bail out. + if((fmt & chars_format::scientific) && !(fmt & chars_format::fixed)) { return answer; } + } + answer.lastmatch = p; + answer.valid = true; + + // If we frequently had to deal with long strings of digits, + // we could extend our code by using a 128-bit integer instead + // of a 64-bit integer. However, this is uncommon. + // + // We can deal with up to 19 digits. + if (digit_count > 19) { // this is uncommon + // It is possible that the integer had an overflow. + // We have to handle the case where we have 0.0000somenumber. + // We need to be mindful of the case where we only have zeroes... + // E.g., 0.000000000...000. + const char *start = start_digits; + while ((start != pend) && (*start == '0' || *start == '.')) { + if(*start == '0') { digit_count --; } + start++; + } + if (digit_count > 19) { + answer.too_many_digits = true; + // Let us start again, this time, avoiding overflows. + i = 0; + p = start_digits; + const uint64_t minimal_nineteen_digit_integer{1000000000000000000}; + while((i < minimal_nineteen_digit_integer) && (p != pend) && is_integer(*p)) { + i = i * 10 + uint64_t(*p - '0'); + ++p; + } + if (i >= minimal_nineteen_digit_integer) { // We have a big integers + exponent = end_of_integer_part - p + exp_number; + } else { // We have a value with a fractional component. + p++; // skip the '.' + const char *first_after_period = p; + while((i < minimal_nineteen_digit_integer) && (p != pend) && is_integer(*p)) { + i = i * 10 + uint64_t(*p - '0'); + ++p; + } + exponent = first_after_period - p + exp_number; + } + // We have now corrected both exponent and i, to a truncated value + } + } + answer.exponent = exponent; + answer.mantissa = i; + return answer; +} + + +// This should always succeed since it follows a call to parse_number_string +// This function could be optimized. In particular, we could stop after 19 digits +// and try to bail out. Furthermore, we should be able to recover the computed +// exponent from the pass in parse_number_string. +fastfloat_really_inline decimal parse_decimal(const char *p, const char *pend) noexcept { + decimal answer; + answer.num_digits = 0; + answer.decimal_point = 0; + answer.truncated = false; + answer.negative = (*p == '-'); + if (*p == '-') { // C++17 20.19.3.(7.1) explicitly forbids '+' sign here + ++p; + } + // skip leading zeroes + while ((p != pend) && (*p == '0')) { + ++p; + } + while ((p != pend) && is_integer(*p)) { + if (answer.num_digits < max_digits) { + answer.digits[answer.num_digits] = uint8_t(*p - '0'); + } + answer.num_digits++; + ++p; + } + if ((p != pend) && (*p == '.')) { + ++p; + const char *first_after_period = p; + // if we have not yet encountered a zero, we have to skip it as well + if(answer.num_digits == 0) { + // skip zeros + while ((p != pend) && (*p == '0')) { + ++p; + } + } + // We expect that this loop will often take the bulk of the running time + // because when a value has lots of digits, these digits often + while ((p + 8 <= pend) && (answer.num_digits + 8 < max_digits)) { + uint64_t val = read_u64(p); + if(! is_made_of_eight_digits_fast(val)) { break; } + // We have eight digits, process them in one go! + val -= 0x3030303030303030; + write_u64(answer.digits + answer.num_digits, val); + answer.num_digits += 8; + p += 8; + } + while ((p != pend) && is_integer(*p)) { + if (answer.num_digits < max_digits) { + answer.digits[answer.num_digits] = uint8_t(*p - '0'); + } + answer.num_digits++; + ++p; + } + answer.decimal_point = int32_t(first_after_period - p); + } + // We want num_digits to be the number of significant digits, excluding + // leading *and* trailing zeros! Otherwise the truncated flag later is + // going to be misleading. + if(answer.num_digits > 0) { + // We potentially need the answer.num_digits > 0 guard because we + // prune leading zeros. So with answer.num_digits > 0, we know that + // we have at least one non-zero digit. + const char *preverse = p - 1; + int32_t trailing_zeros = 0; + while ((*preverse == '0') || (*preverse == '.')) { + if(*preverse == '0') { trailing_zeros++; }; + --preverse; + } + answer.decimal_point += int32_t(answer.num_digits); + answer.num_digits -= uint32_t(trailing_zeros); + } + if(answer.num_digits > max_digits) { + answer.truncated = true; + answer.num_digits = max_digits; + } + if ((p != pend) && (('e' == *p) || ('E' == *p))) { + ++p; + bool neg_exp = false; + if ((p != pend) && ('-' == *p)) { + neg_exp = true; + ++p; + } else if ((p != pend) && ('+' == *p)) { // '+' on exponent is allowed by C++17 20.19.3.(7.1) + ++p; + } + int32_t exp_number = 0; // exponential part + while ((p != pend) && is_integer(*p)) { + uint8_t digit = uint8_t(*p - '0'); + if (exp_number < 0x10000) { + exp_number = 10 * exp_number + digit; + } + ++p; + } + answer.decimal_point += (neg_exp ? -exp_number : exp_number); + } + // In very rare cases, we may have fewer than 19 digits, we want to be able to reliably + // assume that all digits up to max_digit_without_overflow have been initialized. + for(uint32_t i = answer.num_digits; i < max_digit_without_overflow; i++) { answer.digits[i] = 0; } + + return answer; +} +} // namespace duckdb_fast_float + +#endif + + +#ifndef FASTFLOAT_GENERIC_DECIMAL_TO_BINARY_H +#define FASTFLOAT_GENERIC_DECIMAL_TO_BINARY_H + +/** + * This code is meant to handle the case where we have more than 19 digits. + * + * It is based on work by Nigel Tao (at https://github.com/google/wuffs/) + * who credits Ken Thompson for the design (via a reference to the Go source + * code). + * + * Rob Pike suggested that this algorithm be called "Simple Decimal Conversion". + * + * It is probably not very fast but it is a fallback that should almost never + * be used in real life. Though it is not fast, it is "easily" understood and debugged. + **/ +#include + +namespace duckdb_fast_float { + +namespace detail { + +// remove all final zeroes +inline void trim(decimal &h) { + while ((h.num_digits > 0) && (h.digits[h.num_digits - 1] == 0)) { + h.num_digits--; + } +} + + + +inline uint32_t number_of_digits_decimal_left_shift(const decimal &h, uint32_t shift) { + shift &= 63; + const static uint16_t number_of_digits_decimal_left_shift_table[65] = { + 0x0000, 0x0800, 0x0801, 0x0803, 0x1006, 0x1009, 0x100D, 0x1812, 0x1817, + 0x181D, 0x2024, 0x202B, 0x2033, 0x203C, 0x2846, 0x2850, 0x285B, 0x3067, + 0x3073, 0x3080, 0x388E, 0x389C, 0x38AB, 0x38BB, 0x40CC, 0x40DD, 0x40EF, + 0x4902, 0x4915, 0x4929, 0x513E, 0x5153, 0x5169, 0x5180, 0x5998, 0x59B0, + 0x59C9, 0x61E3, 0x61FD, 0x6218, 0x6A34, 0x6A50, 0x6A6D, 0x6A8B, 0x72AA, + 0x72C9, 0x72E9, 0x7B0A, 0x7B2B, 0x7B4D, 0x8370, 0x8393, 0x83B7, 0x83DC, + 0x8C02, 0x8C28, 0x8C4F, 0x9477, 0x949F, 0x94C8, 0x9CF2, 0x051C, 0x051C, + 0x051C, 0x051C, + }; + uint32_t x_a = number_of_digits_decimal_left_shift_table[shift]; + uint32_t x_b = number_of_digits_decimal_left_shift_table[shift + 1]; + uint32_t num_new_digits = x_a >> 11; + uint32_t pow5_a = 0x7FF & x_a; + uint32_t pow5_b = 0x7FF & x_b; + const static uint8_t + number_of_digits_decimal_left_shift_table_powers_of_5[0x051C] = { + 5, 2, 5, 1, 2, 5, 6, 2, 5, 3, 1, 2, 5, 1, 5, 6, 2, 5, 7, 8, 1, 2, 5, 3, + 9, 0, 6, 2, 5, 1, 9, 5, 3, 1, 2, 5, 9, 7, 6, 5, 6, 2, 5, 4, 8, 8, 2, 8, + 1, 2, 5, 2, 4, 4, 1, 4, 0, 6, 2, 5, 1, 2, 2, 0, 7, 0, 3, 1, 2, 5, 6, 1, + 0, 3, 5, 1, 5, 6, 2, 5, 3, 0, 5, 1, 7, 5, 7, 8, 1, 2, 5, 1, 5, 2, 5, 8, + 7, 8, 9, 0, 6, 2, 5, 7, 6, 2, 9, 3, 9, 4, 5, 3, 1, 2, 5, 3, 8, 1, 4, 6, + 9, 7, 2, 6, 5, 6, 2, 5, 1, 9, 0, 7, 3, 4, 8, 6, 3, 2, 8, 1, 2, 5, 9, 5, + 3, 6, 7, 4, 3, 1, 6, 4, 0, 6, 2, 5, 4, 7, 6, 8, 3, 7, 1, 5, 8, 2, 0, 3, + 1, 2, 5, 2, 3, 8, 4, 1, 8, 5, 7, 9, 1, 0, 1, 5, 6, 2, 5, 1, 1, 9, 2, 0, + 9, 2, 8, 9, 5, 5, 0, 7, 8, 1, 2, 5, 5, 9, 6, 0, 4, 6, 4, 4, 7, 7, 5, 3, + 9, 0, 6, 2, 5, 2, 9, 8, 0, 2, 3, 2, 2, 3, 8, 7, 6, 9, 5, 3, 1, 2, 5, 1, + 4, 9, 0, 1, 1, 6, 1, 1, 9, 3, 8, 4, 7, 6, 5, 6, 2, 5, 7, 4, 5, 0, 5, 8, + 0, 5, 9, 6, 9, 2, 3, 8, 2, 8, 1, 2, 5, 3, 7, 2, 5, 2, 9, 0, 2, 9, 8, 4, + 6, 1, 9, 1, 4, 0, 6, 2, 5, 1, 8, 6, 2, 6, 4, 5, 1, 4, 9, 2, 3, 0, 9, 5, + 7, 0, 3, 1, 2, 5, 9, 3, 1, 3, 2, 2, 5, 7, 4, 6, 1, 5, 4, 7, 8, 5, 1, 5, + 6, 2, 5, 4, 6, 5, 6, 6, 1, 2, 8, 7, 3, 0, 7, 7, 3, 9, 2, 5, 7, 8, 1, 2, + 5, 2, 3, 2, 8, 3, 0, 6, 4, 3, 6, 5, 3, 8, 6, 9, 6, 2, 8, 9, 0, 6, 2, 5, + 1, 1, 6, 4, 1, 5, 3, 2, 1, 8, 2, 6, 9, 3, 4, 8, 1, 4, 4, 5, 3, 1, 2, 5, + 5, 8, 2, 0, 7, 6, 6, 0, 9, 1, 3, 4, 6, 7, 4, 0, 7, 2, 2, 6, 5, 6, 2, 5, + 2, 9, 1, 0, 3, 8, 3, 0, 4, 5, 6, 7, 3, 3, 7, 0, 3, 6, 1, 3, 2, 8, 1, 2, + 5, 1, 4, 5, 5, 1, 9, 1, 5, 2, 2, 8, 3, 6, 6, 8, 5, 1, 8, 0, 6, 6, 4, 0, + 6, 2, 5, 7, 2, 7, 5, 9, 5, 7, 6, 1, 4, 1, 8, 3, 4, 2, 5, 9, 0, 3, 3, 2, + 0, 3, 1, 2, 5, 3, 6, 3, 7, 9, 7, 8, 8, 0, 7, 0, 9, 1, 7, 1, 2, 9, 5, 1, + 6, 6, 0, 1, 5, 6, 2, 5, 1, 8, 1, 8, 9, 8, 9, 4, 0, 3, 5, 4, 5, 8, 5, 6, + 4, 7, 5, 8, 3, 0, 0, 7, 8, 1, 2, 5, 9, 0, 9, 4, 9, 4, 7, 0, 1, 7, 7, 2, + 9, 2, 8, 2, 3, 7, 9, 1, 5, 0, 3, 9, 0, 6, 2, 5, 4, 5, 4, 7, 4, 7, 3, 5, + 0, 8, 8, 6, 4, 6, 4, 1, 1, 8, 9, 5, 7, 5, 1, 9, 5, 3, 1, 2, 5, 2, 2, 7, + 3, 7, 3, 6, 7, 5, 4, 4, 3, 2, 3, 2, 0, 5, 9, 4, 7, 8, 7, 5, 9, 7, 6, 5, + 6, 2, 5, 1, 1, 3, 6, 8, 6, 8, 3, 7, 7, 2, 1, 6, 1, 6, 0, 2, 9, 7, 3, 9, + 3, 7, 9, 8, 8, 2, 8, 1, 2, 5, 5, 6, 8, 4, 3, 4, 1, 8, 8, 6, 0, 8, 0, 8, + 0, 1, 4, 8, 6, 9, 6, 8, 9, 9, 4, 1, 4, 0, 6, 2, 5, 2, 8, 4, 2, 1, 7, 0, + 9, 4, 3, 0, 4, 0, 4, 0, 0, 7, 4, 3, 4, 8, 4, 4, 9, 7, 0, 7, 0, 3, 1, 2, + 5, 1, 4, 2, 1, 0, 8, 5, 4, 7, 1, 5, 2, 0, 2, 0, 0, 3, 7, 1, 7, 4, 2, 2, + 4, 8, 5, 3, 5, 1, 5, 6, 2, 5, 7, 1, 0, 5, 4, 2, 7, 3, 5, 7, 6, 0, 1, 0, + 0, 1, 8, 5, 8, 7, 1, 1, 2, 4, 2, 6, 7, 5, 7, 8, 1, 2, 5, 3, 5, 5, 2, 7, + 1, 3, 6, 7, 8, 8, 0, 0, 5, 0, 0, 9, 2, 9, 3, 5, 5, 6, 2, 1, 3, 3, 7, 8, + 9, 0, 6, 2, 5, 1, 7, 7, 6, 3, 5, 6, 8, 3, 9, 4, 0, 0, 2, 5, 0, 4, 6, 4, + 6, 7, 7, 8, 1, 0, 6, 6, 8, 9, 4, 5, 3, 1, 2, 5, 8, 8, 8, 1, 7, 8, 4, 1, + 9, 7, 0, 0, 1, 2, 5, 2, 3, 2, 3, 3, 8, 9, 0, 5, 3, 3, 4, 4, 7, 2, 6, 5, + 6, 2, 5, 4, 4, 4, 0, 8, 9, 2, 0, 9, 8, 5, 0, 0, 6, 2, 6, 1, 6, 1, 6, 9, + 4, 5, 2, 6, 6, 7, 2, 3, 6, 3, 2, 8, 1, 2, 5, 2, 2, 2, 0, 4, 4, 6, 0, 4, + 9, 2, 5, 0, 3, 1, 3, 0, 8, 0, 8, 4, 7, 2, 6, 3, 3, 3, 6, 1, 8, 1, 6, 4, + 0, 6, 2, 5, 1, 1, 1, 0, 2, 2, 3, 0, 2, 4, 6, 2, 5, 1, 5, 6, 5, 4, 0, 4, + 2, 3, 6, 3, 1, 6, 6, 8, 0, 9, 0, 8, 2, 0, 3, 1, 2, 5, 5, 5, 5, 1, 1, 1, + 5, 1, 2, 3, 1, 2, 5, 7, 8, 2, 7, 0, 2, 1, 1, 8, 1, 5, 8, 3, 4, 0, 4, 5, + 4, 1, 0, 1, 5, 6, 2, 5, 2, 7, 7, 5, 5, 5, 7, 5, 6, 1, 5, 6, 2, 8, 9, 1, + 3, 5, 1, 0, 5, 9, 0, 7, 9, 1, 7, 0, 2, 2, 7, 0, 5, 0, 7, 8, 1, 2, 5, 1, + 3, 8, 7, 7, 7, 8, 7, 8, 0, 7, 8, 1, 4, 4, 5, 6, 7, 5, 5, 2, 9, 5, 3, 9, + 5, 8, 5, 1, 1, 3, 5, 2, 5, 3, 9, 0, 6, 2, 5, 6, 9, 3, 8, 8, 9, 3, 9, 0, + 3, 9, 0, 7, 2, 2, 8, 3, 7, 7, 6, 4, 7, 6, 9, 7, 9, 2, 5, 5, 6, 7, 6, 2, + 6, 9, 5, 3, 1, 2, 5, 3, 4, 6, 9, 4, 4, 6, 9, 5, 1, 9, 5, 3, 6, 1, 4, 1, + 8, 8, 8, 2, 3, 8, 4, 8, 9, 6, 2, 7, 8, 3, 8, 1, 3, 4, 7, 6, 5, 6, 2, 5, + 1, 7, 3, 4, 7, 2, 3, 4, 7, 5, 9, 7, 6, 8, 0, 7, 0, 9, 4, 4, 1, 1, 9, 2, + 4, 4, 8, 1, 3, 9, 1, 9, 0, 6, 7, 3, 8, 2, 8, 1, 2, 5, 8, 6, 7, 3, 6, 1, + 7, 3, 7, 9, 8, 8, 4, 0, 3, 5, 4, 7, 2, 0, 5, 9, 6, 2, 2, 4, 0, 6, 9, 5, + 9, 5, 3, 3, 6, 9, 1, 4, 0, 6, 2, 5, + }; + const uint8_t *pow5 = + &number_of_digits_decimal_left_shift_table_powers_of_5[pow5_a]; + uint32_t i = 0; + uint32_t n = pow5_b - pow5_a; + for (; i < n; i++) { + if (i >= h.num_digits) { + return num_new_digits - 1; + } else if (h.digits[i] == pow5[i]) { + continue; + } else if (h.digits[i] < pow5[i]) { + return num_new_digits - 1; + } else { + return num_new_digits; + } + } + return num_new_digits; +} + +inline uint64_t round(decimal &h) { + if ((h.num_digits == 0) || (h.decimal_point < 0)) { + return 0; + } else if (h.decimal_point > 18) { + return UINT64_MAX; + } + // at this point, we know that h.decimal_point >= 0 + uint32_t dp = uint32_t(h.decimal_point); + uint64_t n = 0; + for (uint32_t i = 0; i < dp; i++) { + n = (10 * n) + ((i < h.num_digits) ? h.digits[i] : 0); + } + bool round_up = false; + if (dp < h.num_digits) { + round_up = h.digits[dp] >= 5; // normally, we round up + // but we may need to round to even! + if ((h.digits[dp] == 5) && (dp + 1 == h.num_digits)) { + round_up = h.truncated || ((dp > 0) && (1 & h.digits[dp - 1])); + } + } + if (round_up) { + n++; + } + return n; +} + +// computes h * 2^-shift +inline void decimal_left_shift(decimal &h, uint32_t shift) { + if (h.num_digits == 0) { + return; + } + uint32_t num_new_digits = number_of_digits_decimal_left_shift(h, shift); + int32_t read_index = int32_t(h.num_digits - 1); + uint32_t write_index = h.num_digits - 1 + num_new_digits; + uint64_t n = 0; + + while (read_index >= 0) { + n += uint64_t(h.digits[read_index]) << shift; + uint64_t quotient = n / 10; + uint64_t remainder = n - (10 * quotient); + if (write_index < max_digits) { + h.digits[write_index] = uint8_t(remainder); + } else if (remainder > 0) { + h.truncated = true; + } + n = quotient; + write_index--; + read_index--; + } + while (n > 0) { + uint64_t quotient = n / 10; + uint64_t remainder = n - (10 * quotient); + if (write_index < max_digits) { + h.digits[write_index] = uint8_t(remainder); + } else if (remainder > 0) { + h.truncated = true; + } + n = quotient; + write_index--; + } + h.num_digits += num_new_digits; + if (h.num_digits > max_digits) { + h.num_digits = max_digits; + } + h.decimal_point += int32_t(num_new_digits); + trim(h); +} + +// computes h * 2^shift +inline void decimal_right_shift(decimal &h, uint32_t shift) { + uint32_t read_index = 0; + uint32_t write_index = 0; + + uint64_t n = 0; + + while ((n >> shift) == 0) { + if (read_index < h.num_digits) { + n = (10 * n) + h.digits[read_index++]; + } else if (n == 0) { + return; + } else { + while ((n >> shift) == 0) { + n = 10 * n; + read_index++; + } + break; + } + } + h.decimal_point -= int32_t(read_index - 1); + if (h.decimal_point < -decimal_point_range) { // it is zero + h.num_digits = 0; + h.decimal_point = 0; + h.negative = false; + h.truncated = false; + return; + } + uint64_t mask = (uint64_t(1) << shift) - 1; + while (read_index < h.num_digits) { + uint8_t new_digit = uint8_t(n >> shift); + n = (10 * (n & mask)) + h.digits[read_index++]; + h.digits[write_index++] = new_digit; + } + while (n > 0) { + uint8_t new_digit = uint8_t(n >> shift); + n = 10 * (n & mask); + if (write_index < max_digits) { + h.digits[write_index++] = new_digit; + } else if (new_digit > 0) { + h.truncated = true; + } + } + h.num_digits = write_index; + trim(h); +} + +} // namespace detail + +template +adjusted_mantissa compute_float(decimal &d) { + adjusted_mantissa answer; + if (d.num_digits == 0) { + // should be zero + answer.power2 = 0; + answer.mantissa = 0; + return answer; + } + // At this point, going further, we can assume that d.num_digits > 0. + // + // We want to guard against excessive decimal point values because + // they can result in long running times. Indeed, we do + // shifts by at most 60 bits. We have that log(10**400)/log(2**60) ~= 22 + // which is fine, but log(10**299995)/log(2**60) ~= 16609 which is not + // fine (runs for a long time). + // + if(d.decimal_point < -324) { + // We have something smaller than 1e-324 which is always zero + // in binary64 and binary32. + // It should be zero. + answer.power2 = 0; + answer.mantissa = 0; + return answer; + } else if(d.decimal_point >= 310) { + // We have something at least as large as 0.1e310 which is + // always infinite. + answer.power2 = binary::infinite_power(); + answer.mantissa = 0; + return answer; + } + static const uint32_t max_shift = 60; + static const uint32_t num_powers = 19; + static const uint8_t decimal_powers[19] = { + 0, 3, 6, 9, 13, 16, 19, 23, 26, 29, // + 33, 36, 39, 43, 46, 49, 53, 56, 59, // + }; + int32_t exp2 = 0; + while (d.decimal_point > 0) { + uint32_t n = uint32_t(d.decimal_point); + uint32_t shift = (n < num_powers) ? decimal_powers[n] : max_shift; + detail::decimal_right_shift(d, shift); + if (d.decimal_point < -decimal_point_range) { + // should be zero + answer.power2 = 0; + answer.mantissa = 0; + return answer; + } + exp2 += int32_t(shift); + } + // We shift left toward [1/2 ... 1]. + while (d.decimal_point <= 0) { + uint32_t shift; + if (d.decimal_point == 0) { + if (d.digits[0] >= 5) { + break; + } + shift = (d.digits[0] < 2) ? 2 : 1; + } else { + uint32_t n = uint32_t(-d.decimal_point); + shift = (n < num_powers) ? decimal_powers[n] : max_shift; + } + detail::decimal_left_shift(d, shift); + if (d.decimal_point > decimal_point_range) { + // we want to get infinity: + answer.power2 = binary::infinite_power(); + answer.mantissa = 0; + return answer; + } + exp2 -= int32_t(shift); + } + // We are now in the range [1/2 ... 1] but the binary format uses [1 ... 2]. + exp2--; + constexpr int32_t minimum_exponent = binary::minimum_exponent(); + while ((minimum_exponent + 1) > exp2) { + uint32_t n = uint32_t((minimum_exponent + 1) - exp2); + if (n > max_shift) { + n = max_shift; + } + detail::decimal_right_shift(d, n); + exp2 += int32_t(n); + } + if ((exp2 - minimum_exponent) >= binary::infinite_power()) { + answer.power2 = binary::infinite_power(); + answer.mantissa = 0; + return answer; + } + + const int mantissa_size_in_bits = binary::mantissa_explicit_bits() + 1; + detail::decimal_left_shift(d, mantissa_size_in_bits); + + uint64_t mantissa = detail::round(d); + // It is possible that we have an overflow, in which case we need + // to shift back. + if(mantissa >= (uint64_t(1) << mantissa_size_in_bits)) { + detail::decimal_right_shift(d, 1); + exp2 += 1; + mantissa = detail::round(d); + if ((exp2 - minimum_exponent) >= binary::infinite_power()) { + answer.power2 = binary::infinite_power(); + answer.mantissa = 0; + return answer; + } + } + answer.power2 = exp2 - binary::minimum_exponent(); + if(mantissa < (uint64_t(1) << binary::mantissa_explicit_bits())) { answer.power2--; } + answer.mantissa = mantissa & ((uint64_t(1) << binary::mantissa_explicit_bits()) - 1); + return answer; +} + +template +adjusted_mantissa parse_long_mantissa(const char *first, const char* last) { + decimal d = parse_decimal(first, last); + return compute_float(d); +} + +} // namespace duckdb_fast_float +#endif + + +#ifndef FASTFLOAT_PARSE_NUMBER_H +#define FASTFLOAT_PARSE_NUMBER_H + +#include +#include +#include +#include +#include + +namespace duckdb_fast_float { + + +namespace detail { +/** + * Special case +inf, -inf, nan, infinity, -infinity. + * The case comparisons could be made much faster given that we know that the + * strings a null-free and fixed. + **/ +template +from_chars_result parse_infnan(const char *first, const char *last, T &value) noexcept { + from_chars_result answer; + answer.ptr = first; + answer.ec = std::errc(); // be optimistic + bool minusSign = false; + if (*first == '-') { // assume first < last, so dereference without checks; C++17 20.19.3.(7.1) explicitly forbids '+' here + minusSign = true; + ++first; + } + if (last - first >= 3) { + if (fastfloat_strncasecmp(first, "nan", 3)) { + answer.ptr = (first += 3); + value = minusSign ? -std::numeric_limits::quiet_NaN() : std::numeric_limits::quiet_NaN(); + // Check for possible nan(n-char-seq-opt), C++17 20.19.3.7, C11 7.20.1.3.3. At least MSVC produces nan(ind) and nan(snan). + if(first != last && *first == '(') { + for(const char* ptr = first + 1; ptr != last; ++ptr) { + if (*ptr == ')') { + answer.ptr = ptr + 1; // valid nan(n-char-seq-opt) + break; + } + else if(!(('a' <= *ptr && *ptr <= 'z') || ('A' <= *ptr && *ptr <= 'Z') || ('0' <= *ptr && *ptr <= '9') || *ptr == '_')) + break; // forbidden char, not nan(n-char-seq-opt) + } + } + return answer; + } + if (fastfloat_strncasecmp(first, "inf", 3)) { + if ((last - first >= 8) && fastfloat_strncasecmp(first + 3, "inity", 5)) { + answer.ptr = first + 8; + } else { + answer.ptr = first + 3; + } + value = minusSign ? -std::numeric_limits::infinity() : std::numeric_limits::infinity(); + return answer; + } + } + answer.ec = std::errc::invalid_argument; + return answer; +} + +template +fastfloat_really_inline void to_float(bool negative, adjusted_mantissa am, T &value) { + uint64_t word = am.mantissa; + word |= uint64_t(am.power2) << binary_format::mantissa_explicit_bits(); + word = negative + ? word | (uint64_t(1) << binary_format::sign_index()) : word; +#if FASTFLOAT_IS_BIG_ENDIAN == 1 + if (std::is_same::value) { + ::memcpy(&value, (char *)&word + 4, sizeof(T)); // extract value at offset 4-7 if float on big-endian + } else { + ::memcpy(&value, &word, sizeof(T)); + } +#else + // For little-endian systems: + ::memcpy(&value, &word, sizeof(T)); +#endif +} + +} // namespace detail + + + +template +from_chars_result from_chars(const char *first, const char *last, + T &value, chars_format fmt /*= chars_format::general*/) noexcept { + static_assert (std::is_same::value || std::is_same::value, "only float and double are supported"); + + + from_chars_result answer; + if (first == last) { + answer.ec = std::errc::invalid_argument; + answer.ptr = first; + return answer; + } + parsed_number_string pns = parse_number_string(first, last, fmt); + if (!pns.valid) { + return detail::parse_infnan(first, last, value); + } + answer.ec = std::errc(); // be optimistic + answer.ptr = pns.lastmatch; + // Next is Clinger's fast path. + if (binary_format::min_exponent_fast_path() <= pns.exponent && pns.exponent <= binary_format::max_exponent_fast_path() && pns.mantissa <=binary_format::max_mantissa_fast_path() && !pns.too_many_digits) { + value = T(pns.mantissa); + if (pns.exponent < 0) { value = value / binary_format::exact_power_of_ten(-pns.exponent); } + else { value = value * binary_format::exact_power_of_ten(pns.exponent); } + if (pns.negative) { value = -value; } + return answer; + } + adjusted_mantissa am = compute_float>(pns.exponent, pns.mantissa); + if(pns.too_many_digits) { + if(am != compute_float>(pns.exponent, pns.mantissa + 1)) { + am.power2 = -1; // value is invalid. + } + } + // If we called compute_float>(pns.exponent, pns.mantissa) and we have an invalid power (am.power2 < 0), + // then we need to go the long way around again. This is very uncommon. + if(am.power2 < 0) { am = parse_long_mantissa>(first,last); } + detail::to_float(pns.negative, am, value); + return answer; +} + +} // namespace duckdb_fast_float + +#endif + + + +// LICENSE_CHANGE_END + + + #include #include #include @@ -22652,95 +25916,6 @@ bool TryCast::Operation(string_t input, uint64_t &result, bool strict) { return TryIntegerCast(input.GetDataUnsafe(), input.GetSize(), result, strict); } -template -static void ComputeDoubleResult(T &result, idx_t decimal, idx_t decimal_factor) { - if (decimal_factor > 1) { - if (NEGATIVE) { - result -= (T)decimal / (T)decimal_factor; - } else { - result += (T)decimal / (T)decimal_factor; - } - } -} - -template -static bool DoubleCastLoop(const char *buf, idx_t len, T &result, bool strict) { - idx_t start_pos = NEGATIVE || *buf == '+' ? 1 : 0; - idx_t pos = start_pos; - idx_t decimal = 0; - idx_t decimal_factor = 0; - while (pos < len) { - if (!StringUtil::CharacterIsDigit(buf[pos])) { - // not a digit! - if (buf[pos] == '.') { - // decimal point - if (decimal_factor != 0) { - // nested periods - return false; - } - decimal_factor = 1; - pos++; - continue; - } else if (StringUtil::CharacterIsSpace(buf[pos])) { - // skip any trailing spaces - while (++pos < len) { - if (!StringUtil::CharacterIsSpace(buf[pos])) { - return false; - } - } - ComputeDoubleResult(result, decimal, decimal_factor); - return true; - } else if (buf[pos] == 'e' || buf[pos] == 'E') { - if (pos == start_pos) { - return false; - } - // E power - // parse an integer, this time not allowing another exponent - pos++; - int64_t exponent; - if (!TryIntegerCast(buf + pos, len - pos, exponent, strict)) { - return false; - } - ComputeDoubleResult(result, decimal, decimal_factor); - if (result > NumericLimits::Maximum() / std::pow(10.0L, exponent)) { - return false; - } - result = result * std::pow(10.0L, exponent); - - return true; - } else { - return false; - } - } - T digit = buf[pos++] - '0'; - if (decimal_factor == 0) { - result = result * 10 + (NEGATIVE ? -digit : digit); - } else { - if (decimal_factor >= 1000000000000000000) { - // decimal value will overflow if we parse more, ignore any subsequent numbers - continue; - } - decimal = decimal * 10 + digit; - decimal_factor *= 10; - } - } - ComputeDoubleResult(result, decimal, decimal_factor); - return pos > start_pos; -} - -template -bool CheckDoubleValidity(T value); - -template <> -bool CheckDoubleValidity(float value) { - return Value::FloatIsValid(value); -} - -template <> -bool CheckDoubleValidity(double value) { - return Value::DoubleIsValid(value); -} - template static bool TryDoubleCast(const char *buf, idx_t len, T &result, bool strict) { // skip any spaces at the start @@ -22751,28 +25926,29 @@ static bool TryDoubleCast(const char *buf, idx_t len, T &result, bool strict) { if (len == 0) { return false; } - int negative = *buf == '-'; - - result = 0; - if (!negative) { - if (!DoubleCastLoop(buf, len, result, strict)) { - return false; - } - } else { - if (!DoubleCastLoop(buf, len, result, strict)) { - return false; - } + if (*buf == '+') { + buf++; + len--; } - if (!CheckDoubleValidity(result)) { + auto endptr = buf + len; + auto parse_result = duckdb_fast_float::from_chars(buf, buf + len, result); + if (parse_result.ec != std::errc()) { return false; } - return true; + auto current_end = parse_result.ptr; + if (!strict) { + while (current_end < endptr && StringUtil::CharacterIsSpace(*current_end)) { + current_end++; + } + } + return current_end == endptr; } template <> bool TryCast::Operation(string_t input, float &result, bool strict) { return TryDoubleCast(input.GetDataUnsafe(), input.GetSize(), result, strict); } + template <> bool TryCast::Operation(string_t input, double &result, bool strict) { return TryDoubleCast(input.GetDataUnsafe(), input.GetSize(), result, strict); @@ -23608,9 +26784,11 @@ bool TryCastToDecimal::Operation(hugeint_t input, hugeint_t &result, string *err template bool DoubleToDecimalCast(SRC input, DST &result, string *error_message, uint8_t width, uint8_t scale) { double value = input * NumericHelper::DOUBLE_POWERS_OF_TEN[scale]; + // Add the sign (-1, 0, 1) times a tiny value to fix floating point issues (issue 3091) + double sign = (double(0) < value) - (value < double(0)); + value += 1e-9 * sign; if (value <= -NumericHelper::DOUBLE_POWERS_OF_TEN[width] || value >= NumericHelper::DOUBLE_POWERS_OF_TEN[width]) { string error = StringUtil::Format("Could not cast value %f to DECIMAL(%d,%d)", value, width, scale); - ; HandleCastError::AssignError(error, error_message); return false; } @@ -24445,6 +27623,8 @@ void ProgressBar::Update(bool final) { } // namespace duckdb + + #include #include // strlen() on Solaris #include @@ -24473,15 +27653,17 @@ uint32_t EncodeFloat(float x) { buff |= (1u << 31); return buff; } + // nan + if (Value::IsNan(x)) { + return UINT_MAX; + } //! infinity if (x > FLT_MAX) { - throw InternalException("+INFINITY detected in floating point number"); - // return UINT_MAX; + return UINT_MAX - 1; } //! -infinity if (x < -FLT_MAX) { - throw InternalException("-INFINITY detected in floating point number"); - // return 0; + return 0; } buff = Load((const_data_ptr_t)&x); if ((buff & (1u << 31)) == 0) { //! +0 and positive numbers @@ -24501,15 +27683,17 @@ uint64_t EncodeDouble(double x) { buff += (1ull << 63); return buff; } + // nan + if (Value::IsNan(x)) { + return ULLONG_MAX; + } //! infinity if (x > DBL_MAX) { - throw InternalException("+INFINITY detected in floating point number"); - // return ULLONG_MAX; + return ULLONG_MAX - 1; } //! -infinity if (x < -DBL_MAX) { - throw InternalException("-INFINITY detected in floating point number"); - // return 0; + return 0; } buff = Load((const_data_ptr_t)&x); if (buff < (1ull << 63)) { //! +0 and positive numbers @@ -24605,557 +27789,1876 @@ void EncodeStringDataPrefix(data_ptr_t dataptr, string_t value, idx_t prefix_len } } // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/types/row_operations/row_aggregate.cpp -// -// -//===----------------------------------------------------------------------===// -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/row_operations/row_operations.hpp -// -// -//===----------------------------------------------------------------------===// +#include +#include +// RE2 compatibility layer with std::regex +#include +#include +#include -namespace duckdb { +namespace duckdb_re2 { +class RE2; -struct AggregateObject; -class DataChunk; -class RowLayout; -class RowDataCollection; -struct SelectionVector; -class StringHeap; -class Vector; -struct VectorData; +enum class RegexOptions : uint8_t { NONE, CASE_INSENSITIVE }; -// RowOperations contains a set of operations that operate on data using a RowLayout -struct RowOperations { - //===--------------------------------------------------------------------===// - // Aggregation Operators - //===--------------------------------------------------------------------===// - //! initialize - unaligned addresses - static void InitializeStates(RowLayout &layout, Vector &addresses, const SelectionVector &sel, idx_t count); - //! destructor - unaligned addresses, updated - static void DestroyStates(RowLayout &layout, Vector &addresses, idx_t count); - //! update - aligned addresses - static void UpdateStates(AggregateObject &aggr, Vector &addresses, DataChunk &payload, idx_t arg_idx, idx_t count); - //! filtered update - aligned addresses - static void UpdateFilteredStates(AggregateObject &aggr, Vector &addresses, DataChunk &payload, idx_t arg_idx); - //! combine - unaligned addresses, updated - static void CombineStates(RowLayout &layout, Vector &sources, Vector &targets, idx_t count); - //! finalize - unaligned addresses, updated - static void FinalizeStates(RowLayout &layout, Vector &addresses, DataChunk &result, idx_t aggr_idx); +class Regex { +public: + DUCKDB_API Regex(const std::string &pattern, RegexOptions options = RegexOptions::NONE); + DUCKDB_API Regex(const char *pattern, RegexOptions options = RegexOptions::NONE) : Regex(std::string(pattern)) { + } + const duckdb_re2::RE2 &GetRegex() const { + return *regex; + } - //===--------------------------------------------------------------------===// - // Read/Write Operators - //===--------------------------------------------------------------------===// - //! Scatter group data to the rows. Initialises the ValidityMask. - static void Scatter(DataChunk &columns, VectorData col_data[], const RowLayout &layout, Vector &rows, - RowDataCollection &string_heap, const SelectionVector &sel, idx_t count); - //! Gather a single column. - static void Gather(Vector &rows, const SelectionVector &row_sel, Vector &col, const SelectionVector &col_sel, - const idx_t count, const idx_t col_offset, const idx_t col_no, const idx_t build_size = 0); - //! Full Scan an entire columns - static void FullScanColumn(const RowLayout &layout, Vector &rows, Vector &col, idx_t count, idx_t col_idx); +private: + std::shared_ptr regex; +}; - //===--------------------------------------------------------------------===// - // Comparison Operators - //===--------------------------------------------------------------------===// - //! Compare a block of key data against the row values to produce an updated selection that matches - //! and a second (optional) selection of non-matching values. - //! Returns the number of matches remaining in the selection. - using Predicates = vector; +struct GroupMatch { + std::string text; + uint32_t position; - static idx_t Match(DataChunk &columns, VectorData col_data[], const RowLayout &layout, Vector &rows, - const Predicates &predicates, SelectionVector &sel, idx_t count, SelectionVector *no_match, - idx_t &no_match_count); + const std::string &str() const { + return text; + } + operator std::string() const { + return text; + } +}; - //===--------------------------------------------------------------------===// - // Heap Operators - //===--------------------------------------------------------------------===// - //! Compute the entry sizes of a vector with variable size type (used before building heap buffer space). - static void ComputeEntrySizes(Vector &v, idx_t entry_sizes[], idx_t vcount, idx_t ser_count, - const SelectionVector &sel, idx_t offset = 0); - //! Compute the entry sizes of vector data with variable size type (used before building heap buffer space). - static void ComputeEntrySizes(Vector &v, VectorData &vdata, idx_t entry_sizes[], idx_t vcount, idx_t ser_count, - const SelectionVector &sel, idx_t offset = 0); - //! Scatter vector with variable size type to the heap. - static void HeapScatter(Vector &v, idx_t vcount, const SelectionVector &sel, idx_t ser_count, idx_t col_idx, - data_ptr_t *key_locations, data_ptr_t *validitymask_locations, idx_t offset = 0); - //! Scatter vector data with variable size type to the heap. - static void HeapScatterVData(VectorData &vdata, PhysicalType type, const SelectionVector &sel, idx_t ser_count, - idx_t col_idx, data_ptr_t *key_locations, data_ptr_t *validitymask_locations, - idx_t offset = 0); - //! Gather a single column with variable size type from the heap. - static void HeapGather(Vector &v, const idx_t &vcount, const SelectionVector &sel, const idx_t &col_idx, - data_ptr_t key_locations[], data_ptr_t validitymask_locations[]); +struct Match { + std::vector groups; - //===--------------------------------------------------------------------===// - // Sorting Operators - //===--------------------------------------------------------------------===// - //! Scatter vector data to the rows in radix-sortable format. - static void RadixScatter(Vector &v, idx_t vcount, const SelectionVector &sel, idx_t ser_count, - data_ptr_t key_locations[], bool desc, bool has_null, bool nulls_first, idx_t prefix_len, - idx_t width, idx_t offset = 0); + GroupMatch &GetGroup(uint64_t index) { + if (index >= groups.size()) { + throw std::runtime_error("RE2: Match index is out of range"); + } + return groups[index]; + } - //===--------------------------------------------------------------------===// - // Out-of-Core Operators - //===--------------------------------------------------------------------===// - //! Swizzles blob pointers to offset within heap row - static void SwizzleColumns(const RowLayout &layout, const data_ptr_t base_row_ptr, const idx_t count); - //! Swizzles the base pointer of each row to offset within heap block - static void SwizzleHeapPointer(const RowLayout &layout, data_ptr_t row_ptr, const data_ptr_t heap_base_ptr, - const idx_t count); - //! Unswizzles all offsets back to pointers - static void UnswizzlePointers(const RowLayout &layout, const data_ptr_t base_row_ptr, - const data_ptr_t base_heap_ptr, const idx_t count); + std::string str(uint64_t index) { + return GetGroup(index).text; + } + + uint64_t position(uint64_t index) { + return GetGroup(index).position; + } + + uint64_t length(uint64_t index) { + return GetGroup(index).text.size(); + } + + GroupMatch &operator[](uint64_t i) { + return GetGroup(i); + } }; -} // namespace duckdb +DUCKDB_API bool RegexSearch(const std::string &input, Match &match, const Regex ®ex); +DUCKDB_API bool RegexMatch(const std::string &input, Match &match, const Regex ®ex); +DUCKDB_API bool RegexMatch(const char *start, const char *end, Match &match, const Regex ®ex); +DUCKDB_API bool RegexMatch(const std::string &input, const Regex ®ex); +DUCKDB_API std::vector RegexFindAll(const std::string &input, const Regex ®ex); +} // namespace duckdb_re2 -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/types/row_layout.hpp -// -// -//===----------------------------------------------------------------------===// +// LICENSE_CHANGE_BEGIN +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 +// See the end of this file for a list +// Copyright 2003-2009 The RE2 Authors. All Rights Reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. +#ifndef RE2_RE2_H_ +#define RE2_RE2_H_ +// C++ interface to the re2 regular-expression library. +// RE2 supports Perl-style regular expressions (with extensions like +// \d, \w, \s, ...). +// +// ----------------------------------------------------------------------- +// REGEXP SYNTAX: +// +// This module uses the re2 library and hence supports +// its syntax for regular expressions, which is similar to Perl's with +// some of the more complicated things thrown away. In particular, +// backreferences and generalized assertions are not available, nor is \Z. +// +// See https://github.com/google/re2/wiki/Syntax for the syntax +// supported by RE2, and a comparison with PCRE and PERL regexps. +// +// For those not familiar with Perl's regular expressions, +// here are some examples of the most commonly used extensions: +// +// "hello (\\w+) world" -- \w matches a "word" character +// "version (\\d+)" -- \d matches a digit +// "hello\\s+world" -- \s matches any whitespace character +// "\\b(\\w+)\\b" -- \b matches non-empty string at word boundary +// "(?i)hello" -- (?i) turns on case-insensitive matching +// "/\\*(.*?)\\*/" -- .*? matches . minimum no. of times possible +// +// ----------------------------------------------------------------------- +// MATCHING INTERFACE: +// +// The "FullMatch" operation checks that supplied text matches a +// supplied pattern exactly. +// +// Example: successful match +// CHECK(RE2::FullMatch("hello", "h.*o")); +// +// Example: unsuccessful match (requires full match): +// CHECK(!RE2::FullMatch("hello", "e")); +// +// ----------------------------------------------------------------------- +// UTF-8 AND THE MATCHING INTERFACE: +// +// By default, the pattern and input text are interpreted as UTF-8. +// The RE2::Latin1 option causes them to be interpreted as Latin-1. +// +// Example: +// CHECK(RE2::FullMatch(utf8_string, RE2(utf8_pattern))); +// CHECK(RE2::FullMatch(latin1_string, RE2(latin1_pattern, RE2::Latin1))); +// +// ----------------------------------------------------------------------- +// MATCHING WITH SUBSTRING EXTRACTION: +// +// You can supply extra pointer arguments to extract matched substrings. +// On match failure, none of the pointees will have been modified. +// On match success, the substrings will be converted (as necessary) and +// their values will be assigned to their pointees until all conversions +// have succeeded or one conversion has failed. +// On conversion failure, the pointees will be in an indeterminate state +// because the caller has no way of knowing which conversion failed. +// However, conversion cannot fail for types like string and StringPiece +// that do not inspect the substring contents. Hence, in the common case +// where all of the pointees are of such types, failure is always due to +// match failure and thus none of the pointees will have been modified. +// +// Example: extracts "ruby" into "s" and 1234 into "i" +// int i; +// std::string s; +// CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s, &i)); +// +// Example: fails because string cannot be stored in integer +// CHECK(!RE2::FullMatch("ruby", "(.*)", &i)); +// +// Example: fails because there aren't enough sub-patterns +// CHECK(!RE2::FullMatch("ruby:1234", "\\w+:\\d+", &s)); +// +// Example: does not try to extract any extra sub-patterns +// CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s)); +// +// Example: does not try to extract into NULL +// CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", NULL, &i)); +// +// Example: integer overflow causes failure +// CHECK(!RE2::FullMatch("ruby:1234567891234", "\\w+:(\\d+)", &i)); +// +// NOTE(rsc): Asking for substrings slows successful matches quite a bit. +// This may get a little faster in the future, but right now is slower +// than PCRE. On the other hand, failed matches run *very* fast (faster +// than PCRE), as do matches without substring extraction. +// +// ----------------------------------------------------------------------- +// PARTIAL MATCHES +// +// You can use the "PartialMatch" operation when you want the pattern +// to match any substring of the text. +// +// Example: simple search for a string: +// CHECK(RE2::PartialMatch("hello", "ell")); +// +// Example: find first number in a string +// int number; +// CHECK(RE2::PartialMatch("x*100 + 20", "(\\d+)", &number)); +// CHECK_EQ(number, 100); +// +// ----------------------------------------------------------------------- +// PRE-COMPILED REGULAR EXPRESSIONS +// +// RE2 makes it easy to use any string as a regular expression, without +// requiring a separate compilation step. +// +// If speed is of the essence, you can create a pre-compiled "RE2" +// object from the pattern and use it multiple times. If you do so, +// you can typically parse text faster than with sscanf. +// +// Example: precompile pattern for faster matching: +// RE2 pattern("h.*o"); +// while (ReadLine(&str)) { +// if (RE2::FullMatch(str, pattern)) ...; +// } +// +// ----------------------------------------------------------------------- +// SCANNING TEXT INCREMENTALLY +// +// The "Consume" operation may be useful if you want to repeatedly +// match regular expressions at the front of a string and skip over +// them as they match. This requires use of the "StringPiece" type, +// which represents a sub-range of a real string. +// +// Example: read lines of the form "var = value" from a string. +// std::string contents = ...; // Fill string somehow +// StringPiece input(contents); // Wrap a StringPiece around it +// +// std::string var; +// int value; +// while (RE2::Consume(&input, "(\\w+) = (\\d+)\n", &var, &value)) { +// ...; +// } +// +// Each successful call to "Consume" will set "var/value", and also +// advance "input" so it points past the matched text. Note that if the +// regular expression matches an empty string, input will advance +// by 0 bytes. If the regular expression being used might match +// an empty string, the loop body must check for this case and either +// advance the string or break out of the loop. +// +// The "FindAndConsume" operation is similar to "Consume" but does not +// anchor your match at the beginning of the string. For example, you +// could extract all words from a string by repeatedly calling +// RE2::FindAndConsume(&input, "(\\w+)", &word) +// +// ----------------------------------------------------------------------- +// USING VARIABLE NUMBER OF ARGUMENTS +// +// The above operations require you to know the number of arguments +// when you write the code. This is not always possible or easy (for +// example, the regular expression may be calculated at run time). +// You can use the "N" version of the operations when the number of +// match arguments are determined at run time. +// +// Example: +// const RE2::Arg* args[10]; +// int n; +// // ... populate args with pointers to RE2::Arg values ... +// // ... set n to the number of RE2::Arg objects ... +// bool match = RE2::FullMatchN(input, pattern, args, n); +// +// The last statement is equivalent to +// +// bool match = RE2::FullMatch(input, pattern, +// *args[0], *args[1], ..., *args[n - 1]); +// +// ----------------------------------------------------------------------- +// PARSING HEX/OCTAL/C-RADIX NUMBERS +// +// By default, if you pass a pointer to a numeric value, the +// corresponding text is interpreted as a base-10 number. You can +// instead wrap the pointer with a call to one of the operators Hex(), +// Octal(), or CRadix() to interpret the text in another base. The +// CRadix operator interprets C-style "0" (base-8) and "0x" (base-16) +// prefixes, but defaults to base-10. +// +// Example: +// int a, b, c, d; +// CHECK(RE2::FullMatch("100 40 0100 0x40", "(.*) (.*) (.*) (.*)", +// RE2::Octal(&a), RE2::Hex(&b), RE2::CRadix(&c), RE2::CRadix(&d)); +// will leave 64 in a, b, c, and d. +#include +#include +#include +#include +#include +#include -namespace duckdb { -class BoundAggregateExpression; -struct AggregateObject { - AggregateObject(AggregateFunction function, FunctionData *bind_data, idx_t child_count, idx_t payload_size, - bool distinct, PhysicalType return_type, Expression *filter = nullptr) - : function(move(function)), bind_data(bind_data), child_count(child_count), payload_size(payload_size), - distinct(distinct), return_type(return_type), filter(filter) { - } +// LICENSE_CHANGE_BEGIN +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 +// See the end of this file for a list - AggregateFunction function; - FunctionData *bind_data; - idx_t child_count; - idx_t payload_size; - bool distinct; - PhysicalType return_type; - Expression *filter = nullptr; +// Copyright 2001-2010 The RE2 Authors. All Rights Reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. - static vector CreateAggregateObjects(const vector &bindings); -}; +#ifndef RE2_STRINGPIECE_H_ +#define RE2_STRINGPIECE_H_ -class RowLayout { -public: - using Aggregates = vector; - using ValidityBytes = TemplatedValidityMask; +#ifdef min +#undef min +#endif - //! Creates an empty RowLayout - RowLayout(); +// A string-like object that points to a sized piece of memory. +// +// Functions or methods may use const StringPiece& parameters to accept either +// a "const char*" or a "string" value that will be implicitly converted to +// a StringPiece. The implicit conversion means that it is often appropriate +// to include this .h file in other files rather than forward-declaring +// StringPiece as would be appropriate for most other Google classes. +// +// Systematic usage of StringPiece is encouraged as it will reduce unnecessary +// conversions from "const char*" to "string" and back again. +// +// +// Arghh! I wish C++ literals were "string". -public: - //! Initializes the RowLayout with the specified types and aggregates to an empty RowLayout - void Initialize(vector types_p, Aggregates aggregates_p, bool align = true); - //! Initializes the RowLayout with the specified types to an empty RowLayout - void Initialize(vector types, bool align = true); - //! Initializes the RowLayout with the specified aggregates to an empty RowLayout - void Initialize(Aggregates aggregates_p, bool align = true); - //! Returns the number of data columns - inline idx_t ColumnCount() const { - return types.size(); - } - //! Returns a list of the column types for this data chunk - inline const vector &GetTypes() const { - return types; - } - //! Returns the number of aggregates - inline idx_t AggregateCount() const { - return aggregates.size(); - } - //! Returns a list of the aggregates for this data chunk - inline Aggregates &GetAggregates() { - return aggregates; - } - //! Returns the total width required for each row, including padding - inline idx_t GetRowWidth() const { - return row_width; - } - //! Returns the offset to the start of the data - inline idx_t GetDataOffset() const { - return flag_width; - } - //! Returns the total width required for the data, including padding - inline idx_t GetDataWidth() const { - return data_width; - } - //! Returns the offset to the start of the aggregates - inline idx_t GetAggrOffset() const { - return flag_width + data_width; - } - //! Returns the total width required for the aggregates, including padding - inline idx_t GetAggrWidth() const { - return aggr_width; - } - //! Returns the column offsets into each row - inline const vector &GetOffsets() const { - return offsets; - } - //! Returns whether all columns in this layout are constant size - inline bool AllConstant() const { - return all_constant; - } - inline idx_t GetHeapPointerOffset() const { - return heap_pointer_offset; - } +// Doing this simplifies the logic below. +#ifndef __has_include +#define __has_include(x) 0 +#endif -private: - //! The types of the data columns - vector types; - //! The aggregate functions - Aggregates aggregates; - //! The width of the validity header - idx_t flag_width; - //! The width of the data portion - idx_t data_width; - //! The width of the aggregate state portion - idx_t aggr_width; - //! The width of the entire row - idx_t row_width; - //! The offsets to the columns and aggregate data in each row - vector offsets; - //! Whether all columns in this layout are constant size - bool all_constant; - //! Offset to the pointer to the heap for each row - idx_t heap_pointer_offset; -}; +#include +#include +#include +#include +#include +#include +#if __has_include() && __cplusplus >= 201703L +#include +#endif -} // namespace duckdb +namespace duckdb_re2 { +class StringPiece { + public: + typedef std::char_traits traits_type; + typedef char value_type; + typedef char* pointer; + typedef const char* const_pointer; + typedef char& reference; + typedef const char& const_reference; + typedef const char* const_iterator; + typedef const_iterator iterator; + typedef std::reverse_iterator const_reverse_iterator; + typedef const_reverse_iterator reverse_iterator; + typedef size_t size_type; + typedef ptrdiff_t difference_type; + static const size_type npos = static_cast(-1); + // We provide non-explicit singleton constructors so users can pass + // in a "const char*" or a "string" wherever a "StringPiece" is + // expected. + StringPiece() + : data_(NULL), size_(0) {} +#if __has_include() && __cplusplus >= 201703L + StringPiece(const std::string_view& str) + : data_(str.data()), size_(str.size()) {} +#endif + StringPiece(const std::string& str) + : data_(str.data()), size_(str.size()) {} + StringPiece(const char* str) + : data_(str), size_(str == NULL ? 0 : strlen(str)) {} + StringPiece(const char* str, size_type len) + : data_(str), size_(len) {} + const_iterator begin() const { return data_; } + const_iterator end() const { return data_ + size_; } + const_reverse_iterator rbegin() const { + return const_reverse_iterator(data_ + size_); + } + const_reverse_iterator rend() const { + return const_reverse_iterator(data_); + } -namespace duckdb { + size_type size() const { return size_; } + size_type length() const { return size_; } + bool empty() const { return size_ == 0; } -void RowOperations::InitializeStates(RowLayout &layout, Vector &addresses, const SelectionVector &sel, idx_t count) { - if (count == 0) { - return; - } - auto pointers = FlatVector::GetData(addresses); - auto &offsets = layout.GetOffsets(); - auto aggr_idx = layout.ColumnCount(); + const_reference operator[](size_type i) const { return data_[i]; } + const_pointer data() const { return data_; } - for (auto &aggr : layout.GetAggregates()) { - for (idx_t i = 0; i < count; ++i) { - auto row_idx = sel.get_index(i); - auto row = pointers[row_idx]; - aggr.function.initialize(row + offsets[aggr_idx]); - } - ++aggr_idx; - } -} + void remove_prefix(size_type n) { + data_ += n; + size_ -= n; + } -void RowOperations::DestroyStates(RowLayout &layout, Vector &addresses, idx_t count) { - if (count == 0) { - return; - } - // Move to the first aggregate state - VectorOperations::AddInPlace(addresses, layout.GetAggrOffset(), count); - for (auto &aggr : layout.GetAggregates()) { - if (aggr.function.destructor) { - aggr.function.destructor(addresses, count); - } - // Move to the next aggregate state - VectorOperations::AddInPlace(addresses, aggr.payload_size, count); - } -} + void remove_suffix(size_type n) { + size_ -= n; + } -void RowOperations::UpdateStates(AggregateObject &aggr, Vector &addresses, DataChunk &payload, idx_t arg_idx, - idx_t count) { - aggr.function.update(aggr.child_count == 0 ? nullptr : &payload.data[arg_idx], aggr.bind_data, aggr.child_count, - addresses, count); -} + void set(const char* str) { + data_ = str; + size_ = str == NULL ? 0 : strlen(str); + } -void RowOperations::UpdateFilteredStates(AggregateObject &aggr, Vector &addresses, DataChunk &payload, idx_t arg_idx) { - ExpressionExecutor filter_execution(aggr.filter); - SelectionVector true_sel(STANDARD_VECTOR_SIZE); - auto count = filter_execution.SelectExpression(payload, true_sel); + void set(const char* str, size_type len) { + data_ = str; + size_ = len; + } - DataChunk filtered_payload; - auto pay_types = payload.GetTypes(); - filtered_payload.Initialize(pay_types); - filtered_payload.Slice(payload, true_sel, count); + // Converts to `std::basic_string`. + template + explicit operator std::basic_string() const { + if (!data_) return {}; + return std::basic_string(data_, size_); + } - Vector filtered_addresses(addresses, true_sel, count); - filtered_addresses.Normalify(count); + std::string as_string() const { + return std::string(data_, size_); + } - UpdateStates(aggr, filtered_addresses, filtered_payload, arg_idx, filtered_payload.size()); -} + // We also define ToString() here, since many other string-like + // interfaces name the routine that converts to a C++ string + // "ToString", and it's confusing to have the method that does that + // for a StringPiece be called "as_string()". We also leave the + // "as_string()" method defined here for existing code. + std::string ToString() const { + return std::string(data_, size_); + } -void RowOperations::CombineStates(RowLayout &layout, Vector &sources, Vector &targets, idx_t count) { - if (count == 0) { - return; - } + void CopyToString(std::string* target) const { + target->assign(data_, size_); + } - // Move to the first aggregate states - VectorOperations::AddInPlace(sources, layout.GetAggrOffset(), count); - VectorOperations::AddInPlace(targets, layout.GetAggrOffset(), count); - for (auto &aggr : layout.GetAggregates()) { - D_ASSERT(aggr.function.combine); - aggr.function.combine(sources, targets, count); + void AppendToString(std::string* target) const { + target->append(data_, size_); + } - // Move to the next aggregate states - VectorOperations::AddInPlace(sources, aggr.payload_size, count); - VectorOperations::AddInPlace(targets, aggr.payload_size, count); - } -} + size_type copy(char* buf, size_type n, size_type pos = 0) const; + StringPiece substr(size_type pos = 0, size_type n = npos) const; -void RowOperations::FinalizeStates(RowLayout &layout, Vector &addresses, DataChunk &result, idx_t aggr_idx) { - // Move to the first aggregate state - VectorOperations::AddInPlace(addresses, layout.GetAggrOffset(), result.size()); + int compare(const StringPiece& x) const { + size_type min_size = std::min(size(), x.size()); + if (min_size > 0) { + int r = memcmp(data(), x.data(), min_size); + if (r < 0) return -1; + if (r > 0) return 1; + } + if (size() < x.size()) return -1; + if (size() > x.size()) return 1; + return 0; + } - auto &aggregates = layout.GetAggregates(); - for (idx_t i = 0; i < aggregates.size(); i++) { - auto &target = result.data[aggr_idx + i]; - auto &aggr = aggregates[i]; - aggr.function.finalize(addresses, aggr.bind_data, target, result.size(), 0); + // Does "this" start with "x"? + bool starts_with(const StringPiece& x) const { + return x.empty() || + (size() >= x.size() && memcmp(data(), x.data(), x.size()) == 0); + } - // Move to the next aggregate state - VectorOperations::AddInPlace(addresses, aggr.payload_size, result.size()); - } -} + // Does "this" end with "x"? + bool ends_with(const StringPiece& x) const { + return x.empty() || + (size() >= x.size() && + memcmp(data() + (size() - x.size()), x.data(), x.size()) == 0); + } -} // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/types/row_operations/row_external.cpp -// -// -//===----------------------------------------------------------------------===// + bool contains(const StringPiece& s) const { + return find(s) != npos; + } + size_type find(const StringPiece& s, size_type pos = 0) const; + size_type find(char c, size_type pos = 0) const; + size_type rfind(const StringPiece& s, size_type pos = npos) const; + size_type rfind(char c, size_type pos = npos) const; + private: + const_pointer data_; + size_type size_; +}; -namespace duckdb { +inline bool operator==(const StringPiece& x, const StringPiece& y) { + StringPiece::size_type len = x.size(); + if (len != y.size()) return false; + return x.data() == y.data() || len == 0 || + memcmp(x.data(), y.data(), len) == 0; +} -void RowOperations::SwizzleColumns(const RowLayout &layout, const data_ptr_t base_row_ptr, const idx_t count) { - const idx_t row_width = layout.GetRowWidth(); - data_ptr_t heap_row_ptrs[STANDARD_VECTOR_SIZE]; - idx_t done = 0; - while (done != count) { - const idx_t next = MinValue(count - done, STANDARD_VECTOR_SIZE); - const data_ptr_t row_ptr = base_row_ptr + done * row_width; - // Load heap row pointers - data_ptr_t heap_ptr_ptr = row_ptr + layout.GetHeapPointerOffset(); - for (idx_t i = 0; i < next; i++) { - heap_row_ptrs[i] = Load(heap_ptr_ptr); - heap_ptr_ptr += row_width; - } - // Loop through the blob columns - for (idx_t col_idx = 0; col_idx < layout.ColumnCount(); col_idx++) { - auto physical_type = layout.GetTypes()[col_idx].InternalType(); - if (TypeIsConstantSize(physical_type)) { - continue; - } - data_ptr_t col_ptr = row_ptr + layout.GetOffsets()[col_idx]; - if (physical_type == PhysicalType::VARCHAR) { - data_ptr_t string_ptr = col_ptr + sizeof(uint32_t) + string_t::PREFIX_LENGTH; - for (idx_t i = 0; i < next; i++) { - if (Load(col_ptr) > string_t::INLINE_LENGTH) { - // Overwrite the string pointer with the within-row offset (if not inlined) - Store(Load(string_ptr) - heap_row_ptrs[i], string_ptr); - } - col_ptr += row_width; - string_ptr += row_width; - } - } else { - // Non-varchar blob columns - for (idx_t i = 0; i < next; i++) { - // Overwrite the column data pointer with the within-row offset - Store(Load(col_ptr) - heap_row_ptrs[i], col_ptr); - col_ptr += row_width; - } - } - } - done += next; - } +inline bool operator!=(const StringPiece& x, const StringPiece& y) { + return !(x == y); } -void RowOperations::SwizzleHeapPointer(const RowLayout &layout, data_ptr_t row_ptr, const data_ptr_t heap_base_ptr, - const idx_t count) { - const idx_t row_width = layout.GetRowWidth(); - row_ptr += layout.GetHeapPointerOffset(); - idx_t cumulative_offset = 0; - for (idx_t i = 0; i < count; i++) { - Store(cumulative_offset, row_ptr); - cumulative_offset += Load(heap_base_ptr + cumulative_offset); - row_ptr += row_width; - } +inline bool operator<(const StringPiece& x, const StringPiece& y) { + StringPiece::size_type min_size = std::min(x.size(), y.size()); + int r = min_size == 0 ? 0 : memcmp(x.data(), y.data(), min_size); + return (r < 0) || (r == 0 && x.size() < y.size()); } -void RowOperations::UnswizzlePointers(const RowLayout &layout, const data_ptr_t base_row_ptr, - const data_ptr_t base_heap_ptr, const idx_t count) { - const idx_t row_width = layout.GetRowWidth(); - data_ptr_t heap_row_ptrs[STANDARD_VECTOR_SIZE]; - idx_t done = 0; - while (done != count) { - const idx_t next = MinValue(count - done, STANDARD_VECTOR_SIZE); - const data_ptr_t row_ptr = base_row_ptr + done * row_width; - // Restore heap row pointers - data_ptr_t heap_ptr_ptr = row_ptr + layout.GetHeapPointerOffset(); - for (idx_t i = 0; i < next; i++) { - heap_row_ptrs[i] = base_heap_ptr + Load(heap_ptr_ptr); - Store(heap_row_ptrs[i], heap_ptr_ptr); - heap_ptr_ptr += row_width; - } - // Loop through the blob columns - for (idx_t col_idx = 0; col_idx < layout.ColumnCount(); col_idx++) { - auto physical_type = layout.GetTypes()[col_idx].InternalType(); - if (TypeIsConstantSize(physical_type)) { - continue; - } - data_ptr_t col_ptr = row_ptr + layout.GetOffsets()[col_idx]; - if (physical_type == PhysicalType::VARCHAR) { - data_ptr_t string_ptr = col_ptr + sizeof(uint32_t) + string_t::PREFIX_LENGTH; - for (idx_t i = 0; i < next; i++) { - if (Load(col_ptr) > string_t::INLINE_LENGTH) { - // Overwrite the string offset with the pointer (if not inlined) - Store(heap_row_ptrs[i] + Load(string_ptr), string_ptr); - } - col_ptr += row_width; - string_ptr += row_width; - } - } else { - // Non-varchar blob columns - for (idx_t i = 0; i < next; i++) { - // Overwrite the column data offset with the pointer - Store(heap_row_ptrs[i] + Load(col_ptr), col_ptr); - col_ptr += row_width; - } - } - } - done += next; - } +inline bool operator>(const StringPiece& x, const StringPiece& y) { + return y < x; } -} // namespace duckdb -//===--------------------------------------------------------------------===// -// row_gather.cpp -// Description: This file contains the implementation of the gather operators -//===--------------------------------------------------------------------===// +inline bool operator<=(const StringPiece& x, const StringPiece& y) { + return !(x > y); +} +inline bool operator>=(const StringPiece& x, const StringPiece& y) { + return !(x < y); +} -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/operator/constant_operators.hpp -// -// -//===----------------------------------------------------------------------===// +// Allow StringPiece to be logged. +std::ostream& operator<<(std::ostream& o, const StringPiece& p); +} // namespace duckdb_re2 +#endif // RE2_STRINGPIECE_H_ -namespace duckdb { -struct PickLeft { - template - static inline T Operation(T left, T right) { - return left; - } -}; +// LICENSE_CHANGE_END -struct PickRight { - template - static inline T Operation(T left, T right) { - return right; - } -}; -struct NOP { - template - static inline T Operation(T left) { - return left; - } -}; +namespace duckdb_re2 { +class Prog; +class Regexp; +} // namespace duckdb_re2 -struct ConstantZero { - template - static inline T Operation(T left, T right) { - return 0; - } -}; +namespace duckdb_re2 { -struct ConstantOne { - template - static inline T Operation(T left, T right) { - return 1; - } -}; +// Interface for regular expression matching. Also corresponds to a +// pre-compiled regular expression. An "RE2" object is safe for +// concurrent use by multiple threads. +class RE2 { + public: + // We convert user-passed pointers into special Arg objects + class Arg; + class Options; -struct AddOne { - template - static inline T Operation(T left, T right) { - return right + 1; - } -}; + // Defined in set.h. + class Set; -} // namespace duckdb + enum ErrorCode { + NoError = 0, + // Unexpected error + ErrorInternal, -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/types/row_data_collection.hpp -// -// -//===----------------------------------------------------------------------===// + // Parse errors + ErrorBadEscape, // bad escape sequence + ErrorBadCharClass, // bad character class + ErrorBadCharRange, // bad character class range + ErrorMissingBracket, // missing closing ] + ErrorMissingParen, // missing closing ) + ErrorTrailingBackslash, // trailing \ at end of regexp + ErrorRepeatArgument, // repeat argument missing, e.g. "*" + ErrorRepeatSize, // bad repetition argument + ErrorRepeatOp, // bad repetition operator + ErrorBadPerlOp, // bad perl operator + ErrorBadUTF8, // invalid UTF-8 in regexp + ErrorBadNamedCapture, // bad named capture group + ErrorPatternTooLarge // pattern too large (compile failed) + }; + // Predefined common options. + // If you need more complicated things, instantiate + // an Option class, possibly passing one of these to + // the Option constructor, change the settings, and pass that + // Option class to the RE2 constructor. + enum CannedOptions { + DefaultOptions = 0, + Latin1, // treat input as Latin-1 (default UTF-8) + POSIX, // POSIX syntax, leftmost-longest match + Quiet // do not log about regexp parse errors + }; + // Need to have the const char* and const std::string& forms for implicit + // conversions when passing string literals to FullMatch and PartialMatch. + // Otherwise the StringPiece form would be sufficient. +#ifndef SWIG + RE2(const char* pattern); + RE2(const std::string& pattern); +#endif + RE2(const StringPiece& pattern); + RE2(const StringPiece& pattern, const Options& options); + ~RE2(); + // Returns whether RE2 was created properly. + bool ok() const { return error_code() == NoError; } + // The string specification for this RE2. E.g. + // RE2 re("ab*c?d+"); + // re.pattern(); // "ab*c?d+" + const std::string& pattern() const { return pattern_; } + // If RE2 could not be created properly, returns an error string. + // Else returns the empty string. + const std::string& error() const { return *error_; } + // If RE2 could not be created properly, returns an error code. + // Else returns RE2::NoError (== 0). + ErrorCode error_code() const { return error_code_; } -namespace duckdb { + // If RE2 could not be created properly, returns the offending + // portion of the regexp. + const std::string& error_arg() const { return error_arg_; } -struct RowDataBlock { - RowDataBlock(BufferManager &buffer_manager, idx_t capacity, idx_t entry_size) - : capacity(capacity), entry_size(entry_size), count(0), byte_offset(0) { - block = buffer_manager.RegisterMemory(capacity * entry_size, false); - } - //! The buffer block handle - shared_ptr block; - //! Capacity (number of entries) and entry size that fit in this block - idx_t capacity; - const idx_t entry_size; - //! Number of entries currently in this block - idx_t count; - //! Write offset (if variable size entries) - idx_t byte_offset; -}; + // Returns the program size, a very approximate measure of a regexp's "cost". + // Larger numbers are more expensive than smaller numbers. + int ProgramSize() const; + int ReverseProgramSize() const; -struct BlockAppendEntry { - BlockAppendEntry(data_ptr_t baseptr, idx_t count) : baseptr(baseptr), count(count) { - } - data_ptr_t baseptr; - idx_t count; -}; + // EXPERIMENTAL! SUBJECT TO CHANGE! + // Outputs the program fanout as a histogram bucketed by powers of 2. + // Returns the number of the largest non-empty bucket. + int ProgramFanout(std::map* histogram) const; + int ReverseProgramFanout(std::map* histogram) const; -class RowDataCollection { -public: - RowDataCollection(BufferManager &buffer_manager, idx_t block_capacity, idx_t entry_size, bool keep_pinned = false); + // Returns the underlying Regexp; not for general use. + // Returns entire_regexp_ so that callers don't need + // to know about prefix_ and prefix_foldcase_. + duckdb_re2::Regexp* Regexp() const { return entire_regexp_; } + + /***** The array-based matching interface ******/ + + // The functions here have names ending in 'N' and are used to implement + // the functions whose names are the prefix before the 'N'. It is sometimes + // useful to invoke them directly, but the syntax is awkward, so the 'N'-less + // versions should be preferred. + static bool FullMatchN(const StringPiece& text, const RE2& re, + const Arg* const args[], int n); + static bool PartialMatchN(const StringPiece& text, const RE2& re, + const Arg* const args[], int n); + static bool ConsumeN(StringPiece* input, const RE2& re, + const Arg* const args[], int n); + static bool FindAndConsumeN(StringPiece* input, const RE2& re, + const Arg* const args[], int n); + +#ifndef SWIG + private: + template + static inline bool Apply(F f, SP sp, const RE2& re) { + return f(sp, re, NULL, 0); + } + + template + static inline bool Apply(F f, SP sp, const RE2& re, const A&... a) { + const Arg* const args[] = {&a...}; + const int n = sizeof...(a); + return f(sp, re, args, n); + } + + public: + // In order to allow FullMatch() et al. to be called with a varying number + // of arguments of varying types, we use two layers of variadic templates. + // The first layer constructs the temporary Arg objects. The second layer + // (above) constructs the array of pointers to the temporary Arg objects. + + /***** The useful part: the matching interface *****/ + + // Matches "text" against "re". If pointer arguments are + // supplied, copies matched sub-patterns into them. + // + // You can pass in a "const char*" or a "std::string" for "text". + // You can pass in a "const char*" or a "std::string" or a "RE2" for "re". + // + // The provided pointer arguments can be pointers to any scalar numeric + // type, or one of: + // std::string (matched piece is copied to string) + // StringPiece (StringPiece is mutated to point to matched piece) + // T (where "bool T::ParseFrom(const char*, size_t)" exists) + // (void*)NULL (the corresponding matched sub-pattern is not copied) + // + // Returns true iff all of the following conditions are satisfied: + // a. "text" matches "re" exactly + // b. The number of matched sub-patterns is >= number of supplied pointers + // c. The "i"th argument has a suitable type for holding the + // string captured as the "i"th sub-pattern. If you pass in + // NULL for the "i"th argument, or pass fewer arguments than + // number of sub-patterns, "i"th captured sub-pattern is + // ignored. + // + // CAVEAT: An optional sub-pattern that does not exist in the + // matched string is assigned the empty string. Therefore, the + // following will return false (because the empty string is not a + // valid number): + // int number; + // RE2::FullMatch("abc", "[a-z]+(\\d+)?", &number); + template + static bool FullMatch(const StringPiece& text, const RE2& re, A&&... a) { + return Apply(FullMatchN, text, re, Arg(std::forward(a))...); + } + + // Exactly like FullMatch(), except that "re" is allowed to match + // a substring of "text". + template + static bool PartialMatch(const StringPiece& text, const RE2& re, A&&... a) { + return Apply(PartialMatchN, text, re, Arg(std::forward(a))...); + } + + // Like FullMatch() and PartialMatch(), except that "re" has to match + // a prefix of the text, and "input" is advanced past the matched + // text. Note: "input" is modified iff this routine returns true + // and "re" matched a non-empty substring of "text". + template + static bool Consume(StringPiece* input, const RE2& re, A&&... a) { + return Apply(ConsumeN, input, re, Arg(std::forward(a))...); + } + + // Like Consume(), but does not anchor the match at the beginning of + // the text. That is, "re" need not start its match at the beginning + // of "input". For example, "FindAndConsume(s, "(\\w+)", &word)" finds + // the next word in "s" and stores it in "word". + template + static bool FindAndConsume(StringPiece* input, const RE2& re, A&&... a) { + return Apply(FindAndConsumeN, input, re, Arg(std::forward(a))...); + } +#endif + + // Replace the first match of "re" in "str" with "rewrite". + // Within "rewrite", backslash-escaped digits (\1 to \9) can be + // used to insert text matching corresponding parenthesized group + // from the pattern. \0 in "rewrite" refers to the entire matching + // text. E.g., + // + // std::string s = "yabba dabba doo"; + // CHECK(RE2::Replace(&s, "b+", "d")); + // + // will leave "s" containing "yada dabba doo" + // + // Returns true if the pattern matches and a replacement occurs, + // false otherwise. + static bool Replace(std::string* str, + const RE2& re, + const StringPiece& rewrite); + + // Like Replace(), except replaces successive non-overlapping occurrences + // of the pattern in the string with the rewrite. E.g. + // + // std::string s = "yabba dabba doo"; + // CHECK(RE2::GlobalReplace(&s, "b+", "d")); + // + // will leave "s" containing "yada dada doo" + // Replacements are not subject to re-matching. + // + // Because GlobalReplace only replaces non-overlapping matches, + // replacing "ana" within "banana" makes only one replacement, not two. + // + // Returns the number of replacements made. + static int GlobalReplace(std::string* str, + const RE2& re, + const StringPiece& rewrite); + + // Like Replace, except that if the pattern matches, "rewrite" + // is copied into "out" with substitutions. The non-matching + // portions of "text" are ignored. + // + // Returns true iff a match occurred and the extraction happened + // successfully; if no match occurs, the string is left unaffected. + // + // REQUIRES: "text" must not alias any part of "*out". + static bool Extract(const StringPiece& text, + const RE2& re, + const StringPiece& rewrite, + std::string* out); + + // Escapes all potentially meaningful regexp characters in + // 'unquoted'. The returned string, used as a regular expression, + // will exactly match the original string. For example, + // 1.5-2.0? + // may become: + // 1\.5\-2\.0\? + static std::string QuoteMeta(const StringPiece& unquoted); + + // Computes range for any strings matching regexp. The min and max can in + // some cases be arbitrarily precise, so the caller gets to specify the + // maximum desired length of string returned. + // + // Assuming PossibleMatchRange(&min, &max, N) returns successfully, any + // string s that is an anchored match for this regexp satisfies + // min <= s && s <= max. + // + // Note that PossibleMatchRange() will only consider the first copy of an + // infinitely repeated element (i.e., any regexp element followed by a '*' or + // '+' operator). Regexps with "{N}" constructions are not affected, as those + // do not compile down to infinite repetitions. + // + // Returns true on success, false on error. + bool PossibleMatchRange(std::string* min, std::string* max, + int maxlen) const; + + // Generic matching interface + + // Type of match. + enum Anchor { + UNANCHORED, // No anchoring + ANCHOR_START, // Anchor at start only + ANCHOR_BOTH // Anchor at start and end + }; + + // Return the number of capturing subpatterns, or -1 if the + // regexp wasn't valid on construction. The overall match ($0) + // does not count: if the regexp is "(a)(b)", returns 2. + int NumberOfCapturingGroups() const { return num_captures_; } + + // Return a map from names to capturing indices. + // The map records the index of the leftmost group + // with the given name. + // Only valid until the re is deleted. + const std::map& NamedCapturingGroups() const; + + // Return a map from capturing indices to names. + // The map has no entries for unnamed groups. + // Only valid until the re is deleted. + const std::map& CapturingGroupNames() const; + + // General matching routine. + // Match against text starting at offset startpos + // and stopping the search at offset endpos. + // Returns true if match found, false if not. + // On a successful match, fills in submatch[] (up to nsubmatch entries) + // with information about submatches. + // I.e. matching RE2("(foo)|(bar)baz") on "barbazbla" will return true, with + // submatch[0] = "barbaz", submatch[1].data() = NULL, submatch[2] = "bar", + // submatch[3].data() = NULL, ..., up to submatch[nsubmatch-1].data() = NULL. + // Caveat: submatch[] may be clobbered even on match failure. + // + // Don't ask for more match information than you will use: + // runs much faster with nsubmatch == 1 than nsubmatch > 1, and + // runs even faster if nsubmatch == 0. + // Doesn't make sense to use nsubmatch > 1 + NumberOfCapturingGroups(), + // but will be handled correctly. + // + // Passing text == StringPiece(NULL, 0) will be handled like any other + // empty string, but note that on return, it will not be possible to tell + // whether submatch i matched the empty string or did not match: + // either way, submatch[i].data() == NULL. + bool Match(const StringPiece& text, + size_t startpos, + size_t endpos, + Anchor re_anchor, + StringPiece* submatch, + int nsubmatch) const; + + // Check that the given rewrite string is suitable for use with this + // regular expression. It checks that: + // * The regular expression has enough parenthesized subexpressions + // to satisfy all of the \N tokens in rewrite + // * The rewrite string doesn't have any syntax errors. E.g., + // '\' followed by anything other than a digit or '\'. + // A true return value guarantees that Replace() and Extract() won't + // fail because of a bad rewrite string. + bool CheckRewriteString(const StringPiece& rewrite, + std::string* error) const; + + // Returns the maximum submatch needed for the rewrite to be done by + // Replace(). E.g. if rewrite == "foo \\2,\\1", returns 2. + static int MaxSubmatch(const StringPiece& rewrite); + + // Append the "rewrite" string, with backslash subsitutions from "vec", + // to string "out". + // Returns true on success. This method can fail because of a malformed + // rewrite string. CheckRewriteString guarantees that the rewrite will + // be sucessful. + bool Rewrite(std::string* out, + const StringPiece& rewrite, + const StringPiece* vec, + int veclen) const; + + // Constructor options + class Options { + public: + // The options are (defaults in parentheses): + // + // utf8 (true) text and pattern are UTF-8; otherwise Latin-1 + // posix_syntax (false) restrict regexps to POSIX egrep syntax + // longest_match (false) search for longest match, not first match + // log_errors (true) log syntax and execution errors to ERROR + // max_mem (see below) approx. max memory footprint of RE2 + // literal (false) interpret string as literal, not regexp + // never_nl (false) never match \n, even if it is in regexp + // dot_nl (false) dot matches everything including new line + // never_capture (false) parse all parens as non-capturing + // case_sensitive (true) match is case-sensitive (regexp can override + // with (?i) unless in posix_syntax mode) + // + // The following options are only consulted when posix_syntax == true. + // When posix_syntax == false, these features are always enabled and + // cannot be turned off; to perform multi-line matching in that case, + // begin the regexp with (?m). + // perl_classes (false) allow Perl's \d \s \w \D \S \W + // word_boundary (false) allow Perl's \b \B (word boundary and not) + // one_line (false) ^ and $ only match beginning and end of text + // + // The max_mem option controls how much memory can be used + // to hold the compiled form of the regexp (the Prog) and + // its cached DFA graphs. Code Search placed limits on the number + // of Prog instructions and DFA states: 10,000 for both. + // In RE2, those limits would translate to about 240 KB per Prog + // and perhaps 2.5 MB per DFA (DFA state sizes vary by regexp; RE2 does a + // better job of keeping them small than Code Search did). + // Each RE2 has two Progs (one forward, one reverse), and each Prog + // can have two DFAs (one first match, one longest match). + // That makes 4 DFAs: + // + // forward, first-match - used for UNANCHORED or ANCHOR_START searches + // if opt.longest_match() == false + // forward, longest-match - used for all ANCHOR_BOTH searches, + // and the other two kinds if + // opt.longest_match() == true + // reverse, first-match - never used + // reverse, longest-match - used as second phase for unanchored searches + // + // The RE2 memory budget is statically divided between the two + // Progs and then the DFAs: two thirds to the forward Prog + // and one third to the reverse Prog. The forward Prog gives half + // of what it has left over to each of its DFAs. The reverse Prog + // gives it all to its longest-match DFA. + // + // Once a DFA fills its budget, it flushes its cache and starts over. + // If this happens too often, RE2 falls back on the NFA implementation. + + // For now, make the default budget something close to Code Search. + static const int kDefaultMaxMem = 8<<20; + + enum Encoding { + EncodingUTF8 = 1, + EncodingLatin1 + }; + + Options() : + encoding_(EncodingUTF8), + posix_syntax_(false), + longest_match_(false), + log_errors_(true), + max_mem_(kDefaultMaxMem), + literal_(false), + never_nl_(false), + dot_nl_(false), + never_capture_(false), + case_sensitive_(true), + perl_classes_(false), + word_boundary_(false), + one_line_(false) { + } + + /*implicit*/ Options(CannedOptions); + + Encoding encoding() const { return encoding_; } + void set_encoding(Encoding encoding) { encoding_ = encoding; } + + // Legacy interface to encoding. + // TODO(rsc): Remove once clients have been converted. + bool utf8() const { return encoding_ == EncodingUTF8; } + void set_utf8(bool b) { + if (b) { + encoding_ = EncodingUTF8; + } else { + encoding_ = EncodingLatin1; + } + } + + bool posix_syntax() const { return posix_syntax_; } + void set_posix_syntax(bool b) { posix_syntax_ = b; } + + bool longest_match() const { return longest_match_; } + void set_longest_match(bool b) { longest_match_ = b; } + + bool log_errors() const { return log_errors_; } + void set_log_errors(bool b) { log_errors_ = b; } + + int64_t max_mem() const { return max_mem_; } + void set_max_mem(int64_t m) { max_mem_ = m; } + + bool literal() const { return literal_; } + void set_literal(bool b) { literal_ = b; } + + bool never_nl() const { return never_nl_; } + void set_never_nl(bool b) { never_nl_ = b; } + + bool dot_nl() const { return dot_nl_; } + void set_dot_nl(bool b) { dot_nl_ = b; } + + bool never_capture() const { return never_capture_; } + void set_never_capture(bool b) { never_capture_ = b; } + + bool case_sensitive() const { return case_sensitive_; } + void set_case_sensitive(bool b) { case_sensitive_ = b; } + + bool perl_classes() const { return perl_classes_; } + void set_perl_classes(bool b) { perl_classes_ = b; } + + bool word_boundary() const { return word_boundary_; } + void set_word_boundary(bool b) { word_boundary_ = b; } + + bool one_line() const { return one_line_; } + void set_one_line(bool b) { one_line_ = b; } + + void Copy(const Options& src) { + *this = src; + } + + int ParseFlags() const; + + private: + Encoding encoding_; + bool posix_syntax_; + bool longest_match_; + bool log_errors_; + int64_t max_mem_; + bool literal_; + bool never_nl_; + bool dot_nl_; + bool never_capture_; + bool case_sensitive_; + bool perl_classes_; + bool word_boundary_; + bool one_line_; + }; + + // Returns the options set in the constructor. + const Options& options() const { return options_; } + + // Argument converters; see below. + static inline Arg CRadix(short* x); + static inline Arg CRadix(unsigned short* x); + static inline Arg CRadix(int* x); + static inline Arg CRadix(unsigned int* x); + static inline Arg CRadix(long* x); + static inline Arg CRadix(unsigned long* x); + static inline Arg CRadix(long long* x); + static inline Arg CRadix(unsigned long long* x); + + static inline Arg Hex(short* x); + static inline Arg Hex(unsigned short* x); + static inline Arg Hex(int* x); + static inline Arg Hex(unsigned int* x); + static inline Arg Hex(long* x); + static inline Arg Hex(unsigned long* x); + static inline Arg Hex(long long* x); + static inline Arg Hex(unsigned long long* x); + + static inline Arg Octal(short* x); + static inline Arg Octal(unsigned short* x); + static inline Arg Octal(int* x); + static inline Arg Octal(unsigned int* x); + static inline Arg Octal(long* x); + static inline Arg Octal(unsigned long* x); + static inline Arg Octal(long long* x); + static inline Arg Octal(unsigned long long* x); + + private: + void Init(const StringPiece& pattern, const Options& options); + + bool DoMatch(const StringPiece& text, + Anchor re_anchor, + size_t* consumed, + const Arg* const args[], + int n) const; + + duckdb_re2::Prog* ReverseProg() const; + + std::string pattern_; // string regular expression + Options options_; // option flags + std::string prefix_; // required prefix (before regexp_) + bool prefix_foldcase_; // prefix is ASCII case-insensitive + duckdb_re2::Regexp* entire_regexp_; // parsed regular expression + duckdb_re2::Regexp* suffix_regexp_; // parsed regular expression, prefix removed + duckdb_re2::Prog* prog_; // compiled program for regexp + int num_captures_; // Number of capturing groups + bool is_one_pass_; // can use prog_->SearchOnePass? + + mutable duckdb_re2::Prog* rprog_; // reverse program for regexp + mutable const std::string* error_; // Error indicator + // (or points to empty string) + mutable ErrorCode error_code_; // Error code + mutable std::string error_arg_; // Fragment of regexp showing error + + // Map from capture names to indices + mutable const std::map* named_groups_; + + // Map from capture indices to names + mutable const std::map* group_names_; + + // Onces for lazy computations. + mutable std::once_flag rprog_once_; + mutable std::once_flag named_groups_once_; + mutable std::once_flag group_names_once_; + + RE2(const RE2&) = delete; + RE2& operator=(const RE2&) = delete; +}; + +/***** Implementation details *****/ + +// Hex/Octal/Binary? + +// Special class for parsing into objects that define a ParseFrom() method +template +class _RE2_MatchObject { + public: + static inline bool Parse(const char* str, size_t n, void* dest) { + if (dest == NULL) return true; + T* object = reinterpret_cast(dest); + return object->ParseFrom(str, n); + } +}; + +class RE2::Arg { + public: + // Empty constructor so we can declare arrays of RE2::Arg + Arg(); + + // Constructor specially designed for NULL arguments + Arg(void*); + Arg(std::nullptr_t); + + typedef bool (*Parser)(const char* str, size_t n, void* dest); + +// Type-specific parsers +#define MAKE_PARSER(type, name) \ + Arg(type* p) : arg_(p), parser_(name) {} \ + Arg(type* p, Parser parser) : arg_(p), parser_(parser) {} + + MAKE_PARSER(char, parse_char) + MAKE_PARSER(signed char, parse_schar) + MAKE_PARSER(unsigned char, parse_uchar) + MAKE_PARSER(float, parse_float) + MAKE_PARSER(double, parse_double) + MAKE_PARSER(std::string, parse_string) + MAKE_PARSER(StringPiece, parse_stringpiece) + + MAKE_PARSER(short, parse_short) + MAKE_PARSER(unsigned short, parse_ushort) + MAKE_PARSER(int, parse_int) + MAKE_PARSER(unsigned int, parse_uint) + MAKE_PARSER(long, parse_long) + MAKE_PARSER(unsigned long, parse_ulong) + MAKE_PARSER(long long, parse_longlong) + MAKE_PARSER(unsigned long long, parse_ulonglong) + +#undef MAKE_PARSER + + // Generic constructor templates + template Arg(T* p) + : arg_(p), parser_(_RE2_MatchObject::Parse) { } + template Arg(T* p, Parser parser) + : arg_(p), parser_(parser) { } + + // Parse the data + bool Parse(const char* str, size_t n) const; + + private: + void* arg_; + Parser parser_; + + static bool parse_null (const char* str, size_t n, void* dest); + static bool parse_char (const char* str, size_t n, void* dest); + static bool parse_schar (const char* str, size_t n, void* dest); + static bool parse_uchar (const char* str, size_t n, void* dest); + static bool parse_float (const char* str, size_t n, void* dest); + static bool parse_double (const char* str, size_t n, void* dest); + static bool parse_string (const char* str, size_t n, void* dest); + static bool parse_stringpiece (const char* str, size_t n, void* dest); + +#define DECLARE_INTEGER_PARSER(name) \ + private: \ + static bool parse_##name(const char* str, size_t n, void* dest); \ + static bool parse_##name##_radix(const char* str, size_t n, void* dest, \ + int radix); \ + \ + public: \ + static bool parse_##name##_hex(const char* str, size_t n, void* dest); \ + static bool parse_##name##_octal(const char* str, size_t n, void* dest); \ + static bool parse_##name##_cradix(const char* str, size_t n, void* dest); + + DECLARE_INTEGER_PARSER(short) + DECLARE_INTEGER_PARSER(ushort) + DECLARE_INTEGER_PARSER(int) + DECLARE_INTEGER_PARSER(uint) + DECLARE_INTEGER_PARSER(long) + DECLARE_INTEGER_PARSER(ulong) + DECLARE_INTEGER_PARSER(longlong) + DECLARE_INTEGER_PARSER(ulonglong) + +#undef DECLARE_INTEGER_PARSER + +}; + +inline RE2::Arg::Arg() : arg_(NULL), parser_(parse_null) { } +inline RE2::Arg::Arg(void* p) : arg_(p), parser_(parse_null) { } +inline RE2::Arg::Arg(std::nullptr_t p) : arg_(p), parser_(parse_null) { } + +inline bool RE2::Arg::Parse(const char* str, size_t n) const { + return (*parser_)(str, n, arg_); +} + +// This part of the parser, appropriate only for ints, deals with bases +#define MAKE_INTEGER_PARSER(type, name) \ + inline RE2::Arg RE2::Hex(type* ptr) { \ + return RE2::Arg(ptr, RE2::Arg::parse_##name##_hex); \ + } \ + inline RE2::Arg RE2::Octal(type* ptr) { \ + return RE2::Arg(ptr, RE2::Arg::parse_##name##_octal); \ + } \ + inline RE2::Arg RE2::CRadix(type* ptr) { \ + return RE2::Arg(ptr, RE2::Arg::parse_##name##_cradix); \ + } + +MAKE_INTEGER_PARSER(short, short) +MAKE_INTEGER_PARSER(unsigned short, ushort) +MAKE_INTEGER_PARSER(int, int) +MAKE_INTEGER_PARSER(unsigned int, uint) +MAKE_INTEGER_PARSER(long, long) +MAKE_INTEGER_PARSER(unsigned long, ulong) +MAKE_INTEGER_PARSER(long long, longlong) +MAKE_INTEGER_PARSER(unsigned long long, ulonglong) + +#undef MAKE_INTEGER_PARSER + +#ifndef SWIG + + +// Helper for writing global or static RE2s safely. +// Write +// static LazyRE2 re = {".*"}; +// and then use *re instead of writing +// static RE2 re(".*"); +// The former is more careful about multithreaded +// situations than the latter. +// +// N.B. This class never deletes the RE2 object that +// it constructs: that's a feature, so that it can be used +// for global and function static variables. +class LazyRE2 { + private: + struct NoArg {}; + + public: + typedef RE2 element_type; // support std::pointer_traits + + // Constructor omitted to preserve braced initialization in C++98. + + // Pretend to be a pointer to Type (never NULL due to on-demand creation): + RE2& operator*() const { return *get(); } + RE2* operator->() const { return get(); } + + // Named accessor/initializer: + RE2* get() const { + std::call_once(once_, &LazyRE2::Init, this); + return ptr_; + } + + // All data fields must be public to support {"foo"} initialization. + const char* pattern_; + RE2::CannedOptions options_; + NoArg barrier_against_excess_initializers_; + + mutable RE2* ptr_; + mutable std::once_flag once_; + + private: + static void Init(const LazyRE2* lazy_re2) { + lazy_re2->ptr_ = new RE2(lazy_re2->pattern_, lazy_re2->options_); + } + + void operator=(const LazyRE2&); // disallowed +}; +#endif // SWIG + +} // namespace duckdb_re2 + +using duckdb_re2::RE2; +using duckdb_re2::LazyRE2; + +#endif // RE2_RE2_H_ + + +// LICENSE_CHANGE_END + + +namespace duckdb_re2 { + +Regex::Regex(const std::string &pattern, RegexOptions options) { + RE2::Options o; + o.set_case_sensitive(options == RegexOptions::CASE_INSENSITIVE); + regex = std::make_shared(StringPiece(pattern), o); +} + +bool RegexSearchInternal(const char *input, Match &match, const Regex &r, RE2::Anchor anchor, size_t start, + size_t end) { + auto ®ex = r.GetRegex(); + std::vector target_groups; + auto group_count = regex.NumberOfCapturingGroups() + 1; + target_groups.resize(group_count); + match.groups.clear(); + if (!regex.Match(StringPiece(input), start, end, anchor, target_groups.data(), group_count)) { + return false; + } + for (auto &group : target_groups) { + GroupMatch group_match; + group_match.text = group.ToString(); + group_match.position = group.data() - input; + match.groups.emplace_back(group_match); + } + return true; +} + +bool RegexSearch(const std::string &input, Match &match, const Regex ®ex) { + return RegexSearchInternal(input.c_str(), match, regex, RE2::UNANCHORED, 0, input.size()); +} + +bool RegexMatch(const std::string &input, Match &match, const Regex ®ex) { + return RegexSearchInternal(input.c_str(), match, regex, RE2::ANCHOR_BOTH, 0, input.size()); +} + +bool RegexMatch(const char *start, const char *end, Match &match, const Regex ®ex) { + return RegexSearchInternal(start, match, regex, RE2::ANCHOR_BOTH, 0, end - start); +} + +bool RegexMatch(const std::string &input, const Regex ®ex) { + Match nop_match; + return RegexSearchInternal(input.c_str(), nop_match, regex, RE2::ANCHOR_BOTH, 0, input.size()); +} + +std::vector RegexFindAll(const std::string &input, const Regex ®ex) { + std::vector matches; + size_t position = 0; + Match match; + while (RegexSearchInternal(input.c_str(), match, regex, RE2::UNANCHORED, position, input.size())) { + position += match.position(0) + match.length(0); + matches.emplace_back(std::move(match)); + } + return matches; +} + +} // namespace duckdb_re2//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/types/row_operations/row_aggregate.cpp +// +// +//===----------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/row_operations/row_operations.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + +namespace duckdb { + +struct AggregateObject; +class DataChunk; +class RowLayout; +class RowDataCollection; +struct SelectionVector; +class StringHeap; +class Vector; +struct VectorData; + +// RowOperations contains a set of operations that operate on data using a RowLayout +struct RowOperations { + //===--------------------------------------------------------------------===// + // Aggregation Operators + //===--------------------------------------------------------------------===// + //! initialize - unaligned addresses + static void InitializeStates(RowLayout &layout, Vector &addresses, const SelectionVector &sel, idx_t count); + //! destructor - unaligned addresses, updated + static void DestroyStates(RowLayout &layout, Vector &addresses, idx_t count); + //! update - aligned addresses + static void UpdateStates(AggregateObject &aggr, Vector &addresses, DataChunk &payload, idx_t arg_idx, idx_t count); + //! filtered update - aligned addresses + static void UpdateFilteredStates(AggregateObject &aggr, Vector &addresses, DataChunk &payload, idx_t arg_idx); + //! combine - unaligned addresses, updated + static void CombineStates(RowLayout &layout, Vector &sources, Vector &targets, idx_t count); + //! finalize - unaligned addresses, updated + static void FinalizeStates(RowLayout &layout, Vector &addresses, DataChunk &result, idx_t aggr_idx); + + //===--------------------------------------------------------------------===// + // Read/Write Operators + //===--------------------------------------------------------------------===// + //! Scatter group data to the rows. Initialises the ValidityMask. + static void Scatter(DataChunk &columns, VectorData col_data[], const RowLayout &layout, Vector &rows, + RowDataCollection &string_heap, const SelectionVector &sel, idx_t count); + //! Gather a single column. + static void Gather(Vector &rows, const SelectionVector &row_sel, Vector &col, const SelectionVector &col_sel, + const idx_t count, const idx_t col_offset, const idx_t col_no, const idx_t build_size = 0); + //! Full Scan an entire columns + static void FullScanColumn(const RowLayout &layout, Vector &rows, Vector &col, idx_t count, idx_t col_idx); + + //===--------------------------------------------------------------------===// + // Comparison Operators + //===--------------------------------------------------------------------===// + //! Compare a block of key data against the row values to produce an updated selection that matches + //! and a second (optional) selection of non-matching values. + //! Returns the number of matches remaining in the selection. + using Predicates = vector; + + static idx_t Match(DataChunk &columns, VectorData col_data[], const RowLayout &layout, Vector &rows, + const Predicates &predicates, SelectionVector &sel, idx_t count, SelectionVector *no_match, + idx_t &no_match_count); + + //===--------------------------------------------------------------------===// + // Heap Operators + //===--------------------------------------------------------------------===// + //! Compute the entry sizes of a vector with variable size type (used before building heap buffer space). + static void ComputeEntrySizes(Vector &v, idx_t entry_sizes[], idx_t vcount, idx_t ser_count, + const SelectionVector &sel, idx_t offset = 0); + //! Compute the entry sizes of vector data with variable size type (used before building heap buffer space). + static void ComputeEntrySizes(Vector &v, VectorData &vdata, idx_t entry_sizes[], idx_t vcount, idx_t ser_count, + const SelectionVector &sel, idx_t offset = 0); + //! Scatter vector with variable size type to the heap. + static void HeapScatter(Vector &v, idx_t vcount, const SelectionVector &sel, idx_t ser_count, idx_t col_idx, + data_ptr_t *key_locations, data_ptr_t *validitymask_locations, idx_t offset = 0); + //! Scatter vector data with variable size type to the heap. + static void HeapScatterVData(VectorData &vdata, PhysicalType type, const SelectionVector &sel, idx_t ser_count, + idx_t col_idx, data_ptr_t *key_locations, data_ptr_t *validitymask_locations, + idx_t offset = 0); + //! Gather a single column with variable size type from the heap. + static void HeapGather(Vector &v, const idx_t &vcount, const SelectionVector &sel, const idx_t &col_idx, + data_ptr_t key_locations[], data_ptr_t validitymask_locations[]); + + //===--------------------------------------------------------------------===// + // Sorting Operators + //===--------------------------------------------------------------------===// + //! Scatter vector data to the rows in radix-sortable format. + static void RadixScatter(Vector &v, idx_t vcount, const SelectionVector &sel, idx_t ser_count, + data_ptr_t key_locations[], bool desc, bool has_null, bool nulls_first, idx_t prefix_len, + idx_t width, idx_t offset = 0); + + //===--------------------------------------------------------------------===// + // Out-of-Core Operators + //===--------------------------------------------------------------------===// + //! Swizzles blob pointers to offset within heap row + static void SwizzleColumns(const RowLayout &layout, const data_ptr_t base_row_ptr, const idx_t count); + //! Swizzles the base pointer of each row to offset within heap block + static void SwizzleHeapPointer(const RowLayout &layout, data_ptr_t row_ptr, const data_ptr_t heap_base_ptr, + const idx_t count); + //! Unswizzles all offsets back to pointers + static void UnswizzlePointers(const RowLayout &layout, const data_ptr_t base_row_ptr, + const data_ptr_t base_heap_ptr, const idx_t count); +}; + +} // namespace duckdb + + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/types/row_layout.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + + + +namespace duckdb { +class BoundAggregateExpression; + +struct AggregateObject { + AggregateObject(AggregateFunction function, FunctionData *bind_data, idx_t child_count, idx_t payload_size, + bool distinct, PhysicalType return_type, Expression *filter = nullptr) + : function(move(function)), bind_data(bind_data), child_count(child_count), payload_size(payload_size), + distinct(distinct), return_type(return_type), filter(filter) { + } + + AggregateFunction function; + FunctionData *bind_data; + idx_t child_count; + idx_t payload_size; + bool distinct; + PhysicalType return_type; + Expression *filter = nullptr; + + static vector CreateAggregateObjects(const vector &bindings); +}; + +class RowLayout { +public: + using Aggregates = vector; + using ValidityBytes = TemplatedValidityMask; + + //! Creates an empty RowLayout + RowLayout(); + +public: + //! Initializes the RowLayout with the specified types and aggregates to an empty RowLayout + void Initialize(vector types_p, Aggregates aggregates_p, bool align = true); + //! Initializes the RowLayout with the specified types to an empty RowLayout + void Initialize(vector types, bool align = true); + //! Initializes the RowLayout with the specified aggregates to an empty RowLayout + void Initialize(Aggregates aggregates_p, bool align = true); + //! Returns the number of data columns + inline idx_t ColumnCount() const { + return types.size(); + } + //! Returns a list of the column types for this data chunk + inline const vector &GetTypes() const { + return types; + } + //! Returns the number of aggregates + inline idx_t AggregateCount() const { + return aggregates.size(); + } + //! Returns a list of the aggregates for this data chunk + inline Aggregates &GetAggregates() { + return aggregates; + } + //! Returns the total width required for each row, including padding + inline idx_t GetRowWidth() const { + return row_width; + } + //! Returns the offset to the start of the data + inline idx_t GetDataOffset() const { + return flag_width; + } + //! Returns the total width required for the data, including padding + inline idx_t GetDataWidth() const { + return data_width; + } + //! Returns the offset to the start of the aggregates + inline idx_t GetAggrOffset() const { + return flag_width + data_width; + } + //! Returns the total width required for the aggregates, including padding + inline idx_t GetAggrWidth() const { + return aggr_width; + } + //! Returns the column offsets into each row + inline const vector &GetOffsets() const { + return offsets; + } + //! Returns whether all columns in this layout are constant size + inline bool AllConstant() const { + return all_constant; + } + inline idx_t GetHeapPointerOffset() const { + return heap_pointer_offset; + } + +private: + //! The types of the data columns + vector types; + //! The aggregate functions + Aggregates aggregates; + //! The width of the validity header + idx_t flag_width; + //! The width of the data portion + idx_t data_width; + //! The width of the aggregate state portion + idx_t aggr_width; + //! The width of the entire row + idx_t row_width; + //! The offsets to the columns and aggregate data in each row + vector offsets; + //! Whether all columns in this layout are constant size + bool all_constant; + //! Offset to the pointer to the heap for each row + idx_t heap_pointer_offset; +}; + +} // namespace duckdb + + + + +namespace duckdb { + +void RowOperations::InitializeStates(RowLayout &layout, Vector &addresses, const SelectionVector &sel, idx_t count) { + if (count == 0) { + return; + } + auto pointers = FlatVector::GetData(addresses); + auto &offsets = layout.GetOffsets(); + auto aggr_idx = layout.ColumnCount(); + + for (auto &aggr : layout.GetAggregates()) { + for (idx_t i = 0; i < count; ++i) { + auto row_idx = sel.get_index(i); + auto row = pointers[row_idx]; + aggr.function.initialize(row + offsets[aggr_idx]); + } + ++aggr_idx; + } +} + +void RowOperations::DestroyStates(RowLayout &layout, Vector &addresses, idx_t count) { + if (count == 0) { + return; + } + // Move to the first aggregate state + VectorOperations::AddInPlace(addresses, layout.GetAggrOffset(), count); + for (auto &aggr : layout.GetAggregates()) { + if (aggr.function.destructor) { + aggr.function.destructor(addresses, count); + } + // Move to the next aggregate state + VectorOperations::AddInPlace(addresses, aggr.payload_size, count); + } +} + +void RowOperations::UpdateStates(AggregateObject &aggr, Vector &addresses, DataChunk &payload, idx_t arg_idx, + idx_t count) { + aggr.function.update(aggr.child_count == 0 ? nullptr : &payload.data[arg_idx], aggr.bind_data, aggr.child_count, + addresses, count); +} + +void RowOperations::UpdateFilteredStates(AggregateObject &aggr, Vector &addresses, DataChunk &payload, idx_t arg_idx) { + ExpressionExecutor filter_execution(aggr.filter); + SelectionVector true_sel(STANDARD_VECTOR_SIZE); + auto count = filter_execution.SelectExpression(payload, true_sel); + + DataChunk filtered_payload; + auto pay_types = payload.GetTypes(); + filtered_payload.Initialize(pay_types); + filtered_payload.Slice(payload, true_sel, count); + + Vector filtered_addresses(addresses, true_sel, count); + filtered_addresses.Normalify(count); + + UpdateStates(aggr, filtered_addresses, filtered_payload, arg_idx, filtered_payload.size()); +} + +void RowOperations::CombineStates(RowLayout &layout, Vector &sources, Vector &targets, idx_t count) { + if (count == 0) { + return; + } + + // Move to the first aggregate states + VectorOperations::AddInPlace(sources, layout.GetAggrOffset(), count); + VectorOperations::AddInPlace(targets, layout.GetAggrOffset(), count); + for (auto &aggr : layout.GetAggregates()) { + D_ASSERT(aggr.function.combine); + aggr.function.combine(sources, targets, count); + + // Move to the next aggregate states + VectorOperations::AddInPlace(sources, aggr.payload_size, count); + VectorOperations::AddInPlace(targets, aggr.payload_size, count); + } +} + +void RowOperations::FinalizeStates(RowLayout &layout, Vector &addresses, DataChunk &result, idx_t aggr_idx) { + // Move to the first aggregate state + VectorOperations::AddInPlace(addresses, layout.GetAggrOffset(), result.size()); + + auto &aggregates = layout.GetAggregates(); + for (idx_t i = 0; i < aggregates.size(); i++) { + auto &target = result.data[aggr_idx + i]; + auto &aggr = aggregates[i]; + aggr.function.finalize(addresses, aggr.bind_data, target, result.size(), 0); + + // Move to the next aggregate state + VectorOperations::AddInPlace(addresses, aggr.payload_size, result.size()); + } +} + +} // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/types/row_operations/row_external.cpp +// +// +//===----------------------------------------------------------------------===// + + + +namespace duckdb { + +void RowOperations::SwizzleColumns(const RowLayout &layout, const data_ptr_t base_row_ptr, const idx_t count) { + const idx_t row_width = layout.GetRowWidth(); + data_ptr_t heap_row_ptrs[STANDARD_VECTOR_SIZE]; + idx_t done = 0; + while (done != count) { + const idx_t next = MinValue(count - done, STANDARD_VECTOR_SIZE); + const data_ptr_t row_ptr = base_row_ptr + done * row_width; + // Load heap row pointers + data_ptr_t heap_ptr_ptr = row_ptr + layout.GetHeapPointerOffset(); + for (idx_t i = 0; i < next; i++) { + heap_row_ptrs[i] = Load(heap_ptr_ptr); + heap_ptr_ptr += row_width; + } + // Loop through the blob columns + for (idx_t col_idx = 0; col_idx < layout.ColumnCount(); col_idx++) { + auto physical_type = layout.GetTypes()[col_idx].InternalType(); + if (TypeIsConstantSize(physical_type)) { + continue; + } + data_ptr_t col_ptr = row_ptr + layout.GetOffsets()[col_idx]; + if (physical_type == PhysicalType::VARCHAR) { + data_ptr_t string_ptr = col_ptr + sizeof(uint32_t) + string_t::PREFIX_LENGTH; + for (idx_t i = 0; i < next; i++) { + if (Load(col_ptr) > string_t::INLINE_LENGTH) { + // Overwrite the string pointer with the within-row offset (if not inlined) + Store(Load(string_ptr) - heap_row_ptrs[i], string_ptr); + } + col_ptr += row_width; + string_ptr += row_width; + } + } else { + // Non-varchar blob columns + for (idx_t i = 0; i < next; i++) { + // Overwrite the column data pointer with the within-row offset + Store(Load(col_ptr) - heap_row_ptrs[i], col_ptr); + col_ptr += row_width; + } + } + } + done += next; + } +} + +void RowOperations::SwizzleHeapPointer(const RowLayout &layout, data_ptr_t row_ptr, const data_ptr_t heap_base_ptr, + const idx_t count) { + const idx_t row_width = layout.GetRowWidth(); + row_ptr += layout.GetHeapPointerOffset(); + idx_t cumulative_offset = 0; + for (idx_t i = 0; i < count; i++) { + Store(cumulative_offset, row_ptr); + cumulative_offset += Load(heap_base_ptr + cumulative_offset); + row_ptr += row_width; + } +} + +void RowOperations::UnswizzlePointers(const RowLayout &layout, const data_ptr_t base_row_ptr, + const data_ptr_t base_heap_ptr, const idx_t count) { + const idx_t row_width = layout.GetRowWidth(); + data_ptr_t heap_row_ptrs[STANDARD_VECTOR_SIZE]; + idx_t done = 0; + while (done != count) { + const idx_t next = MinValue(count - done, STANDARD_VECTOR_SIZE); + const data_ptr_t row_ptr = base_row_ptr + done * row_width; + // Restore heap row pointers + data_ptr_t heap_ptr_ptr = row_ptr + layout.GetHeapPointerOffset(); + for (idx_t i = 0; i < next; i++) { + heap_row_ptrs[i] = base_heap_ptr + Load(heap_ptr_ptr); + Store(heap_row_ptrs[i], heap_ptr_ptr); + heap_ptr_ptr += row_width; + } + // Loop through the blob columns + for (idx_t col_idx = 0; col_idx < layout.ColumnCount(); col_idx++) { + auto physical_type = layout.GetTypes()[col_idx].InternalType(); + if (TypeIsConstantSize(physical_type)) { + continue; + } + data_ptr_t col_ptr = row_ptr + layout.GetOffsets()[col_idx]; + if (physical_type == PhysicalType::VARCHAR) { + data_ptr_t string_ptr = col_ptr + sizeof(uint32_t) + string_t::PREFIX_LENGTH; + for (idx_t i = 0; i < next; i++) { + if (Load(col_ptr) > string_t::INLINE_LENGTH) { + // Overwrite the string offset with the pointer (if not inlined) + Store(heap_row_ptrs[i] + Load(string_ptr), string_ptr); + } + col_ptr += row_width; + string_ptr += row_width; + } + } else { + // Non-varchar blob columns + for (idx_t i = 0; i < next; i++) { + // Overwrite the column data offset with the pointer + Store(heap_row_ptrs[i] + Load(col_ptr), col_ptr); + col_ptr += row_width; + } + } + } + done += next; + } +} + +} // namespace duckdb +//===--------------------------------------------------------------------===// +// row_gather.cpp +// Description: This file contains the implementation of the gather operators +//===--------------------------------------------------------------------===// + + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/operator/constant_operators.hpp +// +// +//===----------------------------------------------------------------------===// + + + +namespace duckdb { + +struct PickLeft { + template + static inline T Operation(T left, T right) { + return left; + } +}; + +struct PickRight { + template + static inline T Operation(T left, T right) { + return right; + } +}; + +struct NOP { + template + static inline T Operation(T left) { + return left; + } +}; + +struct ConstantZero { + template + static inline T Operation(T left, T right) { + return 0; + } +}; + +struct ConstantOne { + template + static inline T Operation(T left, T right) { + return 1; + } +}; + +struct AddOne { + template + static inline T Operation(T left, T right) { + return right + 1; + } +}; + +} // namespace duckdb + + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/types/row_data_collection.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + + +namespace duckdb { + +struct RowDataBlock { + RowDataBlock(BufferManager &buffer_manager, idx_t capacity, idx_t entry_size) + : capacity(capacity), entry_size(entry_size), count(0), byte_offset(0) { + block = buffer_manager.RegisterMemory(capacity * entry_size, false); + } + //! The buffer block handle + shared_ptr block; + //! Capacity (number of entries) and entry size that fit in this block + idx_t capacity; + const idx_t entry_size; + //! Number of entries currently in this block + idx_t count; + //! Write offset (if variable size entries) + idx_t byte_offset; +}; + +struct BlockAppendEntry { + BlockAppendEntry(data_ptr_t baseptr, idx_t count) : baseptr(baseptr), count(count) { + } + data_ptr_t baseptr; + idx_t count; +}; + +class RowDataCollection { +public: + RowDataCollection(BufferManager &buffer_manager, idx_t block_capacity, idx_t entry_size, bool keep_pinned = false); //! BufferManager BufferManager &buffer_manager; @@ -26030,45 +30533,45 @@ using ValidityBytes = RowLayout::ValidityBytes; using Predicates = RowOperations::Predicates; template -static idx_t SelectComparison(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, +static idx_t SelectComparison(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { throw NotImplementedException("Unsupported nested comparison operand for RowOperations::Match"); } template <> -idx_t SelectComparison(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, +idx_t SelectComparison(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedEquals(left, right, vcount, sel, count, true_sel, false_sel); + return VectorOperations::NestedEquals(left, right, sel, count, true_sel, false_sel); } template <> -idx_t SelectComparison(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, +idx_t SelectComparison(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedNotEquals(left, right, vcount, sel, count, true_sel, false_sel); + return VectorOperations::NestedNotEquals(left, right, sel, count, true_sel, false_sel); } template <> -idx_t SelectComparison(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, +idx_t SelectComparison(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedGreaterThan(left, right, vcount, sel, count, true_sel, false_sel); + return VectorOperations::DistinctGreaterThan(left, right, &sel, count, true_sel, false_sel); } template <> -idx_t SelectComparison(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedGreaterThanEquals(left, right, vcount, sel, count, true_sel, false_sel); +idx_t SelectComparison(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, + SelectionVector *true_sel, SelectionVector *false_sel) { + return VectorOperations::DistinctGreaterThanEquals(left, right, &sel, count, true_sel, false_sel); } template <> -idx_t SelectComparison(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, +idx_t SelectComparison(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedLessThan(left, right, vcount, sel, count, true_sel, false_sel); + return VectorOperations::DistinctLessThan(left, right, &sel, count, true_sel, false_sel); } template <> -idx_t SelectComparison(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedLessThanEquals(left, right, vcount, sel, count, true_sel, false_sel); +idx_t SelectComparison(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, + SelectionVector *true_sel, SelectionVector *false_sel) { + return VectorOperations::DistinctLessThanEquals(left, right, &sel, count, true_sel, false_sel); } template @@ -26134,27 +30637,28 @@ static void TemplatedMatchType(VectorData &col, Vector &rows, SelectionVector &s } template -static void TemplatedMatchNested(Vector &col, Vector &rows, const idx_t vcount, SelectionVector &sel, idx_t &count, - const idx_t col_offset, const idx_t col_no, SelectionVector *no_match, - idx_t &no_match_count) { - // Gather a scattered Vector containing the column values being matched +static void TemplatedMatchNested(Vector &col, Vector &rows, SelectionVector &sel, idx_t &count, const idx_t col_offset, + const idx_t col_no, SelectionVector *no_match, idx_t &no_match_count) { + // Gather a dense Vector containing the column values being matched Vector key(col.GetType()); - RowOperations::Gather(rows, sel, key, sel, count, col_offset, col_no); + RowOperations::Gather(rows, sel, key, *FlatVector::IncrementalSelectionVector(), count, col_offset, col_no); + + // Densify the input column + Vector sliced(col, sel, count); if (NO_MATCH_SEL) { SelectionVector no_match_sel_offset(no_match->data() + no_match_count); - auto match_count = SelectComparison(col, key, vcount, sel, count, &sel, &no_match_sel_offset); + auto match_count = SelectComparison(sliced, key, sel, count, &sel, &no_match_sel_offset); no_match_count += count - match_count; count = match_count; } else { - count = SelectComparison(col, key, vcount, sel, count, &sel, nullptr); + count = SelectComparison(sliced, key, sel, count, &sel, nullptr); } } template -static void TemplatedMatchOp(Vector &vec, VectorData &col, const idx_t vcount, const RowLayout &layout, Vector &rows, - SelectionVector &sel, idx_t &count, idx_t col_no, SelectionVector *no_match, - idx_t &no_match_count) { +static void TemplatedMatchOp(Vector &vec, VectorData &col, const RowLayout &layout, Vector &rows, SelectionVector &sel, + idx_t &count, idx_t col_no, SelectionVector *no_match, idx_t &no_match_count) { if (count == 0) { return; } @@ -26216,8 +30720,7 @@ static void TemplatedMatchOp(Vector &vec, VectorData &col, const idx_t vcount, c case PhysicalType::LIST: case PhysicalType::MAP: case PhysicalType::STRUCT: - TemplatedMatchNested(vec, rows, vcount, sel, count, col_offset, col_no, no_match, - no_match_count); + TemplatedMatchNested(vec, rows, sel, count, col_offset, col_no, no_match, no_match_count); break; default: throw InternalException("Unsupported column type for RowOperations::Match"); @@ -26228,34 +30731,34 @@ template static void TemplatedMatch(DataChunk &columns, VectorData col_data[], const RowLayout &layout, Vector &rows, const Predicates &predicates, SelectionVector &sel, idx_t &count, SelectionVector *no_match, idx_t &no_match_count) { - const idx_t vcount = columns.size(); for (idx_t col_no = 0; col_no < predicates.size(); ++col_no) { auto &vec = columns.data[col_no]; auto &col = col_data[col_no]; switch (predicates[col_no]) { case ExpressionType::COMPARE_EQUAL: case ExpressionType::COMPARE_NOT_DISTINCT_FROM: - TemplatedMatchOp(vec, col, vcount, layout, rows, sel, count, col_no, no_match, + case ExpressionType::COMPARE_DISTINCT_FROM: + TemplatedMatchOp(vec, col, layout, rows, sel, count, col_no, no_match, no_match_count); break; case ExpressionType::COMPARE_NOTEQUAL: - TemplatedMatchOp(vec, col, vcount, layout, rows, sel, count, col_no, no_match, + TemplatedMatchOp(vec, col, layout, rows, sel, count, col_no, no_match, no_match_count); break; case ExpressionType::COMPARE_GREATERTHAN: - TemplatedMatchOp(vec, col, vcount, layout, rows, sel, count, col_no, no_match, + TemplatedMatchOp(vec, col, layout, rows, sel, count, col_no, no_match, no_match_count); break; case ExpressionType::COMPARE_GREATERTHANOREQUALTO: - TemplatedMatchOp(vec, col, vcount, layout, rows, sel, count, col_no, - no_match, no_match_count); + TemplatedMatchOp(vec, col, layout, rows, sel, count, col_no, no_match, + no_match_count); break; case ExpressionType::COMPARE_LESSTHAN: - TemplatedMatchOp(vec, col, vcount, layout, rows, sel, count, col_no, no_match, + TemplatedMatchOp(vec, col, layout, rows, sel, count, col_no, no_match, no_match_count); break; case ExpressionType::COMPARE_LESSTHANOREQUALTO: - TemplatedMatchOp(vec, col, vcount, layout, rows, sel, count, col_no, no_match, + TemplatedMatchOp(vec, col, layout, rows, sel, count, col_no, no_match, no_match_count); break; default: @@ -26656,15 +31159,17 @@ static void ScatterNestedVector(Vector &vec, VectorData &col, Vector &rows, data // Store pointers to the data in the row // Do this first because SerializeVector destroys the locations auto ptrs = FlatVector::GetData(rows); + data_ptr_t validitymask_locations[STANDARD_VECTOR_SIZE]; for (idx_t i = 0; i < count; i++) { auto idx = sel.get_index(i); auto row = ptrs[idx]; + validitymask_locations[i] = row; Store(data_locations[i], row + col_offset); } // Serialise the data - RowOperations::HeapScatter(vec, vcount, sel, count, col_no, data_locations, ptrs); + RowOperations::HeapScatter(vec, vcount, sel, count, col_no, data_locations, validitymask_locations); } void RowOperations::Scatter(DataChunk &columns, VectorData col_data[], const RowLayout &layout, Vector &rows, @@ -27949,7 +32454,26 @@ struct SBScanState { //! Used to scan the data into DataChunks after sorting struct PayloadScanner { public: - PayloadScanner(SortedData &sorted_data, GlobalSortState &global_sort_state); + PayloadScanner(SortedData &sorted_data, GlobalSortState &global_sort_state, bool flush = true); + explicit PayloadScanner(GlobalSortState &global_sort_state, bool flush = true); + + //! Scan a single block + PayloadScanner(GlobalSortState &global_sort_state, idx_t block_idx); + + //! The type layout of the payload + inline const vector &GetPayloadTypes() const { + return sorted_data.layout.GetTypes(); + } + + //! The number of rows scanned so far + inline idx_t Scanned() const { + return total_scanned; + } + + //! The number of remaining rows + inline idx_t Remaining() const { + return total_count - total_scanned; + } //! Scans the next data chunk from the sorted data void Scan(DataChunk &chunk); @@ -27967,6 +32491,8 @@ struct PayloadScanner { Vector addresses = Vector(LogicalType::POINTER); //! The number of rows scanned so far idx_t total_scanned; + //! Whether to flush the blocks after scanning + const bool flush; }; } // namespace duckdb @@ -30335,21 +34861,34 @@ void SBScanState::SetIndices(idx_t block_idx_to, idx_t entry_idx_to) { entry_idx = entry_idx_to; } -PayloadScanner::PayloadScanner(SortedData &sorted_data, GlobalSortState &global_sort_state) +PayloadScanner::PayloadScanner(SortedData &sorted_data, GlobalSortState &global_sort_state, bool flush_p) : sorted_data(sorted_data), read_state(global_sort_state.buffer_manager, global_sort_state), - total_count(sorted_data.Count()), global_sort_state(global_sort_state), total_scanned(0) { + total_count(sorted_data.Count()), global_sort_state(global_sort_state), total_scanned(0), flush(flush_p) { +} + +PayloadScanner::PayloadScanner(GlobalSortState &global_sort_state, bool flush_p) + : PayloadScanner(*global_sort_state.sorted_blocks[0]->payload_data, global_sort_state, flush_p) { +} + +PayloadScanner::PayloadScanner(GlobalSortState &global_sort_state, idx_t block_idx) + : sorted_data(*global_sort_state.sorted_blocks[0]->payload_data), + read_state(global_sort_state.buffer_manager, global_sort_state), + total_count(sorted_data.data_blocks[block_idx].count), global_sort_state(global_sort_state), total_scanned(0), + flush(false) { + read_state.SetIndices(block_idx, 0); } void PayloadScanner::Scan(DataChunk &chunk) { auto count = MinValue((idx_t)STANDARD_VECTOR_SIZE, total_count - total_scanned); if (count == 0) { - D_ASSERT(read_state.block_idx == sorted_data.data_blocks.size()); chunk.SetCardinality(count); return; } // Eagerly delete references to blocks that we've passed - for (idx_t i = 0; i < read_state.block_idx; i++) { - sorted_data.data_blocks[i].block = nullptr; + if (flush) { + for (idx_t i = 0; i < read_state.block_idx; i++) { + sorted_data.data_blocks[i].block = nullptr; + } } const idx_t &row_width = sorted_data.layout.GetRowWidth(); // Set up a batch of pointers to scan data from @@ -32437,6 +36976,7 @@ void Blob::FromBase64(string_t str, data_ptr_t output, idx_t output_size) { } // namespace duckdb + namespace duckdb { const int64_t NumericHelper::POWERS_OF_TEN[] {1, @@ -32538,6 +37078,11 @@ int NumericHelper::UnsignedLength(uint64_t value) { } } +template <> +std::string NumericHelper::ToString(hugeint_t value) { + return Hugeint::ToString(value); +} + } // namespace duckdb @@ -33260,6 +37805,17 @@ void DataChunk::Split(DataChunk &other, idx_t split_idx) { vector_caches.pop_back(); } other.SetCardinality(*this); + other.SetCapacity(*this); +} + +void DataChunk::Fuse(DataChunk &other) { + D_ASSERT(other.size() == size()); + const idx_t num_cols = other.data.size(); + for (idx_t col_idx = 0; col_idx < num_cols; ++col_idx) { + data.emplace_back(move(other.data[col_idx])); + vector_caches.emplace_back(move(other.vector_caches[col_idx])); + } + other.Destroy(); } void DataChunk::Append(const DataChunk &other, bool resize, SelectionVector *sel, idx_t sel_count) { @@ -33551,13 +38107,13 @@ void SetStructMap(DuckDBArrowArrayChildHolder &child_holder, const LogicalType & } struct ArrowUUIDConversion { - using internal_type_t = uint64_t; + using internal_type_t = hugeint_t; static unique_ptr InitializeVector(Vector &data, idx_t size) { return make_unique(LogicalType::VARCHAR, size); } - static idx_t GetStringLength(uint64_t value) { + static idx_t GetStringLength(hugeint_t value) { return UUID::STRING_SIZE; } @@ -33726,12 +38282,13 @@ void SetArrowChild(DuckDBArrowArrayChildHolder &child_holder, const LogicalType break; } case LogicalTypeId::BLOB: + case LogicalTypeId::JSON: case LogicalTypeId::VARCHAR: { SetVarchar(child_holder, type, data, size); break; } case LogicalTypeId::UUID: { - SetVarchar(child_holder, type, data, size); + SetVarchar(child_holder, type, data, size); break; } case LogicalTypeId::LIST: { @@ -34478,28 +39035,68 @@ hash_t Hash(char *val) { return Hash(val); } -// Jenkins hash function: https://en.wikipedia.org/wiki/Jenkins_hash_function -uint32_t JenkinsOneAtATimeHash(const char *key, size_t length) { - size_t i = 0; - uint32_t hash = 0; - while (i != length) { - hash += key[i++]; - hash += hash << 10; - hash ^= hash >> 6; - } - hash += hash << 3; - hash ^= hash >> 11; - hash += hash << 15; - return hash; +// MIT License +// Copyright (c) 2018-2021 Martin Ankerl +// https://github.com/martinus/robin-hood-hashing/blob/3.11.5/LICENSE +hash_t HashBytes(void *ptr, size_t len) noexcept { + static constexpr uint64_t M = UINT64_C(0xc6a4a7935bd1e995); + static constexpr uint64_t SEED = UINT64_C(0xe17a1465); + static constexpr unsigned int R = 47; + + auto const *const data64 = static_cast(ptr); + uint64_t h = SEED ^ (len * M); + + size_t const n_blocks = len / 8; + for (size_t i = 0; i < n_blocks; ++i) { + auto k = Load(reinterpret_cast(data64 + i)); + + k *= M; + k ^= k >> R; + k *= M; + + h ^= k; + h *= M; + } + + auto const *const data8 = reinterpret_cast(data64 + n_blocks); + switch (len & 7U) { + case 7: + h ^= static_cast(data8[6]) << 48U; + DUCKDB_EXPLICIT_FALLTHROUGH; + case 6: + h ^= static_cast(data8[5]) << 40U; + DUCKDB_EXPLICIT_FALLTHROUGH; + case 5: + h ^= static_cast(data8[4]) << 32U; + DUCKDB_EXPLICIT_FALLTHROUGH; + case 4: + h ^= static_cast(data8[3]) << 24U; + DUCKDB_EXPLICIT_FALLTHROUGH; + case 3: + h ^= static_cast(data8[2]) << 16U; + DUCKDB_EXPLICIT_FALLTHROUGH; + case 2: + h ^= static_cast(data8[1]) << 8U; + DUCKDB_EXPLICIT_FALLTHROUGH; + case 1: + h ^= static_cast(data8[0]); + h *= M; + DUCKDB_EXPLICIT_FALLTHROUGH; + default: + break; + } + h ^= h >> R; + h *= M; + h ^= h >> R; + return static_cast(h); } hash_t Hash(const char *val, size_t size) { - auto hash_val = JenkinsOneAtATimeHash(val, size); - return Hash(hash_val); + return HashBytes((void *)val, size); } hash_t Hash(uint8_t *val, size_t size) { - return Hash((const char *)val, size); + return HashBytes((void *)val, size); } } // namespace duckdb @@ -34509,6 +39106,7 @@ hash_t Hash(uint8_t *val, size_t size) { + #include #include @@ -35048,6 +39646,9 @@ bool Hugeint::TryConvert(float value, hugeint_t &result) { template bool ConvertFloatingToBigint(REAL_T value, hugeint_t &result) { + if (!Value::IsFinite(value)) { + return false; + } if (value <= -170141183460469231731687303715884105728.0 || value >= 170141183460469231731687303715884105727.0) { return false; } @@ -35301,7 +39902,7 @@ class HyperLogLog { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #4 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 // See the end of this file for a list //===----------------------------------------------------------------------===// @@ -35494,6 +40095,10 @@ date_t AddOperator::Operation(date_t left, int32_t right); template <> date_t AddOperator::Operation(int32_t left, date_t right); template <> +timestamp_t AddOperator::Operation(date_t left, dtime_t right); +template <> +timestamp_t AddOperator::Operation(dtime_t left, date_t right); +template <> interval_t AddOperator::Operation(interval_t left, interval_t right); template <> date_t AddOperator::Operation(date_t left, interval_t right); @@ -36658,7 +41263,7 @@ bool Time::TryConvertTime(const char *buf, idx_t len, idx_t &pos, dtime_t &resul string Time::ConversionError(const string &str) { return StringUtil::Format("time field value out of range: \"%s\", " - "expected format is ([YYY-MM-DD ]HH:MM:SS[.MS])", + "expected format is ([YYYY-MM-DD ]HH:MM:SS[.MS])", str); } @@ -37309,6 +41914,9 @@ hugeint_t ModuloOperator::Operation(hugeint_t left, hugeint_t right); +#include +#include + namespace duckdb { Value::Value(LogicalType type) : type_(move(type)), is_null(true) { @@ -37323,16 +41931,10 @@ Value::Value(int64_t val) : type_(LogicalType::BIGINT), is_null(false) { } Value::Value(float val) : type_(LogicalType::FLOAT), is_null(false) { - if (!Value::FloatIsValid(val)) { - throw OutOfRangeException("Invalid float value %f", val); - } value_.float_ = val; } Value::Value(double val) : type_(LogicalType::DOUBLE), is_null(false) { - if (!Value::DoubleIsValid(val)) { - throw OutOfRangeException("Invalid double value %f", val); - } value_.double_ = val; } @@ -37606,14 +42208,34 @@ Value Value::UBIGINT(uint64_t value) { return result; } -bool Value::FloatIsValid(float value) { +bool Value::FloatIsFinite(float value) { return !(std::isnan(value) || std::isinf(value)); } -bool Value::DoubleIsValid(double value) { +bool Value::DoubleIsFinite(double value) { return !(std::isnan(value) || std::isinf(value)); } +template <> +bool Value::IsNan(float input) { + return std::isnan(input); +} + +template <> +bool Value::IsNan(double input) { + return std::isnan(input); +} + +template <> +bool Value::IsFinite(float input) { + return Value::FloatIsFinite(input); +} + +template <> +bool Value::IsFinite(double input) { + return Value::DoubleIsFinite(input); +} + bool Value::StringIsValid(const char *str, idx_t length) { auto utf_type = Utf8Proc::Analyze(str, length); return utf_type != UnicodeType::INVALID; @@ -37666,9 +42288,6 @@ Value Value::DECIMAL(hugeint_t value, uint8_t width, uint8_t scale) { } Value Value::FLOAT(float value) { - if (!Value::FloatIsValid(value)) { - throw OutOfRangeException("Invalid float value %f", value); - } Value result(LogicalType::FLOAT); result.value_.float_ = value; result.is_null = false; @@ -37676,9 +42295,6 @@ Value Value::FLOAT(float value) { } Value Value::DOUBLE(double value) { - if (!Value::DoubleIsValid(value)) { - throw OutOfRangeException("Invalid double value %f", value); - } Value result(LogicalType::DOUBLE); result.value_.double_ = value; result.is_null = false; @@ -37847,6 +42463,25 @@ Value Value::BLOB(const string &data) { result.str_value = Blob::ToBlob(string_t(data)); return result; } + +Value Value::JSON(const char *val) { + auto result = Value(val); + result.type_ = LogicalTypeId::JSON; + return result; +} + +Value Value::JSON(string_t val) { + auto result = Value(val); + result.type_ = LogicalTypeId::JSON; + return result; +} + +Value Value::JSON(string val) { + auto result = Value(move(val)); + result.type_ = LogicalTypeId::JSON; + return result; +} + Value Value::ENUM(uint64_t value, const LogicalType &original_type) { D_ASSERT(original_type.id() == LogicalTypeId::ENUM); Value result(original_type); @@ -38556,6 +43191,7 @@ string Value::ToString() const { return Timestamp::ToString(Timestamp::FromEpochNanoSeconds(value_.timestamp.value)); case LogicalTypeId::INTERVAL: return Interval::ToString(value_.interval); + case LogicalTypeId::JSON: case LogicalTypeId::VARCHAR: return str_value; case LogicalTypeId::BLOB: @@ -38626,6 +43262,72 @@ string Value::ToString() const { } } +string Value::ToSQLString() const { + if (IsNull()) { + return ToString(); + } + switch (type_.id()) { + case LogicalTypeId::UUID: + case LogicalTypeId::DATE: + case LogicalTypeId::TIME: + case LogicalTypeId::TIMESTAMP: + case LogicalTypeId::TIME_TZ: + case LogicalTypeId::TIMESTAMP_TZ: + case LogicalTypeId::TIMESTAMP_SEC: + case LogicalTypeId::TIMESTAMP_MS: + case LogicalTypeId::TIMESTAMP_NS: + case LogicalTypeId::INTERVAL: + case LogicalTypeId::BLOB: + return "'" + ToString() + "'::" + type_.ToString(); + case LogicalTypeId::VARCHAR: + return "'" + StringUtil::Replace(ToString(), "'", "''") + "'"; + case LogicalTypeId::STRUCT: { + string ret = "{"; + auto &child_types = StructType::GetChildTypes(type_); + for (size_t i = 0; i < struct_value.size(); i++) { + auto &name = child_types[i].first; + auto &child = struct_value[i]; + ret += "'" + name + "': " + child.ToSQLString(); + if (i < struct_value.size() - 1) { + ret += ", "; + } + } + ret += "}"; + return ret; + } + case LogicalTypeId::FLOAT: + if (!FloatIsFinite(FloatValue::Get(*this))) { + return "'" + ToString() + "'::" + type_.ToString(); + } + return ToString(); + case LogicalTypeId::DOUBLE: { + double val = DoubleValue::Get(*this); + if (!DoubleIsFinite(val)) { + if (!Value::IsNan(val)) { + // to infinity and beyond + return val < 0 ? "-1e1000" : "1e1000"; + } + return "'" + ToString() + "'::" + type_.ToString(); + } + return ToString(); + } + case LogicalTypeId::LIST: { + string ret = "["; + for (size_t i = 0; i < list_value.size(); i++) { + auto &child = list_value[i]; + ret += child.ToSQLString(); + if (i < list_value.size() - 1) { + ret += ", "; + } + } + ret += "]"; + return ret; + } + default: + return ToString(); + } +} + //===--------------------------------------------------------------------===// // Type-specific getters //===--------------------------------------------------------------------===// @@ -38988,16 +43690,6 @@ bool Value::ValuesAreEqual(const Value &result_value, const Value &value) { } } -template <> -bool Value::IsValid(float value) { - return Value::FloatIsValid(value); -} - -template <> -bool Value::IsValid(double value) { - return Value::DoubleIsValid(value); -} - } // namespace duckdb @@ -39485,6 +44177,11 @@ Value Vector::GetValue(idx_t index) const { auto str = ((string_t *)data)[index]; return Value(str.GetString()); } + case LogicalTypeId::JSON: { + auto str = ((string_t *)data)[index]; + return Value::JSON(str.GetString()); + } + case LogicalTypeId::AGGREGATE_STATE: case LogicalTypeId::BLOB: { auto str = ((string_t *)data)[index]; return Value::BLOB((const_data_ptr_t)str.GetDataUnsafe(), str.GetSize()); @@ -39909,6 +44606,10 @@ void Vector::Deserialize(idx_t count, Deserializer &source) { void Vector::SetVectorType(VectorType vector_type_p) { this->vector_type = vector_type_p; + if (TypeIsConstantSize(GetType().InternalType()) && + (GetVectorType() == VectorType::CONSTANT_VECTOR || GetVectorType() == VectorType::FLAT_VECTOR)) { + auxiliary.reset(); + } if (vector_type == VectorType::CONSTANT_VECTOR && GetType().InternalType() == PhysicalType::STRUCT) { auto &entries = StructVector::GetEntries(*this); for (auto &entry : entries) { @@ -39976,31 +44677,7 @@ void Vector::Verify(const SelectionVector &sel, idx_t count) { (GetVectorType() == VectorType::CONSTANT_VECTOR || GetVectorType() == VectorType::FLAT_VECTOR)) { D_ASSERT(!auxiliary); } - if (GetType().InternalType() == PhysicalType::DOUBLE) { - // verify that there are no INF or NAN values - switch (GetVectorType()) { - case VectorType::CONSTANT_VECTOR: { - auto dbl = ConstantVector::GetData(*this); - if (!ConstantVector::IsNull(*this)) { - D_ASSERT(Value::DoubleIsValid(*dbl)); - } - break; - } - case VectorType::FLAT_VECTOR: { - auto doubles = FlatVector::GetData(*this); - for (idx_t i = 0; i < count; i++) { - auto oidx = sel.get_index(i); - if (validity.RowIsValid(oidx)) { - D_ASSERT(Value::DoubleIsValid(doubles[oidx])); - } - } - break; - } - default: - break; - } - } - if (GetType().id() == LogicalTypeId::VARCHAR) { + if (GetType().id() == LogicalTypeId::VARCHAR || GetType().id() == LogicalTypeId::JSON) { // verify that there are no '\0' bytes in string values switch (GetVectorType()) { case VectorType::FLAT_VECTOR: { @@ -40227,7 +44904,7 @@ string_t StringVector::AddString(Vector &vector, const string &data) { } string_t StringVector::AddString(Vector &vector, string_t data) { - D_ASSERT(vector.GetType().id() == LogicalTypeId::VARCHAR); + D_ASSERT(vector.GetType().id() == LogicalTypeId::VARCHAR || vector.GetType().id() == LogicalTypeId::JSON); if (data.IsInlined()) { // string will be inlined: no need to store in string heap return data; @@ -40765,12 +45442,13 @@ const sel_t ConstantVector::ZERO_VECTOR[STANDARD_VECTOR_SIZE] = {0}; -#include +#include + namespace duckdb { LogicalType::LogicalType() : LogicalType(LogicalTypeId::INVALID) { @@ -40852,6 +45530,7 @@ PhysicalType LogicalType::GetInternalType() { case LogicalTypeId::VARCHAR: case LogicalTypeId::CHAR: case LogicalTypeId::BLOB: + case LogicalTypeId::JSON: return PhysicalType::VARCHAR; case LogicalTypeId::INTERVAL: return PhysicalType::INTERVAL; @@ -40887,6 +45566,8 @@ PhysicalType LogicalType::GetInternalType() { return PhysicalType::INVALID; case LogicalTypeId::USER: return PhysicalType::UNKNOWN; + case LogicalTypeId::AGGREGATE_STATE: + return PhysicalType::VARCHAR; default: throw InternalException("Invalid LogicalType %s", ToString()); } @@ -40923,6 +45604,7 @@ constexpr const LogicalTypeId LogicalType::HASH; constexpr const LogicalTypeId LogicalType::POINTER; constexpr const LogicalTypeId LogicalType::VARCHAR; +constexpr const LogicalTypeId LogicalType::JSON; constexpr const LogicalTypeId LogicalType::BLOB; constexpr const LogicalTypeId LogicalType::INTERVAL; @@ -40956,7 +45638,7 @@ const vector LogicalType::AllTypes() { LogicalType::HUGEINT, LogicalTypeId::DECIMAL, LogicalType::UTINYINT, LogicalType::USMALLINT, LogicalType::UINTEGER, LogicalType::UBIGINT, LogicalType::TIME, LogicalTypeId::LIST, LogicalTypeId::STRUCT, LogicalType::TIME_TZ, LogicalType::TIMESTAMP_TZ, LogicalTypeId::MAP, - LogicalType::UUID}; + LogicalType::UUID, LogicalType::JSON}; return types; } @@ -41134,11 +45816,11 @@ string LogicalTypeIdToString(LogicalTypeId id) { case LogicalTypeId::TIMESTAMP: return "TIMESTAMP"; case LogicalTypeId::TIMESTAMP_MS: - return "TIMESTAMP (MS)"; + return "TIMESTAMP_MS"; case LogicalTypeId::TIMESTAMP_NS: - return "TIMESTAMP (NS)"; + return "TIMESTAMP_NS"; case LogicalTypeId::TIMESTAMP_SEC: - return "TIMESTAMP (SEC)"; + return "TIMESTAMP_S"; case LogicalTypeId::TIMESTAMP_TZ: return "TIMESTAMP WITH TIME ZONE"; case LogicalTypeId::TIME_TZ: @@ -41181,8 +45863,12 @@ string LogicalTypeIdToString(LogicalTypeId id) { return "UNKNOWN"; case LogicalTypeId::ENUM: return "ENUM"; + case LogicalTypeId::AGGREGATE_STATE: + return "AGGREGATE_STATE"; case LogicalTypeId::USER: return "USER"; + case LogicalTypeId::JSON: + return "JSON"; } return "UNDEFINED"; } @@ -41194,21 +45880,21 @@ string LogicalType::ToString() const { return "STRUCT"; } auto &child_types = StructType::GetChildTypes(*this); - string ret = "STRUCT<"; + string ret = "STRUCT("; for (size_t i = 0; i < child_types.size(); i++) { - ret += child_types[i].first + ": " + child_types[i].second.ToString(); + ret += child_types[i].first + " " + child_types[i].second.ToString(); if (i < child_types.size() - 1) { ret += ", "; } } - ret += ">"; + ret += ")"; return ret; } case LogicalTypeId::LIST: { if (!type_info_) { return "LIST"; } - return "LIST<" + ListType::GetChildType(*this).ToString() + ">"; + return ListType::GetChildType(*this).ToString() + "[]"; } case LogicalTypeId::MAP: { if (!type_info_) { @@ -41216,13 +45902,13 @@ string LogicalType::ToString() const { } auto &child_types = StructType::GetChildTypes(*this); if (child_types.empty()) { - return "MAP"; + return "MAP(?)"; } if (child_types.size() != 2) { throw InternalException("Map needs exactly two child elements"); } - return "MAP<" + ListType::GetChildType(child_types[0].second).ToString() + ", " + - ListType::GetChildType(child_types[1].second).ToString() + ">"; + return "MAP(" + ListType::GetChildType(child_types[0].second).ToString() + ", " + + ListType::GetChildType(child_types[1].second).ToString() + ")"; } case LogicalTypeId::DECIMAL: { if (!type_info_) { @@ -41236,7 +45922,13 @@ string LogicalType::ToString() const { return StringUtil::Format("DECIMAL(%d,%d)", width, scale); } case LogicalTypeId::ENUM: { - return EnumType::GetTypeName(*this); + return KeywordHelper::WriteOptionallyQuoted(EnumType::GetTypeName(*this)); + } + case LogicalTypeId::USER: { + return KeywordHelper::WriteOptionallyQuoted(UserType::GetTypeName(*this)); + } + case LogicalTypeId::AGGREGATE_STATE: { + return AggregateStateType::GetTypeName(*this); } default: return LogicalTypeIdToString(id_); @@ -41244,7 +45936,7 @@ string LogicalType::ToString() const { } // LCOV_EXCL_STOP -LogicalTypeId TransformStringToLogicalType(const string &str) { +LogicalTypeId TransformStringToLogicalTypeId(const string &str) { auto lower_str = StringUtil::Lower(str); // Transform column type if (lower_str == "int" || lower_str == "int4" || lower_str == "signed" || lower_str == "integer" || @@ -41304,6 +45996,10 @@ LogicalTypeId TransformStringToLogicalType(const string &str) { return LogicalTypeId::TIMESTAMP_TZ; } else if (lower_str == "timetz") { return LogicalTypeId::TIME_TZ; + } else if (lower_str == "json") { + return LogicalTypeId::JSON; + } else if (lower_str == "null") { + return LogicalTypeId::SQLNULL; } else { // This is a User Type, at this point we don't know if its one of the User Defined Types or an error // It is checked in the binder @@ -41311,6 +46007,13 @@ LogicalTypeId TransformStringToLogicalType(const string &str) { } } +LogicalType TransformStringToLogicalType(const string &str) { + if (StringUtil::Lower(str) == "null") { + return LogicalType::SQLNULL; + } + return Parser::ParseColumnList("dummy " + str)[0].type; +} + bool LogicalType::IsIntegral() const { switch (id_) { case LogicalTypeId::TINYINT: @@ -41474,11 +46177,23 @@ void LogicalType::Verify() const { } bool ApproxEqual(float ldecimal, float rdecimal) { + if (Value::IsNan(ldecimal) && Value::IsNan(rdecimal)) { + return true; + } + if (!Value::FloatIsFinite(ldecimal) || !Value::FloatIsFinite(rdecimal)) { + return ldecimal == rdecimal; + } float epsilon = std::fabs(rdecimal) * 0.01; return std::fabs(ldecimal - rdecimal) <= epsilon; } bool ApproxEqual(double ldecimal, double rdecimal) { + if (Value::IsNan(ldecimal) && Value::IsNan(rdecimal)) { + return true; + } + if (!Value::DoubleIsFinite(ldecimal) || !Value::DoubleIsFinite(rdecimal)) { + return ldecimal == rdecimal; + } double epsilon = std::fabs(rdecimal) * 0.01; return std::fabs(ldecimal - rdecimal) <= epsilon; } @@ -41493,7 +46208,8 @@ enum class ExtraTypeInfoType : uint8_t { LIST_TYPE_INFO = 3, STRUCT_TYPE_INFO = 4, ENUM_TYPE_INFO = 5, - USER_TYPE_INFO = 6 + USER_TYPE_INFO = 6, + AGGREGATE_STATE_TYPE_INFO = 7 }; struct ExtraTypeInfo { @@ -41698,6 +46414,74 @@ struct StructTypeInfo : public ExtraTypeInfo { } }; +struct AggregateStateTypeInfo : public ExtraTypeInfo { + explicit AggregateStateTypeInfo(aggregate_state_t state_type_p) + : ExtraTypeInfo(ExtraTypeInfoType::AGGREGATE_STATE_TYPE_INFO), state_type(move(state_type_p)) { + } + + aggregate_state_t state_type; + +public: + bool Equals(ExtraTypeInfo *other_p) const override { + if (!other_p) { + return false; + } + if (type != other_p->type) { + return false; + } + auto &other = (AggregateStateTypeInfo &)*other_p; + return state_type.function_name == other.state_type.function_name && + state_type.return_type == other.state_type.return_type && + state_type.bound_argument_types == other.state_type.bound_argument_types; + } + + void Serialize(FieldWriter &writer) const override { + auto &serializer = writer.GetSerializer(); + writer.WriteString(state_type.function_name); + state_type.return_type.Serialize(serializer); + writer.WriteField(state_type.bound_argument_types.size()); + for (idx_t i = 0; i < state_type.bound_argument_types.size(); i++) { + state_type.bound_argument_types[i].Serialize(serializer); + } + } + + static shared_ptr Deserialize(FieldReader &reader) { + auto &source = reader.GetSource(); + + auto function_name = reader.ReadRequired(); + auto return_type = LogicalType::Deserialize(source); + auto bound_argument_types_size = reader.ReadRequired(); + vector bound_argument_types; + + for (uint32_t i = 0; i < bound_argument_types_size; i++) { + auto type = LogicalType::Deserialize(source); + bound_argument_types.push_back(move(type)); + } + return make_shared( + aggregate_state_t(move(function_name), move(return_type), move(bound_argument_types))); + } +}; + +const aggregate_state_t &AggregateStateType::GetStateType(const LogicalType &type) { + D_ASSERT(type.id() == LogicalTypeId::AGGREGATE_STATE); + auto info = type.AuxInfo(); + D_ASSERT(info); + return ((AggregateStateTypeInfo &)*info).state_type; +} + +const string AggregateStateType::GetTypeName(const LogicalType &type) { + D_ASSERT(type.id() == LogicalTypeId::AGGREGATE_STATE); + auto info = type.AuxInfo(); + if (!info) { + return "AGGREGATE_STATE"; + } + auto aggr_state = ((AggregateStateTypeInfo &)*info).state_type; + return "AGGREGATE_STATE<" + aggr_state.function_name + "(" + + StringUtil::Join(aggr_state.bound_argument_types, aggr_state.bound_argument_types.size(), ", ", + [](const LogicalType &arg_type) { return arg_type.ToString(); }) + + ")" + "::" + aggr_state.return_type.ToString() + ">"; +} + const child_list_t &StructType::GetChildTypes(const LogicalType &type) { D_ASSERT(type.id() == LogicalTypeId::STRUCT || type.id() == LogicalTypeId::MAP); auto info = type.AuxInfo(); @@ -41726,6 +46510,11 @@ LogicalType LogicalType::STRUCT(child_list_t children) { return LogicalType(LogicalTypeId::STRUCT, move(info)); } +LogicalType LogicalType::AGGREGATE_STATE(aggregate_state_t state_type) { // NOLINT + auto info = make_shared(move(state_type)); + return LogicalType(LogicalTypeId::AGGREGATE_STATE, move(info)); +} + //===--------------------------------------------------------------------===// // Map Type //===--------------------------------------------------------------------===// @@ -41743,12 +46532,12 @@ LogicalType LogicalType::MAP(LogicalType key, LogicalType value) { const LogicalType &MapType::KeyType(const LogicalType &type) { D_ASSERT(type.id() == LogicalTypeId::MAP); - return StructType::GetChildTypes(type)[0].second; + return ListType::GetChildType(StructType::GetChildTypes(type)[0].second); } const LogicalType &MapType::ValueType(const LogicalType &type) { D_ASSERT(type.id() == LogicalTypeId::MAP); - return StructType::GetChildTypes(type)[1].second; + return ListType::GetChildType(StructType::GetChildTypes(type)[1].second); } //===--------------------------------------------------------------------===// @@ -41995,6 +46784,9 @@ shared_ptr ExtraTypeInfo::Deserialize(FieldReader &reader) { throw InternalException("Invalid Physical Type for ENUMs"); } } + case ExtraTypeInfoType::AGGREGATE_STATE_TYPE_INFO: + return AggregateStateTypeInfo::Deserialize(reader); + default: throw InternalException("Unimplemented type info in ExtraTypeInfo::Deserialize"); } @@ -42481,8 +47273,101 @@ void VectorOperations::Not(Vector &input, Vector &result, idx_t count) { +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/likely.hpp +// +// +//===----------------------------------------------------------------------===// + + + +#if __GNUC__ +#define DUCKDB_BUILTIN_EXPECT(cond, expected_value) (__builtin_expect(cond, expected_value)) +#else +#define DUCKDB_BUILTIN_EXPECT(cond, expected_value) (cond) +#endif + +#define DUCKDB_LIKELY(...) DUCKDB_BUILTIN_EXPECT((__VA_ARGS__), 1) +#define DUCKDB_UNLIKELY(...) DUCKDB_BUILTIN_EXPECT((__VA_ARGS__), 0) + + namespace duckdb { +template +bool EqualsFloat(T left, T right) { + if (DUCKDB_UNLIKELY(Value::IsNan(left) && Value::IsNan(right))) { + return true; + } + return left == right; +} + +template <> +bool Equals::Operation(float left, float right) { + return EqualsFloat(left, right); +} + +template <> +bool Equals::Operation(double left, double right) { + return EqualsFloat(left, right); +} + +template +bool GreaterThanFloat(T left, T right) { + // handle nans + // nan is always bigger than everything else + bool left_is_nan = Value::IsNan(left); + bool right_is_nan = Value::IsNan(right); + // if right is nan, there is no number that is bigger than right + if (DUCKDB_UNLIKELY(right_is_nan)) { + return false; + } + // if left is nan, but right is not, left is always bigger + if (DUCKDB_UNLIKELY(left_is_nan)) { + return true; + } + return left > right; +} + +template <> +bool GreaterThan::Operation(float left, float right) { + return GreaterThanFloat(left, right); +} + +template <> +bool GreaterThan::Operation(double left, double right) { + return GreaterThanFloat(left, right); +} + +template +bool GreaterThanEqualsFloat(T left, T right) { + // handle nans + // nan is always bigger than everything else + bool left_is_nan = Value::IsNan(left); + bool right_is_nan = Value::IsNan(right); + // if right is nan, there is no bigger number + // we only return true if left is also nan (in which case the numbers are equal) + if (DUCKDB_UNLIKELY(right_is_nan)) { + return left_is_nan; + } + // if left is nan, but right is not, left is always bigger + if (DUCKDB_UNLIKELY(left_is_nan)) { + return true; + } + return left >= right; +} + +template <> +bool GreaterThanEquals::Operation(float left, float right) { + return GreaterThanEqualsFloat(left, right); +} + +template <> +bool GreaterThanEquals::Operation(double left, double right) { + return GreaterThanEqualsFloat(left, right); +} + struct ComparisonSelector { template static idx_t Select(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel, @@ -42858,7 +47743,7 @@ static void DistinctExecute(Vector &left, Vector &right, Vector &result, idx_t c DistinctExecuteSwitch(left, right, result, count); } -template +template static inline idx_t DistinctSelectGenericLoop(LEFT_TYPE *__restrict ldata, RIGHT_TYPE *__restrict rdata, const SelectionVector *__restrict lsel, const SelectionVector *__restrict rsel, @@ -42867,9 +47752,8 @@ DistinctSelectGenericLoop(LEFT_TYPE *__restrict ldata, RIGHT_TYPE *__restrict rd idx_t true_count = 0, false_count = 0; for (idx_t i = 0; i < count; i++) { auto result_idx = result_sel->get_index(i); - const auto idx = DENSE ? i : result_idx; - auto lindex = lsel->get_index(idx); - auto rindex = rsel->get_index(idx); + auto lindex = lsel->get_index(i); + auto rindex = rsel->get_index(i); if (NO_NULL) { if (OP::Operation(ldata[lindex], rdata[rindex], false, false)) { if (HAS_TRUE_SEL) { @@ -42898,63 +47782,62 @@ DistinctSelectGenericLoop(LEFT_TYPE *__restrict ldata, RIGHT_TYPE *__restrict rd return count - false_count; } } -template +template static inline idx_t DistinctSelectGenericLoopSelSwitch(LEFT_TYPE *__restrict ldata, RIGHT_TYPE *__restrict rdata, const SelectionVector *__restrict lsel, const SelectionVector *__restrict rsel, const SelectionVector *__restrict result_sel, idx_t count, ValidityMask &lmask, ValidityMask &rmask, SelectionVector *true_sel, SelectionVector *false_sel) { if (true_sel && false_sel) { - return DistinctSelectGenericLoop( + return DistinctSelectGenericLoop( ldata, rdata, lsel, rsel, result_sel, count, lmask, rmask, true_sel, false_sel); } else if (true_sel) { - return DistinctSelectGenericLoop( + return DistinctSelectGenericLoop( ldata, rdata, lsel, rsel, result_sel, count, lmask, rmask, true_sel, false_sel); } else { D_ASSERT(false_sel); - return DistinctSelectGenericLoop( + return DistinctSelectGenericLoop( ldata, rdata, lsel, rsel, result_sel, count, lmask, rmask, true_sel, false_sel); } } -template +template static inline idx_t DistinctSelectGenericLoopSwitch(LEFT_TYPE *__restrict ldata, RIGHT_TYPE *__restrict rdata, const SelectionVector *__restrict lsel, const SelectionVector *__restrict rsel, const SelectionVector *__restrict result_sel, idx_t count, ValidityMask &lmask, ValidityMask &rmask, SelectionVector *true_sel, SelectionVector *false_sel) { if (!lmask.AllValid() || !rmask.AllValid()) { - return DistinctSelectGenericLoopSelSwitch( + return DistinctSelectGenericLoopSelSwitch( ldata, rdata, lsel, rsel, result_sel, count, lmask, rmask, true_sel, false_sel); } else { - return DistinctSelectGenericLoopSelSwitch( + return DistinctSelectGenericLoopSelSwitch( ldata, rdata, lsel, rsel, result_sel, count, lmask, rmask, true_sel, false_sel); } } -template -static idx_t DistinctSelectGeneric(Vector &left, Vector &right, idx_t vcount, const SelectionVector *sel, idx_t count, +template +static idx_t DistinctSelectGeneric(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { VectorData ldata, rdata; - left.Orrify(vcount, ldata); - right.Orrify(vcount, rdata); + left.Orrify(count, ldata); + right.Orrify(count, rdata); - return DistinctSelectGenericLoopSwitch( - (LEFT_TYPE *)ldata.data, (RIGHT_TYPE *)rdata.data, ldata.sel, rdata.sel, sel, count, ldata.validity, - rdata.validity, true_sel, false_sel); + return DistinctSelectGenericLoopSwitch((LEFT_TYPE *)ldata.data, (RIGHT_TYPE *)rdata.data, + ldata.sel, rdata.sel, sel, count, ldata.validity, + rdata.validity, true_sel, false_sel); } -template +template static inline idx_t DistinctSelectFlatLoop(LEFT_TYPE *__restrict ldata, RIGHT_TYPE *__restrict rdata, const SelectionVector *sel, idx_t count, ValidityMask &lmask, ValidityMask &rmask, SelectionVector *true_sel, SelectionVector *false_sel) { idx_t true_count = 0, false_count = 0; for (idx_t i = 0; i < count; i++) { idx_t result_idx = sel->get_index(i); - const auto idx = DENSE ? i : result_idx; - idx_t lidx = LEFT_CONSTANT ? 0 : idx; - idx_t ridx = RIGHT_CONSTANT ? 0 : idx; + idx_t lidx = LEFT_CONSTANT ? 0 : i; + idx_t ridx = RIGHT_CONSTANT ? 0 : i; const bool lnull = !lmask.RowIsValid(lidx); const bool rnull = !rmask.RowIsValid(ridx); bool comparison_result = OP::Operation(ldata[lidx], rdata[ridx], lnull, rnull); @@ -42974,34 +47857,33 @@ static inline idx_t DistinctSelectFlatLoop(LEFT_TYPE *__restrict ldata, RIGHT_TY } } -template +template static inline idx_t DistinctSelectFlatLoopSelSwitch(LEFT_TYPE *__restrict ldata, RIGHT_TYPE *__restrict rdata, const SelectionVector *sel, idx_t count, ValidityMask &lmask, ValidityMask &rmask, SelectionVector *true_sel, SelectionVector *false_sel) { if (true_sel && false_sel) { - return DistinctSelectFlatLoop(ldata, rdata, sel, count, lmask, rmask, true_sel, false_sel); + return DistinctSelectFlatLoop( + ldata, rdata, sel, count, lmask, rmask, true_sel, false_sel); } else if (true_sel) { - return DistinctSelectFlatLoop(ldata, rdata, sel, count, lmask, rmask, true_sel, false_sel); + return DistinctSelectFlatLoop( + ldata, rdata, sel, count, lmask, rmask, true_sel, false_sel); } else { D_ASSERT(false_sel); - return DistinctSelectFlatLoop(ldata, rdata, sel, count, lmask, rmask, true_sel, false_sel); + return DistinctSelectFlatLoop( + ldata, rdata, sel, count, lmask, rmask, true_sel, false_sel); } } -template +template static inline idx_t DistinctSelectFlatLoopSwitch(LEFT_TYPE *__restrict ldata, RIGHT_TYPE *__restrict rdata, const SelectionVector *sel, idx_t count, ValidityMask &lmask, ValidityMask &rmask, SelectionVector *true_sel, SelectionVector *false_sel) { - return DistinctSelectFlatLoopSelSwitch( + return DistinctSelectFlatLoopSelSwitch( ldata, rdata, sel, count, lmask, rmask, true_sel, false_sel); } -template +template static idx_t DistinctSelectFlat(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { auto ldata = FlatVector::GetData(left); @@ -43011,17 +47893,17 @@ static idx_t DistinctSelectFlat(Vector &left, Vector &right, const SelectionVect if (ConstantVector::IsNull(left)) { validity.SetAllInvalid(1); } - return DistinctSelectFlatLoopSwitch( + return DistinctSelectFlatLoopSwitch( ldata, rdata, sel, count, validity, FlatVector::Validity(right), true_sel, false_sel); } else if (RIGHT_CONSTANT) { ValidityMask validity; if (ConstantVector::IsNull(right)) { validity.SetAllInvalid(1); } - return DistinctSelectFlatLoopSwitch( + return DistinctSelectFlatLoopSwitch( ldata, rdata, sel, count, FlatVector::Validity(left), validity, true_sel, false_sel); } else { - return DistinctSelectFlatLoopSwitch( + return DistinctSelectFlatLoopSwitch( ldata, rdata, sel, count, FlatVector::Validity(left), FlatVector::Validity(right), true_sel, false_sel); } } @@ -43050,8 +47932,8 @@ static idx_t DistinctSelectConstant(Vector &left, Vector &right, const Selection } } -template -static idx_t DistinctSelect(Vector &left, Vector &right, idx_t vcount, const SelectionVector *sel, idx_t count, +template +static idx_t DistinctSelect(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { SelectionVector owned_sel; if (!sel) { @@ -43061,25 +47943,26 @@ static idx_t DistinctSelect(Vector &left, Vector &right, idx_t vcount, const Sel return DistinctSelectConstant(left, right, sel, count, true_sel, false_sel); } else if (left.GetVectorType() == VectorType::CONSTANT_VECTOR && right.GetVectorType() == VectorType::FLAT_VECTOR) { - return DistinctSelectFlat(left, right, sel, count, true_sel, - false_sel); + return DistinctSelectFlat(left, right, sel, count, true_sel, false_sel); } else if (left.GetVectorType() == VectorType::FLAT_VECTOR && right.GetVectorType() == VectorType::CONSTANT_VECTOR) { - return DistinctSelectFlat(left, right, sel, count, true_sel, - false_sel); + return DistinctSelectFlat(left, right, sel, count, true_sel, false_sel); } else if (left.GetVectorType() == VectorType::FLAT_VECTOR && right.GetVectorType() == VectorType::FLAT_VECTOR) { - return DistinctSelectFlat(left, right, sel, count, true_sel, - false_sel); + return DistinctSelectFlat(left, right, sel, count, true_sel, + false_sel); } else { - return DistinctSelectGeneric(left, right, vcount, sel, count, true_sel, - false_sel); + return DistinctSelectGeneric(left, right, sel, count, true_sel, false_sel); } } template -static idx_t DistinctSelectNotNull(VectorData &lvdata, VectorData &rvdata, const idx_t count, idx_t &true_count, - const SelectionVector &sel, SelectionVector &maybe_vec, OptionalSelection &true_vec, - OptionalSelection &false_vec) { +static idx_t DistinctSelectNotNull(Vector &left, Vector &right, const idx_t count, idx_t &true_count, + const SelectionVector &sel, SelectionVector &maybe_vec, OptionalSelection &true_opt, + OptionalSelection &false_opt) { + VectorData lvdata, rvdata; + left.Orrify(count, lvdata); + right.Orrify(count, rvdata); + auto &lmask = lvdata.validity; auto &rmask = rvdata.validity; @@ -43093,63 +47976,63 @@ static idx_t DistinctSelectNotNull(VectorData &lvdata, VectorData &rvdata, const return remaining; } + // Slice the Vectors down to the rows that are not determined (i.e., neither is NULL) + SelectionVector slicer(count); + true_count = 0; idx_t false_count = 0; for (idx_t i = 0; i < count; ++i) { - const auto idx = sel.get_index(i); - const auto lidx = lvdata.sel->get_index(idx); - const auto ridx = rvdata.sel->get_index(idx); + const auto result_idx = sel.get_index(i); + const auto lidx = lvdata.sel->get_index(i); + const auto ridx = rvdata.sel->get_index(i); const auto lnull = !lmask.RowIsValid(lidx); const auto rnull = !rmask.RowIsValid(ridx); if (lnull || rnull) { // If either is NULL then we can major distinguish them if (!OP::Operation(false, false, lnull, rnull)) { - false_vec.Append(false_count, idx); + false_opt.Append(false_count, result_idx); } else { - true_vec.Append(true_count, idx); + true_opt.Append(true_count, result_idx); } } else { // Neither is NULL, distinguish values. - maybe_vec.set_index(remaining++, idx); + slicer.set_index(remaining, i); + maybe_vec.set_index(remaining++, result_idx); } } - true_vec.Advance(true_count); - false_vec.Advance(false_count); - return remaining; -} + true_opt.Advance(true_count); + false_opt.Advance(false_count); -template -static inline void ScatterSelection(SelectionVector *target, const idx_t count, const SelectionVector &sel, - const SelectionVector &dense_vec) { - if (DENSE && target) { - for (idx_t i = 0; i < count; ++i) { - target->set_index(i, sel.get_index(dense_vec.get_index(i))); - } + if (remaining && remaining < count) { + left.Slice(slicer, remaining); + right.Slice(slicer, remaining); } + + return remaining; } struct PositionComparator { // Select the rows that definitely match. // Default to the same as the final row template - static idx_t Definite(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, + static idx_t Definite(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, SelectionVector &false_sel) { - return Final(left, right, vcount, sel, count, true_sel, &false_sel); + return Final(left, right, sel, count, true_sel, &false_sel); } // Select the possible rows that need further testing. // Usually this means Is Not Distinct, as those are the semantics used by Postges template - static idx_t Possible(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, + static idx_t Possible(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector &true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedEquals(left, right, vcount, sel, count, &true_sel, false_sel); + return VectorOperations::NestedEquals(left, right, sel, count, &true_sel, false_sel); } // Select the matching rows for the final position. // This needs to be specialised. template - static idx_t Final(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, - SelectionVector *true_sel, SelectionVector *false_sel) { + static idx_t Final(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, + SelectionVector *false_sel) { return 0; } @@ -43164,90 +48047,90 @@ struct PositionComparator { // NotDistinctFrom must always check every column template <> -idx_t PositionComparator::Definite(Vector &left, Vector &right, idx_t vcount, - const SelectionVector &sel, idx_t count, - SelectionVector *true_sel, SelectionVector &false_sel) { +idx_t PositionComparator::Definite(Vector &left, Vector &right, const SelectionVector &sel, + idx_t count, SelectionVector *true_sel, + SelectionVector &false_sel) { return 0; } template <> -idx_t PositionComparator::Final(Vector &left, Vector &right, idx_t vcount, - const SelectionVector &sel, idx_t count, - SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedEquals(left, right, vcount, sel, count, true_sel, false_sel); +idx_t PositionComparator::Final(Vector &left, Vector &right, const SelectionVector &sel, + idx_t count, SelectionVector *true_sel, + SelectionVector *false_sel) { + return VectorOperations::NestedEquals(left, right, sel, count, true_sel, false_sel); } // DistinctFrom must check everything that matched template <> -idx_t PositionComparator::Possible(Vector &left, Vector &right, idx_t vcount, - const SelectionVector &sel, idx_t count, - SelectionVector &true_sel, SelectionVector *false_sel) { +idx_t PositionComparator::Possible(Vector &left, Vector &right, const SelectionVector &sel, + idx_t count, SelectionVector &true_sel, + SelectionVector *false_sel) { return count; } template <> -idx_t PositionComparator::Final(Vector &left, Vector &right, idx_t vcount, - const SelectionVector &sel, idx_t count, - SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedNotEquals(left, right, vcount, sel, count, true_sel, false_sel); +idx_t PositionComparator::Final(Vector &left, Vector &right, const SelectionVector &sel, + idx_t count, SelectionVector *true_sel, + SelectionVector *false_sel) { + return VectorOperations::NestedNotEquals(left, right, sel, count, true_sel, false_sel); } // Non-strict inequalities must use strict comparisons for Definite template <> -idx_t PositionComparator::Definite(Vector &left, Vector &right, idx_t vcount, +idx_t PositionComparator::Definite(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, SelectionVector &false_sel) { - return VectorOperations::NestedLessThan(left, right, vcount, sel, count, true_sel, &false_sel); + return VectorOperations::DistinctLessThan(left, right, &sel, count, true_sel, &false_sel); } template <> -idx_t PositionComparator::Final(Vector &left, Vector &right, idx_t vcount, - const SelectionVector &sel, idx_t count, - SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedLessThanEquals(left, right, vcount, sel, count, true_sel, false_sel); +idx_t PositionComparator::Final(Vector &left, Vector &right, const SelectionVector &sel, + idx_t count, SelectionVector *true_sel, + SelectionVector *false_sel) { + return VectorOperations::DistinctLessThanEquals(left, right, &sel, count, true_sel, false_sel); } template <> -idx_t PositionComparator::Definite(Vector &left, Vector &right, idx_t vcount, +idx_t PositionComparator::Definite(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, SelectionVector &false_sel) { - return VectorOperations::NestedGreaterThan(left, right, vcount, sel, count, true_sel, &false_sel); + return VectorOperations::DistinctGreaterThan(left, right, &sel, count, true_sel, &false_sel); } template <> -idx_t PositionComparator::Final(Vector &left, Vector &right, idx_t vcount, +idx_t PositionComparator::Final(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedGreaterThanEquals(left, right, vcount, sel, count, true_sel, false_sel); + return VectorOperations::DistinctGreaterThanEquals(left, right, &sel, count, true_sel, false_sel); } // Strict inequalities just use strict for both Definite and Final template <> -idx_t PositionComparator::Final(Vector &left, Vector &right, idx_t vcount, - const SelectionVector &sel, idx_t count, - SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedLessThan(left, right, vcount, sel, count, true_sel, false_sel); +idx_t PositionComparator::Final(Vector &left, Vector &right, const SelectionVector &sel, + idx_t count, SelectionVector *true_sel, + SelectionVector *false_sel) { + return VectorOperations::DistinctLessThan(left, right, &sel, count, true_sel, false_sel); } template <> -idx_t PositionComparator::Final(Vector &left, Vector &right, idx_t vcount, - const SelectionVector &sel, idx_t count, - SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedGreaterThan(left, right, vcount, sel, count, true_sel, false_sel); +idx_t PositionComparator::Final(Vector &left, Vector &right, const SelectionVector &sel, + idx_t count, SelectionVector *true_sel, + SelectionVector *false_sel) { + return VectorOperations::DistinctGreaterThan(left, right, &sel, count, true_sel, false_sel); } using StructEntries = vector>; -static StructEntries &StructVectorGetSlicedEntries(Vector &parent, StructEntries &sliced, const idx_t vcount) { +static StructEntries &StructVectorGetSlicedEntries(Vector &parent, StructEntries &sliced, const idx_t count) { // We have to manually slice STRUCT dictionaries. auto &children = StructVector::GetEntries(parent); if (parent.GetVectorType() == VectorType::DICTIONARY_VECTOR) { auto &dict_sel = DictionaryVector::SelVector(parent); for (auto &child : children) { - auto v = make_unique(*child, dict_sel, vcount); + auto v = make_unique(*child, dict_sel, count); sliced.push_back(move(v)); } @@ -43257,39 +48140,97 @@ static StructEntries &StructVectorGetSlicedEntries(Vector &parent, StructEntries return children; } +static void ExtractNestedSelection(const SelectionVector &slice_sel, const idx_t count, const SelectionVector &sel, + OptionalSelection &opt) { + + for (idx_t i = 0; i < count;) { + const auto slice_idx = slice_sel.get_index(i); + const auto result_idx = sel.get_index(slice_idx); + opt.Append(i, result_idx); + } + opt.Advance(count); +} + +static void DensifyNestedSelection(const SelectionVector &dense_sel, const idx_t count, SelectionVector &slice_sel) { + for (idx_t i = 0; i < count; ++i) { + slice_sel.set_index(i, dense_sel.get_index(i)); + } +} + template -static idx_t DistinctSelectStruct(Vector &left, Vector &right, idx_t vcount, VectorData &lvdata, VectorData &rvdata, - idx_t count, SelectionVector &maybe_vec, OptionalSelection &true_opt, - OptionalSelection &false_opt) { +static idx_t DistinctSelectStruct(Vector &left, Vector &right, idx_t count, const SelectionVector &sel, + OptionalSelection &true_opt, OptionalSelection &false_opt) { + if (count == 0) { + return 0; + } + // Avoid allocating in the 99% of the cases where we don't need to. StructEntries lsliced, rsliced; - auto &lchildren = StructVectorGetSlicedEntries(left, lsliced, vcount); - auto &rchildren = StructVectorGetSlicedEntries(right, rsliced, vcount); + auto &lchildren = StructVectorGetSlicedEntries(left, lsliced, count); + auto &rchildren = StructVectorGetSlicedEntries(right, rsliced, count); D_ASSERT(lchildren.size() == rchildren.size()); + // In order to reuse the comparators, we have to track what passed and failed internally. + // To do that, we need local SVs that we then merge back into the real ones after every pass. + const auto vcount = count; + SelectionVector slice_sel(count); + for (idx_t i = 0; i < count; ++i) { + slice_sel.set_index(i, i); + } + + SelectionVector true_sel(count); + SelectionVector false_sel(count); + idx_t match_count = 0; for (idx_t col_no = 0; col_no < lchildren.size(); ++col_no) { - auto &lchild = *lchildren[col_no]; - auto &rchild = *rchildren[col_no]; + // Slice the children to maintain density + Vector lchild(*lchildren[col_no]); + lchild.Normalify(vcount); + lchild.Slice(slice_sel, count); + + Vector rchild(*rchildren[col_no]); + rchild.Normalify(vcount); + rchild.Slice(slice_sel, count); // Find everything that definitely matches - auto true_count = - PositionComparator::Definite(lchild, rchild, vcount, maybe_vec, count, true_opt, maybe_vec); + auto true_count = PositionComparator::Definite(lchild, rchild, slice_sel, count, &true_sel, false_sel); if (true_count > 0) { - true_opt.Advance(true_count); + auto false_count = count - true_count; + + // Extract the definite matches into the true result + ExtractNestedSelection(false_count ? true_sel : slice_sel, true_count, sel, true_opt); + + // Remove the definite matches from the slicing vector + DensifyNestedSelection(false_sel, false_count, slice_sel); + match_count += true_count; count -= true_count; } if (col_no != lchildren.size() - 1) { // Find what might match on the next position - true_count = - PositionComparator::Possible(lchild, rchild, vcount, maybe_vec, count, maybe_vec, false_opt); + true_count = PositionComparator::Possible(lchild, rchild, slice_sel, count, true_sel, &false_sel); auto false_count = count - true_count; - false_opt.Advance(false_count); + + // Extract the definite failures into the false result + ExtractNestedSelection(true_count ? false_sel : slice_sel, false_count, sel, false_opt); + + // Remove any definite failures from the slicing vector + if (false_count) { + DensifyNestedSelection(true_sel, true_count, slice_sel); + } + count = true_count; } else { - true_count = PositionComparator::Final(lchild, rchild, vcount, maybe_vec, count, true_opt, false_opt); + true_count = PositionComparator::Final(lchild, rchild, slice_sel, count, &true_sel, &false_sel); + auto false_count = count - true_count; + + // Extract the definite matches into the true result + ExtractNestedSelection(false_count ? true_sel : slice_sel, true_count, sel, true_opt); + + // Extract the definite failures into the false result + ExtractNestedSelection(true_count ? false_sel : slice_sel, false_count, sel, false_opt); + match_count += true_count; } } @@ -43298,28 +48239,27 @@ static idx_t DistinctSelectStruct(Vector &left, Vector &right, idx_t vcount, Vec } static void PositionListCursor(SelectionVector &cursor, VectorData &vdata, const idx_t pos, - const SelectionVector &maybe_vec, const idx_t count) { + const SelectionVector &slice_sel, const idx_t count) { const auto data = (const list_entry_t *)vdata.data; for (idx_t i = 0; i < count; ++i) { - const auto idx = maybe_vec.get_index(i); + const auto slice_idx = slice_sel.get_index(i); - const auto lidx = vdata.sel->get_index(idx); + const auto lidx = vdata.sel->get_index(slice_idx); const auto &entry = data[lidx]; - cursor.set_index(idx, entry.offset + pos); + cursor.set_index(i, entry.offset + pos); } } template -static idx_t DistinctSelectList(Vector &left, Vector &right, idx_t vcount, VectorData &lvdata, VectorData &rvdata, - idx_t count, SelectionVector &maybe_vec, OptionalSelection &true_opt, - OptionalSelection &false_opt) { +static idx_t DistinctSelectList(Vector &left, Vector &right, idx_t count, const SelectionVector &sel, + OptionalSelection &true_opt, OptionalSelection &false_opt) { if (count == 0) { return count; } - // We use them to create dictionary views of the children so we can vectorise the positional comparisons. - SelectionVector lcursor(vcount); - SelectionVector rcursor(vcount); + // Create dictionary views of the children so we can vectorise the positional comparisons. + SelectionVector lcursor(count); + SelectionVector rcursor(count); Vector lchild(ListVector::GetEntry(left), lcursor, count); Vector rchild(ListVector::GetEntry(right), rcursor, count); @@ -43337,105 +48277,137 @@ static idx_t DistinctSelectList(Vector &left, Vector &right, idx_t vcount, Vecto // ++left, ++right; // } // } + + // Get pointers to the list entries + VectorData lvdata; + left.Orrify(count, lvdata); const auto ldata = (const list_entry_t *)lvdata.data; + + VectorData rvdata; + right.Orrify(count, rvdata); const auto rdata = (const list_entry_t *)rvdata.data; + // In order to reuse the comparators, we have to track what passed and failed internally. + // To do that, we need local SVs that we then merge back into the real ones after every pass. + SelectionVector slice_sel(count); + for (idx_t i = 0; i < count; ++i) { + slice_sel.set_index(i, i); + } + + SelectionVector true_sel(count); + SelectionVector false_sel(count); + idx_t match_count = 0; for (idx_t pos = 0; count > 0; ++pos) { // Set up the cursors for the current position - PositionListCursor(lcursor, lvdata, pos, maybe_vec, count); - PositionListCursor(rcursor, rvdata, pos, maybe_vec, count); + PositionListCursor(lcursor, lvdata, pos, slice_sel, count); + PositionListCursor(rcursor, rvdata, pos, slice_sel, count); // Tie-break the pairs where one of the LISTs is exhausted. idx_t true_count = 0; idx_t false_count = 0; idx_t maybe_count = 0; for (idx_t i = 0; i < count; ++i) { - const auto idx = maybe_vec.get_index(i); - const auto lidx = lvdata.sel->get_index(idx); + const auto slice_idx = slice_sel.get_index(i); + const auto lidx = lvdata.sel->get_index(slice_idx); const auto &lentry = ldata[lidx]; - const auto ridx = rvdata.sel->get_index(idx); + const auto ridx = rvdata.sel->get_index(slice_idx); const auto &rentry = rdata[ridx]; if (lentry.length == pos || rentry.length == pos) { + const auto idx = sel.get_index(slice_idx); if (PositionComparator::TieBreak(lentry.length, rentry.length)) { true_opt.Append(true_count, idx); } else { false_opt.Append(false_count, idx); } } else { - maybe_vec.set_index(maybe_count++, idx); + true_sel.set_index(maybe_count++, slice_idx); } } true_opt.Advance(true_count); false_opt.Advance(false_count); - count = maybe_count; match_count += true_count; + // Redensify the list cursors + if (maybe_count < count) { + count = maybe_count; + DensifyNestedSelection(true_sel, count, slice_sel); + PositionListCursor(lcursor, lvdata, pos, slice_sel, count); + PositionListCursor(rcursor, rvdata, pos, slice_sel, count); + } + // Find everything that definitely matches - true_count = PositionComparator::Definite(lchild, rchild, vcount, maybe_vec, count, true_opt, maybe_vec); - true_opt.Advance(true_count); - match_count += true_count; - count -= true_count; + true_count = PositionComparator::Definite(lchild, rchild, slice_sel, count, &true_sel, false_sel); + if (true_count) { + false_count = count - true_count; + ExtractNestedSelection(false_count ? true_sel : slice_sel, true_count, sel, true_opt); + match_count += true_count; + + // Redensify the list cursors + count -= true_count; + DensifyNestedSelection(false_sel, count, slice_sel); + PositionListCursor(lcursor, lvdata, pos, slice_sel, count); + PositionListCursor(rcursor, rvdata, pos, slice_sel, count); + } // Find what might match on the next position - maybe_count = PositionComparator::Possible(lchild, rchild, vcount, maybe_vec, count, maybe_vec, false_opt); - false_count = count - maybe_count; - false_opt.Advance(false_count); - count = maybe_count; + true_count = PositionComparator::Possible(lchild, rchild, slice_sel, count, true_sel, &false_sel); + false_count = count - true_count; + ExtractNestedSelection(true_count ? false_sel : slice_sel, false_count, sel, false_opt); + + if (false_count) { + DensifyNestedSelection(true_sel, true_count, slice_sel); + } + count = true_count; } return match_count; } -template -static idx_t DistinctSelectNested(Vector &left, Vector &right, idx_t vcount, const SelectionVector *sel, idx_t count, +template +static idx_t DistinctSelectNested(Vector &left, Vector &right, const SelectionVector *sel, const idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - // We need multiple, real selections + // The Select operations all use a dense pair of input vectors to partition + // a selection vector in a single pass. But to implement progressive comparisons, + // we have to make multiple passes, so we need to keep track of the original input positions + // and then scatter the output selections when we are done. SelectionVector owned_sel; if (!sel) { sel = FlatVector::IncrementalSelectionVector(count, owned_sel); } - SelectionVector true_vec; - SelectionVector false_vec; - if (DENSE) { - true_vec.Initialize(vcount); - false_vec.Initialize(vcount); - } + // Make buffered selections for progressive comparisons + // TODO: Remove unnecessary allocations + SelectionVector true_vec(count); + OptionalSelection true_opt(&true_vec); - OptionalSelection true_opt(DENSE ? &true_vec : true_sel); - OptionalSelection false_opt(DENSE ? &false_vec : false_sel); + SelectionVector false_vec(count); + OptionalSelection false_opt(&false_vec); - // Handle NULL STRUCTs - VectorData lvdata, rvdata; - left.Orrify(vcount, lvdata); - right.Orrify(vcount, rvdata); + SelectionVector maybe_vec(count); + + // Handle NULL nested values + Vector l_not_null(left); + Vector r_not_null(right); - sel_t maybe_one; - SelectionVector maybe_vec(&maybe_one); - if (count > 1) { - maybe_vec.Initialize(count); - } idx_t match_count = 0; - idx_t no_match_count = count; - count = DistinctSelectNotNull(lvdata, rvdata, count, match_count, *sel, maybe_vec, true_opt, false_opt); - no_match_count -= (count + match_count); + auto unknown = + DistinctSelectNotNull(l_not_null, r_not_null, count, match_count, *sel, maybe_vec, true_opt, false_opt); - idx_t true_count = 0; if (PhysicalType::LIST == left.GetType().InternalType()) { - true_count = - DistinctSelectList(left, right, vcount, lvdata, rvdata, count, maybe_vec, true_opt, false_opt); + match_count += DistinctSelectList(l_not_null, r_not_null, unknown, maybe_vec, true_opt, false_opt); } else { - true_count = - DistinctSelectStruct(left, right, vcount, lvdata, rvdata, count, maybe_vec, true_opt, false_opt); + match_count += DistinctSelectStruct(l_not_null, r_not_null, unknown, maybe_vec, true_opt, false_opt); } - auto false_count = count - true_count; - match_count += true_count; - no_match_count += false_count; + // Copy the buffered selections to the output selections + if (true_sel) { + DensifyNestedSelection(true_vec, match_count, *true_sel); + } - ScatterSelection(true_sel, match_count, *sel, true_vec); - ScatterSelection(false_sel, no_match_count, *sel, false_vec); + if (false_sel) { + DensifyNestedSelection(false_vec, count - match_count, *false_sel); + } return match_count; } @@ -43502,42 +48474,42 @@ static void ExecuteDistinct(Vector &left, Vector &right, Vector &result, idx_t c } } -template -static idx_t TemplatedDistinctSelectOperation(Vector &left, Vector &right, idx_t vcount, const SelectionVector *sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { +template +static idx_t TemplatedDistinctSelectOperation(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, + SelectionVector *true_sel, SelectionVector *false_sel) { // the inplace loops take the result as the last parameter switch (left.GetType().InternalType()) { case PhysicalType::BOOL: case PhysicalType::INT8: - return DistinctSelect(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelect(left, right, sel, count, true_sel, false_sel); case PhysicalType::INT16: - return DistinctSelect(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelect(left, right, sel, count, true_sel, false_sel); case PhysicalType::INT32: - return DistinctSelect(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelect(left, right, sel, count, true_sel, false_sel); case PhysicalType::INT64: - return DistinctSelect(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelect(left, right, sel, count, true_sel, false_sel); case PhysicalType::UINT8: - return DistinctSelect(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelect(left, right, sel, count, true_sel, false_sel); case PhysicalType::UINT16: - return DistinctSelect(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelect(left, right, sel, count, true_sel, false_sel); case PhysicalType::UINT32: - return DistinctSelect(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelect(left, right, sel, count, true_sel, false_sel); case PhysicalType::UINT64: - return DistinctSelect(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelect(left, right, sel, count, true_sel, false_sel); case PhysicalType::INT128: - return DistinctSelect(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelect(left, right, sel, count, true_sel, false_sel); case PhysicalType::FLOAT: - return DistinctSelect(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelect(left, right, sel, count, true_sel, false_sel); case PhysicalType::DOUBLE: - return DistinctSelect(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelect(left, right, sel, count, true_sel, false_sel); case PhysicalType::INTERVAL: - return DistinctSelect(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelect(left, right, sel, count, true_sel, false_sel); case PhysicalType::VARCHAR: - return DistinctSelect(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelect(left, right, sel, count, true_sel, false_sel); case PhysicalType::MAP: case PhysicalType::STRUCT: case PhysicalType::LIST: - return DistinctSelectNested(left, right, vcount, sel, count, true_sel, false_sel); + return DistinctSelectNested(left, right, sel, count, true_sel, false_sel); default: throw InternalException("Invalid type for distinct selection"); } @@ -43553,7 +48525,7 @@ static void NestedDistinctExecute(Vector &left, Vector &right, Vector &result, i result.SetVectorType(VectorType::CONSTANT_VECTOR); auto result_data = ConstantVector::GetData(result); SelectionVector true_sel(1); - auto match_count = TemplatedDistinctSelectOperation(left, right, 1, nullptr, 1, &true_sel, nullptr); + auto match_count = TemplatedDistinctSelectOperation(left, right, nullptr, 1, &true_sel, nullptr); result_data[0] = match_count > 0; return; } @@ -43562,8 +48534,7 @@ static void NestedDistinctExecute(Vector &left, Vector &right, Vector &result, i SelectionVector false_sel(count); // DISTINCT is either true or false - idx_t match_count = - TemplatedDistinctSelectOperation(left, right, count, nullptr, count, &true_sel, &false_sel); + idx_t match_count = TemplatedDistinctSelectOperation(left, right, nullptr, count, &true_sel, &false_sel); result.SetVectorType(VectorType::FLAT_VECTOR); auto result_data = FlatVector::GetData(result); @@ -43591,92 +48562,62 @@ void VectorOperations::NotDistinctFrom(Vector &left, Vector &right, Vector &resu // true := A != B with nulls being equal idx_t VectorOperations::DistinctFrom(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation(left, right, count, sel, count, true_sel, - false_sel); + return TemplatedDistinctSelectOperation(left, right, sel, count, true_sel, false_sel); } // true := A == B with nulls being equal idx_t VectorOperations::NotDistinctFrom(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation(left, right, count, sel, count, true_sel, - false_sel); + return TemplatedDistinctSelectOperation(left, right, sel, count, true_sel, false_sel); } // true := A > B with nulls being maximal idx_t VectorOperations::DistinctGreaterThan(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation(left, right, count, sel, count, true_sel, - false_sel); + return TemplatedDistinctSelectOperation(left, right, sel, count, true_sel, false_sel); } // true := A > B with nulls being minimal idx_t VectorOperations::DistinctGreaterThanNullsFirst(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation( - left, right, count, sel, count, true_sel, false_sel); + return TemplatedDistinctSelectOperation( + left, right, sel, count, true_sel, false_sel); } // true := A >= B with nulls being maximal idx_t VectorOperations::DistinctGreaterThanEquals(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation(left, right, count, sel, count, - true_sel, false_sel); + return TemplatedDistinctSelectOperation(left, right, sel, count, true_sel, + false_sel); } // true := A < B with nulls being maximal idx_t VectorOperations::DistinctLessThan(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation(left, right, count, sel, count, true_sel, - false_sel); + return TemplatedDistinctSelectOperation(left, right, sel, count, true_sel, false_sel); } // true := A < B with nulls being minimal idx_t VectorOperations::DistinctLessThanNullsFirst(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation( - left, right, count, sel, count, true_sel, false_sel); + return TemplatedDistinctSelectOperation( + left, right, sel, count, true_sel, false_sel); } // true := A <= B with nulls being maximal idx_t VectorOperations::DistinctLessThanEquals(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation(left, right, count, sel, count, - true_sel, false_sel); + return TemplatedDistinctSelectOperation(left, right, sel, count, true_sel, + false_sel); } // true := A != B with nulls being equal, inputs selected -idx_t VectorOperations::NestedNotEquals(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation(left, right, vcount, &sel, count, true_sel, - false_sel); +idx_t VectorOperations::NestedNotEquals(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, + SelectionVector *true_sel, SelectionVector *false_sel) { + return TemplatedDistinctSelectOperation(left, right, &sel, count, true_sel, false_sel); } // true := A == B with nulls being equal, inputs selected -idx_t VectorOperations::NestedEquals(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, +idx_t VectorOperations::NestedEquals(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation(left, right, vcount, &sel, count, true_sel, - false_sel); -} -// true := A > B with nulls being maximal, inputs selected -idx_t VectorOperations::NestedGreaterThan(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation(left, right, vcount, &sel, count, - true_sel, false_sel); -} -// true := A >= B with nulls being maximal, inputs selected -idx_t VectorOperations::NestedGreaterThanEquals(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation(left, right, vcount, &sel, count, - true_sel, false_sel); -} -// true := A < B with nulls being maximal, inputs selected -idx_t VectorOperations::NestedLessThan(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation(left, right, vcount, &sel, count, true_sel, - false_sel); -} -// true := A <= B with nulls being maximal, inputs selected -idx_t VectorOperations::NestedLessThanEquals(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return TemplatedDistinctSelectOperation(left, right, vcount, &sel, count, - true_sel, false_sel); + return TemplatedDistinctSelectOperation(left, right, &sel, count, true_sel, false_sel); } } // namespace duckdb @@ -43766,6 +48707,32 @@ bool VectorOperations::HasNull(Vector &input, idx_t count) { } } +idx_t VectorOperations::CountNotNull(Vector &input, const idx_t count) { + idx_t valid = 0; + + VectorData vdata; + input.Orrify(count, vdata); + if (vdata.validity.AllValid()) { + return count; + } + switch (input.GetVectorType()) { + case VectorType::FLAT_VECTOR: + valid += vdata.validity.CountValid(count); + break; + case VectorType::CONSTANT_VECTOR: + valid += vdata.validity.CountValid(1) * count; + break; + default: + for (idx_t i = 0; i < count; ++i) { + const auto row_idx = vdata.sel->get_index(i); + valid += int(vdata.validity.RowIsValid(row_idx)); + } + break; + } + + return valid; +} + } // namespace duckdb //===--------------------------------------------------------------------===// // numeric_inplace_operators.cpp @@ -44209,24 +49176,6 @@ static bool DecimalCastSwitch(Vector &source, Vector &result, idx_t count, strin } // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/likely.hpp -// -// -//===----------------------------------------------------------------------===// - - - -#if __GNUC__ -#define DUCKDB_BUILTIN_EXPECT(cond, expected_value) (__builtin_expect(cond, expected_value)) -#else -#define DUCKDB_BUILTIN_EXPECT(cond, expected_value) (cond) -#endif - -#define DUCKDB_LIKELY(...) DUCKDB_BUILTIN_EXPECT((__VA_ARGS__), 1) -#define DUCKDB_UNLIKELY(...) DUCKDB_BUILTIN_EXPECT((__VA_ARGS__), 0) namespace duckdb { @@ -44378,6 +49327,7 @@ static bool NumericCastSwitch(Vector &source, Vector &result, idx_t count, strin return VectorTryCastLoop(source, result, count, error_message); case LogicalTypeId::DECIMAL: return ToDecimalCast(source, result, count, error_message); + case LogicalTypeId::JSON: case LogicalTypeId::VARCHAR: { VectorStringCast(source, result, count); return true; @@ -44536,6 +49486,10 @@ static bool StringCastSwitch(Vector &source, Vector &result, idx_t count, bool s error_message); case LogicalTypeId::SQLNULL: return TryVectorNullCast(source, result, count, error_message); + case LogicalTypeId::VARCHAR: + case LogicalTypeId::JSON: + result.Reinterpret(source); + return true; default: return VectorStringCastNumericSwitch(source, result, count, strict, error_message); } @@ -44545,6 +49499,7 @@ static bool DateCastSwitch(Vector &source, Vector &result, idx_t count, string * // now switch on the result type switch (result.GetType().id()) { case LogicalTypeId::VARCHAR: + case LogicalTypeId::JSON: // date to varchar VectorStringCast(source, result, count); return true; @@ -44561,6 +49516,7 @@ static bool TimeCastSwitch(Vector &source, Vector &result, idx_t count, string * // now switch on the result type switch (result.GetType().id()) { case LogicalTypeId::VARCHAR: + case LogicalTypeId::JSON: // time to varchar VectorStringCast(source, result, count); return true; @@ -44577,6 +49533,7 @@ static bool TimeTzCastSwitch(Vector &source, Vector &result, idx_t count, string // now switch on the result type switch (result.GetType().id()) { case LogicalTypeId::VARCHAR: + case LogicalTypeId::JSON: // time with time zone to varchar VectorStringCast(source, result, count); return true; @@ -44593,6 +49550,7 @@ static bool TimestampCastSwitch(Vector &source, Vector &result, idx_t count, str // now switch on the result type switch (result.GetType().id()) { case LogicalTypeId::VARCHAR: + case LogicalTypeId::JSON: // timestamp to varchar VectorStringCast(source, result, count); break; @@ -44631,6 +49589,7 @@ static bool TimestampTzCastSwitch(Vector &source, Vector &result, idx_t count, s // now switch on the result type switch (result.GetType().id()) { case LogicalTypeId::VARCHAR: + case LogicalTypeId::JSON: // timestamp with time zone to varchar VectorStringCast(source, result, count); break; @@ -44657,6 +49616,7 @@ static bool TimestampNsCastSwitch(Vector &source, Vector &result, idx_t count, s // now switch on the result type switch (result.GetType().id()) { case LogicalTypeId::VARCHAR: + case LogicalTypeId::JSON: // timestamp (ns) to varchar VectorStringCast(source, result, count); break; @@ -44674,6 +49634,7 @@ static bool TimestampMsCastSwitch(Vector &source, Vector &result, idx_t count, s // now switch on the result type switch (result.GetType().id()) { case LogicalTypeId::VARCHAR: + case LogicalTypeId::JSON: // timestamp (ms) to varchar VectorStringCast(source, result, count); break; @@ -44691,6 +49652,7 @@ static bool TimestampSecCastSwitch(Vector &source, Vector &result, idx_t count, // now switch on the result type switch (result.GetType().id()) { case LogicalTypeId::VARCHAR: + case LogicalTypeId::JSON: // timestamp (sec) to varchar VectorStringCast(source, result, count); break; @@ -44708,6 +49670,7 @@ static bool IntervalCastSwitch(Vector &source, Vector &result, idx_t count, stri // now switch on the result type switch (result.GetType().id()) { case LogicalTypeId::VARCHAR: + case LogicalTypeId::JSON: // time to varchar VectorStringCast(source, result, count); break; @@ -44721,6 +49684,7 @@ static bool UUIDCastSwitch(Vector &source, Vector &result, idx_t count, string * // now switch on the result type switch (result.GetType().id()) { case LogicalTypeId::VARCHAR: + case LogicalTypeId::JSON: // uuid to varchar VectorStringCast(source, result, count); break; @@ -44734,9 +49698,13 @@ static bool BlobCastSwitch(Vector &source, Vector &result, idx_t count, string * // now switch on the result type switch (result.GetType().id()) { case LogicalTypeId::VARCHAR: + case LogicalTypeId::JSON: // blob to varchar VectorStringCast(source, result, count); break; + case LogicalTypeId::AGGREGATE_STATE: + result.Reinterpret(source); + break; default: return TryVectorNullCast(source, result, count, error_message); } @@ -44746,6 +49714,7 @@ static bool BlobCastSwitch(Vector &source, Vector &result, idx_t count, string * static bool ValueStringCastSwitch(Vector &source, Vector &result, idx_t count, string *error_message) { switch (result.GetType().id()) { case LogicalTypeId::VARCHAR: + case LogicalTypeId::JSON: if (source.GetVectorType() == VectorType::CONSTANT_VECTOR) { result.SetVectorType(source.GetVectorType()); } else { @@ -44753,8 +49722,12 @@ static bool ValueStringCastSwitch(Vector &source, Vector &result, idx_t count, s } for (idx_t i = 0; i < count; i++) { auto src_val = source.GetValue(i); - auto str_val = src_val.ToString(); - result.SetValue(i, Value(str_val)); + if (src_val.IsNull()) { + result.SetValue(i, Value(result.GetType())); + } else { + auto str_val = src_val.ToString(); + result.SetValue(i, Value(str_val)); + } } return true; default: @@ -44909,6 +49882,7 @@ static bool EnumCastSwitch(Vector &source, Vector &result, idx_t count, string * } break; } + case LogicalTypeId::JSON: case LogicalTypeId::VARCHAR: { EnumToVarchar(source, result, count, enum_physical_type); break; @@ -44925,6 +49899,15 @@ static bool EnumCastSwitch(Vector &source, Vector &result, idx_t count, string * return true; } +static bool AggregateStateToBlobCast(Vector &source, Vector &result, idx_t count, string *error_message, bool strict) { + if (result.GetType().id() != LogicalTypeId::BLOB) { + throw TypeMismatchException(source.GetType(), result.GetType(), + "Cannot cast AGGREGATE_STATE to anything but BLOB"); + } + result.Reinterpret(source); + return true; +} + static bool StructCastSwitch(Vector &source, Vector &result, idx_t count, string *error_message) { switch (result.GetType().id()) { case LogicalTypeId::STRUCT: @@ -44956,6 +49939,7 @@ static bool StructCastSwitch(Vector &source, Vector &result, idx_t count, string } return true; } + case LogicalTypeId::JSON: case LogicalTypeId::VARCHAR: if (source.GetVectorType() == VectorType::CONSTANT_VECTOR) { result.SetVectorType(source.GetVectorType()); @@ -45023,6 +50007,7 @@ bool VectorOperations::TryCast(Vector &source, Vector &result, idx_t count, stri return TimestampSecCastSwitch(source, result, count, error_message); case LogicalTypeId::INTERVAL: return IntervalCastSwitch(source, result, count, error_message); + case LogicalTypeId::JSON: case LogicalTypeId::VARCHAR: return StringCastSwitch(source, result, count, strict, error_message); case LogicalTypeId::BLOB: @@ -45040,6 +50025,8 @@ bool VectorOperations::TryCast(Vector &source, Vector &result, idx_t count, stri return ListCastSwitch(source, result, count, error_message); case LogicalTypeId::ENUM: return EnumCastSwitch(source, result, count, error_message, strict); + case LogicalTypeId::AGGREGATE_STATE: + return AggregateStateToBlobCast(source, result, count, error_message, strict); default: return TryVectorNullCast(source, result, count, error_message); } @@ -45326,12 +50313,18 @@ void VectorOperations::Copy(const Vector &source, Vector &target, idx_t source_c namespace duckdb { struct HashOp { + static const hash_t NULL_HASH = 0xbf58476d1ce4e5b9; + template static inline hash_t Operation(T input, bool is_null) { - return duckdb::Hash(is_null ? duckdb::NullValue() : input); + return is_null ? NULL_HASH : duckdb::Hash(input); } }; +static inline hash_t CombineHashScalar(hash_t a, hash_t b) { + return (a * UINT64_C(0xbf58476d1ce4e5b9)) ^ b; +} + template static inline void TightLoopHash(T *__restrict ldata, hash_t *__restrict result_data, const SelectionVector *rsel, idx_t count, const SelectionVector *__restrict sel_vector, ValidityMask &mask) { @@ -45373,7 +50366,7 @@ template static inline void StructLoopHash(Vector &input, Vector &hashes, const SelectionVector *rsel, idx_t count) { auto &children = StructVector::GetEntries(input); - D_ASSERT(children.size() > 0); + D_ASSERT(!children.empty()); idx_t col_no = 0; if (HAS_RSEL) { if (FIRST_HASH) { @@ -45403,14 +50396,81 @@ static inline void ListLoopHash(Vector &input, Vector &hashes, const SelectionVe VectorData idata; input.Orrify(count, idata); const auto ldata = (const list_entry_t *)idata.data; - for (idx_t i = 0; i < count; i++) { + + // Hash the children into a temporary + auto &child = ListVector::GetEntry(input); + const auto child_count = ListVector::GetListSize(input); + + Vector child_hashes(LogicalType::HASH, child_count); + VectorOperations::Hash(child, child_hashes, child_count); + auto chdata = FlatVector::GetData(child_hashes); + + // Reduce the number of entries to check to the non-empty ones + SelectionVector unprocessed(count); + SelectionVector cursor(HAS_RSEL ? STANDARD_VECTOR_SIZE : count); + idx_t remaining = 0; + for (idx_t i = 0; i < count; ++i) { const idx_t ridx = HAS_RSEL ? rsel->get_index(i) : i; const auto lidx = idata.sel->get_index(ridx); const auto &entry = ldata[lidx]; - if (idata.validity.RowIsValid(lidx)) { - hdata[ridx] = duckdb::Hash(entry.length); - } else { - hdata[ridx] = 0; + if (idata.validity.RowIsValid(lidx) && entry.length > 0) { + unprocessed.set_index(remaining++, ridx); + cursor.set_index(ridx, entry.offset); + } else if (FIRST_HASH) { + hdata[ridx] = HashOp::NULL_HASH; + } + // Empty or NULL non-first elements have no effect. + } + + count = remaining; + if (count == 0) { + return; + } + + // Merge the first position hash into the main hash + idx_t position = 1; + if (FIRST_HASH) { + remaining = 0; + for (idx_t i = 0; i < count; ++i) { + const auto ridx = unprocessed.get_index(i); + const auto cidx = cursor.get_index(ridx); + hdata[ridx] = chdata[cidx]; + + const auto lidx = idata.sel->get_index(ridx); + const auto &entry = ldata[lidx]; + if (entry.length > position) { + // Entry still has values to hash + unprocessed.set_index(remaining++, ridx); + cursor.set_index(ridx, cidx + 1); + } + } + count = remaining; + if (count == 0) { + return; + } + ++position; + } + + // Combine the hashes for the remaining positions until there are none left + for (;; ++position) { + remaining = 0; + for (idx_t i = 0; i < count; ++i) { + const auto ridx = unprocessed.get_index(i); + const auto cidx = cursor.get_index(ridx); + hdata[ridx] = CombineHashScalar(hdata[ridx], chdata[cidx]); + + const auto lidx = idata.sel->get_index(ridx); + const auto &entry = ldata[lidx]; + if (entry.length > position) { + // Entry still has values to hash + unprocessed.set_index(remaining++, ridx); + cursor.set_index(ridx, cidx + 1); + } + } + + count = remaining; + if (count == 0) { + break; } } } @@ -45479,10 +50539,6 @@ void VectorOperations::Hash(Vector &input, Vector &result, const SelectionVector HashTypeSwitch(input, result, &sel, count); } -static inline hash_t CombineHashScalar(hash_t a, hash_t b) { - return (a * UINT64_C(0xbf58476d1ce4e5b9)) ^ b; -} - template static inline void TightLoopCombineHashConstant(T *__restrict ldata, hash_t constant_hash, hash_t *__restrict hash_data, const SelectionVector *rsel, idx_t count, @@ -45811,7 +50867,7 @@ class VirtualFileSystem : public FileSystem { FindFileSystem(directory)->RemoveDirectory(directory); } - bool ListFiles(const string &directory, const std::function &callback) override { + bool ListFiles(const string &directory, const std::function &callback) override { return FindFileSystem(directory)->ListFiles(directory, callback); } @@ -45823,12 +50879,15 @@ class VirtualFileSystem : public FileSystem { return FindFileSystem(filename)->FileExists(filename); } + bool IsPipe(const string &filename) override { + return FindFileSystem(filename)->IsPipe(filename); + } virtual void RemoveFile(const string &filename) override { FindFileSystem(filename)->RemoveFile(filename); } - vector Glob(const string &path) override { - return FindFileSystem(path)->Glob(path); + virtual vector Glob(const string &path, FileOpener *opener = nullptr) override { + return FindFileSystem(path)->Glob(path, opener); } void RegisterSubSystem(unique_ptr fs) override { @@ -46137,9 +51196,7 @@ void AdaptiveFilter::AdaptRuntimeStatistics(double duration) { - #include -#include namespace duckdb { @@ -46207,7 +51264,7 @@ GroupedAggregateHashTable::GroupedAggregateHashTable(BufferManager &buffer_manag vector distinct_group_types(layout.GetTypes()); (void)distinct_group_types.pop_back(); for (idx_t child_idx = 0; child_idx < aggr.child_count; child_idx++) { - distinct_group_types.push_back(payload_types[payload_idx]); + distinct_group_types.push_back(payload_types[payload_idx + child_idx]); } distinct_hashes[i] = make_unique(buffer_manager, distinct_group_types); } @@ -46413,7 +51470,7 @@ idx_t GroupedAggregateHashTable::AddChunk(DataChunk &groups, Vector &group_hashe // construct chunk for secondary hash table probing vector probe_types(groups.GetTypes()); for (idx_t i = 0; i < aggr.child_count; i++) { - probe_types.push_back(payload_types[payload_idx]); + probe_types.push_back(payload_types[payload_idx + i]); } DataChunk probe_chunk; probe_chunk.Initialize(probe_types); @@ -46920,7 +51977,7 @@ namespace duckdb { //! JoinCondition represents a left-right comparison join condition struct JoinCondition { public: - JoinCondition() : null_values_are_equal(false) { + JoinCondition() { } //! Turns the JoinCondition into an expression; note that this destroys the JoinCondition as the expression inherits @@ -46931,17 +51988,14 @@ struct JoinCondition { unique_ptr left; unique_ptr right; ExpressionType comparison; - //! NULL values are equal for just THIS JoinCondition (instead of the entire join). - //! This is only supported by the HashJoin and can only be used in equality comparisons. - bool null_values_are_equal = false; }; class JoinSide { public: - enum join_value : uint8_t { NONE, LEFT, RIGHT, BOTH }; + enum JoinValue : uint8_t { NONE, LEFT, RIGHT, BOTH }; JoinSide() = default; - constexpr JoinSide(join_value val) : value(val) { // NOLINT: Allow implicit conversion from `join_value` + constexpr JoinSide(JoinValue val) : value(val) { // NOLINT: Allow implicit conversion from `join_value` } bool operator==(JoinSide a) const { @@ -46960,7 +52014,7 @@ class JoinSide { unordered_set &right_bindings); private: - join_value value; + JoinValue value; }; } // namespace duckdb @@ -47354,7 +52408,6 @@ idx_t ExpressionExecutor::Select(const BoundBetweenExpression &expr, ExpressionS - namespace duckdb { struct CaseExpressionState : public ExpressionState { @@ -47711,89 +52764,107 @@ struct NestedSelector { // Select the matching rows for the values of a nested type that are not both NULL. // Those semantics are the same as the corresponding non-distinct comparator template - static idx_t Select(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, - SelectionVector *true_sel, SelectionVector *false_sel) { + static idx_t Select(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, + SelectionVector *false_sel) { throw InvalidTypeException(left.GetType(), "Invalid operation for nested SELECT"); } }; template <> -idx_t NestedSelector::Select(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedEquals(left, right, vcount, sel, count, true_sel, false_sel); +idx_t NestedSelector::Select(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, + SelectionVector *true_sel, SelectionVector *false_sel) { + return VectorOperations::NestedEquals(left, right, sel, count, true_sel, false_sel); } template <> -idx_t NestedSelector::Select(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedNotEquals(left, right, vcount, sel, count, true_sel, false_sel); +idx_t NestedSelector::Select(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, + SelectionVector *true_sel, SelectionVector *false_sel) { + return VectorOperations::NestedNotEquals(left, right, sel, count, true_sel, false_sel); } template <> -idx_t NestedSelector::Select(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedLessThan(left, right, vcount, sel, count, true_sel, false_sel); +idx_t NestedSelector::Select(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, + SelectionVector *true_sel, SelectionVector *false_sel) { + return VectorOperations::DistinctLessThan(left, right, &sel, count, true_sel, false_sel); } template <> -idx_t NestedSelector::Select(Vector &left, Vector &right, idx_t vcount, - const SelectionVector &sel, idx_t count, SelectionVector *true_sel, +idx_t NestedSelector::Select(Vector &left, Vector &right, const SelectionVector &sel, + idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedLessThanEquals(left, right, vcount, sel, count, true_sel, false_sel); + return VectorOperations::DistinctLessThanEquals(left, right, &sel, count, true_sel, false_sel); } template <> -idx_t NestedSelector::Select(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedGreaterThan(left, right, vcount, sel, count, true_sel, false_sel); +idx_t NestedSelector::Select(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, + SelectionVector *true_sel, SelectionVector *false_sel) { + return VectorOperations::DistinctGreaterThan(left, right, &sel, count, true_sel, false_sel); } template <> -idx_t NestedSelector::Select(Vector &left, Vector &right, idx_t vcount, - const SelectionVector &sel, idx_t count, - SelectionVector *true_sel, SelectionVector *false_sel) { - return VectorOperations::NestedGreaterThanEquals(left, right, vcount, sel, count, true_sel, false_sel); +idx_t NestedSelector::Select(Vector &left, Vector &right, const SelectionVector &sel, + idx_t count, SelectionVector *true_sel, + SelectionVector *false_sel) { + return VectorOperations::DistinctGreaterThanEquals(left, right, &sel, count, true_sel, false_sel); } -static inline idx_t SelectNotNull(VectorData &lvdata, VectorData &rvdata, const idx_t count, - OptionalSelection &false_vec, SelectionVector &maybe_vec) { +static inline idx_t SelectNotNull(Vector &left, Vector &right, const idx_t count, const SelectionVector &sel, + SelectionVector &maybe_vec, OptionalSelection &false_opt) { + + VectorData lvdata, rvdata; + left.Orrify(count, lvdata); + right.Orrify(count, rvdata); + + auto &lmask = lvdata.validity; + auto &rmask = rvdata.validity; // For top-level comparisons, NULL semantics are in effect, // so filter out any NULLs - if (!lvdata.validity.AllValid() || !rvdata.validity.AllValid()) { - idx_t true_count = 0; - idx_t false_count = 0; + idx_t remaining = 0; + if (lmask.AllValid() && rmask.AllValid()) { + // None are NULL, distinguish values. for (idx_t i = 0; i < count; ++i) { - const auto lidx = lvdata.sel->get_index(i); - const auto ridx = rvdata.sel->get_index(i); - if (!lvdata.validity.RowIsValid(lidx) || !rvdata.validity.RowIsValid(ridx)) { - false_vec.Append(false_count, i); - } else { - maybe_vec.set_index(true_count++, i); - } + const auto idx = sel.get_index(i); + maybe_vec.set_index(remaining++, idx); } - false_vec.Advance(false_count); + return remaining; + } - return true_count; - } else { - for (idx_t i = 0; i < count; ++i) { - maybe_vec.set_index(i, i); + // Slice the Vectors down to the rows that are not determined (i.e., neither is NULL) + SelectionVector slicer(count); + idx_t false_count = 0; + for (idx_t i = 0; i < count; ++i) { + const auto result_idx = sel.get_index(i); + const auto lidx = lvdata.sel->get_index(i); + const auto ridx = rvdata.sel->get_index(i); + if (!lmask.RowIsValid(lidx) || !rmask.RowIsValid(ridx)) { + false_opt.Append(false_count, result_idx); + } else { + // Neither is NULL, distinguish values. + slicer.set_index(remaining, i); + maybe_vec.set_index(remaining++, result_idx); } - return count; } + false_opt.Advance(false_count); + + if (remaining && remaining < count) { + left.Slice(slicer, remaining); + right.Slice(slicer, remaining); + } + + return remaining; } -static void ScatterSelection(SelectionVector *target, const idx_t count, const SelectionVector *sel, - const SelectionVector &dense_vec) { +static void ScatterSelection(SelectionVector *target, const idx_t count, const SelectionVector &dense_vec) { if (target) { for (idx_t i = 0; i < count; ++i) { - target->set_index(i, sel->get_index(dense_vec.get_index(i))); + target->set_index(i, dense_vec.get_index(i)); } } } template -static idx_t NestedSelectOperation(Vector &left, Vector &right, const SelectionVector *sel, idx_t vcount, +static idx_t NestedSelectOperation(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel) { // The Select operations all use a dense pair of input vectors to partition // a selection vector in a single pass. But to implement progressive comparisons, @@ -47801,47 +52872,34 @@ static idx_t NestedSelectOperation(Vector &left, Vector &right, const SelectionV // and then scatter the output selections when we are done. SelectionVector owned_sel; if (!sel) { - sel = FlatVector::IncrementalSelectionVector(vcount, owned_sel); + sel = FlatVector::IncrementalSelectionVector(count, owned_sel); } - VectorData lvdata, rvdata; - left.Orrify(vcount, lvdata); - right.Orrify(vcount, rvdata); - - // Make real selections for progressive comparisons - SelectionVector true_vec(vcount); + // Make buffered selections for progressive comparisons + // TODO: Remove unnecessary allocations + SelectionVector true_vec(count); OptionalSelection true_opt(&true_vec); - SelectionVector false_vec(vcount); + SelectionVector false_vec(count); OptionalSelection false_opt(&false_vec); - SelectionVector maybe_vec(vcount); - auto count = SelectNotNull(lvdata, rvdata, vcount, false_opt, maybe_vec); - auto no_match_count = vcount - count; + SelectionVector maybe_vec(count); - // If everything was NULL, fill in false_sel with sel - if (count == 0) { - SelectionVector owned_flat_sel; - auto flat_sel = FlatVector::IncrementalSelectionVector(vcount, owned_sel); - ScatterSelection(false_sel, no_match_count, sel, *flat_sel); - return count; - } + // Handle NULL nested values + Vector l_not_null(left); + Vector r_not_null(right); + + auto match_count = SelectNotNull(l_not_null, r_not_null, count, *sel, maybe_vec, false_opt); + auto no_match_count = count - match_count; + count = match_count; // Now that we have handled the NULLs, we can use the recursive nested comparator for the rest. - auto match_count = NestedSelector::Select(left, right, vcount, maybe_vec, count, true_opt, false_opt); + match_count = NestedSelector::Select(l_not_null, r_not_null, maybe_vec, count, true_opt, false_opt); no_match_count += (count - match_count); - // Sort the optional selections if we would overwrite. - if (true_sel == sel) { - std::sort(true_vec.data(), true_vec.data() + match_count); - } - if (false_sel == sel) { - std::sort(false_vec.data(), false_vec.data() + no_match_count); - } - - // Scatter the original selection to the output selections - ScatterSelection(true_sel, match_count, sel, true_vec); - ScatterSelection(false_sel, no_match_count, sel, false_vec); + // Copy the buffered selections to the output selections + ScatterSelection(true_sel, match_count, true_vec); + ScatterSelection(false_sel, no_match_count, false_vec); return match_count; } @@ -48609,9 +53667,9 @@ ExpressionExecutorState::ExpressionExecutorState(const string &name) : profiler( namespace duckdb { -ART::ART(const vector &column_ids, const vector> &unbound_expressions, bool is_unique, - bool is_primary) - : Index(IndexType::ART, column_ids, unbound_expressions, is_unique, is_primary) { +ART::ART(const vector &column_ids, const vector> &unbound_expressions, + IndexConstraintType constraint_type) + : Index(IndexType::ART, column_ids, unbound_expressions, constraint_type) { tree = nullptr; expression_result.Initialize(logical_types); is_little_endian = IsLittleEndian(); @@ -48865,43 +53923,19 @@ bool ART::Append(IndexLock &lock, DataChunk &appended_data, Vector &row_identifi } void ART::VerifyAppend(DataChunk &chunk) { - if (!is_unique) { - return; - } - - DataChunk expression_result; - expression_result.Initialize(logical_types); - - // unique index, check - lock_guard l(lock); - // first resolve the expressions for the index - ExecuteExpressions(chunk, expression_result); + VerifyExistence(chunk, VerifyExistenceType::APPEND); +} - // generate the keys for the given input - vector> keys; - GenerateKeys(expression_result, keys); +void ART::VerifyAppendForeignKey(DataChunk &chunk, string *err_msg_ptr) { + VerifyExistence(chunk, VerifyExistenceType::APPEND_FK, err_msg_ptr); +} - for (idx_t i = 0; i < chunk.size(); i++) { - if (!keys[i]) { - continue; - } - if (Lookup(tree, *keys[i], 0) != nullptr) { - string key_name; - for (idx_t k = 0; k < expression_result.ColumnCount(); k++) { - if (k > 0) { - key_name += ", "; - } - key_name += unbound_expressions[k]->GetName() + ": " + expression_result.data[k].GetValue(i).ToString(); - } - // node already exists in tree - throw ConstraintException("duplicate key \"%s\" violates %s constraint", key_name, - is_primary ? "primary key" : "unique"); - } - } +void ART::VerifyDeleteForeignKey(DataChunk &chunk, string *err_msg_ptr) { + VerifyExistence(chunk, VerifyExistenceType::DELETE_FK, err_msg_ptr); } bool ART::InsertToLeaf(Leaf &leaf, row_t row_id) { - if (is_unique && leaf.num_elements != 0) { + if (IsUnique() && leaf.num_elements != 0) { return false; } leaf.Insert(row_id); @@ -49476,6 +54510,70 @@ bool ART::Scan(Transaction &transaction, DataTable &table, IndexScanState &table return true; } +void ART::VerifyExistence(DataChunk &chunk, VerifyExistenceType verify_type, string *err_msg_ptr) { + if (verify_type != VerifyExistenceType::DELETE_FK && !IsUnique()) { + return; + } + + DataChunk expression_result; + expression_result.Initialize(logical_types); + + // unique index, check + lock_guard l(lock); + // first resolve the expressions for the index + ExecuteExpressions(chunk, expression_result); + + // generate the keys for the given input + vector> keys; + GenerateKeys(expression_result, keys); + + for (idx_t i = 0; i < chunk.size(); i++) { + if (!keys[i]) { + continue; + } + Node *node_ptr = Lookup(tree, *keys[i], 0); + bool throw_exception = + verify_type == VerifyExistenceType::APPEND_FK ? node_ptr == nullptr : node_ptr != nullptr; + if (!throw_exception) { + continue; + } + string key_name; + for (idx_t k = 0; k < expression_result.ColumnCount(); k++) { + if (k > 0) { + key_name += ", "; + } + key_name += unbound_expressions[k]->GetName() + ": " + expression_result.data[k].GetValue(i).ToString(); + } + string exception_msg; + switch (verify_type) { + case VerifyExistenceType::APPEND: { + // node already exists in tree + string type = IsPrimary() ? "primary key" : "unique"; + exception_msg = "duplicate key \"" + key_name + "\" violates "; + exception_msg += type + " constraint"; + break; + } + case VerifyExistenceType::APPEND_FK: { + // found node no exists in tree + exception_msg = + "violates foreign key constraint because key \"" + key_name + "\" no exist in referenced table"; + break; + } + case VerifyExistenceType::DELETE_FK: { + // found node exists in tree + exception_msg = + "violates foreign key constraint because key \"" + key_name + "\" exist in table has foreign key"; + break; + } + } + if (err_msg_ptr) { + err_msg_ptr[i] = exception_msg; + } else { + throw ConstraintException(exception_msg); + } + } +} + } // namespace duckdb @@ -50311,9 +55409,6 @@ class JoinHashTable { - - - namespace duckdb { using ValidityBytes = JoinHashTable::ValidityBytes; @@ -50327,7 +55422,8 @@ JoinHashTable::JoinHashTable(BufferManager &buffer_manager, const vectorreturn_type == condition.right->return_type); auto type = condition.left->return_type; if (condition.comparison == ExpressionType::COMPARE_EQUAL || - condition.comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { + condition.comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM || + condition.comparison == ExpressionType::COMPARE_DISTINCT_FROM) { // all equality conditions should be at the front // all other conditions at the back // this assert checks that @@ -50336,10 +55432,8 @@ JoinHashTable::JoinHashTable(BufferManager &buffer_manager, const vector> select_list; public: + unique_ptr GetGlobalOperatorState(ClientContext &context) const override; unique_ptr GetOperatorState(ClientContext &context) const override; OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const override; + GlobalOperatorState &gstate, OperatorState &state) const override; string ParamsToString() const override; }; @@ -52582,9 +57677,18 @@ PhysicalStreamingWindow::PhysicalStreamingWindow(vector types, vect : PhysicalOperator(type, move(types), estimated_cardinality), select_list(move(select_list)) { } +class StreamingWindowGlobalState : public GlobalOperatorState { +public: + StreamingWindowGlobalState() : row_number(1) { + } + + //! The next row number. + std::atomic row_number; +}; + class StreamingWindowState : public OperatorState { public: - StreamingWindowState() : initialized(false), row_number(1) { + StreamingWindowState() : initialized(false) { } void Initialize(DataChunk &input, const vector> &expressions) { @@ -52615,16 +57719,20 @@ class StreamingWindowState : public OperatorState { public: bool initialized; - int64_t row_number; vector> const_vectors; }; +unique_ptr PhysicalStreamingWindow::GetGlobalOperatorState(ClientContext &context) const { + return make_unique(); +} + unique_ptr PhysicalStreamingWindow::GetOperatorState(ClientContext &context) const { return make_unique(); } OperatorResultType PhysicalStreamingWindow::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state_p) const { + GlobalOperatorState &gstate_p, OperatorState &state_p) const { + auto &gstate = (StreamingWindowGlobalState &)gstate_p; auto &state = (StreamingWindowState &)state_p; if (!state.initialized) { state.Initialize(input, select_list); @@ -52651,7 +57759,7 @@ OperatorResultType PhysicalStreamingWindow::Execute(ExecutionContext &context, D // Set row numbers auto rdata = FlatVector::GetData(chunk.data[col_idx]); for (idx_t i = 0; i < count; i++) { - rdata[i] = state.row_number + i; + rdata[i] = gstate.row_number + i; } break; } @@ -52659,7 +57767,7 @@ OperatorResultType PhysicalStreamingWindow::Execute(ExecutionContext &context, D throw NotImplementedException("%s for StreamingWindow", ExpressionTypeToString(expr.GetExpressionType())); } } - state.row_number += count; + gstate.row_number += count; chunk.SetCardinality(count); return OperatorResultType::NEED_MORE_INPUT; } @@ -53439,7 +58547,7 @@ struct ChunkCollectionIterator { }; template -struct OperationCompare : public std::binary_function { +struct OperationCompare : public std::function { inline bool operator()(const T &lhs, const T &val) const { return OP::template Operation(lhs, val); } @@ -54249,7 +59357,7 @@ class PhysicalFilter : public PhysicalOperator { unique_ptr GetOperatorState(ClientContext &context) const override; OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const override; + GlobalOperatorState &gstate, OperatorState &state) const override; bool ParallelOperator() const override { return true; @@ -54302,7 +59410,7 @@ unique_ptr PhysicalFilter::GetOperatorState(ClientContext &contex } OperatorResultType PhysicalFilter::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state_p) const { + GlobalOperatorState &gstate, OperatorState &state_p) const { auto &state = (FilterState &)state_p; idx_t result_count = state.executor.SelectExpression(input, state.sel); if (result_count == input.size()) { @@ -55521,7 +60629,7 @@ class PhysicalStreamingSample : public PhysicalOperator { // Operator interface unique_ptr GetOperatorState(ClientContext &context) const override; OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const override; + GlobalOperatorState &gstate, OperatorState &state) const override; bool ParallelOperator() const override { return true; @@ -55590,7 +60698,7 @@ unique_ptr PhysicalStreamingSample::GetOperatorState(ClientContex } OperatorResultType PhysicalStreamingSample::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const { + GlobalOperatorState &gstate, OperatorState &state) const { switch (method) { case SampleMethod::BERNOULLI_SAMPLE: BernoulliSample(input, chunk, state); @@ -55945,7 +61053,7 @@ class PhysicalHashJoin : public PhysicalComparisonJoin { // Operator Interface unique_ptr GetOperatorState(ClientContext &context) const override; OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const override; + GlobalOperatorState &gstate, OperatorState &state) const override; bool ParallelOperator() const override { return true; @@ -56140,6 +61248,7 @@ OperatorResultType PerfectHashJoinExecutor::ProbePerfectHashTable(ExecutionConte idx_t probe_sel_count = 0; // fetch the join keys from the chunk + state.join_keys.Reset(); state.probe_executor.Execute(input, state.join_keys); // select the keys that are in the min-max range auto &keys_vec = state.join_keys.data[0]; @@ -56278,7 +61387,7 @@ class PhysicalBlockwiseNLJoin : public PhysicalJoin { // Operator Interface unique_ptr GetOperatorState(ClientContext &context) const override; OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const override; + GlobalOperatorState &gstate, OperatorState &state) const override; bool ParallelOperator() const override { return true; @@ -56417,7 +61526,7 @@ unique_ptr PhysicalBlockwiseNLJoin::GetOperatorState(ClientContex } OperatorResultType PhysicalBlockwiseNLJoin::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state_p) const { + GlobalOperatorState &gstate_p, OperatorState &state_p) const { D_ASSERT(input.size() > 0); auto &state = (BlockwiseNLJoinState &)state_p; auto &gstate = (BlockwiseNLJoinGlobalState &)*sink_state; @@ -56574,7 +61683,7 @@ string PhysicalComparisonJoin::ParamsToString() const { string extra_info = JoinTypeToString(join_type) + "\n"; for (auto &it : conditions) { string op = ExpressionTypeToOperator(it.comparison); - extra_info += it.left->GetName() + op + it.right->GetName() + "\n"; + extra_info += it.left->GetName() + " " + op + " " + it.right->GetName() + "\n"; } return extra_info; } @@ -56680,7 +61789,7 @@ class PhysicalCrossProduct : public PhysicalOperator { // Operator Interface unique_ptr GetOperatorState(ClientContext &context) const override; OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const override; + GlobalOperatorState &gstate, OperatorState &state) const override; bool ParallelOperator() const override { return true; @@ -56758,7 +61867,7 @@ unique_ptr PhysicalCrossProduct::GetOperatorState(ClientContext & } OperatorResultType PhysicalCrossProduct::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state_p) const { + GlobalOperatorState &gstate, OperatorState &state_p) const { auto &state = (CrossProductOperatorState &)state_p; auto &sink = (CrossProductGlobalState &)*sink_state; auto &right_collection = sink.rhs_materialized; @@ -57261,7 +62370,7 @@ unique_ptr PhysicalHashJoin::GetOperatorState(ClientContext &cont } OperatorResultType PhysicalHashJoin::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state_p) const { + GlobalOperatorState &gstate, OperatorState &state_p) const { auto &state = (PhysicalHashJoinState &)state_p; auto &sink = (HashJoinGlobalState &)*sink_state; D_ASSERT(sink.finalized); @@ -57330,6 +62439,1528 @@ void PhysicalHashJoin::GetData(ExecutionContext &context, DataChunk &chunk, Glob sink.hash_table->ScanFullOuter(chunk, state.ht_scan_state); } +} // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/execution/operator/join/physical_piecewise_merge_join.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + +namespace duckdb { + +class IEJoinSortedTable; + +//! PhysicalIEJoin represents a two inequality range join between +//! two tables +class PhysicalIEJoin : public PhysicalComparisonJoin { +public: + PhysicalIEJoin(LogicalOperator &op, unique_ptr left, unique_ptr right, + vector cond, JoinType join_type, idx_t estimated_cardinality); + + vector join_key_types; + vector> lhs_orders; + vector> rhs_orders; + +public: + // Operator Interface + OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, + GlobalOperatorState &gstate, OperatorState &state) const override; + +public: + // Source interface + unique_ptr GetLocalSourceState(ExecutionContext &context, + GlobalSourceState &gstate) const override; + unique_ptr GetGlobalSourceState(ClientContext &context) const override; + void GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate, + LocalSourceState &lstate) const override; + + bool IsSource() const override { + return true; + } + bool ParallelSource() const override { + return true; + } + +public: + // Sink Interface + unique_ptr GetGlobalSinkState(ClientContext &context) const override; + unique_ptr GetLocalSinkState(ExecutionContext &context) const override; + SinkResultType Sink(ExecutionContext &context, GlobalSinkState &state, LocalSinkState &lstate, + DataChunk &input) const override; + void Combine(ExecutionContext &context, GlobalSinkState &gstate, LocalSinkState &lstate) const override; + SinkFinalizeType Finalize(Pipeline &pipeline, Event &event, ClientContext &context, + GlobalSinkState &gstate) const override; + + //! Schedules tasks to merge sort the current child's data during a Finalize phase + static void ScheduleMergeTasks(Pipeline &pipeline, Event &event, IEJoinSortedTable &table); + + bool IsSink() const override { + return true; + } + bool ParallelSink() const override { + return true; + } + +private: + // resolve joins that can potentially output N*M elements (INNER, LEFT, FULL) + void ResolveComplexJoin(ExecutionContext &context, DataChunk &result, LocalSourceState &state) const; +}; + +} // namespace duckdb + + + + + + + + + + + + + +#include + +namespace duckdb { + +PhysicalIEJoin::PhysicalIEJoin(LogicalOperator &op, unique_ptr left, + unique_ptr right, vector cond, JoinType join_type, + idx_t estimated_cardinality) + : PhysicalComparisonJoin(op, PhysicalOperatorType::IE_JOIN, move(cond), join_type, estimated_cardinality) { + // Reorder the conditions so that ranges are at the front. + // TODO: use stats to improve the choice? + // TODO: Prefer fixed length types? + auto conditions_p = std::move(conditions); + conditions.resize(conditions_p.size()); + idx_t range_position = 0; + idx_t other_position = conditions_p.size(); + for (idx_t i = 0; i < conditions_p.size(); ++i) { + switch (conditions_p[i].comparison) { + case ExpressionType::COMPARE_LESSTHAN: + case ExpressionType::COMPARE_LESSTHANOREQUALTO: + case ExpressionType::COMPARE_GREATERTHAN: + case ExpressionType::COMPARE_GREATERTHANOREQUALTO: + conditions[range_position++] = std::move(conditions_p[i]); + break; + case ExpressionType::COMPARE_NOTEQUAL: + case ExpressionType::COMPARE_DISTINCT_FROM: + // Allowed in multi-predicate joins, but can't be first/sort. + conditions[--other_position] = std::move(conditions_p[i]); + break; + default: + // COMPARE EQUAL not supported with iejoin join + throw NotImplementedException("Unimplemented join type for IEJoin"); + } + } + + // IEJoin requires at least two comparisons. + D_ASSERT(range_position > 1); + + // 1. let L1 (resp. L2) be the array of column X (resp. Y) + D_ASSERT(conditions.size() >= 2); + lhs_orders.resize(2); + rhs_orders.resize(2); + for (idx_t i = 0; i < 2; ++i) { + auto &cond = conditions[i]; + D_ASSERT(cond.left->return_type == cond.right->return_type); + join_key_types.push_back(cond.left->return_type); + + // Convert the conditions to sort orders + auto left = cond.left->Copy(); + auto right = cond.right->Copy(); + auto sense = OrderType::INVALID; + + // 2. if (op1 ∈ {>, ≥}) sort L1 in descending order + // 3. else if (op1 ∈ {<, ≤}) sort L1 in ascending order + // 4. if (op2 ∈ {>, ≥}) sort L2 in ascending order + // 5. else if (op2 ∈ {<, ≤}) sort L2 in descending order + switch (cond.comparison) { + case ExpressionType::COMPARE_GREATERTHAN: + case ExpressionType::COMPARE_GREATERTHANOREQUALTO: + sense = i ? OrderType::ASCENDING : OrderType::DESCENDING; + break; + default: + sense = i ? OrderType::DESCENDING : OrderType::ASCENDING; + break; + } + lhs_orders[i].emplace_back(BoundOrderByNode(sense, OrderByNullType::NULLS_LAST, move(left))); + rhs_orders[i].emplace_back(BoundOrderByNode(sense, OrderByNullType::NULLS_LAST, move(right))); + } + + for (idx_t i = 2; i < conditions.size(); ++i) { + auto &cond = conditions[i]; + D_ASSERT(cond.left->return_type == cond.right->return_type); + join_key_types.push_back(cond.left->return_type); + } + + children.push_back(move(left)); + children.push_back(move(right)); +} + +//===--------------------------------------------------------------------===// +// Sink +//===--------------------------------------------------------------------===// +class IEJoinLocalState : public LocalSinkState { +public: + explicit IEJoinLocalState(const vector &conditions, const idx_t child) : has_null(0), count(0) { + // Initialize order clause expression executor and key DataChunk + vector types; + for (const auto &cond : conditions) { + comparisons.emplace_back(cond.comparison); + + const auto &expr = child ? cond.right : cond.left; + executor.AddExpression(*expr); + + types.push_back(expr->return_type); + } + keys.Initialize(types); + } + + //! The local sort state + LocalSortState local_sort_state; + //! Local copy of the sorting expression executor + ExpressionExecutor executor; + //! Holds a vector of incoming sorting columns + DataChunk keys; + //! The comparison list (for null merging) + vector comparisons; + //! The number of NULL values + idx_t has_null; + //! The total number of rows + idx_t count; + + idx_t MergeKeyNulls(); + + void Sink(DataChunk &input, GlobalSortState &global_sort_state) { + // Initialize local state (if necessary) + if (!local_sort_state.initialized) { + local_sort_state.Initialize(global_sort_state, global_sort_state.buffer_manager); + } + + // Obtain sorting columns + keys.Reset(); + executor.Execute(input, keys); + + // Count the NULLs so we can exclude them later + has_null += MergeKeyNulls(); + count += keys.size(); + + // Sink the data into the local sort state + D_ASSERT(keys.ColumnCount() > 1); + // Only sort the primary key + DataChunk join_head; + join_head.data.emplace_back(Vector(keys.data[0])); + join_head.SetCardinality(keys.size()); + + local_sort_state.SinkChunk(join_head, input); + } + + void Sort(GlobalSortState &gss) { + local_sort_state.Sort(gss, true); + } + void Reset() { + has_null = 0; + count = 0; + } +}; + +idx_t IEJoinLocalState::MergeKeyNulls() { + // Merge the validity masks of the comparison keys into the primary + // Return the number of NULLs in the resulting chunk + D_ASSERT(keys.ColumnCount() > 0); + const auto count = keys.size(); + + size_t all_constant = 0; + for (auto &v : keys.data) { + all_constant += int(v.GetVectorType() == VectorType::CONSTANT_VECTOR); + } + + auto &primary = keys.data[0]; + if (all_constant == keys.data.size()) { + // Either all NULL or no NULLs + for (auto &v : keys.data) { + if (ConstantVector::IsNull(v)) { + ConstantVector::SetNull(primary, true); + return count; + } + } + return 0; + } else if (keys.ColumnCount() > 1) { + // Normalify the primary, as it will need to merge arbitrary validity masks + primary.Normalify(count); + auto &pvalidity = FlatVector::Validity(primary); + D_ASSERT(keys.ColumnCount() == comparisons.size()); + for (size_t c = 1; c < keys.data.size(); ++c) { + // Skip comparisons that accept NULLs + if (comparisons[c] == ExpressionType::COMPARE_DISTINCT_FROM) { + continue; + } + // Orrify the rest, as the sort code will do this anyway. + auto &v = keys.data[c]; + VectorData vdata; + v.Orrify(count, vdata); + auto &vvalidity = vdata.validity; + if (vvalidity.AllValid()) { + continue; + } + pvalidity.EnsureWritable(); + auto pmask = pvalidity.GetData(); + if (v.GetVectorType() == VectorType::FLAT_VECTOR) { + // Merge entire entries + const auto entry_count = pvalidity.EntryCount(count); + for (idx_t entry_idx = 0; entry_idx < entry_count; ++entry_idx) { + pmask[entry_idx] &= vvalidity.GetValidityEntry(entry_idx); + } + } + } + return count - pvalidity.CountValid(count); + } else { + return count - VectorOperations::CountNotNull(primary, count); + } +} + +class IEJoinSortedTable { +public: + IEJoinSortedTable(ClientContext &context, const vector &orders, RowLayout &payload_layout) + : global_sort_state(BufferManager::GetBufferManager(context), orders, payload_layout), has_null(0), count(0), + memory_per_thread(0) { + D_ASSERT(orders.size() == 1); + + // Set external (can be force with the PRAGMA) + auto &config = ClientConfig::GetConfig(context); + global_sort_state.external = config.force_external; + // Memory usage per thread should scale with max mem / num threads + // We take 1/4th of this, to be conservative + idx_t max_memory = global_sort_state.buffer_manager.GetMaxMemory(); + idx_t num_threads = TaskScheduler::GetScheduler(context).NumberOfThreads(); + memory_per_thread = (max_memory / num_threads) / 4; + } + + inline idx_t Count() const { + return count; + } + + inline idx_t BlockCount() const { + if (global_sort_state.sorted_blocks.empty()) { + return 0; + } + D_ASSERT(global_sort_state.sorted_blocks.size() == 1); + return global_sort_state.sorted_blocks[0]->radix_sorting_data.size(); + } + + inline idx_t BlockSize(idx_t i) const { + return global_sort_state.sorted_blocks[0]->radix_sorting_data[i].count; + } + + inline void Combine(IEJoinLocalState &lstate) { + global_sort_state.AddLocalState(lstate.local_sort_state); + has_null += lstate.has_null; + count += lstate.count; + } + + inline void IntializeMatches() { + found_match = unique_ptr(new bool[Count()]); + memset(found_match.get(), 0, sizeof(bool) * Count()); + } + + void Print() { + PayloadScanner scanner(global_sort_state, false); + DataChunk chunk; + chunk.Initialize(scanner.GetPayloadTypes()); + for (;;) { + scanner.Scan(chunk); + const auto count = chunk.size(); + if (!count) { + break; + } + chunk.Print(); + } + } + + GlobalSortState global_sort_state; + //! Whether or not the RHS has NULL values + atomic has_null; + //! The total number of rows in the RHS + atomic count; + //! A bool indicating for each tuple in the RHS if they found a match (only used in FULL OUTER JOIN) + unique_ptr found_match; + //! Memory usage per thread + idx_t memory_per_thread; +}; + +class IEJoinGlobalState : public GlobalSinkState { +public: + IEJoinGlobalState(ClientContext &context, const PhysicalIEJoin &op) : child(0) { + tables.resize(2); + RowLayout lhs_layout; + lhs_layout.Initialize(op.children[0]->types); + vector lhs_order; + lhs_order.emplace_back(op.lhs_orders[0][0].Copy()); + tables[0] = make_unique(context, lhs_order, lhs_layout); + + RowLayout rhs_layout; + rhs_layout.Initialize(op.children[1]->types); + vector rhs_order; + rhs_order.emplace_back(op.rhs_orders[0][0].Copy()); + tables[1] = make_unique(context, rhs_order, rhs_layout); + } + + IEJoinGlobalState(IEJoinGlobalState &prev) + : GlobalSinkState(prev), tables(move(prev.tables)), child(prev.child + 1) { + } + + void Sink(DataChunk &input, IEJoinLocalState &lstate) { + auto &table = *tables[child]; + auto &global_sort_state = table.global_sort_state; + auto &local_sort_state = lstate.local_sort_state; + + // Sink the data into the local sort state + lstate.Sink(input, global_sort_state); + + // When sorting data reaches a certain size, we sort it + if (local_sort_state.SizeInBytes() >= table.memory_per_thread) { + local_sort_state.Sort(global_sort_state, true); + } + } + + vector> tables; + size_t child; +}; + +unique_ptr PhysicalIEJoin::GetGlobalSinkState(ClientContext &context) const { + D_ASSERT(!sink_state); + return make_unique(context, *this); +} + +unique_ptr PhysicalIEJoin::GetLocalSinkState(ExecutionContext &context) const { + idx_t sink_child = 0; + if (sink_state) { + const auto &ie_sink = (IEJoinGlobalState &)*sink_state; + sink_child = ie_sink.child; + } + return make_unique(conditions, sink_child); +} + +SinkResultType PhysicalIEJoin::Sink(ExecutionContext &context, GlobalSinkState &gstate_p, LocalSinkState &lstate_p, + DataChunk &input) const { + auto &gstate = (IEJoinGlobalState &)gstate_p; + auto &lstate = (IEJoinLocalState &)lstate_p; + + gstate.Sink(input, lstate); + + return SinkResultType::NEED_MORE_INPUT; +} + +void PhysicalIEJoin::Combine(ExecutionContext &context, GlobalSinkState &gstate_p, LocalSinkState &lstate_p) const { + auto &gstate = (IEJoinGlobalState &)gstate_p; + auto &lstate = (IEJoinLocalState &)lstate_p; + gstate.tables[gstate.child]->Combine(lstate); + auto &client_profiler = QueryProfiler::Get(context.client); + + context.thread.profiler.Flush(this, &lstate.executor, gstate.child ? "rhs_executor" : "lhs_executor", 1); + client_profiler.Flush(context.thread.profiler); +} + +//===--------------------------------------------------------------------===// +// Finalize +//===--------------------------------------------------------------------===// +class IEJoinFinalizeTask : public ExecutorTask { +public: + IEJoinFinalizeTask(shared_ptr event_p, ClientContext &context, IEJoinSortedTable &table) + : ExecutorTask(context), event(move(event_p)), context(context), table(table) { + } + + TaskExecutionResult ExecuteTask(TaskExecutionMode mode) override { + // Initialize iejoin sorted and iterate until done + auto &global_sort_state = table.global_sort_state; + MergeSorter merge_sorter(global_sort_state, BufferManager::GetBufferManager(context)); + merge_sorter.PerformInMergeRound(); + event->FinishTask(); + + return TaskExecutionResult::TASK_FINISHED; + } + +private: + shared_ptr event; + ClientContext &context; + IEJoinSortedTable &table; +}; + +class IEJoinFinalizeEvent : public Event { +public: + IEJoinFinalizeEvent(IEJoinSortedTable &table_p, Pipeline &pipeline_p) + : Event(pipeline_p.executor), table(table_p), pipeline(pipeline_p) { + } + + IEJoinSortedTable &table; + Pipeline &pipeline; + +public: + void Schedule() override { + auto &context = pipeline.GetClientContext(); + + // Schedule tasks equal to the number of threads, which will each iejoin multiple partitions + auto &ts = TaskScheduler::GetScheduler(context); + idx_t num_threads = ts.NumberOfThreads(); + + vector> iejoin_tasks; + for (idx_t tnum = 0; tnum < num_threads; tnum++) { + iejoin_tasks.push_back(make_unique(shared_from_this(), context, table)); + } + SetTasks(move(iejoin_tasks)); + } + + void FinishEvent() override { + auto &global_sort_state = table.global_sort_state; + + global_sort_state.CompleteMergeRound(true); + if (global_sort_state.sorted_blocks.size() > 1) { + // Multiple blocks remaining: Schedule the next round + PhysicalIEJoin::ScheduleMergeTasks(pipeline, *this, table); + } + } +}; + +void PhysicalIEJoin::ScheduleMergeTasks(Pipeline &pipeline, Event &event, IEJoinSortedTable &table) { + // Initialize global sort state for a round of merging + table.global_sort_state.InitializeMergeRound(); + auto new_event = make_shared(table, pipeline); + event.InsertEvent(move(new_event)); +} + +SinkFinalizeType PhysicalIEJoin::Finalize(Pipeline &pipeline, Event &event, ClientContext &context, + GlobalSinkState &gstate_p) const { + auto &gstate = (IEJoinGlobalState &)gstate_p; + auto &table = *gstate.tables[gstate.child]; + auto &global_sort_state = table.global_sort_state; + + if ((gstate.child == 1 && IsRightOuterJoin(join_type)) || (gstate.child == 0 && IsLeftOuterJoin(join_type))) { + // for FULL/LEFT/RIGHT OUTER JOIN, initialize found_match to false for every tuple + table.IntializeMatches(); + } + if (gstate.child == 1 && global_sort_state.sorted_blocks.empty() && EmptyResultIfRHSIsEmpty()) { + // Empty input! + return SinkFinalizeType::NO_OUTPUT_POSSIBLE; + } + + // Prepare for child sort phase + global_sort_state.PrepareMergePhase(); + + // Start the iejoin phase or finish if a iejoin is not necessary + if (global_sort_state.sorted_blocks.size() > 1) { + PhysicalIEJoin::ScheduleMergeTasks(pipeline, event, table); + } + + ++gstate.child; + + return SinkFinalizeType::READY; +} + +//===--------------------------------------------------------------------===// +// Operator +//===--------------------------------------------------------------------===// +struct SBIterator { + static int ComparisonValue(ExpressionType comparison) { + switch (comparison) { + case ExpressionType::COMPARE_LESSTHAN: + case ExpressionType::COMPARE_GREATERTHAN: + return -1; + case ExpressionType::COMPARE_LESSTHANOREQUALTO: + case ExpressionType::COMPARE_GREATERTHANOREQUALTO: + return 0; + default: + throw InternalException("Unimplemented comparison type for IEJoin!"); + } + } + + explicit SBIterator(GlobalSortState &gss, ExpressionType comparison, idx_t entry_idx_p = 0) + : sort_layout(gss.sort_layout), block_count(gss.sorted_blocks[0]->radix_sorting_data.size()), + block_capacity(gss.block_capacity), cmp_size(sort_layout.comparison_size), entry_size(sort_layout.entry_size), + all_constant(sort_layout.all_constant), external(gss.external), cmp(ComparisonValue(comparison)), + scan(gss.buffer_manager, gss), block_ptr(nullptr), entry_ptr(nullptr) { + + scan.sb = gss.sorted_blocks[0].get(); + scan.block_idx = block_count; + SetIndex(entry_idx_p); + } + + inline idx_t GetIndex() const { + return entry_idx; + } + + inline void SetIndex(idx_t entry_idx_p) { + const auto new_block_idx = entry_idx_p / block_capacity; + if (new_block_idx != scan.block_idx) { + scan.SetIndices(new_block_idx, 0); + if (new_block_idx < block_count) { + scan.PinRadix(scan.block_idx); + block_ptr = scan.RadixPtr(); + if (!all_constant) { + scan.PinData(*scan.sb->blob_sorting_data); + } + } + } + + scan.entry_idx = entry_idx_p % block_capacity; + entry_ptr = block_ptr + scan.entry_idx * entry_size; + entry_idx = entry_idx_p; + } + + inline SBIterator &operator++() { + if (++scan.entry_idx < block_capacity) { + entry_ptr += entry_size; + ++entry_idx; + } else { + SetIndex(entry_idx + 1); + } + + return *this; + } + + inline SBIterator &operator--() { + if (scan.entry_idx) { + --scan.entry_idx; + --entry_idx; + entry_ptr -= entry_size; + } else { + SetIndex(entry_idx - 1); + } + + return *this; + } + + inline bool Compare(const SBIterator &other) const { + int comp_res; + if (all_constant) { + comp_res = FastMemcmp(entry_ptr, other.entry_ptr, cmp_size); + } else { + comp_res = Comparators::CompareTuple(scan, other.scan, entry_ptr, other.entry_ptr, sort_layout, external); + } + + return comp_res <= cmp; + } + + // Fixed comparison parameters + const SortLayout &sort_layout; + const idx_t block_count; + const idx_t block_capacity; + const size_t cmp_size; + const size_t entry_size; + const bool all_constant; + const bool external; + const int cmp; + + // Iteration state + SBScanState scan; + idx_t entry_idx; + data_ptr_t block_ptr; + data_ptr_t entry_ptr; +}; + +struct IEJoinUnion { + using SortedTable = IEJoinSortedTable; + + static idx_t AppendKey(SortedTable &table, ExpressionExecutor &executor, SortedTable &marked, int64_t increment, + int64_t base, const idx_t block_idx); + + static void Sort(SortedTable &table) { + auto &global_sort_state = table.global_sort_state; + global_sort_state.PrepareMergePhase(); + while (global_sort_state.sorted_blocks.size() > 1) { + global_sort_state.InitializeMergeRound(); + MergeSorter merge_sorter(global_sort_state, global_sort_state.buffer_manager); + merge_sorter.PerformInMergeRound(); + global_sort_state.CompleteMergeRound(true); + } + } + + template + static vector ExtractColumn(SortedTable &table, idx_t col_idx) { + vector result; + result.reserve(table.count); + + auto &gstate = table.global_sort_state; + auto &blocks = *gstate.sorted_blocks[0]->payload_data; + PayloadScanner scanner(blocks, gstate, false); + + DataChunk payload; + payload.Initialize(gstate.payload_layout.GetTypes()); + for (;;) { + scanner.Scan(payload); + const auto count = payload.size(); + if (!count) { + break; + } + + const auto data_ptr = FlatVector::GetData(payload.data[col_idx]); + result.insert(result.end(), data_ptr, data_ptr + count); + } + + return result; + } + + IEJoinUnion(ClientContext &context, const PhysicalIEJoin &op, SortedTable &t1, const idx_t b1, SortedTable &t2, + const idx_t b2); + + idx_t SearchL1(idx_t pos); + bool NextRow(); + + //! Inverted loop + idx_t JoinComplexBlocks(SelectionVector &lsel, SelectionVector &rsel); + + //! L1 + unique_ptr l1; + //! L2 + unique_ptr l2; + + //! Li + vector li; + //! P + vector p; + + //! B + vector bit_array; + ValidityMask bit_mask; + + //! Bloom Filter + static constexpr idx_t BLOOM_CHUNK_BITS = 1024; + idx_t bloom_count; + vector bloom_array; + ValidityMask bloom_filter; + + //! Iteration state + idx_t n; + idx_t i; + idx_t j; + unique_ptr op1; + unique_ptr off1; + unique_ptr op2; + unique_ptr off2; + int64_t lrid; +}; + +idx_t IEJoinUnion::AppendKey(SortedTable &table, ExpressionExecutor &executor, SortedTable &marked, int64_t increment, + int64_t base, const idx_t block_idx) { + LocalSortState local_sort_state; + local_sort_state.Initialize(marked.global_sort_state, marked.global_sort_state.buffer_manager); + + // Reading + const auto valid = table.count - table.has_null; + auto &gstate = table.global_sort_state; + PayloadScanner scanner(gstate, block_idx); + auto table_idx = block_idx * gstate.block_capacity; + + DataChunk scanned; + scanned.Initialize(scanner.GetPayloadTypes()); + + // Writing + auto types = local_sort_state.sort_layout->logical_types; + const idx_t payload_idx = types.size(); + + const auto &payload_types = local_sort_state.payload_layout->GetTypes(); + types.insert(types.end(), payload_types.begin(), payload_types.end()); + const idx_t rid_idx = types.size() - 1; + + DataChunk keys; + DataChunk payload; + keys.Initialize(types); + + idx_t inserted = 0; + for (auto rid = base; table_idx < valid;) { + scanner.Scan(scanned); + + // NULLs are at the end, so stop when we reach them + auto scan_count = scanned.size(); + if (table_idx + scan_count > valid) { + scan_count = valid - table_idx; + scanned.SetCardinality(scan_count); + } + if (scan_count == 0) { + break; + } + table_idx += scan_count; + + // Compute the input columns from the payload + keys.Reset(); + keys.Split(payload, rid_idx); + executor.Execute(scanned, keys); + + // Mark the rid column + payload.data[0].Sequence(rid, increment); + payload.SetCardinality(scan_count); + keys.Fuse(payload); + rid += increment * scan_count; + + // Sort on the sort columns (which will no longer be needed) + keys.Split(payload, payload_idx); + local_sort_state.SinkChunk(keys, payload); + inserted += scan_count; + keys.Fuse(payload); + + // Flush when we have enough data + if (local_sort_state.SizeInBytes() >= marked.memory_per_thread) { + local_sort_state.Sort(marked.global_sort_state, true); + } + } + marked.global_sort_state.AddLocalState(local_sort_state); + marked.count += inserted; + + return inserted; +} + +IEJoinUnion::IEJoinUnion(ClientContext &context, const PhysicalIEJoin &op, SortedTable &t1, const idx_t b1, + SortedTable &t2, const idx_t b2) + : n(0), i(0) { + // input : query Q with 2 join predicates t1.X op1 t2.X' and t1.Y op2 t2.Y', tables T, T' of sizes m and n resp. + // output: a list of tuple pairs (ti , tj) + // Note that T/T' are already sorted on X/X' and contain the payload data + // We only join the two block numbers and use the sizes of the blocks as the counts + + // 0. Filter out tables with no overlap + if (!t1.BlockSize(b1) || !t2.BlockSize(b2)) { + return; + } + + const auto &cmp1 = op.conditions[0].comparison; + SBIterator bounds1(t1.global_sort_state, cmp1); + SBIterator bounds2(t2.global_sort_state, cmp1); + + // t1.X[0] op1 t2.X'[-1] + bounds1.SetIndex(bounds1.block_capacity * b1); + bounds2.SetIndex(bounds2.block_capacity * b2 + t2.BlockSize(b2) - 1); + if (!bounds1.Compare(bounds2)) { + return; + } + + // 1. let L1 (resp. L2) be the array of column X (resp. Y ) + const auto &order1 = op.lhs_orders[0][0]; + const auto &order2 = op.lhs_orders[1][0]; + + // 2. if (op1 ∈ {>, ≥}) sort L1 in descending order + // 3. else if (op1 ∈ {<, ≤}) sort L1 in ascending order + + // For the union algorithm, we make a unified table with the keys and the rids as the payload: + // X/X', Y/Y', R/R'/Li + // The first position is the sort key. + vector types; + types.emplace_back(order2.expression->return_type); + types.emplace_back(LogicalType::BIGINT); + RowLayout payload_layout; + payload_layout.Initialize(types); + + // Sort on the first expression + auto ref = make_unique(order1.expression->return_type, 0); + vector orders; + orders.emplace_back(BoundOrderByNode(order1.type, order1.null_order, move(ref))); + + l1 = make_unique(context, orders, payload_layout); + + // LHS has positive rids + ExpressionExecutor l_executor; + l_executor.AddExpression(*order1.expression); + l_executor.AddExpression(*order2.expression); + AppendKey(t1, l_executor, *l1, 1, 1, b1); + + // RHS has negative rids + ExpressionExecutor r_executor; + r_executor.AddExpression(*op.rhs_orders[0][0].expression); + r_executor.AddExpression(*op.rhs_orders[1][0].expression); + AppendKey(t2, r_executor, *l1, -1, -1, b2); + + Sort(*l1); + + op1 = make_unique(l1->global_sort_state, cmp1); + off1 = make_unique(l1->global_sort_state, cmp1); + + // We don't actually need the L1 column, just its sort key, which is in the sort blocks + li = ExtractColumn(*l1, types.size() - 1); + + // 4. if (op2 ∈ {>, ≥}) sort L2 in ascending order + // 5. else if (op2 ∈ {<, ≤}) sort L2 in descending order + + // We sort on Y/Y' to obtain the sort keys and the permutation array. + // For this we just need a two-column table of Y, P + types.clear(); + types.emplace_back(LogicalType::BIGINT); + payload_layout.Initialize(types); + + // Sort on the first expression + orders.clear(); + ref = make_unique(order2.expression->return_type, 0); + orders.emplace_back(BoundOrderByNode(order2.type, order2.null_order, move(ref))); + + ExpressionExecutor executor; + executor.AddExpression(*orders[0].expression); + + l2 = make_unique(context, orders, payload_layout); + for (idx_t base = 0, block_idx = 0; block_idx < l1->BlockCount(); ++block_idx) { + base += AppendKey(*l1, executor, *l2, 1, base, block_idx); + } + + Sort(*l2); + + // We don't actually need the L2 column, just its sort key, which is in the sort blocks + + // 6. compute the permutation array P of L2 w.r.t. L1 + p = ExtractColumn(*l2, types.size() - 1); + + // 7. initialize bit-array B (|B| = n), and set all bits to 0 + n = l2->count.load(); + bit_array.resize(ValidityMask::EntryCount(n), 0); + bit_mask.Initialize(bit_array.data()); + + // Bloom filter + bloom_count = (n + (BLOOM_CHUNK_BITS - 1)) / BLOOM_CHUNK_BITS; + bloom_array.resize(ValidityMask::EntryCount(bloom_count), 0); + bloom_filter.Initialize(bloom_array.data()); + + // 11. for(i←1 to n) do + const auto &cmp2 = op.conditions[1].comparison; + op2 = make_unique(l2->global_sort_state, cmp2); + off2 = make_unique(l2->global_sort_state, cmp2); + i = 0; + j = 0; + (void)NextRow(); +} + +idx_t IEJoinUnion::SearchL1(idx_t pos) { + // Perform an exponential search in the appropriate direction + op1->SetIndex(pos); + + idx_t step = 1; + auto hi = pos; + auto lo = pos; + if (!op1->cmp) { + // Scan left for loose inequality + lo -= MinValue(step, lo); + step *= 2; + off1->SetIndex(lo); + while (lo > 0 && op1->Compare(*off1)) { + hi = lo; + lo -= MinValue(step, lo); + step *= 2; + off1->SetIndex(lo); + } + } else { + // Scan right for strict inequality + hi += MinValue(step, n - hi); + step *= 2; + off1->SetIndex(hi); + while (hi < n && !op1->Compare(*off1)) { + lo = hi; + hi += MinValue(step, n - hi); + step *= 2; + off1->SetIndex(hi); + } + } + + // Binary search the target area + while (lo < hi) { + const auto mid = lo + (hi - lo) / 2; + off1->SetIndex(mid); + if (op1->Compare(*off1)) { + hi = mid; + } else { + lo = mid + 1; + } + } + + off1->SetIndex(lo); + + return lo; +} + +bool IEJoinUnion::NextRow() { + for (; i < n; ++i) { + // 12. pos ← P[i] + auto pos = p[i]; + lrid = li[pos]; + if (lrid < 0) { + continue; + } + + // 16. B[pos] ← 1 + op2->SetIndex(i); + for (; off2->GetIndex() < n; ++(*off2)) { + if (!off2->Compare(*op2)) { + break; + } + const auto p2 = p[off2->GetIndex()]; + if (li[p2] < 0) { + // Only mark rhs matches. + bit_mask.SetValid(p2); + bloom_filter.SetValid(p2 / BLOOM_CHUNK_BITS); + } + } + + // 9. if (op1 ∈ {≤,≥} and op2 ∈ {≤,≥}) eqOff = 0 + // 10. else eqOff = 1 + // No, because there could be more than one equal value. + // Find the leftmost off1 where L1[pos] op1 L1[off1..n] + // These are the rows that satisfy the op1 condition + // and that is where we should start scanning B from + j = SearchL1(pos); + + return true; + } + return false; +} + +static idx_t NextValid(const ValidityMask &bits, idx_t j, const idx_t n) { + if (j >= n) { + return n; + } + + // We can do a first approximation by checking entries one at a time + // which gives 64:1. + idx_t entry_idx, idx_in_entry; + bits.GetEntryIndex(j, entry_idx, idx_in_entry); + auto entry = bits.GetValidityEntry(entry_idx++); + + // Trim the bits before the start position + entry &= (ValidityMask::ValidityBuffer::MAX_ENTRY << idx_in_entry); + + // Check the non-ragged entries + for (const auto entry_count = bits.EntryCount(n); entry_idx < entry_count; ++entry_idx) { + if (entry) { + for (; idx_in_entry < bits.BITS_PER_VALUE; ++idx_in_entry, ++j) { + if (bits.RowIsValid(entry, idx_in_entry)) { + return j; + } + } + } else { + j += bits.BITS_PER_VALUE - idx_in_entry; + } + + entry = bits.GetValidityEntry(entry_idx); + idx_in_entry = 0; + } + + // Check the final entry + for (; j < n; ++idx_in_entry, ++j) { + if (bits.RowIsValid(entry, idx_in_entry)) { + return j; + } + } + + return j; +} + +idx_t IEJoinUnion::JoinComplexBlocks(SelectionVector &lsel, SelectionVector &rsel) { + // 8. initialize join result as an empty list for tuple pairs + idx_t result_count = 0; + + // 11. for(i←1 to n) do + while (i < n) { + // 13. for (j ← pos+eqOff to n) do + for (;;) { + // 14. if B[j] = 1 then + + // Use the Bloom filter to find candidate blocks + while (j < n) { + auto bloom_begin = NextValid(bloom_filter, j / BLOOM_CHUNK_BITS, bloom_count) * BLOOM_CHUNK_BITS; + auto bloom_end = MinValue(n, bloom_begin + BLOOM_CHUNK_BITS); + + j = MaxValue(j, bloom_begin); + j = NextValid(bit_mask, j, bloom_end); + if (j < bloom_end) { + break; + } + } + + if (j >= n) { + break; + } + + // Filter out tuples with the same sign (they come from the same table) + const auto rrid = li[j]; + ++j; + + // 15. add tuples w.r.t. (L1[j], L1[i]) to join result + if (lrid > 0 && rrid < 0) { + lsel.set_index(result_count, sel_t(+lrid - 1)); + rsel.set_index(result_count, sel_t(-rrid - 1)); + ++result_count; + if (result_count == STANDARD_VECTOR_SIZE) { + // out of space! + return result_count; + } + } + } + ++i; + + if (!NextRow()) { + break; + } + } + + return result_count; +} + +class IEJoinState : public OperatorState { +public: + explicit IEJoinState(const PhysicalIEJoin &op) : local_left(op.conditions, 0) {}; + + IEJoinLocalState local_left; +}; + +static void SliceSortedPayload(DataChunk &payload, GlobalSortState &state, const idx_t block_idx, + const SelectionVector &result, const idx_t result_count, const idx_t left_cols = 0) { + // There should only be one sorted block if they have been sorted + D_ASSERT(state.sorted_blocks.size() == 1); + SBScanState read_state(state.buffer_manager, state); + read_state.sb = state.sorted_blocks[0].get(); + auto &sorted_data = *read_state.sb->payload_data; + + read_state.SetIndices(block_idx, 0); + read_state.PinData(sorted_data); + const auto data_ptr = read_state.DataPtr(sorted_data); + + // Set up a batch of pointers to scan data from + Vector addresses(LogicalType::POINTER, result_count); + auto data_pointers = FlatVector::GetData(addresses); + + // Set up the data pointers for the values that are actually referenced + const idx_t &row_width = sorted_data.layout.GetRowWidth(); + + auto prev_idx = result.get_index(0); + SelectionVector gsel(result_count); + idx_t addr_count = 0; + gsel.set_index(0, addr_count); + data_pointers[addr_count] = data_ptr + prev_idx * row_width; + for (idx_t i = 1; i < result_count; ++i) { + const auto row_idx = result.get_index(i); + if (row_idx != prev_idx) { + data_pointers[++addr_count] = data_ptr + row_idx * row_width; + prev_idx = row_idx; + } + gsel.set_index(i, addr_count); + } + ++addr_count; + + // Unswizzle the offsets back to pointers (if needed) + if (!sorted_data.layout.AllConstant() && state.external) { + RowOperations::UnswizzlePointers(sorted_data.layout, data_ptr, read_state.payload_heap_handle->Ptr(), + addr_count); + } + + // Deserialize the payload data + auto sel = FlatVector::IncrementalSelectionVector(); + for (idx_t col_idx = 0; col_idx < sorted_data.layout.ColumnCount(); col_idx++) { + const auto col_offset = sorted_data.layout.GetOffsets()[col_idx]; + auto &col = payload.data[left_cols + col_idx]; + RowOperations::Gather(addresses, *sel, col, *sel, addr_count, col_offset, col_idx); + col.Slice(gsel, result_count); + } +} + +class IEJoinLocalSourceState : public LocalSourceState { +public: + explicit IEJoinLocalSourceState(const PhysicalIEJoin &op) + : op(op), true_sel(STANDARD_VECTOR_SIZE), left_matches(nullptr), right_matches(nullptr) { + + if (op.conditions.size() < 3) { + return; + } + + vector left_types; + vector right_types; + for (idx_t i = 2; i < op.conditions.size(); ++i) { + const auto &cond = op.conditions[i]; + + left_types.push_back(cond.left->return_type); + left_executor.AddExpression(*cond.left); + + right_types.push_back(cond.left->return_type); + right_executor.AddExpression(*cond.right); + } + + left_keys.Initialize(left_types); + right_keys.Initialize(right_types); + } + + idx_t SelectJoinTail(const ExpressionType &condition, Vector &left, Vector &right, const SelectionVector *sel, + idx_t count); + + idx_t SelectOuterRows(bool *matches) { + idx_t count = 0; + for (; outer_idx < outer_count; ++outer_idx) { + if (!matches[outer_idx]) { + true_sel.set_index(count++, outer_idx); + if (count >= STANDARD_VECTOR_SIZE) { + break; + } + } + } + + return count; + } + + const PhysicalIEJoin &op; + + // Joining + unique_ptr joiner; + + idx_t left_base; + idx_t left_block_index; + + idx_t right_base; + idx_t right_block_index; + + // Trailing predicates + SelectionVector true_sel; + + ExpressionExecutor left_executor; + DataChunk left_keys; + + ExpressionExecutor right_executor; + DataChunk right_keys; + + // Outer joins + idx_t outer_idx; + idx_t outer_count; + bool *left_matches; + bool *right_matches; +}; + +idx_t IEJoinLocalSourceState::SelectJoinTail(const ExpressionType &condition, Vector &left, Vector &right, + const SelectionVector *sel, idx_t count) { + switch (condition) { + case ExpressionType::COMPARE_NOTEQUAL: + return VectorOperations::NotEquals(left, right, sel, count, &true_sel, nullptr); + case ExpressionType::COMPARE_LESSTHAN: + return VectorOperations::LessThan(left, right, sel, count, &true_sel, nullptr); + case ExpressionType::COMPARE_GREATERTHAN: + return VectorOperations::GreaterThan(left, right, sel, count, &true_sel, nullptr); + case ExpressionType::COMPARE_LESSTHANOREQUALTO: + return VectorOperations::LessThanEquals(left, right, sel, count, &true_sel, nullptr); + case ExpressionType::COMPARE_GREATERTHANOREQUALTO: + return VectorOperations::GreaterThanEquals(left, right, sel, count, &true_sel, nullptr); + case ExpressionType::COMPARE_DISTINCT_FROM: + return VectorOperations::DistinctFrom(left, right, sel, count, &true_sel, nullptr); + case ExpressionType::COMPARE_NOT_DISTINCT_FROM: + case ExpressionType::COMPARE_EQUAL: + default: + throw InternalException("Unsupported comparison type for PhysicalIEJoin"); + } + + return count; +} + +void PhysicalIEJoin::ResolveComplexJoin(ExecutionContext &context, DataChunk &chunk, LocalSourceState &state_p) const { + auto &state = (IEJoinLocalSourceState &)state_p; + auto &ie_sink = (IEJoinGlobalState &)*sink_state; + auto &left_table = *ie_sink.tables[0]; + auto &right_table = *ie_sink.tables[1]; + + const auto left_cols = children[0]->GetTypes().size(); + do { + SelectionVector lsel(STANDARD_VECTOR_SIZE); + SelectionVector rsel(STANDARD_VECTOR_SIZE); + auto result_count = state.joiner->JoinComplexBlocks(lsel, rsel); + if (result_count == 0) { + // exhausted this pair + return; + } + + // found matches: extract them + chunk.Reset(); + SliceSortedPayload(chunk, left_table.global_sort_state, state.left_block_index, lsel, result_count, 0); + SliceSortedPayload(chunk, right_table.global_sort_state, state.right_block_index, rsel, result_count, + left_cols); + chunk.SetCardinality(result_count); + + auto sel = FlatVector::IncrementalSelectionVector(); + if (conditions.size() > 2) { + // If there are more expressions to compute, + // split the result chunk into the left and right halves + // so we can compute the values for comparison. + const auto tail_cols = conditions.size() - 2; + + DataChunk right_chunk; + chunk.Split(right_chunk, left_cols); + state.left_executor.SetChunk(chunk); + state.right_executor.SetChunk(right_chunk); + + auto tail_count = result_count; + for (size_t cmp_idx = 0; cmp_idx < tail_cols; ++cmp_idx) { + auto &left = state.left_keys.data[cmp_idx]; + state.left_executor.ExecuteExpression(cmp_idx, left); + + auto &right = state.right_keys.data[cmp_idx]; + state.right_executor.ExecuteExpression(cmp_idx, right); + + if (tail_count < result_count) { + left.Slice(*sel, tail_count); + right.Slice(*sel, tail_count); + } + tail_count = state.SelectJoinTail(conditions[cmp_idx + 2].comparison, left, right, sel, tail_count); + sel = &state.true_sel; + } + chunk.Fuse(right_chunk); + + if (tail_count < result_count) { + result_count = tail_count; + chunk.Slice(*sel, result_count); + } + } + + // found matches: mark the found matches if required + if (left_table.found_match) { + for (idx_t i = 0; i < result_count; i++) { + left_table.found_match[state.left_base + lsel[sel->get_index(i)]] = true; + } + } + if (right_table.found_match) { + for (idx_t i = 0; i < result_count; i++) { + right_table.found_match[state.right_base + rsel[sel->get_index(i)]] = true; + } + } + chunk.Verify(); + } while (chunk.size() == 0); +} + +OperatorResultType PhysicalIEJoin::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, + GlobalOperatorState &gstate, OperatorState &state) const { + return OperatorResultType::FINISHED; +} + +//===--------------------------------------------------------------------===// +// Source +//===--------------------------------------------------------------------===// +class IEJoinGlobalSourceState : public GlobalSourceState { +public: + explicit IEJoinGlobalSourceState(const PhysicalIEJoin &op) + : op(op), initialized(false), next_pair(0), completed(0), left_outers(0), next_left(0), right_outers(0), + next_right(0) { + } + + void Initialize(IEJoinGlobalState &sink_state) { + lock_guard initializing(lock); + if (initialized) { + return; + } + + // Compute the starting row for reach block + // (In theory these are all the same size, but you never know...) + auto &left_table = *sink_state.tables[0]; + const auto left_blocks = left_table.BlockCount(); + idx_t left_base = 0; + + for (size_t lhs = 0; lhs < left_blocks; ++lhs) { + left_bases.emplace_back(left_base); + left_base += left_table.BlockSize(lhs); + } + + auto &right_table = *sink_state.tables[1]; + const auto right_blocks = right_table.BlockCount(); + idx_t right_base = 0; + for (size_t rhs = 0; rhs < right_blocks; ++rhs) { + right_bases.emplace_back(right_base); + right_base += right_table.BlockSize(rhs); + } + + // Outer join block counts + if (left_table.found_match) { + left_outers = left_blocks; + } + + if (right_table.found_match) { + right_outers = right_blocks; + } + + // Ready for action + initialized = true; + } + +public: + idx_t MaxThreads() override { + // We can't leverage any more threads than block pairs. + const auto &sink_state = ((IEJoinGlobalState &)*op.sink_state); + return sink_state.tables[0]->BlockCount() * sink_state.tables[1]->BlockCount(); + } + + void GetNextPair(ClientContext &client, IEJoinGlobalState &gstate, IEJoinLocalSourceState &lstate) { + auto &left_table = *gstate.tables[0]; + auto &right_table = *gstate.tables[1]; + + const auto left_blocks = left_table.BlockCount(); + const auto right_blocks = right_table.BlockCount(); + const auto pair_count = left_blocks * right_blocks; + + // Regular block + const auto i = next_pair++; + if (i < pair_count) { + const auto b1 = i / right_blocks; + const auto b2 = i % right_blocks; + + lstate.left_block_index = b1; + lstate.left_base = left_bases[b1]; + + lstate.right_block_index = b2; + lstate.right_base = right_bases[b2]; + + lstate.joiner = make_unique(client, op, left_table, b1, right_table, b2); + return; + } else { + --next_pair; + } + + // Outer joins + if (!left_outers && !right_outers) { + return; + } + + // Spin wait for regular blocks to finish(!) + while (completed < pair_count) { + std::this_thread::yield(); + } + + // Left outer blocks + const auto l = next_left++; + if (l < left_outers) { + lstate.left_block_index = l; + lstate.left_base = left_bases[l]; + + lstate.left_matches = left_table.found_match.get() + lstate.left_base; + lstate.outer_idx = 0; + lstate.outer_count = left_table.BlockSize(l); + return; + } else { + lstate.left_matches = nullptr; + --next_left; + } + + // Right outer block + const auto r = next_right++; + if (r < right_outers) { + lstate.right_block_index = r; + lstate.right_base = right_bases[r]; + + lstate.right_matches = right_table.found_match.get() + lstate.right_base; + lstate.outer_idx = 0; + lstate.outer_count = right_table.BlockSize(r); + return; + } else { + lstate.right_matches = nullptr; + --next_right; + } + } + + void PairCompleted(ClientContext &client, IEJoinGlobalState &gstate, IEJoinLocalSourceState &lstate) { + lstate.joiner.reset(); + ++completed; + GetNextPair(client, gstate, lstate); + } + + const PhysicalIEJoin &op; + + mutex lock; + bool initialized; + + // Join queue state + std::atomic next_pair; + std::atomic completed; + + // Block base row number + vector left_bases; + vector right_bases; + + // Outer joins + idx_t left_outers; + std::atomic next_left; + + idx_t right_outers; + std::atomic next_right; +}; + +unique_ptr PhysicalIEJoin::GetGlobalSourceState(ClientContext &context) const { + return make_unique(*this); +} + +unique_ptr PhysicalIEJoin::GetLocalSourceState(ExecutionContext &context, + GlobalSourceState &gstate) const { + return make_unique(*this); +} + +void PhysicalIEJoin::GetData(ExecutionContext &context, DataChunk &result, GlobalSourceState &gstate, + LocalSourceState &lstate) const { + auto &ie_sink = (IEJoinGlobalState &)*sink_state; + auto &ie_gstate = (IEJoinGlobalSourceState &)gstate; + auto &ie_lstate = (IEJoinLocalSourceState &)lstate; + + ie_gstate.Initialize(ie_sink); + + if (!ie_lstate.joiner) { + ie_gstate.GetNextPair(context.client, ie_sink, ie_lstate); + } + + // Process INNER results + while (ie_lstate.joiner) { + ResolveComplexJoin(context, result, ie_lstate); + + if (result.size()) { + return; + } + + ie_gstate.PairCompleted(context.client, ie_sink, ie_lstate); + } + + // Process LEFT OUTER results + const auto left_cols = children[0]->GetTypes().size(); + while (ie_lstate.left_matches) { + const idx_t count = ie_lstate.SelectOuterRows(ie_lstate.left_matches); + if (!count) { + ie_gstate.GetNextPair(context.client, ie_sink, ie_lstate); + continue; + } + + SliceSortedPayload(result, ie_sink.tables[0]->global_sort_state, ie_lstate.left_base, ie_lstate.true_sel, + count); + + // Fill in NULLs to the right + for (auto col_idx = left_cols; col_idx < result.ColumnCount(); ++col_idx) { + result.data[col_idx].SetVectorType(VectorType::CONSTANT_VECTOR); + ConstantVector::SetNull(result.data[col_idx], true); + } + + result.SetCardinality(count); + result.Verify(); + + return; + } + + // Process RIGHT OUTER results + while (ie_lstate.right_matches) { + const idx_t count = ie_lstate.SelectOuterRows(ie_lstate.right_matches); + if (!count) { + ie_gstate.GetNextPair(context.client, ie_sink, ie_lstate); + } + + SliceSortedPayload(result, ie_sink.tables[1]->global_sort_state, ie_lstate.right_base, ie_lstate.true_sel, + count, left_cols); + + // Fill in NULLs to the left + for (idx_t col_idx = 0; col_idx < left_cols; ++col_idx) { + result.data[col_idx].SetVectorType(VectorType::CONSTANT_VECTOR); + ConstantVector::SetNull(result.data[col_idx], true); + } + + result.SetCardinality(count); + result.Verify(); + + return; + } +} + } // namespace duckdb //===----------------------------------------------------------------------===// // DuckDB @@ -57385,7 +64016,7 @@ class PhysicalIndexJoin : public PhysicalOperator { public: unique_ptr GetOperatorState(ClientContext &context) const override; OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const override; + GlobalOperatorState &gstate, OperatorState &state) const override; bool ParallelOperator() const override { return true; @@ -57671,7 +64302,7 @@ void PhysicalIndexJoin::GetRHSMatches(ExecutionContext &context, DataChunk &inpu } OperatorResultType PhysicalIndexJoin::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state_p) const { + GlobalOperatorState &gstate, OperatorState &state_p) const { auto &state = (IndexJoinOperatorState &)state_p; state.result_size = 0; @@ -57748,7 +64379,7 @@ class PhysicalNestedLoopJoin : public PhysicalComparisonJoin { // Operator Interface unique_ptr GetOperatorState(ClientContext &context) const override; OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const override; + GlobalOperatorState &gstate, OperatorState &state) const override; bool ParallelOperator() const override { return true; @@ -58036,7 +64667,7 @@ unique_ptr PhysicalNestedLoopJoin::GetOperatorState(ClientContext } OperatorResultType PhysicalNestedLoopJoin::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state_p) const { + GlobalOperatorState &gstate_p, OperatorState &state_p) const { auto &gstate = (NestedLoopJoinGlobalState &)*sink_state; if (gstate.right_chunks.Count() == 0) { @@ -58139,6 +64770,7 @@ OperatorResultType PhysicalNestedLoopJoin::ResolveComplexJoin(ExecutionContext & } if (state.fetch_next_left) { // resolve the left join condition for the current chunk + state.left_condition.Reset(); state.lhs_executor.Execute(input, state.left_condition); state.left_tuple = 0; @@ -58257,7 +64889,7 @@ class PhysicalPiecewiseMergeJoin : public PhysicalComparisonJoin { // Operator Interface unique_ptr GetOperatorState(ClientContext &context) const override; OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const override; + GlobalOperatorState &gstate, OperatorState &state) const override; bool ParallelOperator() const override { return true; @@ -58329,8 +64961,28 @@ PhysicalPiecewiseMergeJoin::PhysicalPiecewiseMergeJoin(LogicalOperator &op, uniq JoinType join_type, idx_t estimated_cardinality) : PhysicalComparisonJoin(op, PhysicalOperatorType::PIECEWISE_MERGE_JOIN, move(cond), join_type, estimated_cardinality) { - // for now we only support one condition! - D_ASSERT(conditions.size() == 1); + // Reorder the conditions so that ranges are at the front. + // TODO: use stats to improve the choice? + if (conditions.size() > 1) { + auto conditions_p = std::move(conditions); + conditions.resize(conditions_p.size()); + idx_t range_position = 0; + idx_t other_position = conditions_p.size(); + for (idx_t i = 0; i < conditions_p.size(); ++i) { + switch (conditions_p[i].comparison) { + case ExpressionType::COMPARE_LESSTHAN: + case ExpressionType::COMPARE_LESSTHANOREQUALTO: + case ExpressionType::COMPARE_GREATERTHAN: + case ExpressionType::COMPARE_GREATERTHANOREQUALTO: + conditions[range_position++] = std::move(conditions_p[i]); + break; + default: + conditions[--other_position] = std::move(conditions_p[i]); + break; + } + } + } + for (auto &cond : conditions) { D_ASSERT(cond.left->return_type == cond.right->return_type); join_key_types.push_back(cond.left->return_type); @@ -58349,8 +65001,16 @@ PhysicalPiecewiseMergeJoin::PhysicalPiecewiseMergeJoin(LogicalOperator &op, uniq lhs_orders.emplace_back(BoundOrderByNode(OrderType::DESCENDING, OrderByNullType::NULLS_LAST, move(left))); rhs_orders.emplace_back(BoundOrderByNode(OrderType::DESCENDING, OrderByNullType::NULLS_LAST, move(right))); break; + case ExpressionType::COMPARE_NOTEQUAL: + case ExpressionType::COMPARE_DISTINCT_FROM: + // Allowed in multi-predicate joins, but can't be first/sort. + D_ASSERT(!lhs_orders.empty()); + lhs_orders.emplace_back(BoundOrderByNode(OrderType::INVALID, OrderByNullType::NULLS_LAST, move(left))); + rhs_orders.emplace_back(BoundOrderByNode(OrderType::INVALID, OrderByNullType::NULLS_LAST, move(right))); + break; + default: - // COMPARE NOT EQUAL not supported with merge join + // COMPARE EQUAL not supported with merge join throw NotImplementedException("Unimplemented join type for merge join"); } } @@ -58366,6 +65026,7 @@ class MergeJoinGlobalState : public GlobalSinkState { MergeJoinGlobalState(BufferManager &buffer_manager, const vector &orders, RowLayout &rhs_layout) : rhs_global_sort_state(buffer_manager, orders, rhs_layout), rhs_has_null(0), rhs_count(0), memory_per_thread(0) { + D_ASSERT(orders.size() == 1); } inline idx_t Count() const { @@ -58387,11 +65048,12 @@ class MergeJoinGlobalState : public GlobalSinkState { }; unique_ptr PhysicalPiecewiseMergeJoin::GetGlobalSinkState(ClientContext &context) const { - // Get the payload layout from the rhs types + // Get the payload layout from the rhs types and tail predicates RowLayout rhs_layout; - auto types = children[1]->types; - rhs_layout.Initialize(types); - auto state = make_unique(BufferManager::GetBufferManager(context), rhs_orders, rhs_layout); + rhs_layout.Initialize(children[1]->types); + vector rhs_order; + rhs_order.emplace_back(rhs_orders[0].Copy()); + auto state = make_unique(BufferManager::GetBufferManager(context), rhs_order, rhs_layout); // Set external (can be force with the PRAGMA) auto &config = ClientConfig::GetConfig(context); state->rhs_global_sort_state.external = config.force_external; @@ -58403,32 +65065,6 @@ unique_ptr PhysicalPiecewiseMergeJoin::GetGlobalSinkState(Clien return move(state); } -static idx_t CountValid(Vector &v, const idx_t count) { - idx_t valid = 0; - - VectorData vdata; - v.Orrify(count, vdata); - if (vdata.validity.AllValid()) { - return count; - } - switch (v.GetVectorType()) { - case VectorType::FLAT_VECTOR: - valid += vdata.validity.CountValid(count); - break; - case VectorType::CONSTANT_VECTOR: - valid += vdata.validity.CountValid(1) * count; - break; - default: - for (idx_t i = 0; i < count; ++i) { - const auto row_idx = vdata.sel->get_index(i); - valid += int(vdata.validity.RowIsValid(row_idx)); - } - break; - } - - return valid; -} - class MergeJoinLocalState : public LocalSinkState { public: explicit MergeJoinLocalState() : rhs_has_null(0), rhs_count(0) { @@ -58458,6 +65094,94 @@ unique_ptr PhysicalPiecewiseMergeJoin::GetLocalSinkState(Executi return move(result); } +static idx_t PiecewiseMergeNulls(DataChunk &keys, const vector &conditions) { + // Merge the validity masks of the comparison keys into the primary + // Return the number of NULLs in the resulting chunk + D_ASSERT(keys.ColumnCount() > 0); + const auto count = keys.size(); + + size_t all_constant = 0; + for (auto &v : keys.data) { + if (v.GetVectorType() == VectorType::CONSTANT_VECTOR) { + ++all_constant; + } + } + + auto &primary = keys.data[0]; + if (all_constant == keys.data.size()) { + // Either all NULL or no NULLs + for (auto &v : keys.data) { + if (ConstantVector::IsNull(v)) { + ConstantVector::SetNull(primary, true); + return count; + } + } + return 0; + } else if (keys.ColumnCount() > 1) { + // Normalify the primary, as it will need to merge arbitrary validity masks + primary.Normalify(count); + auto &pvalidity = FlatVector::Validity(primary); + for (size_t c = 1; c < keys.data.size(); ++c) { + // Skip comparisons that accept NULLs + if (conditions[c].comparison == ExpressionType::COMPARE_DISTINCT_FROM) { + continue; + } + // Orrify the rest, as the sort code will do this anyway. + auto &v = keys.data[c]; + VectorData vdata; + v.Orrify(count, vdata); + auto &vvalidity = vdata.validity; + if (vvalidity.AllValid()) { + continue; + } + pvalidity.EnsureWritable(); + switch (v.GetVectorType()) { + case VectorType::FLAT_VECTOR: { + // Merge entire entries + auto pmask = pvalidity.GetData(); + const auto entry_count = pvalidity.EntryCount(count); + for (idx_t entry_idx = 0; entry_idx < entry_count; ++entry_idx) { + pmask[entry_idx] &= vvalidity.GetValidityEntry(entry_idx); + } + break; + } + case VectorType::CONSTANT_VECTOR: + // All or nothing + if (ConstantVector::IsNull(v)) { + pvalidity.SetAllInvalid(count); + return count; + } + break; + default: + // One by one + for (idx_t i = 0; i < count; ++i) { + const auto idx = vdata.sel->get_index(i); + if (!vvalidity.RowIsValidUnsafe(idx)) { + pvalidity.SetInvalidUnsafe(i); + } + } + break; + } + } + return count - pvalidity.CountValid(count); + } else { + return count - VectorOperations::CountNotNull(primary, count); + } +} + +static inline void SinkPiecewiseMergeChunk(LocalSortState &sort_state, DataChunk &join_keys, DataChunk &input) { + if (join_keys.ColumnCount() > 1) { + // Only sort the first key + DataChunk join_head; + join_head.data.emplace_back(Vector(join_keys.data[0])); + join_head.SetCardinality(join_keys.size()); + + sort_state.SinkChunk(join_head, input); + } else { + sort_state.SinkChunk(join_keys, input); + } +} + SinkResultType PhysicalPiecewiseMergeJoin::Sink(ExecutionContext &context, GlobalSinkState &gstate_p, LocalSinkState &lstate_p, DataChunk &input) const { auto &gstate = (MergeJoinGlobalState &)gstate_p; @@ -58477,15 +65201,11 @@ SinkResultType PhysicalPiecewiseMergeJoin::Sink(ExecutionContext &context, Globa lstate.rhs_executor.Execute(input, join_keys); // Count the NULLs so we can exclude them later - // TODO: Sort any comparison NULLs to the end using an initial sort column - const auto count = join_keys.size(); - for (auto &key : join_keys.data) { - lstate.rhs_has_null += (count - CountValid(key, count)); - } - lstate.rhs_count += count; + lstate.rhs_has_null += PiecewiseMergeNulls(join_keys, conditions); + lstate.rhs_count += join_keys.size(); // Sink the data into the local sort state - local_sort_state.SinkChunk(join_keys, input); + SinkPiecewiseMergeChunk(local_sort_state, join_keys, input); // When sorting data reaches a certain size, we sort it if (local_sort_state.SizeInBytes() >= gstate.memory_per_thread) { @@ -58610,9 +65330,9 @@ class PiecewiseMergeJoinState : public OperatorState { : op(op), buffer_manager(buffer_manager), force_external(force_external), left_position(0), first_fetch(true), finished(true), right_position(0), right_chunk_index(0) { vector condition_types; - for (auto &cond : op.conditions) { - lhs_executor.AddExpression(*cond.left); - condition_types.push_back(cond.left->return_type); + for (auto &order : op.lhs_orders) { + lhs_executor.AddExpression(*order.expression); + condition_types.push_back(order.expression->return_type); } lhs_keys.Initialize(condition_types); if (IsLeftOuterJoin(op.join_type)) { @@ -58620,6 +65340,18 @@ class PiecewiseMergeJoinState : public OperatorState { memset(lhs_found_match.get(), 0, sizeof(bool) * STANDARD_VECTOR_SIZE); } lhs_layout.Initialize(op.children[0]->types); + lhs_payload.Initialize(op.children[0]->types); + + lhs_order.emplace_back(op.lhs_orders[0].Copy()); + + // Set up shared data for multiple predicates + sel.Initialize(STANDARD_VECTOR_SIZE); + condition_types.clear(); + for (auto &order : op.rhs_orders) { + rhs_executor.AddExpression(*order.expression); + condition_types.push_back(order.expression->return_type); + } + rhs_keys.Initialize(condition_types); } const PhysicalPiecewiseMergeJoin &op; @@ -58628,8 +65360,10 @@ class PiecewiseMergeJoinState : public OperatorState { // Block sorting DataChunk lhs_keys; + DataChunk lhs_payload; ExpressionExecutor lhs_executor; unique_ptr lhs_found_match; + vector lhs_order; RowLayout lhs_layout; unique_ptr lhs_local_state; unique_ptr lhs_global_state; @@ -58646,6 +65380,12 @@ class PiecewiseMergeJoinState : public OperatorState { idx_t right_chunk_index; idx_t right_base; + // Secondary predicate shared data + SelectionVector sel; + DataChunk rhs_keys; + DataChunk rhs_input; + ExpressionExecutor rhs_executor; + public: void ResolveJoinKeys(DataChunk &input) { // resolve the join keys for the input @@ -58653,18 +65393,14 @@ class PiecewiseMergeJoinState : public OperatorState { lhs_executor.Execute(input, lhs_keys); // Count the NULLs so we can exclude them later - // TODO: Sort any multi-comparison NULLs to the end using an initial sort column lhs_count = lhs_keys.size(); - for (auto &key : lhs_keys.data) { - lhs_has_null = lhs_count - CountValid(key, lhs_count); - break; - } + lhs_has_null = PiecewiseMergeNulls(lhs_keys, op.conditions); // sort by join key - lhs_global_state = make_unique(buffer_manager, op.lhs_orders, lhs_layout); + lhs_global_state = make_unique(buffer_manager, lhs_order, lhs_layout); lhs_local_state = make_unique(); lhs_local_state->Initialize(*lhs_global_state, buffer_manager); - lhs_local_state->SinkChunk(lhs_keys, input); + SinkPiecewiseMergeChunk(*lhs_local_state, lhs_keys, input); // Set external (can be force with the PRAGMA) lhs_global_state->external = force_external; @@ -58675,6 +65411,17 @@ class PiecewiseMergeJoinState : public OperatorState { merge_sorter.PerformInMergeRound(); lhs_global_state->CompleteMergeRound(); } + + // Scan the sorted payload + D_ASSERT(lhs_global_state->sorted_blocks.size() == 1); + + PayloadScanner scanner(*lhs_global_state->sorted_blocks[0]->payload_data, *lhs_global_state); + lhs_payload.Reset(); + scanner.Scan(lhs_payload); + + // Recompute the sorted keys from the sorted input + lhs_keys.Reset(); + lhs_executor.Execute(lhs_payload, lhs_keys); } void Finalize(PhysicalOperator *op, ExecutionContext &context) override { @@ -58723,8 +65470,8 @@ struct BlockMergeInfo { } }; -static void SliceSortedPayload(DataChunk &payload, BlockMergeInfo &info, const idx_t result_count, const idx_t vcount, - const idx_t left_cols = 0) { +static idx_t SliceSortedPayload(DataChunk &payload, BlockMergeInfo &info, const idx_t result_count, + const idx_t left_cols = 0) { // There should only be one sorted block if they have been sorted D_ASSERT(info.state.sorted_blocks.size() == 1); SBScanState read_state(info.state.buffer_manager, info.state); @@ -58733,33 +65480,50 @@ static void SliceSortedPayload(DataChunk &payload, BlockMergeInfo &info, const i // We have to create pointers for the entire block // because unswizzle works on ranges not selections. - read_state.SetIndices(info.block_idx, info.base_idx); + const auto first_idx = info.result.get_index(0); + read_state.SetIndices(info.block_idx, info.base_idx + first_idx); read_state.PinData(sorted_data); const auto data_ptr = read_state.DataPtr(sorted_data); - const auto next = vcount - info.base_idx; // Set up a batch of pointers to scan data from - Vector addresses(LogicalType::POINTER, next); + Vector addresses(LogicalType::POINTER, result_count); auto data_pointers = FlatVector::GetData(addresses); - // Set up the data pointers + // Set up the data pointers for the values that are actually referenced + // and normalise the selection vector to zero data_ptr_t row_ptr = data_ptr; const idx_t &row_width = sorted_data.layout.GetRowWidth(); - for (idx_t i = 0; i < next; ++i) { - data_pointers[i] = row_ptr; - row_ptr += row_width; + + auto prev_idx = first_idx; + info.result.set_index(0, 0); + idx_t addr_count = 0; + data_pointers[addr_count++] = row_ptr; + for (idx_t i = 1; i < result_count; ++i) { + const auto row_idx = info.result.get_index(i); + info.result.set_index(i, row_idx - first_idx); + if (row_idx == prev_idx) { + continue; + } + row_ptr += (row_idx - prev_idx) * row_width; + data_pointers[addr_count++] = row_ptr; + prev_idx = row_idx; } // Unswizzle the offsets back to pointers (if needed) if (!sorted_data.layout.AllConstant() && info.state.external) { + const auto next = prev_idx + 1; RowOperations::UnswizzlePointers(sorted_data.layout, data_ptr, read_state.payload_heap_handle->Ptr(), next); } // Deserialize the payload data + auto sel = FlatVector::IncrementalSelectionVector(); for (idx_t col_idx = 0; col_idx < sorted_data.layout.ColumnCount(); col_idx++) { const auto col_offset = sorted_data.layout.GetOffsets()[col_idx]; - RowOperations::Gather(addresses, info.result, payload.data[left_cols + col_idx], - *FlatVector::IncrementalSelectionVector(), result_count, col_offset, col_idx); + auto &col = payload.data[left_cols + col_idx]; + RowOperations::Gather(addresses, *sel, col, *sel, addr_count, col_offset, col_idx); + col.Slice(info.result, result_count); } + + return first_idx; } static void MergeJoinPinSortingBlock(SBScanState &scan, const idx_t block_idx) { @@ -58867,16 +65631,9 @@ void PhysicalPiecewiseMergeJoin::ResolveSimpleJoin(ExecutionContext &context, Da memset(found_match, 0, sizeof(found_match)); MergeJoinSimpleBlocks(state, gstate, found_match, conditions[0].comparison); - // extract the sorted payload - idx_t left_position = 0; + // use the sorted payload const auto lhs_not_null = state.lhs_count - state.lhs_has_null; - BlockMergeInfo left_info(*state.lhs_global_state, 0, 0, left_position, lhs_not_null); - left_info.result.Initialize(nullptr); - - DataChunk payload; - payload.Initialize(input.GetTypes()); - SliceSortedPayload(payload, left_info, state.lhs_count, state.lhs_count); - payload.SetCardinality(state.lhs_count); + auto &payload = state.lhs_payload; // now construct the result based on the join result switch (join_type) { @@ -58983,11 +65740,37 @@ static idx_t MergeJoinComplexBlocks(BlockMergeInfo &l, BlockMergeInfo &r, const return result_count; } +static idx_t SelectJoinTail(const ExpressionType &condition, Vector &left, Vector &right, const SelectionVector *sel, + idx_t count, SelectionVector *true_sel) { + switch (condition) { + case ExpressionType::COMPARE_NOTEQUAL: + return VectorOperations::NotEquals(left, right, sel, count, true_sel, nullptr); + case ExpressionType::COMPARE_LESSTHAN: + return VectorOperations::LessThan(left, right, sel, count, true_sel, nullptr); + case ExpressionType::COMPARE_GREATERTHAN: + return VectorOperations::GreaterThan(left, right, sel, count, true_sel, nullptr); + case ExpressionType::COMPARE_LESSTHANOREQUALTO: + return VectorOperations::LessThanEquals(left, right, sel, count, true_sel, nullptr); + case ExpressionType::COMPARE_GREATERTHANOREQUALTO: + return VectorOperations::GreaterThanEquals(left, right, sel, count, true_sel, nullptr); + case ExpressionType::COMPARE_DISTINCT_FROM: + return VectorOperations::DistinctFrom(left, right, sel, count, true_sel, nullptr); + case ExpressionType::COMPARE_NOT_DISTINCT_FROM: + case ExpressionType::COMPARE_EQUAL: + default: + throw InternalException("Unsupported comparison type for PhysicalPiecewiseMergeJoin"); + } + + return count; +} + OperatorResultType PhysicalPiecewiseMergeJoin::ResolveComplexJoin(ExecutionContext &context, DataChunk &input, DataChunk &chunk, OperatorState &state_p) const { auto &state = (PiecewiseMergeJoinState &)state_p; auto &gstate = (MergeJoinGlobalState &)*sink_state; auto &rsorted = *gstate.rhs_global_sort_state.sorted_blocks[0]; + const auto left_cols = input.ColumnCount(); + const auto tail_cols = conditions.size() - 1; do { if (state.first_fetch) { state.ResolveJoinKeys(input); @@ -59003,7 +65786,7 @@ OperatorResultType PhysicalPiecewiseMergeJoin::ResolveComplexJoin(ExecutionConte if (IsLeftOuterJoin(join_type)) { // left join: before we move to the next chunk, see if we need to output any vectors that didn't // have a match found - PhysicalJoin::ConstructLeftJoinResult(input, chunk, state.lhs_found_match.get()); + PhysicalJoin::ConstructLeftJoinResult(state.lhs_payload, chunk, state.lhs_found_match.get()); memset(state.lhs_found_match.get(), 0, sizeof(bool) * STANDARD_VECTOR_SIZE); } state.first_fetch = true; @@ -59032,22 +65815,60 @@ OperatorResultType PhysicalPiecewiseMergeJoin::ResolveComplexJoin(ExecutionConte state.finished = true; } } else { + // found matches: extract them + chunk.Reset(); + for (idx_t c = 0; c < state.lhs_payload.ColumnCount(); ++c) { + chunk.data[c].Slice(state.lhs_payload.data[c], left_info.result, result_count); + } + const auto first_idx = SliceSortedPayload(chunk, right_info, result_count, left_cols); + chunk.SetCardinality(result_count); + + auto sel = FlatVector::IncrementalSelectionVector(); + if (tail_cols) { + // If there are more expressions to compute, + // split the result chunk into the left and right halves + // so we can compute the values for comparison. + chunk.Split(state.rhs_input, left_cols); + state.rhs_executor.SetChunk(state.rhs_input); + state.rhs_keys.Reset(); + + auto tail_count = result_count; + for (size_t cmp_idx = 1; cmp_idx < conditions.size(); ++cmp_idx) { + Vector left(state.lhs_keys.data[cmp_idx]); + left.Slice(left_info.result, result_count); + + auto &right = state.rhs_keys.data[cmp_idx]; + state.rhs_executor.ExecuteExpression(cmp_idx, right); + + if (tail_count < result_count) { + left.Slice(*sel, tail_count); + right.Slice(*sel, tail_count); + } + tail_count = + SelectJoinTail(conditions[cmp_idx].comparison, left, right, sel, tail_count, &state.sel); + sel = &state.sel; + } + chunk.Fuse(state.rhs_input); + + if (tail_count < result_count) { + result_count = tail_count; + chunk.Slice(*sel, result_count); + } + } + // found matches: mark the found matches if required if (state.lhs_found_match) { for (idx_t i = 0; i < result_count; i++) { - state.lhs_found_match[left_info.result[i]] = true; + state.lhs_found_match[left_info.result[sel->get_index(i)]] = true; } } if (gstate.rhs_found_match) { // Absolute position of the block + start position inside that block - const idx_t base_index = state.right_base + right_info.base_idx; + const idx_t base_index = right_info.base_idx + first_idx; for (idx_t i = 0; i < result_count; i++) { - gstate.rhs_found_match[base_index + right_info.result[i]] = true; + gstate.rhs_found_match[base_index + right_info.result[sel->get_index(i)]] = true; } } - // found matches: output them - SliceSortedPayload(chunk, left_info, result_count, input.size()); - SliceSortedPayload(chunk, right_info, result_count, right_info.entry_idx + 1, input.ColumnCount()); chunk.SetCardinality(result_count); chunk.Verify(); } @@ -59056,7 +65877,7 @@ OperatorResultType PhysicalPiecewiseMergeJoin::ResolveComplexJoin(ExecutionConte } OperatorResultType PhysicalPiecewiseMergeJoin::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const { + GlobalOperatorState &gstate_p, OperatorState &state) const { auto &gstate = (MergeJoinGlobalState &)*sink_state; if (gstate.Count() == 0) { @@ -59133,7 +65954,7 @@ void PhysicalPiecewiseMergeJoin::GetData(ExecutionContext &context, DataChunk &r // ConstructFullOuterJoinResult(sink.rhs_found_match.get(), sink.right_chunks, chunk, state.right_outer_position); DataChunk rhs_chunk; - rhs_chunk.Initialize(children[1]->types); + rhs_chunk.Initialize(sink.rhs_global_sort_state.payload_layout.GetTypes()); SelectionVector rsel(STANDARD_VECTOR_SIZE); for (;;) { // Read the next sorted chunk @@ -59155,12 +65976,14 @@ void PhysicalPiecewiseMergeJoin::GetData(ExecutionContext &context, DataChunk &r if (result_count > 0) { // if there were any tuples that didn't find a match, output them - const idx_t left_column_count = result.ColumnCount() - rhs_chunk.ColumnCount(); + const idx_t left_column_count = children[0]->types.size(); for (idx_t col_idx = 0; col_idx < left_column_count; ++col_idx) { result.data[col_idx].SetVectorType(VectorType::CONSTANT_VECTOR); ConstantVector::SetNull(result.data[col_idx], true); } - for (idx_t col_idx = 0; col_idx < rhs_chunk.ColumnCount(); ++col_idx) { + const idx_t right_column_count = children[1]->types.size(); + ; + for (idx_t col_idx = 0; col_idx < right_column_count; ++col_idx) { result.data[left_column_count + col_idx].Slice(rhs_chunk.data[col_idx], rsel, result_count); } result.SetCardinality(result_count); @@ -60125,9 +66948,9 @@ struct StrfTimeFormat : public StrTimeFormat { static idx_t GetSpecifierLength(StrTimeSpecifier specifier, date_t date, dtime_t time); char *WriteString(char *target, const string_t &str); char *Write2(char *target, uint8_t value); - char *WritePadded2(char *target, int32_t value); + char *WritePadded2(char *target, uint32_t value); char *WritePadded3(char *target, uint32_t value); - char *WritePadded(char *target, int32_t value, int32_t padding); + char *WritePadded(char *target, uint32_t value, size_t padding); bool IsDateSpecifier(StrTimeSpecifier specifier); char *WriteDateSpecifier(StrTimeSpecifier specifier, date_t date, char *target); char *WriteStandardSpecifier(StrTimeSpecifier specifier, int32_t data[], char *target); @@ -62193,6 +69016,8 @@ class PhysicalCopyToFile : public PhysicalOperator { CopyFunction function; unique_ptr bind_data; + string file_path; + bool use_tmp_file; public: // Source interface @@ -62218,6 +69043,7 @@ class PhysicalCopyToFile : public PhysicalOperator { + #include namespace duckdb { @@ -62242,6 +69068,15 @@ class CopyToFunctionLocalState : public LocalSinkState { //===--------------------------------------------------------------------===// // Sink //===--------------------------------------------------------------------===// +void MoveTmpFile(ClientContext &context, const string &tmp_file_path) { + auto &fs = FileSystem::GetFileSystem(context); + auto file_path = tmp_file_path.substr(0, tmp_file_path.length() - 4); + if (fs.FileExists(file_path)) { + fs.RemoveFile(file_path); + } + fs.MoveFile(tmp_file_path, file_path); +} + PhysicalCopyToFile::PhysicalCopyToFile(vector types, CopyFunction function_p, unique_ptr bind_data, idx_t estimated_cardinality) : PhysicalOperator(PhysicalOperatorType::COPY_TO_FILE, move(types), estimated_cardinality), @@ -62272,6 +69107,10 @@ SinkFinalizeType PhysicalCopyToFile::Finalize(Pipeline &pipeline, Event &event, auto &gstate = (CopyToFunctionGlobalState &)gstate_p; if (function.copy_to_finalize) { function.copy_to_finalize(context, *bind_data, *gstate.global_state); + + if (use_tmp_file) { + MoveTmpFile(context, file_path); + } } return SinkFinalizeType::READY; } @@ -62280,7 +69119,7 @@ unique_ptr PhysicalCopyToFile::GetLocalSinkState(ExecutionContex return make_unique(function.copy_to_initialize_local(context.client, *bind_data)); } unique_ptr PhysicalCopyToFile::GetGlobalSinkState(ClientContext &context) const { - return make_unique(function.copy_to_initialize_global(context, *bind_data)); + return make_unique(function.copy_to_initialize_global(context, *bind_data, file_path)); } //===--------------------------------------------------------------------===// @@ -62331,14 +69170,15 @@ class DataTable; class PhysicalDelete : public PhysicalOperator { public: PhysicalDelete(vector types, TableCatalogEntry &tableref, DataTable &table, idx_t row_id_index, - idx_t estimated_cardinality) + idx_t estimated_cardinality, bool return_chunk) : PhysicalOperator(PhysicalOperatorType::DELETE_OPERATOR, move(types), estimated_cardinality), - tableref(tableref), table(table), row_id_index(row_id_index) { + tableref(tableref), table(table), row_id_index(row_id_index), return_chunk(return_chunk) { } TableCatalogEntry &tableref; DataTable &table; idx_t row_id_index; + bool return_chunk; public: // Source interface @@ -62349,6 +69189,7 @@ class PhysicalDelete : public PhysicalOperator { public: // Sink interface unique_ptr GetGlobalSinkState(ClientContext &context) const override; + unique_ptr GetLocalSinkState(ExecutionContext &context) const override; SinkResultType Sink(ExecutionContext &context, GlobalSinkState &state, LocalSinkState &lstate, DataChunk &input) const override; @@ -62368,6 +69209,7 @@ class PhysicalDelete : public PhysicalOperator { + namespace duckdb { //===--------------------------------------------------------------------===// @@ -62375,21 +69217,46 @@ namespace duckdb { //===--------------------------------------------------------------------===// class DeleteGlobalState : public GlobalSinkState { public: - DeleteGlobalState() : deleted_count(0) { + DeleteGlobalState() : deleted_count(0), returned_chunk_count(0) { } mutex delete_lock; idx_t deleted_count; + ChunkCollection return_chunk_collection; + idx_t returned_chunk_count; +}; + +class DeleteLocalState : public LocalSinkState { +public: + explicit DeleteLocalState(const vector &table_types) { + delete_chunk.Initialize(table_types); + } + DataChunk delete_chunk; }; SinkResultType PhysicalDelete::Sink(ExecutionContext &context, GlobalSinkState &state, LocalSinkState &lstate, DataChunk &input) const { auto &gstate = (DeleteGlobalState &)state; + auto &ustate = (DeleteLocalState &)lstate; + + // get rows and + auto &transaction = Transaction::GetTransaction(context.client); + auto &row_identifiers = input.data[row_id_index]; + + vector column_ids; + for (idx_t i = 0; i < table.column_definitions.size(); i++) { + column_ids.emplace_back(i); + }; + auto cfs = ColumnFetchState(); - // delete data in the base table - // the row ids are given to us as the last column of the child chunk lock_guard delete_guard(gstate.delete_lock); - gstate.deleted_count += table.Delete(tableref, context.client, input.data[row_id_index], input.size()); + if (return_chunk) { + row_identifiers.Normalify(input.size()); + table.Fetch(transaction, ustate.delete_chunk, column_ids, row_identifiers, input.size(), cfs); + gstate.return_chunk_collection.Append(ustate.delete_chunk); + } + gstate.deleted_count += table.Delete(tableref, context.client, row_identifiers, input.size()); + return SinkResultType::NEED_MORE_INPUT; } @@ -62397,6 +69264,10 @@ unique_ptr PhysicalDelete::GetGlobalSinkState(ClientContext &co return make_unique(); } +unique_ptr PhysicalDelete::GetLocalSinkState(ExecutionContext &context) const { + return make_unique(table.GetTypes()); +} + //===--------------------------------------------------------------------===// // Source //===--------------------------------------------------------------------===// @@ -62420,9 +69291,22 @@ void PhysicalDelete::GetData(ExecutionContext &context, DataChunk &chunk, Global return; } - chunk.SetCardinality(1); - chunk.SetValue(0, 0, Value::BIGINT(g.deleted_count)); - state.finished = true; + if (!return_chunk) { + chunk.SetCardinality(1); + chunk.SetValue(0, 0, Value::BIGINT(g.deleted_count)); + state.finished = true; + } + + idx_t chunk_return = g.returned_chunk_count; + if (chunk_return >= g.return_chunk_collection.Chunks().size()) { + return; + } + chunk.Reference(g.return_chunk_collection.GetChunk(chunk_return)); + chunk.SetCardinality((g.return_chunk_collection.GetChunk(chunk_return)).size()); + g.returned_chunk_count += 1; + if (g.returned_chunk_count >= g.return_chunk_collection.Chunks().size()) { + state.finished = true; + } } } // namespace duckdb @@ -62467,8 +69351,13 @@ struct ExportedTableData { string file_path; }; +struct ExportedTableInfo { + TableCatalogEntry *entry; + ExportedTableData table_data; +}; + struct BoundExportData : public ParseInfo { - unordered_map data; + std::vector data; }; } // namespace duckdb @@ -62621,19 +69510,16 @@ void PhysicalExport::GetData(ExecutionContext &context, DataChunk &chunk, Global vector views; vector indexes; - Catalog::GetCatalog(ccontext).schemas->Scan(context.client, [&](CatalogEntry *entry) { - auto schema = (SchemaCatalogEntry *)entry; + auto schema_list = Catalog::GetCatalog(ccontext).schemas->GetEntries(context.client); + for (auto &schema : schema_list) { if (!schema->internal) { - // export schema schemas.push_back(schema); } schema->Scan(context.client, CatalogType::TABLE_ENTRY, [&](CatalogEntry *entry) { if (entry->internal) { return; } - if (entry->type == CatalogType::TABLE_ENTRY) { - tables.push_back(entry); - } else { + if (entry->type != CatalogType::TABLE_ENTRY) { views.push_back(entry); } }); @@ -62642,7 +69528,12 @@ void PhysicalExport::GetData(ExecutionContext &context, DataChunk &chunk, Global schema->Scan(context.client, CatalogType::TYPE_ENTRY, [&](CatalogEntry *entry) { custom_types.push_back(entry); }); schema->Scan(context.client, CatalogType::INDEX_ENTRY, [&](CatalogEntry *entry) { indexes.push_back(entry); }); - }); + } + + // consider the order of tables because of foreign key constraint + for (idx_t i = 0; i < exported_tables.data.size(); i++) { + tables.push_back((CatalogEntry *)exported_tables.data[i].entry); + } // write the schema.sql file // export order is SCHEMA -> SEQUENCE -> TABLE -> VIEW -> INDEX @@ -62660,9 +69551,9 @@ void PhysicalExport::GetData(ExecutionContext &context, DataChunk &chunk, Global // write the load.sql file // for every table, we write COPY INTO statement with the specified options stringstream load_ss; - for (auto const &kv : exported_tables.data) { - auto table = kv.first; - auto exported_table_info = kv.second; + for (idx_t i = 0; i < exported_tables.data.size(); i++) { + auto &table = exported_tables.data[i].entry; + auto exported_table_info = exported_tables.data[i].table_data; WriteCopyStatement(fs, load_ss, table, *info, exported_table_info, function); } WriteStringStreamToFile(fs, opener, load_ss, fs.JoinPath(info->file_path, "load.sql")); @@ -62698,7 +69589,7 @@ namespace duckdb { class PhysicalInsert : public PhysicalOperator { public: PhysicalInsert(vector types, TableCatalogEntry *table, vector column_index_map, - vector> bound_defaults, idx_t estimated_cardinality); + vector> bound_defaults, idx_t estimated_cardinality, bool return_chunk); //! The map from insert column index to table column index vector column_index_map; @@ -62706,6 +69597,8 @@ class PhysicalInsert : public PhysicalOperator { TableCatalogEntry *table; //! The default expressions of the columns for which no value is provided vector> bound_defaults; + //! If the returning statement is present, return the whole chunk + bool return_chunk; public: // Source interface @@ -62747,11 +69640,13 @@ namespace duckdb { //===--------------------------------------------------------------------===// class InsertGlobalState : public GlobalSinkState { public: - InsertGlobalState() : insert_count(0) { + InsertGlobalState() : insert_count(0), returned_chunk_count(0) { } mutex lock; idx_t insert_count; + ChunkCollection return_chunk_collection; + idx_t returned_chunk_count; }; class InsertLocalState : public LocalSinkState { @@ -62766,9 +69661,11 @@ class InsertLocalState : public LocalSinkState { }; PhysicalInsert::PhysicalInsert(vector types, TableCatalogEntry *table, vector column_index_map, - vector> bound_defaults, idx_t estimated_cardinality) + vector> bound_defaults, idx_t estimated_cardinality, + bool return_chunk) : PhysicalOperator(PhysicalOperatorType::INSERT, move(types), estimated_cardinality), - column_index_map(std::move(column_index_map)), table(table), bound_defaults(move(bound_defaults)) { + column_index_map(std::move(column_index_map)), table(table), bound_defaults(move(bound_defaults)), + return_chunk(return_chunk) { } SinkResultType PhysicalInsert::Sink(ExecutionContext &context, GlobalSinkState &state, LocalSinkState &lstate, @@ -62781,6 +69678,7 @@ SinkResultType PhysicalInsert::Sink(ExecutionContext &context, GlobalSinkState & istate.insert_chunk.Reset(); istate.insert_chunk.SetCardinality(chunk); + if (!column_index_map.empty()) { // columns specified by the user, use column_index_map for (idx_t i = 0; i < table->columns.size(); i++) { @@ -62804,6 +69702,11 @@ SinkResultType PhysicalInsert::Sink(ExecutionContext &context, GlobalSinkState & lock_guard glock(gstate.lock); table->storage->Append(*table, context.client, istate.insert_chunk); + + if (return_chunk) { + gstate.return_chunk_collection.Append(istate.insert_chunk); + } + gstate.insert_count += chunk.size(); return SinkResultType::NEED_MORE_INPUT; } @@ -62841,14 +69744,27 @@ unique_ptr PhysicalInsert::GetGlobalSourceState(ClientContext void PhysicalInsert::GetData(ExecutionContext &context, DataChunk &chunk, GlobalSourceState &gstate, LocalSourceState &lstate) const { auto &state = (InsertSourceState &)gstate; - auto &g = (InsertGlobalState &)*sink_state; + auto &insert_gstate = (InsertGlobalState &)*sink_state; if (state.finished) { return; } + if (!return_chunk) { + chunk.SetCardinality(1); + chunk.SetValue(0, 0, Value::BIGINT(insert_gstate.insert_count)); + state.finished = true; + } - chunk.SetCardinality(1); - chunk.SetValue(0, 0, Value::BIGINT(g.insert_count)); - state.finished = true; + idx_t chunk_return = insert_gstate.returned_chunk_count; + if (chunk_return >= insert_gstate.return_chunk_collection.Chunks().size()) { + return; + } + + chunk.Reference(insert_gstate.return_chunk_collection.GetChunk(chunk_return)); + chunk.SetCardinality((insert_gstate.return_chunk_collection.GetChunk(chunk_return)).size()); + insert_gstate.returned_chunk_count += 1; + if (insert_gstate.returned_chunk_count >= insert_gstate.return_chunk_collection.Chunks().size()) { + state.finished = true; + } } } // namespace duckdb @@ -62873,10 +69789,10 @@ class PhysicalUpdate : public PhysicalOperator { public: PhysicalUpdate(vector types, TableCatalogEntry &tableref, DataTable &table, vector columns, vector> expressions, vector> bound_defaults, - idx_t estimated_cardinality) + idx_t estimated_cardinality, bool return_chunk) : PhysicalOperator(PhysicalOperatorType::UPDATE, move(types), estimated_cardinality), tableref(tableref), table(table), columns(std::move(columns)), expressions(move(expressions)), - bound_defaults(move(bound_defaults)) { + bound_defaults(move(bound_defaults)), return_chunk(return_chunk) { } TableCatalogEntry &tableref; @@ -62885,6 +69801,8 @@ class PhysicalUpdate : public PhysicalOperator { vector> expressions; vector> bound_defaults; bool update_is_del_and_insert; + //! If the returning statement is present, return the whole chunk + bool return_chunk; public: // Source interface @@ -62918,6 +69836,7 @@ class PhysicalUpdate : public PhysicalOperator { + namespace duckdb { //===--------------------------------------------------------------------===// @@ -62925,12 +69844,14 @@ namespace duckdb { //===--------------------------------------------------------------------===// class UpdateGlobalState : public GlobalSinkState { public: - UpdateGlobalState() : updated_count(0) { + UpdateGlobalState() : updated_count(0), returned_chunk_count(0) { } mutex lock; idx_t updated_count; unordered_set updated_columns; + ChunkCollection return_chunk_collection; + idx_t returned_chunk_count; }; class UpdateLocalState : public LocalSinkState { @@ -63010,9 +69931,21 @@ SinkResultType PhysicalUpdate::Sink(ExecutionContext &context, GlobalSinkState & } table.Append(tableref, context.client, mock_chunk); } else { + if (return_chunk) { + mock_chunk.SetCardinality(update_chunk); + for (idx_t i = 0; i < columns.size(); i++) { + mock_chunk.data[columns[i]].Reference(update_chunk.data[i]); + } + } table.Update(tableref, context.client, row_ids, columns, update_chunk); } + + if (return_chunk) { + gstate.return_chunk_collection.Append(mock_chunk); + } + gstate.updated_count += chunk.size(); + return SinkResultType::NEED_MORE_INPUT; } @@ -63053,10 +69986,22 @@ void PhysicalUpdate::GetData(ExecutionContext &context, DataChunk &chunk, Global if (state.finished) { return; } + if (!return_chunk) { + chunk.SetCardinality(1); + chunk.SetValue(0, 0, Value::BIGINT(g.updated_count)); + state.finished = true; + } - chunk.SetCardinality(1); - chunk.SetValue(0, 0, Value::BIGINT(g.updated_count)); - state.finished = true; + idx_t chunk_return = g.returned_chunk_count; + if (chunk_return >= g.return_chunk_collection.Chunks().size()) { + return; + } + chunk.Reference(g.return_chunk_collection.GetChunk(chunk_return)); + chunk.SetCardinality((g.return_chunk_collection.GetChunk(chunk_return)).size()); + g.returned_chunk_count += 1; + if (g.returned_chunk_count >= g.return_chunk_collection.Chunks().size()) { + state.finished = true; + } } } // namespace duckdb @@ -63085,7 +70030,7 @@ class PhysicalProjection : public PhysicalOperator { public: unique_ptr GetOperatorState(ClientContext &context) const override; OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const override; + GlobalOperatorState &gstate, OperatorState &state) const override; bool ParallelOperator() const override { return true; @@ -63121,7 +70066,7 @@ PhysicalProjection::PhysicalProjection(vector types, vector GetOperatorState(ClientContext &context) const override; OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const override; + GlobalOperatorState &gstate, OperatorState &state) const override; bool ParallelOperator() const override { return true; @@ -63207,7 +70152,7 @@ unique_ptr PhysicalTableInOutFunction::GetOperatorState(ClientCon } OperatorResultType PhysicalTableInOutFunction::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state_p) const { + GlobalOperatorState &gstate, OperatorState &state_p) const { auto &state = (TableInOutFunctionState &)state_p; if (!state.initialized) { @@ -63250,7 +70195,7 @@ class PhysicalUnnest : public PhysicalOperator { public: unique_ptr GetOperatorState(ClientContext &context) const override; OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const override; + GlobalOperatorState &gstate, OperatorState &state) const override; bool ParallelOperator() const override { return true; @@ -63410,7 +70355,7 @@ unique_ptr PhysicalUnnest::GetOperatorState(ClientContext &contex } OperatorResultType PhysicalUnnest::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state_p) const { + GlobalOperatorState &gstate, OperatorState &state_p) const { auto &state = (UnnestOperatorState &)state_p; do { if (state.first_fetch) { @@ -63439,9 +70384,15 @@ OperatorResultType PhysicalUnnest::Execute(ExecutionContext &context, DataChunk auto &list_vector = state.list_data.data[col_idx]; list_vector.Orrify(state.list_data.size(), state.list_vector_data[col_idx]); - auto &child_vector = ListVector::GetEntry(list_vector); - auto list_size = ListVector::GetListSize(list_vector); - child_vector.Orrify(list_size, state.list_child_data[col_idx]); + if (list_vector.GetType() == LogicalType::SQLNULL) { + // UNNEST(NULL) + auto &child_vector = list_vector; + child_vector.Orrify(0, state.list_child_data[col_idx]); + } else { + auto list_size = ListVector::GetListSize(list_vector); + auto &child_vector = ListVector::GetEntry(list_vector); + child_vector.Orrify(list_size, state.list_child_data[col_idx]); + } } state.first_fetch = false; } @@ -63490,34 +70441,40 @@ OperatorResultType PhysicalUnnest::Execute(ExecutionContext &context, DataChunk for (idx_t col_idx = 0; col_idx < state.list_data.ColumnCount(); col_idx++) { auto &result_vector = chunk.data[col_idx + input.ColumnCount()]; - auto &vdata = state.list_vector_data[col_idx]; - auto &child_data = state.list_child_data[col_idx]; - auto current_idx = vdata.sel->get_index(state.parent_position); - - auto list_data = (list_entry_t *)vdata.data; - auto list_entry = list_data[current_idx]; - - idx_t list_count; - if (state.list_position >= list_entry.length) { - list_count = 0; + if (state.list_data.data[col_idx].GetType() == LogicalType::SQLNULL) { + // UNNEST(NULL) + chunk.SetCardinality(0); } else { - list_count = MinValue(this_chunk_len, list_entry.length - state.list_position); - } + auto &vdata = state.list_vector_data[col_idx]; + auto &child_data = state.list_child_data[col_idx]; + auto current_idx = vdata.sel->get_index(state.parent_position); - if (list_entry.length > state.list_position) { - if (!vdata.validity.RowIsValid(current_idx)) { - UnnestNull(0, list_count, result_vector); + auto list_data = (list_entry_t *)vdata.data; + auto list_entry = list_data[current_idx]; + + idx_t list_count; + if (state.list_position >= list_entry.length) { + list_count = 0; } else { - auto &list_vector = state.list_data.data[col_idx]; - auto &child_vector = ListVector::GetEntry(list_vector); - auto list_size = ListVector::GetListSize(list_vector); + list_count = MinValue(this_chunk_len, list_entry.length - state.list_position); + } + + if (list_entry.length > state.list_position) { + if (!vdata.validity.RowIsValid(current_idx)) { + UnnestNull(0, list_count, result_vector); + } else { + auto &list_vector = state.list_data.data[col_idx]; + auto &child_vector = ListVector::GetEntry(list_vector); + auto list_size = ListVector::GetListSize(list_vector); - auto base_offset = list_entry.offset + state.list_position; - UnnestVector(child_data, child_vector, list_size, base_offset, base_offset + list_count, - result_vector); + auto base_offset = list_entry.offset + state.list_position; + UnnestVector(child_data, child_vector, list_size, base_offset, base_offset + list_count, + result_vector); + } } + + UnnestNull(list_count, this_chunk_len, result_vector); } - UnnestNull(list_count, this_chunk_len, result_vector); } state.list_position += this_chunk_len; @@ -63686,7 +70643,7 @@ class PhysicalExpressionScan : public PhysicalOperator { public: unique_ptr GetOperatorState(ClientContext &context) const override; OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const override; + GlobalOperatorState &gstate, OperatorState &state) const override; bool ParallelOperator() const override { return true; @@ -63721,7 +70678,7 @@ unique_ptr PhysicalExpressionScan::GetOperatorState(ClientContext } OperatorResultType PhysicalExpressionScan::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state_p) const { + GlobalOperatorState &gstate, OperatorState &state_p) const { auto &state = (ExpressionScanState &)state_p; for (; chunk.size() + input.size() <= STANDARD_VECTOR_SIZE && state.expression_index < expressions.size(); @@ -64153,7 +71110,8 @@ void PhysicalCreateIndex::GetData(ExecutionContext &context, DataChunk &chunk, G unique_ptr index; switch (info->index_type) { case IndexType::ART: { - index = make_unique(column_ids, unbound_expressions, info->unique); + index = make_unique(column_ids, unbound_expressions, + info->unique ? IndexConstraintType::UNIQUE : IndexConstraintType::NONE); break; } default: @@ -64867,6 +71825,11 @@ void PhysicalRecursiveCTE::ExecuteRecursivePipelines(ExecutionContext &context) // reset the sink state for any intermediate sinks sink->sink_state = sink->GetGlobalSinkState(context.client); } + for (auto &op : pipeline->GetOperators()) { + if (op) { + op->op_state = op->GetGlobalOperatorState(context.client); + } + } pipeline->Reset(); } auto &executor = pipelines[0]->executor; @@ -65107,7 +72070,6 @@ void PartitionableHashTable::Finalize() { - namespace duckdb { PerfectAggregateHashTable::PerfectAggregateHashTable(BufferManager &buffer_manager, @@ -65422,8 +72384,12 @@ unique_ptr PhysicalOperator::GetOperatorState(ClientContext &cont return make_unique(); } +unique_ptr PhysicalOperator::GetGlobalOperatorState(ClientContext &context) const { + return make_unique(); +} + OperatorResultType PhysicalOperator::Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const { + GlobalOperatorState &gstate, OperatorState &state) const { throw InternalException("Calling Execute on a node that is not an operator!"); } // LCOV_EXCL_STOP @@ -65751,7 +72717,8 @@ namespace duckdb { //! and has two children. class ComparisonExpression : public ParsedExpression { public: - ComparisonExpression(ExpressionType type, unique_ptr left, unique_ptr right); + DUCKDB_API ComparisonExpression(ExpressionType type, unique_ptr left, + unique_ptr right); unique_ptr left; unique_ptr right; @@ -65765,6 +72732,12 @@ class ComparisonExpression : public ParsedExpression { void Serialize(FieldWriter &writer) const override; static unique_ptr Deserialize(ExpressionType type, FieldReader &source); + +public: + template + static string ToString(const T &entry) { + return entry.left->ToString() + " " + ExpressionTypeToOperator(entry.type) + " " + entry.right->ToString(); + } }; } // namespace duckdb @@ -66146,6 +73119,7 @@ unique_ptr PhysicalPlanGenerator::CreatePlan(LogicalChunkGet & + namespace duckdb { static bool CanPlanIndexJoin(Transaction &transaction, TableScanBindData *bind_data, PhysicalTableScan &scan) { @@ -66204,7 +73178,7 @@ void CheckForPerfectJoinOpt(LogicalComparisonJoin &op, PerfectHashJoinStats &joi } // with equality condition and null values not equal for (auto &&condition : op.conditions) { - if (condition.comparison != ExpressionType::COMPARE_EQUAL || condition.null_values_are_equal) { + if (condition.comparison != ExpressionType::COMPARE_EQUAL) { return; } } @@ -66303,24 +73277,29 @@ unique_ptr PhysicalPlanGenerator::CreatePlan(LogicalComparison } bool has_equality = false; - bool has_inequality = false; - bool has_null_equal_conditions = false; - for (auto &cond : op.conditions) { - if (cond.comparison == ExpressionType::COMPARE_EQUAL || - cond.comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { + // bool has_inequality = false; + size_t has_range = 0; + for (size_t c = 0; c < op.conditions.size(); ++c) { + auto &cond = op.conditions[c]; + switch (cond.comparison) { + case ExpressionType::COMPARE_EQUAL: + case ExpressionType::COMPARE_NOT_DISTINCT_FROM: has_equality = true; - } - if (cond.comparison == ExpressionType::COMPARE_NOTEQUAL || - cond.comparison == ExpressionType::COMPARE_DISTINCT_FROM) { - has_inequality = true; - } - if (cond.null_values_are_equal) { - has_null_equal_conditions = true; - D_ASSERT(cond.comparison == ExpressionType::COMPARE_EQUAL || - cond.comparison == ExpressionType::COMPARE_DISTINCT_FROM); + break; + case ExpressionType::COMPARE_LESSTHAN: + case ExpressionType::COMPARE_GREATERTHAN: + case ExpressionType::COMPARE_LESSTHANOREQUALTO: + case ExpressionType::COMPARE_GREATERTHANOREQUALTO: + ++has_range; + break; + case ExpressionType::COMPARE_NOTEQUAL: + case ExpressionType::COMPARE_DISTINCT_FROM: + // has_inequality = true; + break; + default: + throw NotImplementedException("Unimplemented comparison join"); } } - (void)has_null_equal_conditions; unique_ptr plan; if (has_equality) { @@ -66349,8 +73328,22 @@ unique_ptr PhysicalPlanGenerator::CreatePlan(LogicalComparison op.estimated_cardinality, perfect_join_stats); } else { - if (op.conditions.size() == 1 && !has_inequality) { - D_ASSERT(!has_null_equal_conditions); // we support this for this join for now + bool can_merge = has_range > 0; + bool can_iejoin = has_range >= 2 && rec_ctes.empty(); + switch (op.join_type) { + case JoinType::SEMI: + case JoinType::ANTI: + case JoinType::MARK: + can_merge = can_merge && op.conditions.size() == 1; + can_iejoin = false; + break; + default: + break; + } + if (can_iejoin) { + plan = make_unique(op, move(left), move(right), move(op.conditions), op.join_type, + op.estimated_cardinality); + } else if (can_merge) { // range join: use piecewise merge join plan = make_unique(op, move(left), move(right), move(op.conditions), op.join_type, op.estimated_cardinality); @@ -66379,6 +73372,7 @@ unique_ptr PhysicalPlanGenerator::CreatePlan(LogicalComparison + namespace duckdb { class LogicalCopyToFile : public LogicalOperator { @@ -66388,6 +73382,9 @@ class LogicalCopyToFile : public LogicalOperator { } CopyFunction function; unique_ptr bind_data; + std::string file_path; + bool use_tmp_file; + bool is_file_and_exists; protected: void ResolveTypes() override { @@ -66401,8 +73398,14 @@ namespace duckdb { unique_ptr PhysicalPlanGenerator::CreatePlan(LogicalCopyToFile &op) { auto plan = CreatePlan(*op.children[0]); + bool use_tmp_file = op.is_file_and_exists && op.use_tmp_file; + if (use_tmp_file) { + op.file_path += ".tmp"; + } // COPY from select statement to file auto copy = make_unique(op.types, op.function, move(op.bind_data), op.estimated_cardinality); + copy->file_path = op.file_path; + copy->use_tmp_file = use_tmp_file; copy->children.push_back(move(plan)); return move(copy); @@ -66495,6 +73498,7 @@ unique_ptr PhysicalPlanGenerator::CreatePlan(LogicalCreateInde + //===----------------------------------------------------------------------===// // DuckDB // @@ -66566,7 +73570,6 @@ class LogicalCreateTable : public LogicalOperator { } // namespace duckdb - namespace duckdb { static void ExtractDependencies(Expression &expr, unordered_set &dependencies) { @@ -66590,7 +73593,8 @@ unique_ptr PhysicalPlanGenerator::CreatePlan(LogicalCreateTabl auto &catalog = Catalog::GetCatalog(context); auto existing_entry = catalog.GetEntry(context, CatalogType::TABLE_ENTRY, create_info.schema, create_info.table, true); - if (!existing_entry && !op.children.empty()) { + bool replace = op.info->Base().on_conflict == OnCreateConflict::REPLACE_ON_CONFLICT; + if ((!existing_entry || replace) && !op.children.empty()) { D_ASSERT(op.children.size() == 1); auto create = make_unique(op, op.schema, move(op.info), op.estimated_cardinality); auto plan = CreatePlan(*op.children[0]); @@ -66664,14 +73668,27 @@ namespace duckdb { class LogicalDelete : public LogicalOperator { public: explicit LogicalDelete(TableCatalogEntry *table) - : LogicalOperator(LogicalOperatorType::LOGICAL_DELETE), table(table) { + : LogicalOperator(LogicalOperatorType::LOGICAL_DELETE), table(table), table_index(0), return_chunk(false) { } TableCatalogEntry *table; + idx_t table_index; + bool return_chunk; protected: + vector GetColumnBindings() override { + if (return_chunk) { + return GenerateColumnBindings(table_index, table->columns.size()); + } + return {ColumnBinding(0, 0)}; + } + void ResolveTypes() override { - types.emplace_back(LogicalType::BIGINT); + if (return_chunk) { + types = table->GetTypes(); + } else { + types.emplace_back(LogicalType::BIGINT); + } } }; } // namespace duckdb @@ -66690,8 +73707,8 @@ unique_ptr PhysicalPlanGenerator::CreatePlan(LogicalDelete &op auto &bound_ref = (BoundReferenceExpression &)*op.expressions[0]; dependencies.insert(op.table); - auto del = - make_unique(op.types, *op.table, *op.table->storage, bound_ref.index, op.estimated_cardinality); + auto del = make_unique(op.types, *op.table, *op.table->storage, bound_ref.index, + op.estimated_cardinality, op.return_chunk); del->children.push_back(move(plan)); return move(del); } @@ -68019,7 +75036,7 @@ namespace duckdb { class LogicalInsert : public LogicalOperator { public: explicit LogicalInsert(TableCatalogEntry *table) - : LogicalOperator(LogicalOperatorType::LOGICAL_INSERT), table(table) { + : LogicalOperator(LogicalOperatorType::LOGICAL_INSERT), table(table), table_index(0), return_chunk(false) { } vector>> insert_values; @@ -68029,12 +75046,26 @@ class LogicalInsert : public LogicalOperator { vector expected_types; //! The base table to insert into TableCatalogEntry *table; + idx_t table_index; + //! if returning option is used, return actual chunk to projection + bool return_chunk; //! The default statements used by the table vector> bound_defaults; protected: + vector GetColumnBindings() override { + if (return_chunk) { + return GenerateColumnBindings(table_index, table->columns.size()); + } + return {ColumnBinding(0, 0)}; + } + void ResolveTypes() override { - types.emplace_back(LogicalType::BIGINT); + if (return_chunk) { + types = table->GetTypes(); + } else { + types.emplace_back(LogicalType::BIGINT); + } } }; } // namespace duckdb @@ -68051,7 +75082,7 @@ unique_ptr PhysicalPlanGenerator::CreatePlan(LogicalInsert &op dependencies.insert(op.table); auto insert = make_unique(op.types, op.table, op.column_index_map, move(op.bound_defaults), - op.estimated_cardinality); + op.estimated_cardinality, op.return_chunk); if (plan) { insert->children.push_back(move(plan)); } @@ -68679,10 +75710,9 @@ unique_ptr PhysicalPlanGenerator::CreatePlan(LogicalSetOperati // create equality condition for all columns for (idx_t i = 0; i < types.size(); i++) { JoinCondition cond; - cond.comparison = ExpressionType::COMPARE_EQUAL; cond.left = make_unique(types[i], i); cond.right = make_unique(types[i], i); - cond.null_values_are_equal = true; + cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; conditions.push_back(move(cond)); } // EXCEPT is ANTI join @@ -69002,17 +76032,33 @@ namespace duckdb { class LogicalUpdate : public LogicalOperator { public: explicit LogicalUpdate(TableCatalogEntry *table) - : LogicalOperator(LogicalOperatorType::LOGICAL_UPDATE), table(table) { + : LogicalOperator(LogicalOperatorType::LOGICAL_UPDATE), table(table), table_index(0), return_chunk(false) { } + //! The base table to update TableCatalogEntry *table; + //! table catalog index + idx_t table_index; + //! if returning option is used, return the update chunk + bool return_chunk; vector columns; vector> bound_defaults; bool update_is_del_and_insert; protected: + vector GetColumnBindings() override { + if (return_chunk) { + return GenerateColumnBindings(table_index, table->columns.size()); + } + return {ColumnBinding(0, 0)}; + } + void ResolveTypes() override { - types.emplace_back(LogicalType::BIGINT); + if (return_chunk) { + types = table->GetTypes(); + } else { + types.emplace_back(LogicalType::BIGINT); + } } }; } // namespace duckdb @@ -69027,7 +76073,8 @@ unique_ptr PhysicalPlanGenerator::CreatePlan(LogicalUpdate &op dependencies.insert(op.table); auto update = make_unique(op.types, *op.table, *op.table->storage, op.columns, move(op.expressions), - move(op.bound_defaults), op.estimated_cardinality); + move(op.bound_defaults), op.estimated_cardinality, op.return_chunk); + update->update_is_del_and_insert = op.update_is_del_and_insert; update->children.push_back(move(plan)); return move(update); @@ -69680,17 +76727,21 @@ void RadixPartitionedHashTable::GetData(ExecutionContext &context, DataChunk &ch // special case hack to sort out aggregating from empty intermediates // for aggregations without groups if (gstate.is_empty && grouping_set.empty()) { - D_ASSERT(chunk.ColumnCount() == op.aggregates.size()); + D_ASSERT(chunk.ColumnCount() == null_groups.size() + op.aggregates.size()); // for each column in the aggregates, set to initial state chunk.SetCardinality(1); - for (idx_t i = 0; i < chunk.ColumnCount(); i++) { + for (auto null_group : null_groups) { + chunk.data[null_group].SetVectorType(VectorType::CONSTANT_VECTOR); + ConstantVector::SetNull(chunk.data[null_group], true); + } + for (idx_t i = 0; i < op.aggregates.size(); i++) { D_ASSERT(op.aggregates[i]->GetExpressionClass() == ExpressionClass::BOUND_AGGREGATE); auto &aggr = (BoundAggregateExpression &)*op.aggregates[i]; auto aggr_state = unique_ptr(new data_t[aggr.function.state_size()]); aggr.function.initialize(aggr_state.get()); Vector state_vector(Value::POINTER((uintptr_t)aggr_state.get())); - aggr.function.finalize(state_vector, aggr.bind_info.get(), chunk.data[i], 1, 0); + aggr.function.finalize(state_vector, aggr.bind_info.get(), chunk.data[null_groups.size() + i], 1, 0); if (aggr.function.destructor) { aggr.function.destructor(state_vector, 1); } @@ -69969,8 +77020,6 @@ void BaseReservoirSampling::ReplaceElement() { -#include - namespace duckdb { WindowSegmentTree::WindowSegmentTree(AggregateFunction &aggregate, FunctionData *bind_info, @@ -70275,6 +77324,10 @@ struct VarianceFun { static void RegisterFunction(BuiltinFunctions &set); }; +struct StandardErrorOfTheMeanFun { + static void RegisterFunction(BuiltinFunctions &set); +}; + } // namespace duckdb //===----------------------------------------------------------------------===// @@ -70563,7 +77616,7 @@ struct NumericAverageOperation : public BaseSumOperationcount == 0) { mask.SetInvalid(idx); } else { - if (!Value::DoubleIsValid(state->value)) { + if (!Value::DoubleIsFinite(state->value)) { throw OutOfRangeException("AVG is out of range!"); } target[idx] = (state->value / state->count); @@ -70577,7 +77630,7 @@ struct KahanAverageOperation : public BaseSumOperationcount == 0) { mask.SetInvalid(idx); } else { - if (!Value::DoubleIsValid(state->value)) { + if (!Value::DoubleIsFinite(state->value)) { throw OutOfRangeException("AVG is out of range!"); } target[idx] = (state->value / state->count) + (state->err / state->count); @@ -70589,22 +77642,22 @@ AggregateFunction GetAverageAggregate(PhysicalType type) { switch (type) { case PhysicalType::INT16: return AggregateFunction::UnaryAggregate, int16_t, double, IntegerAverageOperation>( - LogicalType::SMALLINT, LogicalType::DOUBLE); + LogicalType::SMALLINT, LogicalType::DOUBLE, true); case PhysicalType::INT32: { auto function = AggregateFunction::UnaryAggregate, int32_t, double, IntegerAverageOperationHugeint>( - LogicalType::INTEGER, LogicalType::DOUBLE); + LogicalType::INTEGER, LogicalType::DOUBLE, true); return function; } case PhysicalType::INT64: { auto function = AggregateFunction::UnaryAggregate, int64_t, double, IntegerAverageOperationHugeint>( - LogicalType::BIGINT, LogicalType::DOUBLE); + LogicalType::BIGINT, LogicalType::DOUBLE, true); return function; } case PhysicalType::INT128: return AggregateFunction::UnaryAggregate, hugeint_t, double, HugeintAverageOperation>( - LogicalType::HUGEINT, LogicalType::DOUBLE); + LogicalType::HUGEINT, LogicalType::DOUBLE, true); default: throw InternalException("Unimplemented average aggregate"); } @@ -70624,18 +77677,18 @@ unique_ptr BindDecimalAvg(ClientContext &context, AggregateFunctio void AvgFun::RegisterFunction(BuiltinFunctions &set) { AggregateFunctionSet avg("avg"); avg.AddFunction(AggregateFunction({LogicalTypeId::DECIMAL}, LogicalTypeId::DECIMAL, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, BindDecimalAvg)); + nullptr, nullptr, true, nullptr, BindDecimalAvg)); avg.AddFunction(GetAverageAggregate(PhysicalType::INT16)); avg.AddFunction(GetAverageAggregate(PhysicalType::INT32)); avg.AddFunction(GetAverageAggregate(PhysicalType::INT64)); avg.AddFunction(GetAverageAggregate(PhysicalType::INT128)); avg.AddFunction(AggregateFunction::UnaryAggregate, double, double, NumericAverageOperation>( - LogicalType::DOUBLE, LogicalType::DOUBLE)); + LogicalType::DOUBLE, LogicalType::DOUBLE, true)); set.AddFunction(avg); AggregateFunctionSet favg("favg"); favg.AddFunction(AggregateFunction::UnaryAggregate( - LogicalType::DOUBLE, LogicalType::DOUBLE)); + LogicalType::DOUBLE, LogicalType::DOUBLE, true)); set.AddFunction(favg); } @@ -70821,7 +77874,7 @@ struct VarSampOperation : public STDDevBaseOperation { mask.SetInvalid(idx); } else { target[idx] = state->dsquared / (state->count - 1); - if (!Value::DoubleIsValid(target[idx])) { + if (!Value::DoubleIsFinite(target[idx])) { throw OutOfRangeException("VARSAMP is out of range!"); } } @@ -70835,7 +77888,7 @@ struct VarPopOperation : public STDDevBaseOperation { mask.SetInvalid(idx); } else { target[idx] = state->count > 1 ? (state->dsquared / state->count) : 0; - if (!Value::DoubleIsValid(target[idx])) { + if (!Value::DoubleIsFinite(target[idx])) { throw OutOfRangeException("VARPOP is out of range!"); } } @@ -70849,7 +77902,7 @@ struct STDDevSampOperation : public STDDevBaseOperation { mask.SetInvalid(idx); } else { target[idx] = sqrt(state->dsquared / (state->count - 1)); - if (!Value::DoubleIsValid(target[idx])) { + if (!Value::DoubleIsFinite(target[idx])) { throw OutOfRangeException("STDDEV_SAMP is out of range!"); } } @@ -70863,12 +77916,26 @@ struct STDDevPopOperation : public STDDevBaseOperation { mask.SetInvalid(idx); } else { target[idx] = state->count > 1 ? sqrt(state->dsquared / state->count) : 0; - if (!Value::DoubleIsValid(target[idx])) { + if (!Value::DoubleIsFinite(target[idx])) { throw OutOfRangeException("STDDEV_POP is out of range!"); } } } }; + +struct StandardErrorOfTheMeanOperation : public STDDevBaseOperation { + template + static void Finalize(Vector &result, FunctionData *, STATE *state, T *target, ValidityMask &mask, idx_t idx) { + if (state->count == 0) { + mask.SetInvalid(idx); + } else { + target[idx] = sqrt(state->dsquared / state->count) / sqrt((state->count)); + if (!Value::DoubleIsFinite(target[idx])) { + throw OutOfRangeException("SEM is out of range!"); + } + } + } +}; } // namespace duckdb //===----------------------------------------------------------------------===// @@ -70927,12 +77994,12 @@ struct CorrOperation { } else { auto cov = state->cov_pop.co_moment / state->cov_pop.count; auto std_x = state->dev_pop_x.count > 1 ? sqrt(state->dev_pop_x.dsquared / state->dev_pop_x.count) : 0; - if (!Value::DoubleIsValid(std_x)) { - throw OutOfRangeException("STDDEV_POP for X is invalid!"); + if (!Value::DoubleIsFinite(std_x)) { + throw OutOfRangeException("STDDEV_POP for X is out of range!"); } auto std_y = state->dev_pop_y.count > 1 ? sqrt(state->dev_pop_y.dsquared / state->dev_pop_y.count) : 0; - if (!Value::DoubleIsValid(std_y)) { - throw OutOfRangeException("STDDEV_POP for Y is invalid!"); + if (!Value::DoubleIsFinite(std_y)) { + throw OutOfRangeException("STDDEV_POP for Y is out of range!"); } if (std_x * std_y == 0) { mask.SetInvalid(idx); @@ -71030,6 +78097,13 @@ void VarianceFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(var_samp); } +void StandardErrorOfTheMeanFun::RegisterFunction(BuiltinFunctions &set) { + AggregateFunctionSet sem("sem"); + sem.AddFunction(AggregateFunction::UnaryAggregate( + LogicalType::DOUBLE, LogicalType::DOUBLE)); + set.AddFunction(sem); +} + } // namespace duckdb @@ -71047,7 +78121,7 @@ void BuiltinFunctions::RegisterAlgebraicAggregates() { Register(); Register(); Register(); - + Register(); Register(); } @@ -71220,7 +78294,6 @@ void ApproxCountDistinctFun::RegisterFunction(BuiltinFunctions &set) { -#include namespace duckdb { @@ -71231,39 +78304,71 @@ struct ArgMinMaxState { bool is_initialized; }; -struct ArgMinMaxOperation { - template - static void Initialize(STATE *state) { - state->is_initialized = false; +template +static void ArgMinMaxDestroyValue(T value) { +} + +template <> +void ArgMinMaxDestroyValue(string_t value) { + if (!value.IsInlined()) { + delete[] value.GetDataUnsafe(); } +} - template - static void Finalize(Vector &result, FunctionData *, STATE *state, T *target, ValidityMask &mask, idx_t idx) { - if (!state->is_initialized) { - mask.SetInvalid(idx); - } else { - target[idx] = state->arg; +template +static void ArgMinMaxAssignValue(T &target, T new_value, bool is_initialized) { + target = new_value; +} + +template <> +void ArgMinMaxAssignValue(string_t &target, string_t new_value, bool is_initialized) { + if (is_initialized) { + ArgMinMaxDestroyValue(target); + } + if (new_value.IsInlined()) { + target = new_value; + } else { + // non-inlined string, need to allocate space for it + auto len = new_value.GetSize(); + auto ptr = new char[len]; + memcpy(ptr, new_value.GetDataUnsafe(), len); + + target = string_t(ptr, len); + } +} + +template +struct ArgMinMaxBase { + template + static void Destroy(STATE *state) { + if (state->is_initialized) { + ArgMinMaxDestroyValue(state->arg); + ArgMinMaxDestroyValue(state->value); } } - static bool IgnoreNull() { - return true; + template + static void Initialize(STATE *state) { + state->is_initialized = false; } -}; -struct ArgMinOperation : ArgMinMaxOperation { template static void Operation(STATE *state, FunctionData *bind_data, A_TYPE *x_data, B_TYPE *y_data, ValidityMask &amask, ValidityMask &bmask, idx_t xidx, idx_t yidx) { if (!state->is_initialized) { - state->value = y_data[yidx]; - state->arg = x_data[xidx]; + ArgMinMaxAssignValue(state->arg, x_data[xidx], false); + ArgMinMaxAssignValue(state->value, y_data[yidx], false); state->is_initialized = true; } else { - if (y_data[yidx] < state->value) { - state->value = y_data[yidx]; - state->arg = x_data[xidx]; - } + OP::template Execute(state, x_data[xidx], y_data[yidx]); + } + } + + template + static void Execute(STATE *state, A_TYPE x_data, B_TYPE y_data) { + if (COMPARATOR::Operation(y_data, state->value)) { + ArgMinMaxAssignValue(state->arg, x_data, true); + ArgMinMaxAssignValue(state->value, y_data, true); } } @@ -71272,183 +78377,98 @@ struct ArgMinOperation : ArgMinMaxOperation { if (!source.is_initialized) { return; } - if (!target->is_initialized) { + if (!target->is_initialized || COMPARATOR::Operation(source.value, target->value)) { + ArgMinMaxAssignValue(target->arg, source.arg, target->is_initialized); + ArgMinMaxAssignValue(target->value, source.value, target->is_initialized); target->is_initialized = true; - target->value = source.value; - target->arg = source.arg; - return; - } - if (source.value < target->value) { - target->value = source.value; - target->arg = source.arg; } } + + static bool IgnoreNull() { + return true; + } }; -struct ArgMaxOperation : ArgMinMaxOperation { - template - static void Operation(STATE *state, FunctionData *bind_data, A_TYPE *x_data, B_TYPE *y_data, ValidityMask &amask, - ValidityMask &bmask, idx_t xidx, idx_t yidx) { +template +struct StringArgMinMax : public ArgMinMaxBase { + template + static void Finalize(Vector &result, FunctionData *, STATE *state, T *target, ValidityMask &mask, idx_t idx) { if (!state->is_initialized) { - state->value = y_data[yidx]; - state->arg = x_data[xidx]; - state->is_initialized = true; + mask.SetInvalid(idx); } else { - if (state->value < y_data[yidx]) { - state->value = y_data[yidx]; - state->arg = x_data[xidx]; - } + target[idx] = StringVector::AddStringOrBlob(result, state->arg); } } +}; - template - static void Combine(const STATE &source, STATE *target) { - if (!source.is_initialized) { - return; - } - if (!target->is_initialized) { - target->is_initialized = true; - target->value = source.value; - target->arg = source.arg; - return; - } - if (target->value < source.value) { - target->value = source.value; - target->arg = source.arg; +template +struct NumericArgMinMax : public ArgMinMaxBase { + template + static void Finalize(Vector &result, FunctionData *, STATE *state, T *target, ValidityMask &mask, idx_t idx) { + if (!state->is_initialized) { + mask.SetInvalid(idx); + } else { + target[idx] = state->arg; } } }; +using NumericArgMinOperation = NumericArgMinMax; +using NumericArgMaxOperation = NumericArgMinMax; +using StringArgMinOperation = StringArgMinMax; +using StringArgMaxOperation = StringArgMinMax; + +template +AggregateFunction GetArgMinMaxFunctionInternal(const LogicalType &arg_2, const LogicalType &arg) { + auto function = AggregateFunction::BinaryAggregate, T, T2, T, OP>(arg, arg_2, arg); + if (arg.InternalType() == PhysicalType::VARCHAR || arg_2.InternalType() == PhysicalType::VARCHAR) { + function.destructor = AggregateFunction::StateDestroy, OP>; + } + return function; +} template -AggregateFunction GetArgMinMaxFunctionArg2(LogicalTypeId arg_2, const LogicalType &arg) { - switch (arg_2) { - case LogicalTypeId::INTEGER: - return AggregateFunction::BinaryAggregate, T, int32_t, T, OP>( - arg, LogicalType::INTEGER, arg); - case LogicalTypeId::BIGINT: - return AggregateFunction::BinaryAggregate, T, int64_t, T, OP>( - arg, LogicalType::BIGINT, arg); - case LogicalTypeId::DOUBLE: - return AggregateFunction::BinaryAggregate, T, double, T, OP>(arg, LogicalType::DOUBLE, - arg); - case LogicalTypeId::VARCHAR: - return AggregateFunction::BinaryAggregate, T, string_t, T, OP>( - arg, LogicalType::VARCHAR, arg); - case LogicalTypeId::DATE: - return AggregateFunction::BinaryAggregate, T, date_t, T, OP>(arg, LogicalType::DATE, - arg); - case LogicalTypeId::TIMESTAMP: - return AggregateFunction::BinaryAggregate, T, timestamp_t, T, OP>( - arg, LogicalType::TIMESTAMP, arg); - case LogicalTypeId::TIMESTAMP_TZ: - return AggregateFunction::BinaryAggregate, T, timestamp_t, T, OP>( - arg, LogicalType::TIMESTAMP_TZ, arg); - case LogicalTypeId::BLOB: - return AggregateFunction::BinaryAggregate, T, string_t, T, OP>( - arg, LogicalType::BLOB, arg); +AggregateFunction GetArgMinMaxFunctionArg2(const LogicalType &arg_2, const LogicalType &arg) { + switch (arg_2.InternalType()) { + case PhysicalType::INT32: + return GetArgMinMaxFunctionInternal(arg_2, arg); + case PhysicalType::INT64: + return GetArgMinMaxFunctionInternal(arg_2, arg); + case PhysicalType::DOUBLE: + return GetArgMinMaxFunctionInternal(arg_2, arg); + case PhysicalType::VARCHAR: + return GetArgMinMaxFunctionInternal(arg_2, arg); default: throw InternalException("Unimplemented arg_min/arg_max aggregate"); } } -template -void GetArgMinMaxFunction(LogicalTypeId arg_1, AggregateFunctionSet &fun) { - switch (arg_1) { - case LogicalTypeId::INTEGER: - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::INTEGER, LogicalType::INTEGER)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BIGINT, LogicalType::INTEGER)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DOUBLE, LogicalType::INTEGER)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::VARCHAR, LogicalType::INTEGER)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DATE, LogicalType::INTEGER)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP, LogicalType::INTEGER)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP_TZ, LogicalType::INTEGER)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BLOB, LogicalType::INTEGER)); - break; - case LogicalTypeId::BIGINT: - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::INTEGER, LogicalType::BIGINT)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BIGINT, LogicalType::BIGINT)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DOUBLE, LogicalType::BIGINT)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::VARCHAR, LogicalType::BIGINT)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DATE, LogicalType::BIGINT)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP, LogicalType::BIGINT)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP_TZ, LogicalType::BIGINT)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BLOB, LogicalType::BIGINT)); - break; - case LogicalTypeId::DOUBLE: - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::INTEGER, LogicalType::DOUBLE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BIGINT, LogicalType::DOUBLE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DOUBLE, LogicalType::DOUBLE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::VARCHAR, LogicalType::DOUBLE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DATE, LogicalType::DOUBLE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP, LogicalType::DOUBLE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP_TZ, LogicalType::DOUBLE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BLOB, LogicalType::DOUBLE)); - break; - case LogicalTypeId::VARCHAR: - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::INTEGER, LogicalType::VARCHAR)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BIGINT, LogicalType::VARCHAR)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DOUBLE, LogicalType::VARCHAR)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::VARCHAR, LogicalType::VARCHAR)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DATE, LogicalType::VARCHAR)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP, LogicalType::VARCHAR)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP_TZ, LogicalType::VARCHAR)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BLOB, LogicalType::VARCHAR)); - break; - case LogicalTypeId::DATE: - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::INTEGER, LogicalType::DATE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BIGINT, LogicalType::DATE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DOUBLE, LogicalType::DATE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::VARCHAR, LogicalType::DATE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DATE, LogicalType::DATE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP, LogicalType::DATE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP_TZ, LogicalType::DATE)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BLOB, LogicalType::DATE)); - break; - case LogicalTypeId::TIMESTAMP: - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::INTEGER, LogicalType::TIMESTAMP)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BIGINT, LogicalType::TIMESTAMP)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DOUBLE, LogicalType::TIMESTAMP)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::VARCHAR, LogicalType::TIMESTAMP)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DATE, LogicalType::TIMESTAMP)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP, LogicalType::TIMESTAMP)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP_TZ, LogicalType::TIMESTAMP)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BLOB, LogicalType::TIMESTAMP)); - break; - case LogicalTypeId::TIMESTAMP_TZ: - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::INTEGER, LogicalType::TIMESTAMP_TZ)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BIGINT, LogicalType::TIMESTAMP_TZ)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DOUBLE, LogicalType::TIMESTAMP_TZ)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::VARCHAR, LogicalType::TIMESTAMP_TZ)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DATE, LogicalType::TIMESTAMP_TZ)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP, LogicalType::TIMESTAMP_TZ)); - fun.AddFunction( - GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP_TZ, LogicalType::TIMESTAMP_TZ)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BLOB, LogicalType::TIMESTAMP_TZ)); - break; - case LogicalTypeId::BLOB: - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::INTEGER, LogicalType::BLOB)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BIGINT, LogicalType::BLOB)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DOUBLE, LogicalType::BLOB)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::VARCHAR, LogicalType::BLOB)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::DATE, LogicalType::BLOB)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP, LogicalType::BLOB)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::TIMESTAMP_TZ, LogicalType::BLOB)); - fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalTypeId::BLOB, LogicalType::BLOB)); - break; - default: - throw InternalException("Unimplemented arg_min/arg_max aggregate"); - } +template +void AddArgMinMaxFunctionArg2(AggregateFunctionSet &fun, const LogicalType &arg) { + fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalType::INTEGER, arg)); + fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalType::BIGINT, arg)); + fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalType::DOUBLE, arg)); + fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalType::VARCHAR, arg)); + fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalType::DATE, arg)); + fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalType::TIMESTAMP, arg)); + fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalType::TIMESTAMP_TZ, arg)); + fun.AddFunction(GetArgMinMaxFunctionArg2(LogicalType::BLOB, arg)); +} + +template +static void AddArgMinMaxFunctions(AggregateFunctionSet &fun) { + AddArgMinMaxFunctionArg2(fun, LogicalType::INTEGER); + AddArgMinMaxFunctionArg2(fun, LogicalType::BIGINT); + AddArgMinMaxFunctionArg2(fun, LogicalType::DOUBLE); + AddArgMinMaxFunctionArg2(fun, LogicalType::VARCHAR); + AddArgMinMaxFunctionArg2(fun, LogicalType::DATE); + AddArgMinMaxFunctionArg2(fun, LogicalType::TIMESTAMP); + AddArgMinMaxFunctionArg2(fun, LogicalType::TIMESTAMP_TZ); + AddArgMinMaxFunctionArg2(fun, LogicalType::BLOB); } + void ArgMinFun::RegisterFunction(BuiltinFunctions &set) { AggregateFunctionSet fun("argmin"); - GetArgMinMaxFunction(LogicalTypeId::INTEGER, fun); - GetArgMinMaxFunction(LogicalTypeId::BIGINT, fun); - GetArgMinMaxFunction(LogicalTypeId::DOUBLE, fun); - GetArgMinMaxFunction(LogicalTypeId::VARCHAR, fun); - GetArgMinMaxFunction(LogicalTypeId::DATE, fun); - GetArgMinMaxFunction(LogicalTypeId::TIMESTAMP, fun); - GetArgMinMaxFunction(LogicalTypeId::TIMESTAMP_TZ, fun); - GetArgMinMaxFunction(LogicalTypeId::BLOB, fun); + AddArgMinMaxFunctions(fun); set.AddFunction(fun); //! Add min_by alias @@ -71462,14 +78482,7 @@ void ArgMinFun::RegisterFunction(BuiltinFunctions &set) { void ArgMaxFun::RegisterFunction(BuiltinFunctions &set) { AggregateFunctionSet fun("argmax"); - GetArgMinMaxFunction(LogicalTypeId::INTEGER, fun); - GetArgMinMaxFunction(LogicalTypeId::BIGINT, fun); - GetArgMinMaxFunction(LogicalTypeId::DOUBLE, fun); - GetArgMinMaxFunction(LogicalTypeId::VARCHAR, fun); - GetArgMinMaxFunction(LogicalTypeId::DATE, fun); - GetArgMinMaxFunction(LogicalTypeId::TIMESTAMP, fun); - GetArgMinMaxFunction(LogicalTypeId::TIMESTAMP_TZ, fun); - GetArgMinMaxFunction(LogicalTypeId::BLOB, fun); + AddArgMinMaxFunctions(fun); set.AddFunction(fun); //! Add max_by alias @@ -72204,7 +79217,7 @@ struct FirstFunctionString : public FirstFunctionBase { if (!state->is_set || state->is_null) { mask.SetInvalid(idx); } else { - target[idx] = StringVector::AddString(result, state->value); + target[idx] = StringVector::AddStringOrBlob(result, state->value); } } @@ -72386,6 +79399,7 @@ unique_ptr BindDecimalFirst(ClientContext &context, AggregateFunct vector> &arguments) { auto decimal_type = arguments[0]->return_type; function = GetFirstFunction(decimal_type); + function.name = "first"; function.return_type = decimal_type; return nullptr; } @@ -72488,8 +79502,8 @@ struct KurtosisOperation { mask.SetInvalid(idx); } // LCOV_EXCL_STOP target[idx] = (n - 1) * ((n + 1) * m4 / (m2 * m2) - 3 * (n - 1)) / ((n - 2) * (n - 3)); - if (!Value::DoubleIsValid(target[idx])) { - mask.SetInvalid(idx); + if (!Value::DoubleIsFinite(target[idx])) { + throw OutOfRangeException("Kurtosis is out of range!"); } } @@ -72542,24 +79556,24 @@ static AggregateFunction GetUnaryAggregate(LogicalType type) { case LogicalTypeId::TIMESTAMP_TZ: case LogicalTypeId::TIME_TZ: case LogicalTypeId::BIGINT: - return AggregateFunction::UnaryAggregate, int64_t, int64_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, int64_t, int64_t, OP>(type, type, true); case LogicalTypeId::UTINYINT: - return AggregateFunction::UnaryAggregate, uint8_t, uint8_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, uint8_t, uint8_t, OP>(type, type, true); case LogicalTypeId::USMALLINT: - return AggregateFunction::UnaryAggregate, uint16_t, uint16_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, uint16_t, uint16_t, OP>(type, type, true); case LogicalTypeId::UINTEGER: - return AggregateFunction::UnaryAggregate, uint32_t, uint32_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, uint32_t, uint32_t, OP>(type, type, true); case LogicalTypeId::UBIGINT: - return AggregateFunction::UnaryAggregate, uint64_t, uint64_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, uint64_t, uint64_t, OP>(type, type, true); case LogicalTypeId::HUGEINT: case LogicalTypeId::UUID: - return AggregateFunction::UnaryAggregate, hugeint_t, hugeint_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, hugeint_t, hugeint_t, OP>(type, type, true); case LogicalTypeId::FLOAT: - return AggregateFunction::UnaryAggregate, float, float, OP>(type, type); + return AggregateFunction::UnaryAggregate, float, float, OP>(type, type, true); case LogicalTypeId::DOUBLE: - return AggregateFunction::UnaryAggregate, double, double, OP>(type, type); + return AggregateFunction::UnaryAggregate, double, double, OP>(type, type, true); case LogicalTypeId::INTERVAL: - return AggregateFunction::UnaryAggregate, interval_t, interval_t, OP>(type, type); + return AggregateFunction::UnaryAggregate, interval_t, interval_t, OP>(type, type, true); default: throw InternalException("Unimplemented type for min/max aggregate"); } @@ -72942,9 +79956,9 @@ struct VectorMinMaxBase { const auto sidx = sdata.sel->get_index(i); auto state = states[sidx]; if (!state->value) { - Assign(state, input, idx); + Assign(state, input, i); } else { - OP::template Execute(state, input, idx, count); + OP::template Execute(state, input, i, count); } } } @@ -72963,10 +79977,19 @@ struct VectorMinMaxBase { template static void Finalize(Vector &result, FunctionData *, STATE *state, T *target, ValidityMask &mask, idx_t idx) { if (!state->value) { - // we need to use FlatVector::SetNull here + // we need to use SetNull here // since for STRUCT columns only setting the validity mask of the struct is incorrect // as for a struct column, we need to also set ALL child columns to NULL - FlatVector::SetNull(result, idx, true); + switch (result.GetVectorType()) { + case VectorType::FLAT_VECTOR: + FlatVector::SetNull(result, idx, true); + break; + case VectorType::CONSTANT_VECTOR: + ConstantVector::SetNull(result, true); + break; + default: + throw InternalException("Invalid result vector type for nested min/max"); + } } else { VectorOperations::Copy(*state->value, result, 1, 0, idx); } @@ -73002,6 +80025,7 @@ template unique_ptr BindDecimalMinMax(ClientContext &context, AggregateFunction &function, vector> &arguments) { auto decimal_type = arguments[0]->return_type; + auto name = function.name; switch (decimal_type.InternalType()) { case PhysicalType::INT16: function = GetUnaryAggregate(LogicalType::SMALLINT); @@ -73016,6 +80040,7 @@ unique_ptr BindDecimalMinMax(ClientContext &context, AggregateFunc function = GetUnaryAggregate(LogicalType::HUGEINT); break; } + function.name = move(name); function.arguments[0] = decimal_type; function.return_type = decimal_type; return nullptr; @@ -73033,12 +80058,12 @@ static AggregateFunction GetMinMaxFunction(const LogicalType &type) { template static void AddMinMaxOperator(AggregateFunctionSet &set) { for (auto &type : LogicalType::AllTypes()) { - if (type.id() == LogicalTypeId::VARCHAR || type.id() == LogicalTypeId::BLOB) { + if (type.id() == LogicalTypeId::VARCHAR || type.id() == LogicalTypeId::BLOB || type.id() == LogicalType::JSON) { set.AddFunction( AggregateFunction::UnaryAggregateDestructor, string_t, string_t, OP_STRING>( type.id(), type.id())); } else if (type.id() == LogicalTypeId::DECIMAL) { - set.AddFunction(AggregateFunction({type}, type, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + set.AddFunction(AggregateFunction({type}, type, nullptr, nullptr, nullptr, nullptr, nullptr, false, nullptr, BindDecimalMinMax)); } else if (type.id() == LogicalTypeId::LIST || type.id() == LogicalTypeId::MAP || type.id() == LogicalTypeId::STRUCT) { @@ -73200,8 +80225,8 @@ struct SkewnessOperation { target[idx] = temp1 * temp * (state->sum_cub - 3 * state->sum_sqr * state->sum * temp + 2 * pow(state->sum, 3) * temp * temp) / div; - if (!Value::DoubleIsValid(target[idx])) { - mask.SetInvalid(idx); + if (!Value::DoubleIsFinite(target[idx])) { + throw OutOfRangeException("SKEW is out of range!"); } } @@ -73410,7 +80435,7 @@ struct DoubleSumOperation : public BaseSumOperationisset) { mask.SetInvalid(idx); } else { - if (!Value::DoubleIsValid(state->value)) { + if (!Value::DoubleIsFinite(state->value)) { throw OutOfRangeException("SUM is out of range!"); } target[idx] = state->value; @@ -73467,13 +80492,13 @@ unique_ptr SumPropagateStats(ClientContext &context, BoundAggreg case PhysicalType::INT32: expr.function = AggregateFunction::UnaryAggregate, int32_t, hugeint_t, IntegerSumOperation>( - LogicalType::INTEGER, LogicalType::HUGEINT); + LogicalType::INTEGER, LogicalType::HUGEINT, true); expr.function.name = "sum"; break; case PhysicalType::INT64: expr.function = AggregateFunction::UnaryAggregate, int64_t, hugeint_t, IntegerSumOperation>( - LogicalType::BIGINT, LogicalType::HUGEINT); + LogicalType::BIGINT, LogicalType::HUGEINT, true); expr.function.name = "sum"; break; default: @@ -73487,24 +80512,24 @@ AggregateFunction SumFun::GetSumAggregate(PhysicalType type) { switch (type) { case PhysicalType::INT16: return AggregateFunction::UnaryAggregate, int16_t, hugeint_t, IntegerSumOperation>( - LogicalType::SMALLINT, LogicalType::HUGEINT); + LogicalType::SMALLINT, LogicalType::HUGEINT, true); case PhysicalType::INT32: { auto function = AggregateFunction::UnaryAggregate, int32_t, hugeint_t, SumToHugeintOperation>( - LogicalType::INTEGER, LogicalType::HUGEINT); + LogicalType::INTEGER, LogicalType::HUGEINT, true); function.statistics = SumPropagateStats; return function; } case PhysicalType::INT64: { auto function = AggregateFunction::UnaryAggregate, int64_t, hugeint_t, SumToHugeintOperation>( - LogicalType::BIGINT, LogicalType::HUGEINT); + LogicalType::BIGINT, LogicalType::HUGEINT, true); function.statistics = SumPropagateStats; return function; } case PhysicalType::INT128: return AggregateFunction::UnaryAggregate, hugeint_t, hugeint_t, HugeintSumOperation>( - LogicalType::HUGEINT, LogicalType::HUGEINT); + LogicalType::HUGEINT, LogicalType::HUGEINT, true); default: throw InternalException("Unimplemented sum aggregate"); } @@ -73524,20 +80549,20 @@ void SumFun::RegisterFunction(BuiltinFunctions &set) { AggregateFunctionSet sum("sum"); // decimal sum.AddFunction(AggregateFunction({LogicalTypeId::DECIMAL}, LogicalTypeId::DECIMAL, nullptr, nullptr, nullptr, - nullptr, nullptr, nullptr, BindDecimalSum)); + nullptr, nullptr, true, nullptr, BindDecimalSum)); sum.AddFunction(GetSumAggregate(PhysicalType::INT16)); sum.AddFunction(GetSumAggregate(PhysicalType::INT32)); sum.AddFunction(GetSumAggregate(PhysicalType::INT64)); sum.AddFunction(GetSumAggregate(PhysicalType::INT128)); sum.AddFunction(AggregateFunction::UnaryAggregate, double, double, NumericSumOperation>( - LogicalType::DOUBLE, LogicalType::DOUBLE)); + LogicalType::DOUBLE, LogicalType::DOUBLE, true)); set.AddFunction(sum); // fsum AggregateFunctionSet fsum("fsum"); fsum.AddFunction(AggregateFunction::UnaryAggregate( - LogicalType::DOUBLE, LogicalType::DOUBLE)); + LogicalType::DOUBLE, LogicalType::DOUBLE, true)); set.AddFunction(fsum); @@ -73617,7 +80642,7 @@ struct ReservoirQuantileFun { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7 // See the end of this file for a list /* @@ -76411,6 +83436,26 @@ struct ListConcatFun { static void RegisterFunction(BuiltinFunctions &set); }; +struct ListContainsFun { + static ScalarFunction GetFunction(); + static void RegisterFunction(BuiltinFunctions &set); +}; + +struct ListFlattenFun { + static ScalarFunction GetFunction(); + static void RegisterFunction(BuiltinFunctions &set); +}; + +struct ListPositionFun { + static ScalarFunction GetFunction(); + static void RegisterFunction(BuiltinFunctions &set); +}; + +struct ListAggregateFun { + static ScalarFunction GetFunction(); + static void RegisterFunction(BuiltinFunctions &set); +}; + struct CardinalityFun { static void RegisterFunction(BuiltinFunctions &set); }; @@ -76702,6 +83747,9 @@ void HistogramFun::RegisterFunction(BuiltinFunctions &set) { fun.AddFunction(GetHistogramFunction(PhysicalType::VARCHAR)); fun.AddFunction(GetHistogramFunction(LogicalType::TIMESTAMP)); fun.AddFunction(GetHistogramFunction(LogicalType::TIMESTAMP_TZ)); + fun.AddFunction(GetHistogramFunction(LogicalType::TIMESTAMP_S)); + fun.AddFunction(GetHistogramFunction(LogicalType::TIMESTAMP_MS)); + fun.AddFunction(GetHistogramFunction(LogicalType::TIMESTAMP_NS)); set.AddFunction(fun); } @@ -76762,10 +83810,12 @@ static void ListCombineFunction(Vector &state, Vector &combined, idx_t count) { auto states_ptr = (ListAggState **)sdata.data; auto combined_ptr = FlatVector::GetData(combined); - for (idx_t i = 0; i < count; i++) { auto state = states_ptr[sdata.sel->get_index(i)]; - D_ASSERT(state->list_vector); + if (!state->list_vector) { + // NULL, no need to append. + continue; + } if (!combined_ptr[i]->list_vector) { combined_ptr[i]->list_vector = new Vector(state->list_vector->GetType()); } @@ -76783,17 +83833,18 @@ static void ListFinalize(Vector &state_vector, FunctionData *, Vector &result, i auto &mask = FlatVector::Validity(result); size_t total_len = ListVector::GetListSize(result); + for (idx_t i = 0; i < count; i++) { auto state = states[sdata.sel->get_index(i)]; + const auto rid = i + offset; if (!state->list_vector) { - mask.SetInvalid(i); + mask.SetInvalid(rid); continue; } - D_ASSERT(state->list_vector); + auto list_struct_data = FlatVector::GetData(result); auto &state_lv = *state->list_vector; auto state_lv_count = ListVector::GetListSize(state_lv); - const auto rid = i + offset; list_struct_data[rid].length = state_lv_count; list_struct_data[rid].offset = total_len; total_len += state_lv_count; @@ -77072,7 +84123,7 @@ struct RegrSlopeOperation { } else { auto cov = state->cov_pop.co_moment / state->cov_pop.count; auto var_pop = state->var_pop.count > 1 ? (state->var_pop.dsquared / state->var_pop.count) : 0; - if (!Value::DoubleIsValid(var_pop)) { + if (!Value::DoubleIsFinite(var_pop)) { throw OutOfRangeException("VARPOP is out of range!"); } if (var_pop == 0) { @@ -77197,7 +84248,7 @@ struct RegrR2Operation { template static void Finalize(Vector &result, FunctionData *fd, STATE *state, T *target, ValidityMask &mask, idx_t idx) { auto var_pop_x = state->var_pop_x.count > 1 ? (state->var_pop_x.dsquared / state->var_pop_x.count) : 0; - if (!Value::DoubleIsValid(var_pop_x)) { + if (!Value::DoubleIsFinite(var_pop_x)) { throw OutOfRangeException("VARPOP(X) is out of range!"); } if (var_pop_x == 0) { @@ -77205,7 +84256,7 @@ struct RegrR2Operation { return; } auto var_pop_y = state->var_pop_y.count > 1 ? (state->var_pop_y.dsquared / state->var_pop_y.count) : 0; - if (!Value::DoubleIsValid(var_pop_y)) { + if (!Value::DoubleIsFinite(var_pop_y)) { throw OutOfRangeException("VARPOP(Y) is out of range!"); } if (var_pop_y == 0) { @@ -77286,7 +84337,7 @@ struct RegrBaseOperation { return; } auto var_pop = state->var_pop.count > 1 ? (state->var_pop.dsquared / state->var_pop.count) : 0; - if (!Value::DoubleIsValid(var_pop)) { + if (!Value::DoubleIsFinite(var_pop)) { throw OutOfRangeException("VARPOP is out of range!"); } RegrCountFunction::Finalize(result, fd, &state->count, target, mask, idx); @@ -77907,8 +84958,13 @@ int64_t CastRules::ImplicitCast(const LogicalType &from, const LogicalType &to) // Implicit cast not allowed from BLOB to VARCHAR return -1; } - if (to.id() == LogicalTypeId::VARCHAR) { - // everything can be cast to VARCHAR, but this cast has a high cost + if ((from.id() == LogicalTypeId::VARCHAR && to.id() == LogicalTypeId::JSON) || + (from.id() == LogicalTypeId::JSON && to.id() == LogicalTypeId::VARCHAR)) { + // Virtually no cost, just a different tag + return 1; + } + if (to.id() == LogicalTypeId::VARCHAR || to.id() == LogicalTypeId::JSON) { + // everything can be cast to VARCHAR/JSON, but this cast has a high cost return TargetTypeCost(to); } if (from.id() == LogicalTypeId::LIST && to.id() == LogicalTypeId::LIST) { @@ -77997,6 +85053,11 @@ struct BitpackingFun { static bool TypeIsSupported(PhysicalType type); }; +struct DictionaryCompressionFun { + static CompressionFunction GetFunction(PhysicalType type); + static bool TypeIsSupported(PhysicalType type); +}; + } // namespace duckdb @@ -78017,6 +85078,8 @@ static DefaultCompressionMethod internal_compression_methods[] = { {CompressionType::COMPRESSION_UNCOMPRESSED, UncompressedFun::GetFunction, UncompressedFun::TypeIsSupported}, {CompressionType::COMPRESSION_RLE, RLEFun::GetFunction, RLEFun::TypeIsSupported}, {CompressionType::COMPRESSION_BITPACKING, BitpackingFun::GetFunction, BitpackingFun::TypeIsSupported}, + {CompressionType::COMPRESSION_DICTIONARY, DictionaryCompressionFun::GetFunction, + DictionaryCompressionFun::TypeIsSupported}, {CompressionType::COMPRESSION_AUTO, nullptr, nullptr}}; static CompressionFunction *FindCompressionFunction(CompressionFunctionSet &set, CompressionType type, @@ -78066,6 +85129,7 @@ vector DBConfig::GetCompressionFunctions(PhysicalType dat TryLoadCompression(*this, result, CompressionType::COMPRESSION_UNCOMPRESSED, data_type); TryLoadCompression(*this, result, CompressionType::COMPRESSION_RLE, data_type); TryLoadCompression(*this, result, CompressionType::COMPRESSION_BITPACKING, data_type); + TryLoadCompression(*this, result, CompressionType::COMPRESSION_DICTIONARY, data_type); return result; } @@ -78163,9 +85227,9 @@ bool SimpleNamedParameterFunction::HasNamedParameters() { } BaseScalarFunction::BaseScalarFunction(string name_p, vector arguments_p, LogicalType return_type_p, - bool has_side_effects, LogicalType varargs_p) + bool has_side_effects, LogicalType varargs_p, bool propagates_null_values_p) : SimpleFunction(move(name_p), move(arguments_p), move(varargs_p)), return_type(move(return_type_p)), - has_side_effects(has_side_effects) { + has_side_effects(has_side_effects), propagates_null_values(propagates_null_values_p) { } BaseScalarFunction::~BaseScalarFunction() { @@ -78583,26 +85647,29 @@ AggregateFunction::BindAggregateFunction(ClientContext &context, AggregateFuncti + + namespace duckdb { -MacroFunction::MacroFunction(unique_ptr expression) : expression(move(expression)) { +// MacroFunction::MacroFunction(unique_ptr expression) : expression(move(expression)) {} + +MacroFunction::MacroFunction(MacroType type) : type(type) { } -string MacroFunction::ValidateArguments(MacroCatalogEntry ¯o_func, FunctionExpression &function_expr, +string MacroFunction::ValidateArguments(MacroFunction ¯o_def, const string &name, FunctionExpression &function_expr, vector> &positionals, unordered_map> &defaults) { + // separate positional and default arguments - auto ¯o_def = *macro_func.function; for (auto &arg : function_expr.children) { if (arg->type == ExpressionType::VALUE_CONSTANT && !arg->alias.empty()) { // default argument if (macro_def.default_parameters.find(arg->alias) == macro_def.default_parameters.end()) { - return StringUtil::Format("Macro %s does not have default parameter %s!", macro_func.name, arg->alias); + return StringUtil::Format("Macro %s does not have default parameter %s!", name, arg->alias); } else if (defaults.find(arg->alias) != defaults.end()) { return StringUtil::Format("Duplicate default parameters %s!", arg->alias); } - auto alias = arg->alias; - defaults[alias] = move(arg); + defaults[arg->alias] = move(arg); } else if (!defaults.empty()) { return "Positional parameters cannot come after parameters with a default value!"; } else { @@ -78613,10 +85680,10 @@ string MacroFunction::ValidateArguments(MacroCatalogEntry ¯o_func, FunctionE // validate if the right number of arguments was supplied string error; - auto ¶meters = macro_func.function->parameters; + auto ¶meters = macro_def.parameters; if (parameters.size() != positionals.size()) { error = StringUtil::Format( - "Macro function '%s(%s)' requires ", macro_func.name, + "Macro function '%s(%s)' requires ", name, StringUtil::Join(parameters, parameters.size(), ", ", [](const unique_ptr &p) { return ((ColumnRefExpression &)*p).column_names[0]; })); @@ -78639,15 +85706,14 @@ string MacroFunction::ValidateArguments(MacroCatalogEntry ¯o_func, FunctionE return error; } -unique_ptr MacroFunction::Copy() { - auto result = make_unique(expression->Copy()); +void MacroFunction::CopyProperties(MacroFunction &other) { + other.type = type; for (auto ¶m : parameters) { - result->parameters.push_back(param->Copy()); + other.parameters.push_back(param->Copy()); } for (auto &kv : default_parameters) { - result->default_parameters[kv.first] = kv.second->Copy(); + other.default_parameters[kv.first] = kv.second->Copy(); } - return result; } } // namespace duckdb @@ -78822,6 +85888,21 @@ string PragmaShowTables(ClientContext &context, const FunctionParameters ¶me return "SELECT name FROM sqlite_master ORDER BY name"; } +string PragmaShowTablesExpanded(ClientContext &context, const FunctionParameters ¶meters) { + return R"( + SELECT + t.table_name, + LIST(c.column_name order by c.column_name) AS column_names, + LIST(c.data_type order by c.column_name) AS column_types, + FIRST(t.temporary) AS temporary + FROM duckdb_tables t + JOIN duckdb_columns c + USING (table_oid) + GROUP BY t.table_name + ORDER BY t.table_name; + )"; +} + string PragmaAllProfiling(ClientContext &context, const FunctionParameters ¶meters) { return "SELECT * FROM pragma_last_profiling_output() JOIN pragma_detailed_profiling_output() ON " "(pragma_last_profiling_output.operator_id);"; @@ -78842,8 +85923,8 @@ string PragmaFunctionsQuery(ClientContext &context, const FunctionParameters &pa string PragmaShow(ClientContext &context, const FunctionParameters ¶meters) { // PRAGMA table_info but with some aliases return StringUtil::Format( - "SELECT name AS \"Field\", type as \"Type\", CASE WHEN \"notnull\" THEN 'NO' ELSE 'YES' END AS \"Null\", " - "NULL AS \"Key\", dflt_value AS \"Default\", NULL AS \"Extra\" FROM pragma_table_info('%s')", + "SELECT name AS \"column_name\", type as \"column_type\", CASE WHEN \"notnull\" THEN 'NO' ELSE 'YES' " + "END AS \"null\", NULL AS \"key\", dflt_value AS \"default\", NULL AS \"extra\" FROM pragma_table_info('%s')", parameters.values[0].ToString()); } @@ -78887,6 +85968,7 @@ void PragmaQueries::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(PragmaFunction::PragmaCall("table_info", PragmaTableInfo, {LogicalType::VARCHAR})); set.AddFunction(PragmaFunction::PragmaCall("storage_info", PragmaStorageInfo, {LogicalType::VARCHAR})); set.AddFunction(PragmaFunction::PragmaStatement("show_tables", PragmaShowTables)); + set.AddFunction(PragmaFunction::PragmaStatement("show_tables_expanded", PragmaShowTablesExpanded)); set.AddFunction(PragmaFunction::PragmaStatement("database_list", PragmaDatabaseList)); set.AddFunction(PragmaFunction::PragmaStatement("collations", PragmaCollations)); set.AddFunction(PragmaFunction::PragmaCall("show", PragmaShow, {LogicalType::VARCHAR})); @@ -79215,8 +86297,8 @@ void CurrentDateFun::RegisterFunction(BuiltinFunctions &set) { } void CurrentTimestampFun::RegisterFunction(BuiltinFunctions &set) { - set.AddFunction({"now", "current_timestamp"}, - ScalarFunction({}, LogicalType::TIMESTAMP, CurrentTimestampFunction, false, BindCurrentTime)); + set.AddFunction({"now", "current_timestamp"}, ScalarFunction({}, LogicalType::TIMESTAMP, CurrentTimestampFunction, + false, false, BindCurrentTime)); } } // namespace duckdb @@ -80863,9 +87945,9 @@ void AddGenericDatePartOperator(BuiltinFunctions &set, const string &name, scala scalar_function_t ts_func, scalar_function_t interval_func, function_statistics_t date_stats, function_statistics_t ts_stats) { ScalarFunctionSet operator_set(name); - operator_set.AddFunction( - ScalarFunction({LogicalType::DATE}, LogicalType::BIGINT, move(date_func), false, nullptr, nullptr, date_stats)); - operator_set.AddFunction(ScalarFunction({LogicalType::TIMESTAMP}, LogicalType::BIGINT, move(ts_func), false, + operator_set.AddFunction(ScalarFunction({LogicalType::DATE}, LogicalType::BIGINT, move(date_func), false, false, + nullptr, nullptr, date_stats)); + operator_set.AddFunction(ScalarFunction({LogicalType::TIMESTAMP}, LogicalType::BIGINT, move(ts_func), false, false, nullptr, nullptr, ts_stats)); operator_set.AddFunction(ScalarFunction({LogicalType::INTERVAL}, LogicalType::BIGINT, move(interval_func))); set.AddFunction(operator_set); @@ -80884,13 +87966,13 @@ void AddGenericTimePartOperator(BuiltinFunctions &set, const string &name, scala function_statistics_t date_stats, function_statistics_t ts_stats, function_statistics_t time_stats) { ScalarFunctionSet operator_set(name); - operator_set.AddFunction( - ScalarFunction({LogicalType::DATE}, LogicalType::BIGINT, move(date_func), false, nullptr, nullptr, date_stats)); - operator_set.AddFunction(ScalarFunction({LogicalType::TIMESTAMP}, LogicalType::BIGINT, move(ts_func), false, + operator_set.AddFunction(ScalarFunction({LogicalType::DATE}, LogicalType::BIGINT, move(date_func), false, false, + nullptr, nullptr, date_stats)); + operator_set.AddFunction(ScalarFunction({LogicalType::TIMESTAMP}, LogicalType::BIGINT, move(ts_func), false, false, nullptr, nullptr, ts_stats)); operator_set.AddFunction(ScalarFunction({LogicalType::INTERVAL}, LogicalType::BIGINT, move(interval_func))); - operator_set.AddFunction( - ScalarFunction({LogicalType::TIME}, LogicalType::BIGINT, move(time_func), false, nullptr, nullptr, time_stats)); + operator_set.AddFunction(ScalarFunction({LogicalType::TIME}, LogicalType::BIGINT, move(time_func), false, false, + nullptr, nullptr, time_stats)); set.AddFunction(operator_set); } @@ -81089,7 +88171,7 @@ struct StructDatePart { static ScalarFunction GetFunction(const LogicalType &temporal_type) { auto part_type = LogicalType::LIST(LogicalType::VARCHAR); auto result_type = LogicalType::STRUCT({}); - return ScalarFunction({part_type, temporal_type}, result_type, Function, false, Bind); + return ScalarFunction({part_type, temporal_type}, result_type, Function, false, false, Bind); } }; @@ -82032,6 +89114,8 @@ void EpochFun::RegisterFunction(BuiltinFunctions &set) { +#include + namespace duckdb { struct SenaryExecutor { @@ -82142,6 +89226,21 @@ static void ExecuteMakeDate(DataChunk &input, ExpressionState &state, Vector &re MakeDateOperator::Operation); } +template +static void ExecuteStructMakeDate(DataChunk &input, ExpressionState &state, Vector &result) { + // this should be guaranteed by the binder + D_ASSERT(input.ColumnCount() == 1); + auto &vec = input.data[0]; + + auto &children = StructVector::GetEntries(vec); + D_ASSERT(children.size() == 3); + auto &yyyy = *children[0]; + auto &mm = *children[1]; + auto &dd = *children[2]; + + TernaryExecutor::Execute(yyyy, mm, dd, result, input.size(), Date::FromDate); +} + struct MakeTimeOperator { template static RESULT_TYPE Operation(HH hh, MM mm, SS ss) { @@ -82183,6 +89282,11 @@ void MakeDateFun::RegisterFunction(BuiltinFunctions &set) { ScalarFunctionSet make_date("make_date"); make_date.AddFunction(ScalarFunction({LogicalType::BIGINT, LogicalType::BIGINT, LogicalType::BIGINT}, LogicalType::DATE, ExecuteMakeDate)); + + child_list_t make_date_children { + {"year", LogicalType::BIGINT}, {"month", LogicalType::BIGINT}, {"day", LogicalType::BIGINT}}; + make_date.AddFunction( + ScalarFunction({LogicalType::STRUCT(make_date_children)}, LogicalType::DATE, ExecuteStructMakeDate)); set.AddFunction(make_date); ScalarFunctionSet make_time("make_time"); @@ -82364,7 +89468,7 @@ char *StrfTimeFormat::Write2(char *target, uint8_t value) { } // write a value in the range of 0..99 padded to 2 digits -char *StrfTimeFormat::WritePadded2(char *target, int32_t value) { +char *StrfTimeFormat::WritePadded2(char *target, uint32_t value) { D_ASSERT(value < 100); auto index = static_cast(value * 2); *target++ = duckdb_fmt::internal::data::digits[index]; @@ -82387,9 +89491,9 @@ char *StrfTimeFormat::WritePadded3(char *target, uint32_t value) { } // write a value in the range of 0..999999 padded to 6 digits -char *StrfTimeFormat::WritePadded(char *target, int32_t value, int32_t padding) { +char *StrfTimeFormat::WritePadded(char *target, uint32_t value, size_t padding) { D_ASSERT(padding % 2 == 0); - for (int i = 0; i < padding / 2; i++) { + for (size_t i = 0; i < padding / 2; i++) { int decimals = value % 100; WritePadded2(target + padding - 2 * (i + 1), decimals); value /= 100; @@ -82564,6 +89668,7 @@ char *StrfTimeFormat::WriteStandardSpecifier(StrTimeSpecifier specifier, int32_t } void StrfTimeFormat::FormatString(date_t date, int32_t data[7], char *target) { + D_ASSERT(specifiers.size() + 1 == literals.size()); idx_t i; for (i = 0; i < specifiers.size(); i++) { // first copy the current literal @@ -82781,14 +89886,15 @@ struct StrfTimeBindData : public FunctionData { } }; +template static unique_ptr StrfTimeBindFunction(ClientContext &context, ScalarFunction &bound_function, vector> &arguments) { - if (!arguments[1]->IsFoldable()) { + if (!arguments[REVERSED ? 0 : 1]->IsFoldable()) { throw InvalidInputException("strftime format must be a constant"); } - Value options_str = ExpressionExecutor::EvaluateScalar(*arguments[1]); + Value options_str = ExpressionExecutor::EvaluateScalar(*arguments[REVERSED ? 0 : 1]); StrfTimeFormat format; - if (!options_str.IsNull() && options_str.type().id() == LogicalTypeId::VARCHAR) { + if (!options_str.IsNull()) { auto format_string = options_str.GetValue(); string error = StrTimeFormat::ParseFormatSpecifier(format_string, format); if (!error.empty()) { @@ -82798,16 +89904,17 @@ static unique_ptr StrfTimeBindFunction(ClientContext &context, Sca return make_unique(format); } +template static void StrfTimeFunctionDate(DataChunk &args, ExpressionState &state, Vector &result) { auto &func_expr = (BoundFunctionExpression &)state.expr; auto &info = (StrfTimeBindData &)*func_expr.bind_info; - if (ConstantVector::IsNull(args.data[1])) { + if (ConstantVector::IsNull(args.data[REVERSED ? 0 : 1])) { result.SetVectorType(VectorType::CONSTANT_VECTOR); ConstantVector::SetNull(result, true); return; } - UnaryExecutor::Execute(args.data[0], result, args.size(), [&](date_t input) { + UnaryExecutor::Execute(args.data[REVERSED ? 1 : 0], result, args.size(), [&](date_t input) { dtime_t time(0); idx_t len = info.format.GetLength(input, time); string_t target = StringVector::EmptyString(result, len); @@ -82817,36 +89924,44 @@ static void StrfTimeFunctionDate(DataChunk &args, ExpressionState &state, Vector }); } +template static void StrfTimeFunctionTimestamp(DataChunk &args, ExpressionState &state, Vector &result) { auto &func_expr = (BoundFunctionExpression &)state.expr; auto &info = (StrfTimeBindData &)*func_expr.bind_info; - if (ConstantVector::IsNull(args.data[1])) { + if (ConstantVector::IsNull(args.data[REVERSED ? 0 : 1])) { result.SetVectorType(VectorType::CONSTANT_VECTOR); ConstantVector::SetNull(result, true); return; } - UnaryExecutor::Execute(args.data[0], result, args.size(), [&](timestamp_t input) { - date_t date; - dtime_t time; - Timestamp::Convert(input, date, time); - idx_t len = info.format.GetLength(date, time); - string_t target = StringVector::EmptyString(result, len); - info.format.FormatString(date, time, target.GetDataWriteable()); - target.Finalize(); - return target; - }); + UnaryExecutor::Execute(args.data[REVERSED ? 1 : 0], result, args.size(), + [&](timestamp_t input) { + date_t date; + dtime_t time; + Timestamp::Convert(input, date, time); + idx_t len = info.format.GetLength(date, time); + string_t target = StringVector::EmptyString(result, len); + info.format.FormatString(date, time, target.GetDataWriteable()); + target.Finalize(); + return target; + }); } void StrfTimeFun::RegisterFunction(BuiltinFunctions &set) { ScalarFunctionSet strftime("strftime"); strftime.AddFunction(ScalarFunction({LogicalType::DATE, LogicalType::VARCHAR}, LogicalType::VARCHAR, - StrfTimeFunctionDate, false, StrfTimeBindFunction)); + StrfTimeFunctionDate, false, false, StrfTimeBindFunction)); strftime.AddFunction(ScalarFunction({LogicalType::TIMESTAMP, LogicalType::VARCHAR}, LogicalType::VARCHAR, - StrfTimeFunctionTimestamp, false, StrfTimeBindFunction)); + StrfTimeFunctionTimestamp, false, false, StrfTimeBindFunction)); + + strftime.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::DATE}, LogicalType::VARCHAR, + StrfTimeFunctionDate, false, false, StrfTimeBindFunction)); + + strftime.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::TIMESTAMP}, LogicalType::VARCHAR, + StrfTimeFunctionTimestamp, false, false, StrfTimeBindFunction)); set.AddFunction(strftime); } @@ -83409,7 +90524,7 @@ void StrpTimeFun::RegisterFunction(BuiltinFunctions &set) { ScalarFunctionSet strptime("strptime"); strptime.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::TIMESTAMP, - StrpTimeFunction, false, StrpTimeBindFunction)); + StrpTimeFunction, false, false, StrpTimeBindFunction)); set.AddFunction(strptime); } @@ -83743,6 +90858,10 @@ struct AliasFun { static void RegisterFunction(BuiltinFunctions &set); }; +struct HashFun { + static void RegisterFunction(BuiltinFunctions &set); +}; + struct LeastFun { static void RegisterFunction(BuiltinFunctions &set); }; @@ -83773,6 +90892,18 @@ struct SystemFun { static void RegisterFunction(BuiltinFunctions &set); }; +struct ExportAggregateFunctionBindData : public FunctionData { + unique_ptr aggregate; + explicit ExportAggregateFunctionBindData(unique_ptr aggregate_p); + unique_ptr Copy() override; +}; + +struct ExportAggregateFunction { + static unique_ptr Bind(unique_ptr child_aggregate); + static ScalarFunction GetCombine(); + static ScalarFunction GetFinalize(); +}; + } // namespace duckdb @@ -83932,6 +91063,21 @@ void CurrentSettingFun::RegisterFunction(BuiltinFunctions &set) { } // namespace duckdb +namespace duckdb { + +static void HashFunction(DataChunk &args, ExpressionState &state, Vector &result) { + args.Hash(result); +} + +void HashFun::RegisterFunction(BuiltinFunctions &set) { + auto hash_fun = ScalarFunction("hash", {LogicalType::ANY}, LogicalType::HASH, HashFunction); + hash_fun.varargs = LogicalType::ANY; + set.AddFunction(hash_fun); +} + +} // namespace duckdb + + namespace duckdb { @@ -84028,22 +91174,23 @@ static void LeastGreatestFunction(DataChunk &args, ExpressionState &state, Vecto template ScalarFunction GetLeastGreatestFunction(const LogicalType &type) { - return ScalarFunction({type}, type, LeastGreatestFunction, false, nullptr, nullptr, nullptr, nullptr, type); + return ScalarFunction({type}, type, LeastGreatestFunction, true, false, nullptr, nullptr, nullptr, nullptr, + type); } template static void RegisterLeastGreatest(BuiltinFunctions &set, const string &fun_name) { ScalarFunctionSet fun_set(fun_name); fun_set.AddFunction(ScalarFunction({LogicalType::BIGINT}, LogicalType::BIGINT, LeastGreatestFunction, - false, nullptr, nullptr, nullptr, nullptr, LogicalType::BIGINT)); + true, false, nullptr, nullptr, nullptr, nullptr, LogicalType::BIGINT)); fun_set.AddFunction(ScalarFunction({LogicalType::HUGEINT}, LogicalType::HUGEINT, - LeastGreatestFunction, false, nullptr, nullptr, nullptr, nullptr, - LogicalType::HUGEINT)); + LeastGreatestFunction, true, false, nullptr, nullptr, nullptr, + nullptr, LogicalType::HUGEINT)); fun_set.AddFunction(ScalarFunction({LogicalType::DOUBLE}, LogicalType::DOUBLE, LeastGreatestFunction, - false, nullptr, nullptr, nullptr, nullptr, LogicalType::DOUBLE)); + true, false, nullptr, nullptr, nullptr, nullptr, LogicalType::DOUBLE)); fun_set.AddFunction(ScalarFunction({LogicalType::VARCHAR}, LogicalType::VARCHAR, - LeastGreatestFunction, false, nullptr, nullptr, nullptr, - nullptr, LogicalType::VARCHAR)); + LeastGreatestFunction, true, false, nullptr, nullptr, + nullptr, nullptr, LogicalType::VARCHAR)); fun_set.AddFunction(GetLeastGreatestFunction(LogicalType::TIMESTAMP)); fun_set.AddFunction(GetLeastGreatestFunction(LogicalType::TIME)); @@ -84132,6 +91279,7 @@ namespace duckdb { void BuiltinFunctions::RegisterGenericFunctions() { Register(); + Register(); Register(); Register(); Register(); @@ -84231,7 +91379,7 @@ static void ExecuteSlice(Vector &result, Vector &s, Vector &b, Vector &e, const auto edata = ConstantVector::GetData(e); auto sliced = sdata[0]; - auto begin = bdata[0]; + auto begin = (bdata[0] > 0) ? bdata[0] - 1 : bdata[0]; auto end = edata[0]; auto svalid = !ConstantVector::IsNull(s); @@ -84263,6 +91411,8 @@ static void ExecuteSlice(Vector &result, Vector &s, Vector &b, Vector &e, const auto begin = ((INDEX_TYPE *)bdata.data)[bidx]; auto end = ((INDEX_TYPE *)edata.data)[eidx]; + begin = (begin > 0) ? begin - 1 : begin; + auto svalid = sdata.validity.RowIsValid(sidx); auto bvalid = bdata.validity.RowIsValid(bidx); auto evalid = edata.validity.RowIsValid(eidx); @@ -84335,7 +91485,7 @@ static unique_ptr ArraySliceBind(ClientContext &context, ScalarFun void ArraySliceFun::RegisterFunction(BuiltinFunctions &set) { // the arguments and return types are actually set in the binder function ScalarFunction fun({LogicalType::ANY, LogicalType::BIGINT, LogicalType::BIGINT}, LogicalType::ANY, - ArraySliceFunction, false, ArraySliceBind); + ArraySliceFunction, false, false, ArraySliceBind); fun.varargs = LogicalType::ANY; set.AddFunction({"array_slice", "list_slice"}, fun); } @@ -84345,6 +91495,231 @@ void ArraySliceFun::RegisterFunction(BuiltinFunctions &set) { +namespace duckdb { + +template +static inline bool ValueEqualsOrNot(const T &left, const T &right) { + return left == right; +} + +template <> +inline bool ValueEqualsOrNot(const string_t &left, const string_t &right) { + return StringComparisonOperators::EqualsOrNot(left, right); +} + +struct ContainsFunctor { + static inline bool Initialize() { + return false; + } + static inline bool UpdateResultEntries(idx_t child_idx) { + return true; + } +}; + +struct PositionFunctor { + static inline int32_t Initialize() { + return 0; + } + static inline int32_t UpdateResultEntries(idx_t child_idx) { + return child_idx + 1; + } +}; + +template +static void TemplatedContainsOrPosition(DataChunk &args, ExpressionState &state, Vector &result, + bool is_nested = false) { + D_ASSERT(args.ColumnCount() == 2); + auto count = args.size(); + Vector &list = args.data[0]; + Vector &value_vector = args.data[1]; + + // Create a result vector of type RETURN_TYPE + result.SetVectorType(VectorType::FLAT_VECTOR); + auto result_entries = FlatVector::GetData(result); + auto &result_validity = FlatVector::Validity(result); + + if (list.GetType().id() == LogicalTypeId::SQLNULL) { + result_validity.SetInvalid(0); + return; + } + + auto list_size = ListVector::GetListSize(list); + auto &child_vector = ListVector::GetEntry(list); + + VectorData child_data; + child_vector.Orrify(list_size, child_data); + + VectorData list_data; + list.Orrify(count, list_data); + auto list_entries = (list_entry_t *)list_data.data; + + VectorData value_data; + value_vector.Orrify(count, value_data); + + for (idx_t i = 0; i < count; i++) { + auto list_index = list_data.sel->get_index(i); + auto value_index = value_data.sel->get_index(i); + + if (!list_data.validity.RowIsValid(list_index) || !value_data.validity.RowIsValid(value_index)) { + result_validity.SetInvalid(i); + continue; + } + + const auto &list_entry = list_entries[list_index]; + auto source_idx = child_data.sel->get_index(list_entry.offset); + + // not required for a comparison of nested types + auto child_value = FlatVector::GetData(child_vector); + auto values = FlatVector::GetData(value_vector); + + result_entries[list_index] = OP::Initialize(); + for (idx_t child_idx = 0; child_idx < list_entry.length; child_idx++) { + auto child_value_idx = source_idx + child_idx; + + if (!child_data.validity.RowIsValid(child_value_idx)) { + continue; + } + + if (!is_nested) { + if (ValueEqualsOrNot(child_value[child_value_idx], values[value_index])) { + result_entries[list_index] = OP::UpdateResultEntries(child_idx); + break; // Found value in list, no need to look further + } + } else { + // FIXME: using Value is less efficient than modifying the vector comparison code + // to more efficiently compare nested types + if (ValueEqualsOrNot(child_vector.GetValue(child_value_idx), + value_vector.GetValue(value_index))) { + result_entries[list_index] = OP::UpdateResultEntries(child_idx); + break; // Found value in list, no need to look further + } + } + } + } +} + +template +static void ListContainsOrPosition(DataChunk &args, ExpressionState &state, Vector &result) { + switch (args.data[1].GetType().InternalType()) { + case PhysicalType::BOOL: + case PhysicalType::INT8: + TemplatedContainsOrPosition(args, state, result); + break; + case PhysicalType::INT16: + TemplatedContainsOrPosition(args, state, result); + break; + case PhysicalType::INT32: + TemplatedContainsOrPosition(args, state, result); + break; + case PhysicalType::INT64: + TemplatedContainsOrPosition(args, state, result); + break; + case PhysicalType::INT128: + TemplatedContainsOrPosition(args, state, result); + break; + case PhysicalType::UINT8: + TemplatedContainsOrPosition(args, state, result); + break; + case PhysicalType::UINT16: + TemplatedContainsOrPosition(args, state, result); + break; + case PhysicalType::UINT32: + TemplatedContainsOrPosition(args, state, result); + break; + case PhysicalType::UINT64: + TemplatedContainsOrPosition(args, state, result); + break; + case PhysicalType::FLOAT: + TemplatedContainsOrPosition(args, state, result); + break; + case PhysicalType::DOUBLE: + TemplatedContainsOrPosition(args, state, result); + break; + case PhysicalType::VARCHAR: + TemplatedContainsOrPosition(args, state, result); + break; + case PhysicalType::MAP: + case PhysicalType::STRUCT: + case PhysicalType::LIST: + TemplatedContainsOrPosition(args, state, result, true); + break; + default: + throw NotImplementedException("This function has not been implemented for this type"); + } +} + +static void ListContainsFunction(DataChunk &args, ExpressionState &state, Vector &result) { + return ListContainsOrPosition(args, state, result); +} + +static void ListPositionFunction(DataChunk &args, ExpressionState &state, Vector &result) { + return ListContainsOrPosition(args, state, result); +} + +template +static unique_ptr ListContainsOrPositionBind(ClientContext &context, ScalarFunction &bound_function, + vector> &arguments) { + D_ASSERT(bound_function.arguments.size() == 2); + + const auto &list = arguments[0]->return_type; // change to list + const auto &value = arguments[1]->return_type; + if (list.id() == LogicalTypeId::SQLNULL && value.id() == LogicalTypeId::SQLNULL) { + bound_function.arguments[0] = LogicalType::SQLNULL; + bound_function.arguments[1] = LogicalType::SQLNULL; + bound_function.return_type = LogicalType::SQLNULL; + } else if (list.id() == LogicalTypeId::SQLNULL || value.id() == LogicalTypeId::SQLNULL) { + // In case either the list or the value is NULL, return NULL + // Similar to behaviour of prestoDB + bound_function.arguments[0] = list; + bound_function.arguments[1] = value; + bound_function.return_type = LogicalTypeId::SQLNULL; + } else { + auto const &child_type = ListType::GetChildType(arguments[0]->return_type); + auto max_child_type = LogicalType::MaxLogicalType(child_type, value); + ExpressionBinder::ResolveParameterType(max_child_type); + auto list_type = LogicalType::LIST(max_child_type); + + bound_function.arguments[0] = list_type; + bound_function.arguments[1] = value == max_child_type ? value : max_child_type; + + // list_contains and list_position only differ in their return type + bound_function.return_type = RETURN_TYPE; + } + return make_unique(bound_function.return_type); +} + +static unique_ptr ListContainsBind(ClientContext &context, ScalarFunction &bound_function, + vector> &arguments) { + return ListContainsOrPositionBind(context, bound_function, arguments); +} + +static unique_ptr ListPositionBind(ClientContext &context, ScalarFunction &bound_function, + vector> &arguments) { + return ListContainsOrPositionBind(context, bound_function, arguments); +} + +ScalarFunction ListContainsFun::GetFunction() { + return ScalarFunction({LogicalType::LIST(LogicalType::ANY), LogicalType::ANY}, // argument list + LogicalType::BOOLEAN, // return type + ListContainsFunction, false, false, ListContainsBind, nullptr); +} + +ScalarFunction ListPositionFun::GetFunction() { + return ScalarFunction({LogicalType::LIST(LogicalType::ANY), LogicalType::ANY}, // argument list + LogicalType::INTEGER, // return type + ListPositionFunction, false, false, ListPositionBind, nullptr); +} + +void ListContainsFun::RegisterFunction(BuiltinFunctions &set) { + set.AddFunction({"list_contains", "array_contains", "list_has", "array_has"}, GetFunction()); +} + +void ListPositionFun::RegisterFunction(BuiltinFunctions &set) { + set.AddFunction({"list_position", "list_indexof", "array_position", "array_indexof"}, GetFunction()); +} +} // namespace duckdb + + //===----------------------------------------------------------------------===// // DuckDB // @@ -84383,6 +91758,363 @@ class ListStatistics : public BaseStatistics { } // namespace duckdb +namespace duckdb { + +void ListFlattenFunction(DataChunk &args, ExpressionState &state, Vector &result) { + D_ASSERT(args.ColumnCount() == 1); + + Vector &input = args.data[0]; + if (input.GetType().id() == LogicalTypeId::SQLNULL) { + result.Reference(input); + return; + } + + idx_t count = args.size(); + + VectorData list_data; + input.Orrify(count, list_data); + auto list_entries = (list_entry_t *)list_data.data; + + auto &child_vector = ListVector::GetEntry(input); + + result.SetVectorType(VectorType::FLAT_VECTOR); + auto result_entries = FlatVector::GetData(result); + auto &result_validity = FlatVector::Validity(result); + + if (child_vector.GetType().id() == LogicalTypeId::SQLNULL) { + auto result_entries = FlatVector::GetData(result); + for (idx_t i = 0; i < count; i++) { + auto list_index = list_data.sel->get_index(i); + if (!list_data.validity.RowIsValid(list_index)) { + result_validity.SetInvalid(i); + continue; + } + result_entries[i].offset = 0; + result_entries[i].length = 0; + } + return; + } + + auto child_size = ListVector::GetListSize(input); + VectorData child_data; + child_vector.Orrify(child_size, child_data); + auto child_entries = (list_entry_t *)child_data.data; + auto &data_vector = ListVector::GetEntry(child_vector); + + idx_t offset = 0; + for (idx_t i = 0; i < count; i++) { + auto list_index = list_data.sel->get_index(i); + if (!list_data.validity.RowIsValid(list_index)) { + result_validity.SetInvalid(i); + continue; + } + auto list_entry = list_entries[list_index]; + + idx_t source_offset = 0; + // Find first valid child list entry to get offset + for (idx_t j = 0; j < list_entry.length; j++) { + auto child_list_index = child_data.sel->get_index(list_entry.offset + j); + if (child_data.validity.RowIsValid(child_list_index)) { + source_offset = child_entries[child_list_index].offset; + break; + } + } + + idx_t length = 0; + // Find last valid child list entry to get length + for (idx_t j = list_entry.length - 1; j != (idx_t)-1; j--) { + auto child_list_index = child_data.sel->get_index(list_entry.offset + j); + if (child_data.validity.RowIsValid(child_list_index)) { + auto child_entry = child_entries[child_list_index]; + length = child_entry.offset + child_entry.length - source_offset; + break; + } + } + ListVector::Append(result, data_vector, source_offset + length, source_offset); + + result_entries[i].offset = offset; + result_entries[i].length = length; + offset += length; + } + + if (input.GetVectorType() == VectorType::CONSTANT_VECTOR) { + result.SetVectorType(VectorType::CONSTANT_VECTOR); + } +} + +static unique_ptr ListFlattenBind(ClientContext &context, ScalarFunction &bound_function, + vector> &arguments) { + D_ASSERT(bound_function.arguments.size() == 1); + + auto &input_type = arguments[0]->return_type; + bound_function.arguments[0] = input_type; + if (input_type.id() == LogicalTypeId::SQLNULL) { + bound_function.return_type = LogicalType(LogicalTypeId::SQLNULL); + return make_unique(bound_function.return_type); + } + D_ASSERT(input_type.id() == LogicalTypeId::LIST); + + auto child_type = ListType::GetChildType(input_type); + if (child_type.id() == LogicalType::SQLNULL) { + bound_function.return_type = input_type; + return make_unique(bound_function.return_type); + } + D_ASSERT(child_type.id() == LogicalTypeId::LIST); + + bound_function.return_type = child_type; + return make_unique(bound_function.return_type); +} + +static unique_ptr ListFlattenStats(ClientContext &context, BoundFunctionExpression &expr, + FunctionData *bind_data, + vector> &child_stats) { + if (!child_stats[0]) { + return nullptr; + } + auto &list_stats = (ListStatistics &)*child_stats[0]; + if (!list_stats.child_stats || list_stats.child_stats->type == LogicalTypeId::SQLNULL) { + return nullptr; + } + + auto child_copy = list_stats.child_stats->Copy(); + child_copy->validity_stats = make_unique(true); + return child_copy; +} + +void ListFlattenFun::RegisterFunction(BuiltinFunctions &set) { + ScalarFunction fun({LogicalType::LIST(LogicalType::LIST(LogicalType::ANY))}, LogicalType::LIST(LogicalType::ANY), + ListFlattenFunction, false, false, ListFlattenBind, nullptr, ListFlattenStats); + set.AddFunction({"flatten"}, fun); +} + +} // namespace duckdb + + + + + + + + +namespace duckdb { + +// FIXME: use a local state for each thread to increase performance? +// FIXME: benchmark the use of simple_update against using update (if applicable) + +struct ListAggregatesBindData : public FunctionData { + ListAggregatesBindData(const LogicalType &stype_p, unique_ptr aggr_expr_p); + ~ListAggregatesBindData() override; + + LogicalType stype; + unique_ptr aggr_expr; + + unique_ptr Copy() override; +}; + +ListAggregatesBindData::ListAggregatesBindData(const LogicalType &stype_p, unique_ptr aggr_expr_p) + : stype(stype_p), aggr_expr(move(aggr_expr_p)) { +} + +unique_ptr ListAggregatesBindData::Copy() { + return make_unique(stype, aggr_expr->Copy()); +} + +ListAggregatesBindData::~ListAggregatesBindData() { +} + +struct StateVector { + StateVector(idx_t count_p, unique_ptr aggr_expr_p) + : count(count_p), aggr_expr(move(aggr_expr_p)), state_vector(Vector(LogicalType::POINTER, count_p)) { + } + + ~StateVector() { + // destroy objects within the aggregate states + auto &aggr = (BoundAggregateExpression &)*aggr_expr; + if (aggr.function.destructor) { + aggr.function.destructor(state_vector, count); + } + } + + idx_t count; + unique_ptr aggr_expr; + Vector state_vector; +}; + +static void ListAggregateFunction(DataChunk &args, ExpressionState &state, Vector &result) { + + D_ASSERT(args.ColumnCount() == 2); + auto count = args.size(); + Vector &lists = args.data[0]; + + // set the result vector + result.SetVectorType(VectorType::FLAT_VECTOR); + auto &result_validity = FlatVector::Validity(result); + + if (lists.GetType().id() == LogicalTypeId::SQLNULL) { + result_validity.SetInvalid(0); + return; + } + + // get the aggregate function + auto &func_expr = (BoundFunctionExpression &)state.expr; + auto &info = (ListAggregatesBindData &)*func_expr.bind_info; + auto &aggr = (BoundAggregateExpression &)*info.aggr_expr; + + D_ASSERT(aggr.function.update); + + auto lists_size = ListVector::GetListSize(lists); + auto &child_vector = ListVector::GetEntry(lists); + + VectorData child_data; + child_vector.Orrify(lists_size, child_data); + + VectorData lists_data; + lists.Orrify(count, lists_data); + auto list_entries = (list_entry_t *)lists_data.data; + + // state_buffer holds the state for each list of this chunk + idx_t size = aggr.function.state_size(); + auto state_buffer = unique_ptr(new data_t[size * count]); + + // state vector for initialize and finalize + StateVector state_vector(count, info.aggr_expr->Copy()); + auto states = FlatVector::GetData(state_vector.state_vector); + + // state vector of STANDARD_VECTOR_SIZE holds the pointers to the states + Vector state_vector_update = Vector(LogicalType::POINTER); + auto states_update = FlatVector::GetData(state_vector_update); + + // selection vector pointing to the data + SelectionVector sel_vector(STANDARD_VECTOR_SIZE); + idx_t states_idx = 0; + + for (idx_t i = 0; i < count; i++) { + + // initialize the state for this list + auto state_ptr = state_buffer.get() + size * i; + states[i] = state_ptr; + aggr.function.initialize(states[i]); + + auto lists_index = lists_data.sel->get_index(i); + const auto &list_entry = list_entries[lists_index]; + + // nothing to do for this list + if (!lists_data.validity.RowIsValid(lists_index)) { + result_validity.SetInvalid(i); + continue; + } + + // skip empty list + if (list_entry.length == 0) { + continue; + } + + auto source_idx = child_data.sel->get_index(list_entry.offset); + idx_t child_idx = 0; + + while (child_idx < list_entry.length) { + + // states vector is full, update + if (states_idx == STANDARD_VECTOR_SIZE) { + + // update the aggregate state(s) + Vector slice = Vector(child_vector, sel_vector, states_idx); + aggr.function.update(&slice, aggr.bind_info.get(), 1, state_vector_update, states_idx); + + // reset values + states_idx = 0; + } + + sel_vector.set_index(states_idx, source_idx + child_idx); + states_update[states_idx] = state_ptr; + states_idx++; + child_idx++; + } + } + + // update the remaining elements of the last list(s) + if (states_idx != 0) { + Vector slice = Vector(child_vector, sel_vector, states_idx); + aggr.function.update(&slice, aggr.bind_info.get(), 1, state_vector_update, states_idx); + } + + // finalize all the aggregate states + aggr.function.finalize(state_vector.state_vector, aggr.bind_info.get(), result, count, 0); +} + +static unique_ptr ListAggregateBind(ClientContext &context, ScalarFunction &bound_function, + vector> &arguments) { + + // the list column and the name of the aggregate function + D_ASSERT(bound_function.arguments.size() == 2); + D_ASSERT(arguments.size() == 2); + + if (arguments[0]->return_type.id() == LogicalTypeId::SQLNULL) { + bound_function.arguments[0] = LogicalType::SQLNULL; + bound_function.return_type = LogicalType::SQLNULL; + return make_unique(bound_function.return_type); + } + + D_ASSERT(LogicalTypeId::LIST == arguments[0]->return_type.id()); + auto list_child_type = ListType::GetChildType(arguments[0]->return_type); + bound_function.return_type = list_child_type; + + if (!arguments[1]->IsFoldable()) { + throw InvalidInputException("Aggregate function name must be a constant"); + } + + // get the function name + Value function_value = ExpressionExecutor::EvaluateScalar(*arguments[1]); + auto function_name = StringValue::Get(function_value); + + vector types; + types.push_back(list_child_type); + + // create the child expression and its type + vector> children; + auto expr = make_unique(Value(LogicalType::SQLNULL)); + expr->return_type = list_child_type; + children.push_back(move(expr)); + + // look up the aggregate function in the catalog + QueryErrorContext error_context(nullptr, 0); + auto func = (AggregateFunctionCatalogEntry *)Catalog::GetCatalog(context).GetEntry( + context, DEFAULT_SCHEMA, function_name, false, error_context); + D_ASSERT(func->type == CatalogType::AGGREGATE_FUNCTION_ENTRY); + + // find a matching aggregate function + string error; + auto best_function_idx = Function::BindFunction(func->name, func->functions, types, error); + if (best_function_idx == DConstants::INVALID_INDEX) { + throw BinderException("No matching aggregate function"); + } + + // found a matching function, bind it as an aggregate + auto &best_function = func->functions[best_function_idx]; + auto bound_aggr_function = AggregateFunction::BindAggregateFunction(context, best_function, move(children)); + + bound_function.arguments[0] = + LogicalType::LIST(bound_aggr_function->function.arguments[0]); // for proper casting of the vectors + bound_function.return_type = bound_aggr_function->function.return_type; + return make_unique(bound_function.return_type, move(bound_aggr_function)); +} + +ScalarFunction ListAggregateFun::GetFunction() { + return ScalarFunction({LogicalType::LIST(LogicalType::ANY), LogicalType::VARCHAR}, LogicalType::ANY, + ListAggregateFunction, false, false, ListAggregateBind, nullptr, nullptr, nullptr); +} + +void ListAggregateFun::RegisterFunction(BuiltinFunctions &set) { + set.AddFunction({"list_aggregate", "array_aggregate", "list_aggr", "array_aggr"}, GetFunction()); +} + +} // namespace duckdb + + + + + + namespace duckdb { @@ -84504,8 +92236,8 @@ static unique_ptr ListConcatStats(ClientContext &context, BoundF ScalarFunction ListConcatFun::GetFunction() { // the arguments and return types are actually set in the binder function return ScalarFunction({LogicalType::LIST(LogicalType::ANY), LogicalType::LIST(LogicalType::ANY)}, - LogicalType::LIST(LogicalType::ANY), ListConcatFunction, false, ListConcatBind, nullptr, - ListConcatStats); + LogicalType::LIST(LogicalType::ANY), ListConcatFunction, false, false, ListConcatBind, + nullptr, ListConcatStats); } void ListConcatFun::RegisterFunction(BuiltinFunctions &set) { @@ -84554,6 +92286,14 @@ void ListExtractTemplate(idx_t count, VectorData &list_data, VectorData &offsets if (list_data.validity.RowIsValid(list_index) && offsets_data.validity.RowIsValid(offsets_index)) { auto list_entry = ((list_entry_t *)list_data.data)[list_index]; auto offsets_entry = ((int64_t *)offsets_data.data)[offsets_index]; + + // 1-based indexing + if (offsets_entry == 0) { + result_mask.SetInvalid(i); + continue; + } + offsets_entry = (offsets_entry > 0) ? offsets_entry - 1 : offsets_entry; + idx_t child_offset; if (offsets_entry < 0) { if ((idx_t)-offsets_entry > list_entry.length) { @@ -84586,59 +92326,48 @@ void ListExtractTemplate(idx_t count, VectorData &list_data, VectorData &offsets static void ExecuteListExtractInternal(const idx_t count, VectorData &list, VectorData &offsets, Vector &child_vector, idx_t list_size, Vector &result) { D_ASSERT(child_vector.GetType() == result.GetType()); - switch (result.GetType().id()) { - case LogicalTypeId::UTINYINT: - ListExtractTemplate(count, list, offsets, child_vector, list_size, result); - break; - case LogicalTypeId::TINYINT: + switch (result.GetType().InternalType()) { + case PhysicalType::BOOL: + case PhysicalType::INT8: ListExtractTemplate(count, list, offsets, child_vector, list_size, result); break; - case LogicalTypeId::USMALLINT: - ListExtractTemplate(count, list, offsets, child_vector, list_size, result); - break; - case LogicalTypeId::SMALLINT: + case PhysicalType::INT16: ListExtractTemplate(count, list, offsets, child_vector, list_size, result); break; - case LogicalTypeId::UINTEGER: - ListExtractTemplate(count, list, offsets, child_vector, list_size, result); - break; - case LogicalTypeId::INTEGER: + case PhysicalType::INT32: ListExtractTemplate(count, list, offsets, child_vector, list_size, result); break; - case LogicalTypeId::UBIGINT: - ListExtractTemplate(count, list, offsets, child_vector, list_size, result); - break; - case LogicalTypeId::BIGINT: + case PhysicalType::INT64: ListExtractTemplate(count, list, offsets, child_vector, list_size, result); break; - case LogicalTypeId::HUGEINT: + case PhysicalType::INT128: ListExtractTemplate(count, list, offsets, child_vector, list_size, result); break; - case LogicalTypeId::FLOAT: - ListExtractTemplate(count, list, offsets, child_vector, list_size, result); + case PhysicalType::UINT8: + ListExtractTemplate(count, list, offsets, child_vector, list_size, result); break; - case LogicalTypeId::DOUBLE: - ListExtractTemplate(count, list, offsets, child_vector, list_size, result); + case PhysicalType::UINT16: + ListExtractTemplate(count, list, offsets, child_vector, list_size, result); break; - case LogicalTypeId::DATE: - ListExtractTemplate(count, list, offsets, child_vector, list_size, result); + case PhysicalType::UINT32: + ListExtractTemplate(count, list, offsets, child_vector, list_size, result); break; - case LogicalTypeId::TIME: - case LogicalTypeId::TIME_TZ: - ListExtractTemplate(count, list, offsets, child_vector, list_size, result); + case PhysicalType::UINT64: + ListExtractTemplate(count, list, offsets, child_vector, list_size, result); break; - case LogicalTypeId::TIMESTAMP: - case LogicalTypeId::TIMESTAMP_TZ: - ListExtractTemplate(count, list, offsets, child_vector, list_size, result); + case PhysicalType::FLOAT: + ListExtractTemplate(count, list, offsets, child_vector, list_size, result); break; - case LogicalTypeId::BLOB: - case LogicalTypeId::VARCHAR: + case PhysicalType::DOUBLE: + ListExtractTemplate(count, list, offsets, child_vector, list_size, result); + break; + case PhysicalType::VARCHAR: ListExtractTemplate(count, list, offsets, child_vector, list_size, result); break; - case LogicalTypeId::SQLNULL: - result.Reference(Value()); + case PhysicalType::INTERVAL: + ListExtractTemplate(count, list, offsets, child_vector, list_size, result); break; - case LogicalTypeId::STRUCT: { + case PhysicalType::STRUCT: { auto &entries = StructVector::GetEntries(child_vector); auto &result_entries = StructVector::GetEntries(result); D_ASSERT(entries.size() == result_entries.size()); @@ -84650,7 +92379,7 @@ static void ExecuteListExtractInternal(const idx_t count, VectorData &list, Vect ListExtractTemplate(count, list, offsets, child_vector, list_size, result); break; } - case LogicalTypeId::LIST: { + case PhysicalType::LIST: { // nested list: we have to reference the child auto &child_child_list = ListVector::GetEntry(child_vector); @@ -84679,7 +92408,7 @@ static void ExecuteListExtract(Vector &result, Vector &list, Vector &offsets, co static void ExecuteStringExtract(Vector &result, Vector &input_vector, Vector &subscript_vector, const idx_t count) { BinaryExecutor::Execute( input_vector, subscript_vector, result, count, [&](string_t input_string, int32_t subscript) { - return SubstringFun::SubstringScalarFunction(result, input_string, subscript + int32_t(subscript >= 0), 1); + return SubstringFun::SubstringScalarFunction(result, input_string, subscript, 1); }); } @@ -84746,10 +92475,10 @@ static unique_ptr ListExtractStats(ClientContext &context, Bound void ListExtractFun::RegisterFunction(BuiltinFunctions &set) { // the arguments and return types are actually set in the binder function ScalarFunction lfun({LogicalType::LIST(LogicalType::ANY), LogicalType::BIGINT}, LogicalType::ANY, - ListExtractFunction, false, ListExtractBind, nullptr, ListExtractStats); + ListExtractFunction, false, false, ListExtractBind, nullptr, ListExtractStats); ScalarFunction sfun({LogicalType::VARCHAR, LogicalType::INTEGER}, LogicalType::VARCHAR, ListExtractFunction, false, - nullptr); + false, nullptr); ScalarFunctionSet list_extract("list_extract"); list_extract.AddFunction(lfun); @@ -85446,6 +93175,18 @@ struct EvenFun { static void RegisterFunction(BuiltinFunctions &set); }; +struct IsNanFun { + static void RegisterFunction(BuiltinFunctions &set); +}; + +struct IsInfiniteFun { + static void RegisterFunction(BuiltinFunctions &set); +}; + +struct IsFiniteFun { + static void RegisterFunction(BuiltinFunctions &set); +}; + } // namespace duckdb @@ -85504,6 +93245,7 @@ struct Atan2Fun { + #include #include @@ -85534,51 +93276,6 @@ static scalar_function_t GetScalarIntegerUnaryFunctionFixedReturn(const LogicalT return function; } -template -struct UnaryDoubleWrapper { - template - static RESULT_TYPE Operation(INPUT_TYPE input, ValidityMask &mask, idx_t idx, void *dataptr) { - RESULT_TYPE result = OP::template Operation(input); - if (std::isnan(result) || std::isinf(result) || errno != 0) { - errno = 0; - mask.SetInvalid(idx); - return 0; - } - return result; - } -}; - -template -static void UnaryDoubleFunctionWrapper(DataChunk &input, ExpressionState &state, Vector &result) { - D_ASSERT(input.ColumnCount() >= 1); - errno = 0; - UnaryExecutor::GenericExecute>(input.data[0], result, input.size(), nullptr, true); -} - -struct BinaryDoubleWrapper { - template - static inline TR Operation(FUNC fun, TA left, TB right, ValidityMask &mask, idx_t idx) { - TR result = OP::template Operation(left, right); - if (std::isnan(result) || std::isinf(result) || errno != 0) { - errno = 0; - mask.SetInvalid(idx); - return 0; - } - return result; - } - - static bool AddsNulls() { - return true; - } -}; - -template -static void BinaryDoubleFunctionWrapper(DataChunk &input, ExpressionState &state, Vector &result) { - D_ASSERT(input.ColumnCount() >= 2); - errno = 0; - BinaryExecutor::Execute(input.data[0], input.data[1], result, input.size()); -} - //===--------------------------------------------------------------------===// // nextafter //===--------------------------------------------------------------------===// @@ -85599,23 +93296,14 @@ struct NextAfterOperator { } }; -unique_ptr BindNextAfter(ClientContext &context, ScalarFunction &function, - vector> &arguments) { - if ((arguments[0]->return_type != arguments[1]->return_type) || - (arguments[0]->return_type != LogicalType::FLOAT && arguments[0]->return_type != LogicalType::DOUBLE)) { - throw NotImplementedException("Unimplemented type for NextAfter Function"); - } - return nullptr; -} - void NextAfterFun::RegisterFunction(BuiltinFunctions &set) { ScalarFunctionSet next_after_fun("nextafter"); next_after_fun.AddFunction( ScalarFunction("nextafter", {LogicalType::DOUBLE, LogicalType::DOUBLE}, LogicalType::DOUBLE, - BinaryDoubleFunctionWrapper, false, BindNextAfter)); + ScalarFunction::BinaryFunction, false)); next_after_fun.AddFunction(ScalarFunction("nextafter", {LogicalType::FLOAT, LogicalType::FLOAT}, LogicalType::FLOAT, - BinaryDoubleFunctionWrapper, false, - BindNextAfter)); + ScalarFunction::BinaryFunction, + false)); set.AddFunction(next_after_fun); } @@ -85649,7 +93337,7 @@ void AbsFun::RegisterFunction(BuiltinFunctions &set) { ScalarFunctionSet abs("abs"); for (auto &type : LogicalType::Numeric()) { if (type.id() == LogicalTypeId::DECIMAL) { - abs.AddFunction(ScalarFunction({type}, type, nullptr, false, DecimalUnaryOpBind)); + abs.AddFunction(ScalarFunction({type}, type, nullptr, false, false, DecimalUnaryOpBind)); } else { abs.AddFunction(ScalarFunction({type}, type, ScalarFunction::GetScalarUnaryFunction(type))); } @@ -85692,10 +93380,10 @@ void BitCountFun::RegisterFunction(BuiltinFunctions &set) { //===--------------------------------------------------------------------===// struct SignOperator { template - static inline TR Operation(TA left) { - if (left == TA(0)) { + static TR Operation(TA input) { + if (input == TA(0)) { return 0; - } else if (left > TA(0)) { + } else if (input > TA(0)) { return 1; } else { return -1; @@ -85703,6 +93391,28 @@ struct SignOperator { } }; +template <> +int8_t SignOperator::Operation(float input) { + if (input == 0 || Value::IsNan(input)) { + return 0; + } else if (input > 0) { + return 1; + } else { + return -1; + } +} + +template <> +int8_t SignOperator::Operation(double input) { + if (input == 0 || Value::IsNan(input)) { + return 0; + } else if (input > 0) { + return 1; + } else { + return -1; + } +} + void SignFun::RegisterFunction(BuiltinFunctions &set) { ScalarFunctionSet sign("sign"); for (auto &type : LogicalType::Numeric()) { @@ -85801,7 +93511,7 @@ void CeilFun::RegisterFunction(BuiltinFunctions &set) { default: throw InternalException("Unimplemented numeric type for function \"ceil\""); } - ceil.AddFunction(ScalarFunction({type}, type, func, false, bind_func)); + ceil.AddFunction(ScalarFunction({type}, type, func, false, false, bind_func)); } set.AddFunction(ceil); @@ -85857,7 +93567,7 @@ void FloorFun::RegisterFunction(BuiltinFunctions &set) { default: throw InternalException("Unimplemented numeric type for function \"floor\""); } - floor.AddFunction(ScalarFunction({type}, type, func, false, bind_func)); + floor.AddFunction(ScalarFunction({type}, type, func, false, false, bind_func)); } set.AddFunction(floor); } @@ -86064,8 +93774,9 @@ void RoundFun::RegisterFunction(BuiltinFunctions &set) { default: throw InternalException("Unimplemented numeric type for function \"floor\""); } - round.AddFunction(ScalarFunction({type}, type, round_func, false, bind_func)); - round.AddFunction(ScalarFunction({type, LogicalType::INTEGER}, type, round_prec_func, false, bind_prec_func)); + round.AddFunction(ScalarFunction({type}, type, round_func, false, false, bind_func)); + round.AddFunction( + ScalarFunction({type, LogicalType::INTEGER}, type, round_prec_func, false, false, bind_prec_func)); } set.AddFunction(round); } @@ -86082,7 +93793,7 @@ struct ExpOperator { void ExpFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(ScalarFunction("exp", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + ScalarFunction::UnaryFunction)); } //===--------------------------------------------------------------------===// @@ -86097,7 +93808,7 @@ struct PowOperator { void PowFun::RegisterFunction(BuiltinFunctions &set) { ScalarFunction power_function("pow", {LogicalType::DOUBLE, LogicalType::DOUBLE}, LogicalType::DOUBLE, - BinaryDoubleFunctionWrapper); + ScalarFunction::BinaryFunction); set.AddFunction(power_function); power_function.name = "power"; set.AddFunction(power_function); @@ -86112,14 +93823,17 @@ void PowFun::RegisterFunction(BuiltinFunctions &set) { //===--------------------------------------------------------------------===// struct SqrtOperator { template - static inline TR Operation(TA left) { - return std::sqrt(left); + static inline TR Operation(TA input) { + if (input < 0) { + throw OutOfRangeException("cannot take square root of a negative number"); + } + return std::sqrt(input); } }; void SqrtFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(ScalarFunction("sqrt", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + ScalarFunction::UnaryFunction)); } //===--------------------------------------------------------------------===// @@ -86134,7 +93848,7 @@ struct CbRtOperator { void CbrtFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(ScalarFunction("cbrt", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + ScalarFunction::UnaryFunction)); } //===--------------------------------------------------------------------===// @@ -86143,14 +93857,20 @@ void CbrtFun::RegisterFunction(BuiltinFunctions &set) { struct LnOperator { template - static inline TR Operation(TA left) { - return std::log(left); + static inline TR Operation(TA input) { + if (input < 0) { + throw OutOfRangeException("cannot take logarithm of a negative number"); + } + if (input == 0) { + throw OutOfRangeException("cannot take logarithm of zero"); + } + return std::log(input); } }; void LnFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(ScalarFunction("ln", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + ScalarFunction::UnaryFunction)); } //===--------------------------------------------------------------------===// @@ -86158,14 +93878,20 @@ void LnFun::RegisterFunction(BuiltinFunctions &set) { //===--------------------------------------------------------------------===// struct Log10Operator { template - static inline TR Operation(TA left) { - return std::log10(left); + static inline TR Operation(TA input) { + if (input < 0) { + throw OutOfRangeException("cannot take logarithm of a negative number"); + } + if (input == 0) { + throw OutOfRangeException("cannot take logarithm of zero"); + } + return std::log10(input); } }; void Log10Fun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction({"log10", "log"}, ScalarFunction({LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + ScalarFunction::UnaryFunction)); } //===--------------------------------------------------------------------===// @@ -86173,14 +93899,20 @@ void Log10Fun::RegisterFunction(BuiltinFunctions &set) { //===--------------------------------------------------------------------===// struct Log2Operator { template - static inline TR Operation(TA left) { - return std::log2(left); + static inline TR Operation(TA input) { + if (input < 0) { + throw OutOfRangeException("cannot take logarithm of a negative number"); + } + if (input == 0) { + throw OutOfRangeException("cannot take logarithm of zero"); + } + return std::log2(input); } }; void Log2Fun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(ScalarFunction("log2", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + ScalarFunction::UnaryFunction)); } //===--------------------------------------------------------------------===// @@ -86208,7 +93940,7 @@ struct DegreesOperator { void DegreesFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(ScalarFunction("degrees", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + ScalarFunction::UnaryFunction)); } //===--------------------------------------------------------------------===// @@ -86223,12 +93955,83 @@ struct RadiansOperator { void RadiansFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(ScalarFunction("radians", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + ScalarFunction::UnaryFunction)); +} + +//===--------------------------------------------------------------------===// +// isnan +//===--------------------------------------------------------------------===// +struct IsNanOperator { + template + static inline TR Operation(TA input) { + return Value::IsNan(input); + } +}; + +void IsNanFun::RegisterFunction(BuiltinFunctions &set) { + ScalarFunctionSet funcs("isnan"); + funcs.AddFunction(ScalarFunction({LogicalType::FLOAT}, LogicalType::BOOLEAN, + ScalarFunction::UnaryFunction)); + funcs.AddFunction(ScalarFunction({LogicalType::DOUBLE}, LogicalType::BOOLEAN, + ScalarFunction::UnaryFunction)); + set.AddFunction(funcs); +} + +//===--------------------------------------------------------------------===// +// isinf +//===--------------------------------------------------------------------===// +struct IsInfiniteOperator { + template + static inline TR Operation(TA input) { + return !Value::IsNan(input) && !Value::IsFinite(input); + } +}; + +void IsInfiniteFun::RegisterFunction(BuiltinFunctions &set) { + ScalarFunctionSet funcs("isinf"); + funcs.AddFunction(ScalarFunction({LogicalType::FLOAT}, LogicalType::BOOLEAN, + ScalarFunction::UnaryFunction)); + funcs.AddFunction(ScalarFunction({LogicalType::DOUBLE}, LogicalType::BOOLEAN, + ScalarFunction::UnaryFunction)); + set.AddFunction(funcs); +} + +//===--------------------------------------------------------------------===// +// isfinite +//===--------------------------------------------------------------------===// +struct IsFiniteOperator { + template + static inline TR Operation(TA input) { + return Value::IsFinite(input); + } +}; + +void IsFiniteFun::RegisterFunction(BuiltinFunctions &set) { + ScalarFunctionSet funcs("isfinite"); + funcs.AddFunction(ScalarFunction({LogicalType::FLOAT}, LogicalType::BOOLEAN, + ScalarFunction::UnaryFunction)); + funcs.AddFunction(ScalarFunction({LogicalType::DOUBLE}, LogicalType::BOOLEAN, + ScalarFunction::UnaryFunction)); + set.AddFunction(funcs); } //===--------------------------------------------------------------------===// // sin //===--------------------------------------------------------------------===// +template +struct NoInfiniteDoubleWrapper { + template + static RESULT_TYPE Operation(INPUT_TYPE input) { + if (DUCKDB_UNLIKELY(!Value::IsFinite(input))) { + if (Value::IsNan(input)) { + return input; + } + throw OutOfRangeException("input value %lf is out of range for numeric function", input); + } + return OP::template Operation(input); + } +}; + struct SinOperator { template static inline TR Operation(TA input) { @@ -86237,8 +94040,9 @@ struct SinOperator { }; void SinFun::RegisterFunction(BuiltinFunctions &set) { - set.AddFunction(ScalarFunction("sin", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + set.AddFunction( + ScalarFunction("sin", {LogicalType::DOUBLE}, LogicalType::DOUBLE, + ScalarFunction::UnaryFunction>)); } //===--------------------------------------------------------------------===// @@ -86252,8 +94056,9 @@ struct CosOperator { }; void CosFun::RegisterFunction(BuiltinFunctions &set) { - set.AddFunction(ScalarFunction("cos", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + set.AddFunction( + ScalarFunction("cos", {LogicalType::DOUBLE}, LogicalType::DOUBLE, + ScalarFunction::UnaryFunction>)); } //===--------------------------------------------------------------------===// @@ -86267,8 +94072,9 @@ struct TanOperator { }; void TanFun::RegisterFunction(BuiltinFunctions &set) { - set.AddFunction(ScalarFunction("tan", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + set.AddFunction( + ScalarFunction("tan", {LogicalType::DOUBLE}, LogicalType::DOUBLE, + ScalarFunction::UnaryFunction>)); } //===--------------------------------------------------------------------===// @@ -86285,8 +94091,9 @@ struct ASinOperator { }; void AsinFun::RegisterFunction(BuiltinFunctions &set) { - set.AddFunction(ScalarFunction("asin", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + set.AddFunction( + ScalarFunction("asin", {LogicalType::DOUBLE}, LogicalType::DOUBLE, + ScalarFunction::UnaryFunction>)); } //===--------------------------------------------------------------------===// @@ -86301,7 +94108,7 @@ struct ATanOperator { void AtanFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(ScalarFunction("atan", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + ScalarFunction::UnaryFunction)); } //===--------------------------------------------------------------------===// @@ -86316,7 +94123,7 @@ struct ATan2 { void Atan2Fun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(ScalarFunction("atan2", {LogicalType::DOUBLE, LogicalType::DOUBLE}, LogicalType::DOUBLE, - BinaryDoubleFunctionWrapper)); + ScalarFunction::BinaryFunction)); } //===--------------------------------------------------------------------===// @@ -86330,8 +94137,8 @@ struct ACos { }; void AcosFun::RegisterFunction(BuiltinFunctions &set) { - set.AddFunction( - ScalarFunction("acos", {LogicalType::DOUBLE}, LogicalType::DOUBLE, UnaryDoubleFunctionWrapper)); + set.AddFunction(ScalarFunction("acos", {LogicalType::DOUBLE}, LogicalType::DOUBLE, + ScalarFunction::UnaryFunction>)); } //===--------------------------------------------------------------------===// @@ -86345,8 +94152,9 @@ struct CotOperator { }; void CotFun::RegisterFunction(BuiltinFunctions &set) { - set.AddFunction(ScalarFunction("cot", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + set.AddFunction( + ScalarFunction("cot", {LogicalType::DOUBLE}, LogicalType::DOUBLE, + ScalarFunction::UnaryFunction>)); } //===--------------------------------------------------------------------===// @@ -86354,14 +94162,17 @@ void CotFun::RegisterFunction(BuiltinFunctions &set) { //===--------------------------------------------------------------------===// struct GammaOperator { template - static inline TR Operation(TA left) { - return std::tgamma(left); + static inline TR Operation(TA input) { + if (input == 0) { + throw OutOfRangeException("cannot take gamma of zero"); + } + return std::tgamma(input); } }; void GammaFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(ScalarFunction("gamma", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + ScalarFunction::UnaryFunction)); } //===--------------------------------------------------------------------===// @@ -86369,14 +94180,17 @@ void GammaFun::RegisterFunction(BuiltinFunctions &set) { //===--------------------------------------------------------------------===// struct LogGammaOperator { template - static inline TR Operation(TA left) { - return std::lgamma(left); + static inline TR Operation(TA input) { + if (input == 0) { + throw OutOfRangeException("cannot take log gamma of zero"); + } + return std::lgamma(input); } }; void LogGammaFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(ScalarFunction("lgamma", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + ScalarFunction::UnaryFunction)); } //===--------------------------------------------------------------------===// @@ -86426,7 +94240,7 @@ struct EvenOperator { void EvenFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(ScalarFunction("even", {LogicalType::DOUBLE}, LogicalType::DOUBLE, - UnaryDoubleFunctionWrapper)); + ScalarFunction::UnaryFunction)); } } // namespace duckdb @@ -86566,6 +94380,10 @@ void BuiltinFunctions::RegisterMathFunctions() { Register(); Register(); + + Register(); + Register(); + Register(); } } // namespace duckdb @@ -86578,9 +94396,13 @@ void BuiltinFunctions::RegisterNestedFunctions() { Register(); Register(); Register(); + Register(); + Register(); + Register(); Register(); Register(); Register(); + Register(); Register(); Register(); Register(); @@ -86608,7 +94430,7 @@ namespace duckdb { template <> float AddOperator::Operation(float left, float right) { auto result = left + right; - if (!Value::FloatIsValid(result)) { + if (!Value::FloatIsFinite(result)) { throw OutOfRangeException("Overflow in addition of float!"); } return result; @@ -86617,7 +94439,7 @@ float AddOperator::Operation(float left, float right) { template <> double AddOperator::Operation(double left, double right) { auto result = left + right; - if (!Value::DoubleIsValid(result)) { + if (!Value::DoubleIsFinite(result)) { throw OutOfRangeException("Overflow in addition of double!"); } return result; @@ -86645,6 +94467,20 @@ date_t AddOperator::Operation(int32_t left, date_t right) { return AddOperator::Operation(right, left); } +template <> +timestamp_t AddOperator::Operation(date_t left, dtime_t right) { + timestamp_t result; + if (!Timestamp::TryFromDatetime(left, right, result)) { + throw OutOfRangeException("Timestamp out of range"); + } + return result; +} + +template <> +timestamp_t AddOperator::Operation(dtime_t left, date_t right) { + return AddOperator::Operation(right, left); +} + template <> date_t AddOperator::Operation(date_t left, interval_t right) { return Interval::Add(left, right); @@ -87127,6 +94963,9 @@ ScalarFunction AddFun::GetFunction(const LogicalType &left_type, const LogicalTy } else if (right_type.id() == LogicalTypeId::INTERVAL) { return ScalarFunction("+", {left_type, right_type}, LogicalType::DATE, ScalarFunction::BinaryFunction); + } else if (right_type.id() == LogicalTypeId::TIME) { + return ScalarFunction("+", {left_type, right_type}, LogicalType::TIMESTAMP, + ScalarFunction::BinaryFunction); } break; case LogicalTypeId::INTEGER: @@ -87154,6 +94993,9 @@ ScalarFunction AddFun::GetFunction(const LogicalType &left_type, const LogicalTy if (right_type.id() == LogicalTypeId::INTERVAL) { return ScalarFunction("+", {left_type, right_type}, LogicalType::TIME, ScalarFunction::BinaryFunction); + } else if (right_type.id() == LogicalTypeId::DATE) { + return ScalarFunction("+", {left_type, right_type}, LogicalType::TIMESTAMP, + ScalarFunction::BinaryFunction); } break; case LogicalTypeId::TIMESTAMP: @@ -87193,6 +95035,11 @@ void AddFun::RegisterFunction(BuiltinFunctions &set) { functions.AddFunction(GetFunction(LogicalType::TIMESTAMP, LogicalType::INTERVAL)); functions.AddFunction(GetFunction(LogicalType::INTERVAL, LogicalType::TIMESTAMP)); + + // we can add times to dates + functions.AddFunction(GetFunction(LogicalType::TIME, LogicalType::DATE)); + functions.AddFunction(GetFunction(LogicalType::DATE, LogicalType::TIME)); + // we can add lists together functions.AddFunction(ListConcatFun::GetFunction()); @@ -87219,6 +95066,16 @@ struct NegateOperator { } }; +template <> +bool NegateOperator::CanNegate(float input) { + return Value::FloatIsFinite(input); +} + +template <> +bool NegateOperator::CanNegate(double input) { + return Value::DoubleIsFinite(input); +} + template <> interval_t NegateOperator::Operation(interval_t input) { interval_t result; @@ -87518,23 +95375,23 @@ void MultiplyFun::RegisterFunction(BuiltinFunctions &set) { ScalarFunctionSet functions("*"); for (auto &type : LogicalType::Numeric()) { if (type.id() == LogicalTypeId::DECIMAL) { - functions.AddFunction(ScalarFunction({type, type}, type, nullptr, false, BindDecimalMultiply)); + functions.AddFunction(ScalarFunction({type, type}, type, nullptr, true, false, BindDecimalMultiply)); } else if (TypeIsIntegral(type.InternalType()) && type.id() != LogicalTypeId::HUGEINT) { functions.AddFunction(ScalarFunction( - {type, type}, type, GetScalarIntegerFunction(type.InternalType()), false, - nullptr, nullptr, + {type, type}, type, GetScalarIntegerFunction(type.InternalType()), true, + false, nullptr, nullptr, PropagateNumericStats)); } else { - functions.AddFunction( - ScalarFunction({type, type}, type, GetScalarBinaryFunction(type.InternalType()))); + functions.AddFunction(ScalarFunction({type, type}, type, + GetScalarBinaryFunction(type.InternalType()), true)); } } functions.AddFunction( ScalarFunction({LogicalType::INTERVAL, LogicalType::BIGINT}, LogicalType::INTERVAL, - ScalarFunction::BinaryFunction)); + ScalarFunction::BinaryFunction, true)); functions.AddFunction( ScalarFunction({LogicalType::BIGINT, LogicalType::INTERVAL}, LogicalType::INTERVAL, - ScalarFunction::BinaryFunction)); + ScalarFunction::BinaryFunction, true)); set.AddFunction(functions); } @@ -87544,7 +95401,7 @@ void MultiplyFun::RegisterFunction(BuiltinFunctions &set) { template <> float DivideOperator::Operation(float left, float right) { auto result = left / right; - if (!Value::FloatIsValid(result)) { + if (!Value::FloatIsFinite(result)) { throw OutOfRangeException("Overflow in division of float!"); } return result; @@ -87553,7 +95410,7 @@ float DivideOperator::Operation(float left, float right) { template <> double DivideOperator::Operation(double left, double right) { auto result = left / right; - if (!Value::DoubleIsValid(result)) { + if (!Value::DoubleIsFinite(result)) { throw OutOfRangeException("Overflow in division of double!"); } return result; @@ -87665,13 +95522,21 @@ void DivideFun::RegisterFunction(BuiltinFunctions &set) { template <> float ModuloOperator::Operation(float left, float right) { D_ASSERT(right != 0); - return std::fmod(left, right); + auto result = std::fmod(left, right); + if (!Value::FloatIsFinite(result)) { + throw OutOfRangeException("Overflow in modulo of float!"); + } + return result; } template <> double ModuloOperator::Operation(double left, double right) { D_ASSERT(right != 0); - return std::fmod(left, right); + auto result = std::fmod(left, right); + if (!Value::DoubleIsFinite(result)) { + throw OutOfRangeException("Overflow in modulo of double!"); + } + return result; } template <> @@ -87701,6 +95566,7 @@ void ModFun::RegisterFunction(BuiltinFunctions &set) { + namespace duckdb { template @@ -87837,15 +95703,32 @@ void BitwiseXorFun::RegisterFunction(BuiltinFunctions &set) { //===--------------------------------------------------------------------===// // << [bitwise_left_shift] //===--------------------------------------------------------------------===// -template -bool ShiftInRange(T shift) { - return shift >= 0 && shift < T(sizeof(T) * 8); -} struct BitwiseShiftLeftOperator { template static inline TR Operation(TA input, TB shift) { - return ShiftInRange(shift) ? input << shift : 0; + TA max_shift = TA(sizeof(TA) * 8); + if (input < 0) { + throw OutOfRangeException("Cannot left-shift negative number %s", NumericHelper::ToString(input)); + } + if (shift < 0) { + throw OutOfRangeException("Cannot left-shift by negative number %s", NumericHelper::ToString(shift)); + } + if (shift >= max_shift) { + if (input == 0) { + return 0; + } + throw OutOfRangeException("Left-shift value %s is out of range", NumericHelper::ToString(shift)); + } + if (shift == 0) { + return input; + } + TA max_value = (TA(1) << (max_shift - shift - 1)); + if (input >= max_value) { + throw OutOfRangeException("Overflow in left shift (%s << %s)", NumericHelper::ToString(input), + NumericHelper::ToString(shift)); + } + return input << shift; } }; @@ -87861,10 +95744,15 @@ void LeftShiftFun::RegisterFunction(BuiltinFunctions &set) { //===--------------------------------------------------------------------===// // >> [bitwise_right_shift] //===--------------------------------------------------------------------===// +template +bool RightShiftInRange(T shift) { + return shift >= 0 && shift < T(sizeof(T) * 8); +} + struct BitwiseShiftRightOperator { template static inline TR Operation(TA input, TB shift) { - return ShiftInRange(shift) ? input >> shift : 0; + return RightShiftInRange(shift) ? input >> shift : 0; } }; @@ -87914,7 +95802,7 @@ namespace duckdb { template <> float MultiplyOperator::Operation(float left, float right) { auto result = left * right; - if (!Value::FloatIsValid(result)) { + if (!Value::FloatIsFinite(result)) { throw OutOfRangeException("Overflow in multiplication of float!"); } return result; @@ -87923,7 +95811,7 @@ float MultiplyOperator::Operation(float left, float right) { template <> double MultiplyOperator::Operation(double left, double right) { auto result = left * right; - if (!Value::DoubleIsValid(result)) { + if (!Value::DoubleIsFinite(result)) { throw OutOfRangeException("Overflow in multiplication of double!"); } return result; @@ -88147,7 +96035,7 @@ namespace duckdb { template <> float SubtractOperator::Operation(float left, float right) { auto result = left - right; - if (!Value::FloatIsValid(result)) { + if (!Value::FloatIsFinite(result)) { throw OutOfRangeException("Overflow in subtraction of float!"); } return result; @@ -88156,7 +96044,7 @@ float SubtractOperator::Operation(float left, float right) { template <> double SubtractOperator::Operation(double left, double right) { auto result = left - right; - if (!Value::DoubleIsValid(result)) { + if (!Value::DoubleIsFinite(result)) { throw OutOfRangeException("Overflow in subtraction of double!"); } return result; @@ -88452,14 +96340,11 @@ struct NextSequenceValueOperator { bool overflow = !TryAddOperator::Operation(seq->counter, seq->increment, seq->counter); if (seq->cycle) { if (overflow) { - throw SequenceException("overflow in sequence"); - } - if (result < seq->min_value) { - result = seq->max_value; - seq->counter = seq->max_value + seq->increment; - } else if (result > seq->max_value) { - result = seq->min_value; - seq->counter = seq->min_value + seq->increment; + seq->counter = seq->increment < 0 ? seq->max_value : seq->min_value; + } else if (seq->counter < seq->min_value) { + seq->counter = seq->max_value; + } else if (seq->counter > seq->max_value) { + seq->counter = seq->min_value; } } else { if (result < seq->min_value || (overflow && seq->increment < 0)) { @@ -88753,8 +96638,8 @@ static unique_ptr CaseConvertPropagateStats(ClientContext &conte } ScalarFunction LowerFun::GetFunction() { - return ScalarFunction({LogicalType::VARCHAR}, LogicalType::VARCHAR, CaseConvertFunction, false, nullptr, - nullptr, CaseConvertPropagateStats); + return ScalarFunction("lower", {LogicalType::VARCHAR}, LogicalType::VARCHAR, CaseConvertFunction, false, + nullptr, nullptr, CaseConvertPropagateStats); } void LowerFun::RegisterFunction(BuiltinFunctions &set) { @@ -88764,7 +96649,7 @@ void LowerFun::RegisterFunction(BuiltinFunctions &set) { void UpperFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction({"upper", "ucase"}, ScalarFunction({LogicalType::VARCHAR}, LogicalType::VARCHAR, CaseConvertFunction, false, - nullptr, nullptr, CaseConvertPropagateStats)); + false, nullptr, nullptr, CaseConvertPropagateStats)); } } // namespace duckdb @@ -89494,11 +97379,11 @@ static unique_ptr ListLengthBind(ClientContext &context, ScalarFun void LengthFun::RegisterFunction(BuiltinFunctions &set) { ScalarFunction array_length_unary = ScalarFunction( {LogicalType::LIST(LogicalType::ANY)}, LogicalType::BIGINT, - ScalarFunction::UnaryFunction, false, ListLengthBind); + ScalarFunction::UnaryFunction, false, false, ListLengthBind); ScalarFunctionSet length("length"); length.AddFunction(ScalarFunction({LogicalType::VARCHAR}, LogicalType::BIGINT, ScalarFunction::UnaryFunction, false, - nullptr, nullptr, LengthPropagateStats)); + false, nullptr, nullptr, LengthPropagateStats)); length.AddFunction(array_length_unary); set.AddFunction(length); length.name = "len"; @@ -89509,7 +97394,7 @@ void LengthFun::RegisterFunction(BuiltinFunctions &set) { array_length.AddFunction( ScalarFunction({LogicalType::LIST(LogicalType::ANY), LogicalType::BIGINT}, LogicalType::BIGINT, ScalarFunction::BinaryFunction, false, - ListLengthBind)); + false, ListLengthBind)); set.AddFunction(array_length); set.AddFunction(ScalarFunction("strlen", {LogicalType::VARCHAR}, LogicalType::BIGINT, @@ -89972,14 +97857,18 @@ parse_bracket : { } } +static char GetEscapeChar(string_t escape) { + // Only one escape character should be allowed + if (escape.GetSize() > 1) { + throw SyntaxException("Invalid escape string. Escape string must be empty or one character."); + } + return escape.GetSize() == 0 ? '\0' : *escape.GetDataUnsafe(); +} + struct LikeEscapeOperator { template static inline bool Operation(TA str, TB pattern, TC escape) { - // Only one escape character should be allowed - if (escape.GetSize() > 1) { - throw SyntaxException("Invalid escape string. Escape string must be empty or one character."); - } - char escape_char = escape.GetSize() == 0 ? '\0' : *escape.GetDataUnsafe(); + char escape_char = GetEscapeChar(escape); return LikeOperatorFunction(str.GetDataUnsafe(), str.GetSize(), pattern.GetDataUnsafe(), pattern.GetSize(), escape_char); } @@ -89999,24 +97888,44 @@ struct LikeOperator { } }; +bool ILikeOperatorFunction(string_t &str, string_t &pattern, char escape = '\0') { + auto str_data = str.GetDataUnsafe(); + auto str_size = str.GetSize(); + auto pat_data = pattern.GetDataUnsafe(); + auto pat_size = pattern.GetSize(); + + // lowercase both the str and the pattern + idx_t str_llength = LowerFun::LowerLength(str_data, str_size); + auto str_ldata = unique_ptr(new char[str_llength]); + LowerFun::LowerCase(str_data, str_size, str_ldata.get()); + + idx_t pat_llength = LowerFun::LowerLength(pat_data, pat_size); + auto pat_ldata = unique_ptr(new char[pat_llength]); + LowerFun::LowerCase(pat_data, pat_size, pat_ldata.get()); + string_t str_lcase(str_ldata.get(), str_llength); + string_t pat_lcase(pat_ldata.get(), pat_llength); + return LikeOperatorFunction(str_lcase, pat_lcase, escape); +} + +struct ILikeEscapeOperator { + template + static inline bool Operation(TA str, TB pattern, TC escape) { + char escape_char = GetEscapeChar(escape); + return ILikeOperatorFunction(str, pattern, escape_char); + } +}; + +struct NotILikeEscapeOperator { + template + static inline bool Operation(TA str, TB pattern, TC escape) { + return !ILikeEscapeOperator::Operation(str, pattern, escape); + } +}; + struct ILikeOperator { template static inline TR Operation(TA str, TB pattern) { - auto str_data = str.GetDataUnsafe(); - auto str_size = str.GetSize(); - auto pat_data = pattern.GetDataUnsafe(); - auto pat_size = pattern.GetSize(); - // lowercase both the str and the pattern - idx_t str_llength = LowerFun::LowerLength(str_data, str_size); - auto str_ldata = unique_ptr(new char[str_llength]); - LowerFun::LowerCase(str_data, str_size, str_ldata.get()); - - idx_t pat_llength = LowerFun::LowerLength(pat_data, pat_size); - auto pat_ldata = unique_ptr(new char[pat_llength]); - LowerFun::LowerCase(pat_data, pat_size, pat_ldata.get()); - string_t str_lcase(str_ldata.get(), str_llength); - string_t pat_lcase(pat_ldata.get(), pat_llength); - return LikeOperatorFunction(str_lcase, pat_lcase); + return ILikeOperatorFunction(str, pattern); } }; @@ -90124,6 +98033,12 @@ void LikeEscapeFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction({"not_like_escape"}, ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::BOOLEAN, LikeEscapeFunction)); + + set.AddFunction({"ilike_escape"}, ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR}, + LogicalType::BOOLEAN, LikeEscapeFunction)); + set.AddFunction({"not_ilike_escape"}, + ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR}, + LogicalType::BOOLEAN, LikeEscapeFunction)); } } // namespace duckdb @@ -90146,1696 +98061,569 @@ struct MD5Operator { } }; -static void MD5Function(DataChunk &args, ExpressionState &state, Vector &result) { - auto &input = args.data[0]; - - UnaryExecutor::ExecuteString(input, result, args.size()); -} - -void MD5Fun::RegisterFunction(BuiltinFunctions &set) { - set.AddFunction(ScalarFunction("md5", // name of the function - {LogicalType::VARCHAR}, // argument list - LogicalType::VARCHAR, // return type - MD5Function)); // pointer to function implementation -} - -} // namespace duckdb - - - -#include -#include - -namespace duckdb { - -static int64_t MismatchesScalarFunction(Vector &result, const string_t str, string_t tgt) { - idx_t str_len = str.GetSize(); - idx_t tgt_len = tgt.GetSize(); - - if (str_len != tgt_len) { - throw InvalidInputException("Mismatch Function: Strings must be of equal length!"); - } - if (str_len < 1) { - throw InvalidInputException("Mismatch Function: Strings must be of length > 0!"); - } - - idx_t mismatches = 0; - auto str_str = str.GetDataUnsafe(); - auto tgt_str = tgt.GetDataUnsafe(); - - for (idx_t idx = 0; idx < str_len; ++idx) { - if (str_str[idx] != tgt_str[idx]) { - mismatches++; - } - } - return (int64_t)mismatches; -} - -static void MismatchesFunction(DataChunk &args, ExpressionState &state, Vector &result) { - auto &str_vec = args.data[0]; - auto &tgt_vec = args.data[1]; - - BinaryExecutor::Execute( - str_vec, tgt_vec, result, args.size(), - [&](string_t str, string_t tgt) { return MismatchesScalarFunction(result, str, tgt); }); -} - -void MismatchesFun::RegisterFunction(BuiltinFunctions &set) { - ScalarFunctionSet mismatches("mismatches"); - mismatches.AddFunction(ScalarFunction("mismatches", {LogicalType::VARCHAR, LogicalType::VARCHAR}, - LogicalType::BIGINT, - MismatchesFunction)); // Pointer to function implementation - set.AddFunction(mismatches); - - ScalarFunctionSet hamming("hamming"); - hamming.AddFunction(ScalarFunction("mismatches", {LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::BIGINT, - MismatchesFunction)); // Pointer to function implementation - set.AddFunction(hamming); -} - -} // namespace duckdb - - - - -namespace duckdb { - -struct NFCNormalizeOperator { +struct MD5Number128Operator { template - static RESULT_TYPE Operation(INPUT_TYPE input, Vector &result) { - auto input_data = input.GetDataUnsafe(); - auto input_length = input.GetSize(); - if (StripAccentsFun::IsAscii(input_data, input_length)) { - return input; - } - auto normalized_str = Utf8Proc::Normalize(input_data, input_length); - D_ASSERT(normalized_str); - auto result_str = StringVector::AddString(result, normalized_str); - free(normalized_str); - return result_str; - } -}; - -static void NFCNormalizeFunction(DataChunk &args, ExpressionState &state, Vector &result) { - D_ASSERT(args.ColumnCount() == 1); - - UnaryExecutor::ExecuteString(args.data[0], result, args.size()); - StringVector::AddHeapReference(result, args.data[0]); -} - -ScalarFunction NFCNormalizeFun::GetFunction() { - return ScalarFunction("nfc_normalize", {LogicalType::VARCHAR}, LogicalType::VARCHAR, NFCNormalizeFunction); -} - -void NFCNormalizeFun::RegisterFunction(BuiltinFunctions &set) { - set.AddFunction(NFCNormalizeFun::GetFunction()); -} - -} // namespace duckdb - - - - - - - - - - -namespace duckdb { - -static pair PadCountChars(const idx_t len, const char *data, const idx_t size) { - // Count how much of str will fit in the output - auto str = reinterpret_cast(data); - idx_t nbytes = 0; - idx_t nchars = 0; - for (; nchars < len && nbytes < size; ++nchars) { - utf8proc_int32_t codepoint; - auto bytes = utf8proc_iterate(str + nbytes, size - nbytes, &codepoint); - D_ASSERT(bytes > 0); - nbytes += bytes; - } - - return pair(nbytes, nchars); -} - -static bool InsertPadding(const idx_t len, const string_t &pad, vector &result) { - // Copy the padding until the output is long enough - auto data = pad.GetDataUnsafe(); - auto size = pad.GetSize(); - - // Check whether we need data that we don't have - if (len > 0 && size == 0) { - return false; - } - - // Insert characters until we have all we need. - auto str = reinterpret_cast(data); - idx_t nbytes = 0; - for (idx_t nchars = 0; nchars < len; ++nchars) { - // If we are at the end of the pad, flush all of it and loop back - if (nbytes >= size) { - result.insert(result.end(), data, data + size); - nbytes = 0; - } - - // Write the next character - utf8proc_int32_t codepoint; - auto bytes = utf8proc_iterate(str + nbytes, size - nbytes, &codepoint); - D_ASSERT(bytes > 0); - nbytes += bytes; - } - - // Flush the remaining pad - result.insert(result.end(), data, data + nbytes); - - return true; -} - -static string_t LeftPadFunction(const string_t &str, const int32_t len, const string_t &pad, vector &result) { - // Reuse the buffer - result.clear(); - - // Get information about the base string - auto data_str = str.GetDataUnsafe(); - auto size_str = str.GetSize(); - - // Count how much of str will fit in the output - auto written = PadCountChars(len, data_str, size_str); - - // Left pad by the number of characters still needed - if (!InsertPadding(len - written.second, pad, result)) { - throw Exception("Insufficient padding in LPAD."); - } - - // Append as much of the original string as fits - result.insert(result.end(), data_str, data_str + written.first); - - return string_t(result.data(), result.size()); -} - -struct LeftPadOperator { - static inline string_t Operation(const string_t &str, const int32_t len, const string_t &pad, - vector &result) { - return LeftPadFunction(str, len, pad, result); - } -}; - -static string_t RightPadFunction(const string_t &str, const int32_t len, const string_t &pad, vector &result) { - // Reuse the buffer - result.clear(); - - // Get information about the base string - auto data_str = str.GetDataUnsafe(); - auto size_str = str.GetSize(); - - // Count how much of str will fit in the output - auto written = PadCountChars(len, data_str, size_str); - - // Append as much of the original string as fits - result.insert(result.end(), data_str, data_str + written.first); - - // Right pad by the number of characters still needed - if (!InsertPadding(len - written.second, pad, result)) { - throw Exception("Insufficient padding in RPAD."); - }; - - return string_t(result.data(), result.size()); -} - -struct RightPadOperator { - static inline string_t Operation(const string_t &str, const int32_t len, const string_t &pad, - vector &result) { - return RightPadFunction(str, len, pad, result); - } -}; - -template -static void PadFunction(DataChunk &args, ExpressionState &state, Vector &result) { - auto &str_vector = args.data[0]; - auto &len_vector = args.data[1]; - auto &pad_vector = args.data[2]; - - vector buffer; - TernaryExecutor::Execute( - str_vector, len_vector, pad_vector, result, args.size(), [&](string_t str, int32_t len, string_t pad) { - len = MaxValue(len, 0); - return StringVector::AddString(result, OP::Operation(str, len, pad, buffer)); - }); -} - -void LpadFun::RegisterFunction(BuiltinFunctions &set) { - set.AddFunction(ScalarFunction("lpad", // name of the function - {LogicalType::VARCHAR, LogicalType::INTEGER, // argument list - LogicalType::VARCHAR}, - LogicalType::VARCHAR, // return type - PadFunction)); // pointer to function implementation -} - -void RpadFun::RegisterFunction(BuiltinFunctions &set) { - set.AddFunction(ScalarFunction("rpad", // name of the function - {LogicalType::VARCHAR, LogicalType::INTEGER, // argument list - LogicalType::VARCHAR}, - LogicalType::VARCHAR, // return type - PadFunction)); // pointer to function implementation -} - -} // namespace duckdb - - - - - -namespace duckdb { - -static bool PrefixFunction(const string_t &str, const string_t &pattern); - -struct PrefixOperator { - template - static inline TR Operation(TA left, TB right) { - return PrefixFunction(left, right); - } -}; -static bool PrefixFunction(const string_t &str, const string_t &pattern) { - auto str_length = str.GetSize(); - auto patt_length = pattern.GetSize(); - if (patt_length > str_length) { - return false; - } - if (patt_length <= string_t::PREFIX_LENGTH) { - // short prefix - if (patt_length == 0) { - // length = 0, return true - return true; - } - - // prefix early out - const char *str_pref = str.GetPrefix(); - const char *patt_pref = pattern.GetPrefix(); - for (idx_t i = 0; i < patt_length; ++i) { - if (str_pref[i] != patt_pref[i]) { - return false; - } - } - return true; - } else { - // prefix early out - const char *str_pref = str.GetPrefix(); - const char *patt_pref = pattern.GetPrefix(); - for (idx_t i = 0; i < string_t::PREFIX_LENGTH; ++i) { - if (str_pref[i] != patt_pref[i]) { - // early out - return false; - } - } - // compare the rest of the prefix - const char *str_data = str.GetDataUnsafe(); - const char *patt_data = pattern.GetDataUnsafe(); - D_ASSERT(patt_length <= str_length); - for (idx_t i = string_t::PREFIX_LENGTH; i < patt_length; ++i) { - if (str_data[i] != patt_data[i]) { - return false; - } - } - return true; - } -} - -ScalarFunction PrefixFun::GetFunction() { - return ScalarFunction("prefix", // name of the function - {LogicalType::VARCHAR, LogicalType::VARCHAR}, // argument list - LogicalType::BOOLEAN, // return type - ScalarFunction::BinaryFunction); -} - -void PrefixFun::RegisterFunction(BuiltinFunctions &set) { - set.AddFunction(GetFunction()); -} - -} // namespace duckdb - - - - - - -namespace duckdb { - -struct FMTPrintf { - template - static string OP(const char *format_str, std::vector> &format_args) { - return duckdb_fmt::vsprintf( - format_str, duckdb_fmt::basic_format_args(format_args.data(), static_cast(format_args.size()))); - } -}; - -struct FMTFormat { - template - static string OP(const char *format_str, std::vector> &format_args) { - return duckdb_fmt::vformat( - format_str, duckdb_fmt::basic_format_args(format_args.data(), static_cast(format_args.size()))); - } -}; - -unique_ptr BindPrintfFunction(ClientContext &context, ScalarFunction &bound_function, - vector> &arguments) { - for (idx_t i = 1; i < arguments.size(); i++) { - switch (arguments[i]->return_type.id()) { - case LogicalTypeId::BOOLEAN: - case LogicalTypeId::TINYINT: - case LogicalTypeId::SMALLINT: - case LogicalTypeId::INTEGER: - case LogicalTypeId::BIGINT: - case LogicalTypeId::FLOAT: - case LogicalTypeId::DOUBLE: - case LogicalTypeId::VARCHAR: - // these types are natively supported - bound_function.arguments.push_back(arguments[i]->return_type); - break; - case LogicalTypeId::DECIMAL: - // decimal type: add cast to double - bound_function.arguments.emplace_back(LogicalType::DOUBLE); - break; - default: - // all other types: add cast to string - bound_function.arguments.emplace_back(LogicalType::VARCHAR); - break; - } - } - return nullptr; -} - -template -static void PrintfFunction(DataChunk &args, ExpressionState &state, Vector &result) { - auto &format_string = args.data[0]; - auto &result_validity = FlatVector::Validity(result); - result.SetVectorType(VectorType::CONSTANT_VECTOR); - result_validity.Initialize(args.size()); - for (idx_t i = 0; i < args.ColumnCount(); i++) { - switch (args.data[i].GetVectorType()) { - case VectorType::CONSTANT_VECTOR: - if (ConstantVector::IsNull(args.data[i])) { - // constant null! result is always NULL regardless of other input - result.SetVectorType(VectorType::CONSTANT_VECTOR); - ConstantVector::SetNull(result, true); - return; - } - break; - default: - // FLAT VECTOR, we can directly OR the nullmask - args.data[i].Normalify(args.size()); - result.SetVectorType(VectorType::FLAT_VECTOR); - result_validity.Combine(FlatVector::Validity(args.data[i]), args.size()); - break; - } - } - idx_t count = result.GetVectorType() == VectorType::CONSTANT_VECTOR ? 1 : args.size(); - - auto format_data = FlatVector::GetData(format_string); - auto result_data = FlatVector::GetData(result); - for (idx_t idx = 0; idx < count; idx++) { - if (result.GetVectorType() == VectorType::FLAT_VECTOR && FlatVector::IsNull(result, idx)) { - // this entry is NULL: skip it - continue; - } - - // first fetch the format string - auto fmt_idx = format_string.GetVectorType() == VectorType::CONSTANT_VECTOR ? 0 : idx; - auto format_string = format_data[fmt_idx].GetString(); - - // now gather all the format arguments - std::vector> format_args; - std::vector> string_args; - - for (idx_t col_idx = 1; col_idx < args.ColumnCount(); col_idx++) { - auto &col = args.data[col_idx]; - idx_t arg_idx = col.GetVectorType() == VectorType::CONSTANT_VECTOR ? 0 : idx; - switch (col.GetType().id()) { - case LogicalTypeId::BOOLEAN: { - auto arg_data = FlatVector::GetData(col); - format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); - break; - } - case LogicalTypeId::TINYINT: { - auto arg_data = FlatVector::GetData(col); - format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); - break; - } - case LogicalTypeId::SMALLINT: { - auto arg_data = FlatVector::GetData(col); - format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); - break; - } - case LogicalTypeId::INTEGER: { - auto arg_data = FlatVector::GetData(col); - format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); - break; - } - case LogicalTypeId::BIGINT: { - auto arg_data = FlatVector::GetData(col); - format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); - break; - } - case LogicalTypeId::FLOAT: { - auto arg_data = FlatVector::GetData(col); - format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); - break; - } - case LogicalTypeId::DOUBLE: { - auto arg_data = FlatVector::GetData(col); - format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); - break; - } - case LogicalTypeId::VARCHAR: { - auto arg_data = FlatVector::GetData(col); - auto string_view = - duckdb_fmt::basic_string_view(arg_data[arg_idx].GetDataUnsafe(), arg_data[arg_idx].GetSize()); - format_args.emplace_back(duckdb_fmt::internal::make_arg(string_view)); - break; - } - default: - throw InternalException("Unexpected type for printf format"); - } - } - // finally actually perform the format - string dynamic_result = FORMAT_FUN::template OP(format_string.c_str(), format_args); - result_data[idx] = StringVector::AddString(result, dynamic_result); - } -} - -void PrintfFun::RegisterFunction(BuiltinFunctions &set) { - // duckdb_fmt::printf_context, duckdb_fmt::vsprintf - ScalarFunction printf_fun = - ScalarFunction("printf", {LogicalType::VARCHAR}, LogicalType::VARCHAR, - PrintfFunction, false, BindPrintfFunction); - printf_fun.varargs = LogicalType::ANY; - set.AddFunction(printf_fun); - - // duckdb_fmt::format_context, duckdb_fmt::vformat - ScalarFunction format_fun = - ScalarFunction("format", {LogicalType::VARCHAR}, LogicalType::VARCHAR, - PrintfFunction, false, BindPrintfFunction); - format_fun.varargs = LogicalType::ANY; - set.AddFunction(format_fun); -} - -} // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/function/scalar/regexp.hpp -// -// -//===----------------------------------------------------------------------===// - - - - - - -// LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 -// See the end of this file for a list - -// Copyright 2003-2009 The RE2 Authors. All Rights Reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#ifndef RE2_RE2_H_ -#define RE2_RE2_H_ - -// C++ interface to the re2 regular-expression library. -// RE2 supports Perl-style regular expressions (with extensions like -// \d, \w, \s, ...). -// -// ----------------------------------------------------------------------- -// REGEXP SYNTAX: -// -// This module uses the re2 library and hence supports -// its syntax for regular expressions, which is similar to Perl's with -// some of the more complicated things thrown away. In particular, -// backreferences and generalized assertions are not available, nor is \Z. -// -// See https://github.com/google/re2/wiki/Syntax for the syntax -// supported by RE2, and a comparison with PCRE and PERL regexps. -// -// For those not familiar with Perl's regular expressions, -// here are some examples of the most commonly used extensions: -// -// "hello (\\w+) world" -- \w matches a "word" character -// "version (\\d+)" -- \d matches a digit -// "hello\\s+world" -- \s matches any whitespace character -// "\\b(\\w+)\\b" -- \b matches non-empty string at word boundary -// "(?i)hello" -- (?i) turns on case-insensitive matching -// "/\\*(.*?)\\*/" -- .*? matches . minimum no. of times possible -// -// ----------------------------------------------------------------------- -// MATCHING INTERFACE: -// -// The "FullMatch" operation checks that supplied text matches a -// supplied pattern exactly. -// -// Example: successful match -// CHECK(RE2::FullMatch("hello", "h.*o")); -// -// Example: unsuccessful match (requires full match): -// CHECK(!RE2::FullMatch("hello", "e")); -// -// ----------------------------------------------------------------------- -// UTF-8 AND THE MATCHING INTERFACE: -// -// By default, the pattern and input text are interpreted as UTF-8. -// The RE2::Latin1 option causes them to be interpreted as Latin-1. -// -// Example: -// CHECK(RE2::FullMatch(utf8_string, RE2(utf8_pattern))); -// CHECK(RE2::FullMatch(latin1_string, RE2(latin1_pattern, RE2::Latin1))); -// -// ----------------------------------------------------------------------- -// MATCHING WITH SUBSTRING EXTRACTION: -// -// You can supply extra pointer arguments to extract matched substrings. -// On match failure, none of the pointees will have been modified. -// On match success, the substrings will be converted (as necessary) and -// their values will be assigned to their pointees until all conversions -// have succeeded or one conversion has failed. -// On conversion failure, the pointees will be in an indeterminate state -// because the caller has no way of knowing which conversion failed. -// However, conversion cannot fail for types like string and StringPiece -// that do not inspect the substring contents. Hence, in the common case -// where all of the pointees are of such types, failure is always due to -// match failure and thus none of the pointees will have been modified. -// -// Example: extracts "ruby" into "s" and 1234 into "i" -// int i; -// std::string s; -// CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s, &i)); -// -// Example: fails because string cannot be stored in integer -// CHECK(!RE2::FullMatch("ruby", "(.*)", &i)); -// -// Example: fails because there aren't enough sub-patterns -// CHECK(!RE2::FullMatch("ruby:1234", "\\w+:\\d+", &s)); -// -// Example: does not try to extract any extra sub-patterns -// CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", &s)); -// -// Example: does not try to extract into NULL -// CHECK(RE2::FullMatch("ruby:1234", "(\\w+):(\\d+)", NULL, &i)); -// -// Example: integer overflow causes failure -// CHECK(!RE2::FullMatch("ruby:1234567891234", "\\w+:(\\d+)", &i)); -// -// NOTE(rsc): Asking for substrings slows successful matches quite a bit. -// This may get a little faster in the future, but right now is slower -// than PCRE. On the other hand, failed matches run *very* fast (faster -// than PCRE), as do matches without substring extraction. -// -// ----------------------------------------------------------------------- -// PARTIAL MATCHES -// -// You can use the "PartialMatch" operation when you want the pattern -// to match any substring of the text. -// -// Example: simple search for a string: -// CHECK(RE2::PartialMatch("hello", "ell")); -// -// Example: find first number in a string -// int number; -// CHECK(RE2::PartialMatch("x*100 + 20", "(\\d+)", &number)); -// CHECK_EQ(number, 100); -// -// ----------------------------------------------------------------------- -// PRE-COMPILED REGULAR EXPRESSIONS -// -// RE2 makes it easy to use any string as a regular expression, without -// requiring a separate compilation step. -// -// If speed is of the essence, you can create a pre-compiled "RE2" -// object from the pattern and use it multiple times. If you do so, -// you can typically parse text faster than with sscanf. -// -// Example: precompile pattern for faster matching: -// RE2 pattern("h.*o"); -// while (ReadLine(&str)) { -// if (RE2::FullMatch(str, pattern)) ...; -// } -// -// ----------------------------------------------------------------------- -// SCANNING TEXT INCREMENTALLY -// -// The "Consume" operation may be useful if you want to repeatedly -// match regular expressions at the front of a string and skip over -// them as they match. This requires use of the "StringPiece" type, -// which represents a sub-range of a real string. -// -// Example: read lines of the form "var = value" from a string. -// std::string contents = ...; // Fill string somehow -// StringPiece input(contents); // Wrap a StringPiece around it -// -// std::string var; -// int value; -// while (RE2::Consume(&input, "(\\w+) = (\\d+)\n", &var, &value)) { -// ...; -// } -// -// Each successful call to "Consume" will set "var/value", and also -// advance "input" so it points past the matched text. Note that if the -// regular expression matches an empty string, input will advance -// by 0 bytes. If the regular expression being used might match -// an empty string, the loop body must check for this case and either -// advance the string or break out of the loop. -// -// The "FindAndConsume" operation is similar to "Consume" but does not -// anchor your match at the beginning of the string. For example, you -// could extract all words from a string by repeatedly calling -// RE2::FindAndConsume(&input, "(\\w+)", &word) -// -// ----------------------------------------------------------------------- -// USING VARIABLE NUMBER OF ARGUMENTS -// -// The above operations require you to know the number of arguments -// when you write the code. This is not always possible or easy (for -// example, the regular expression may be calculated at run time). -// You can use the "N" version of the operations when the number of -// match arguments are determined at run time. -// -// Example: -// const RE2::Arg* args[10]; -// int n; -// // ... populate args with pointers to RE2::Arg values ... -// // ... set n to the number of RE2::Arg objects ... -// bool match = RE2::FullMatchN(input, pattern, args, n); -// -// The last statement is equivalent to -// -// bool match = RE2::FullMatch(input, pattern, -// *args[0], *args[1], ..., *args[n - 1]); -// -// ----------------------------------------------------------------------- -// PARSING HEX/OCTAL/C-RADIX NUMBERS -// -// By default, if you pass a pointer to a numeric value, the -// corresponding text is interpreted as a base-10 number. You can -// instead wrap the pointer with a call to one of the operators Hex(), -// Octal(), or CRadix() to interpret the text in another base. The -// CRadix operator interprets C-style "0" (base-8) and "0x" (base-16) -// prefixes, but defaults to base-10. -// -// Example: -// int a, b, c, d; -// CHECK(RE2::FullMatch("100 40 0100 0x40", "(.*) (.*) (.*) (.*)", -// RE2::Octal(&a), RE2::Hex(&b), RE2::CRadix(&c), RE2::CRadix(&d)); -// will leave 64 in a, b, c, and d. - -#include -#include -#include -#include -#include -#include - - - -// LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 -// See the end of this file for a list - -// Copyright 2001-2010 The RE2 Authors. All Rights Reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#ifndef RE2_STRINGPIECE_H_ -#define RE2_STRINGPIECE_H_ - -#ifdef min -#undef min -#endif - -// A string-like object that points to a sized piece of memory. -// -// Functions or methods may use const StringPiece& parameters to accept either -// a "const char*" or a "string" value that will be implicitly converted to -// a StringPiece. The implicit conversion means that it is often appropriate -// to include this .h file in other files rather than forward-declaring -// StringPiece as would be appropriate for most other Google classes. -// -// Systematic usage of StringPiece is encouraged as it will reduce unnecessary -// conversions from "const char*" to "string" and back again. -// -// -// Arghh! I wish C++ literals were "string". - -// Doing this simplifies the logic below. -#ifndef __has_include -#define __has_include(x) 0 -#endif - -#include -#include -#include -#include -#include -#include -#if __has_include() && __cplusplus >= 201703L -#include -#endif - -namespace duckdb_re2 { - -class StringPiece { - public: - typedef std::char_traits traits_type; - typedef char value_type; - typedef char* pointer; - typedef const char* const_pointer; - typedef char& reference; - typedef const char& const_reference; - typedef const char* const_iterator; - typedef const_iterator iterator; - typedef std::reverse_iterator const_reverse_iterator; - typedef const_reverse_iterator reverse_iterator; - typedef size_t size_type; - typedef ptrdiff_t difference_type; - static const size_type npos = static_cast(-1); - - // We provide non-explicit singleton constructors so users can pass - // in a "const char*" or a "string" wherever a "StringPiece" is - // expected. - StringPiece() - : data_(NULL), size_(0) {} -#if __has_include() && __cplusplus >= 201703L - StringPiece(const std::string_view& str) - : data_(str.data()), size_(str.size()) {} -#endif - StringPiece(const std::string& str) - : data_(str.data()), size_(str.size()) {} - StringPiece(const char* str) - : data_(str), size_(str == NULL ? 0 : strlen(str)) {} - StringPiece(const char* str, size_type len) - : data_(str), size_(len) {} - - const_iterator begin() const { return data_; } - const_iterator end() const { return data_ + size_; } - const_reverse_iterator rbegin() const { - return const_reverse_iterator(data_ + size_); - } - const_reverse_iterator rend() const { - return const_reverse_iterator(data_); - } - - size_type size() const { return size_; } - size_type length() const { return size_; } - bool empty() const { return size_ == 0; } - - const_reference operator[](size_type i) const { return data_[i]; } - const_pointer data() const { return data_; } - - void remove_prefix(size_type n) { - data_ += n; - size_ -= n; - } - - void remove_suffix(size_type n) { - size_ -= n; - } - - void set(const char* str) { - data_ = str; - size_ = str == NULL ? 0 : strlen(str); - } - - void set(const char* str, size_type len) { - data_ = str; - size_ = len; - } - - // Converts to `std::basic_string`. - template - explicit operator std::basic_string() const { - if (!data_) return {}; - return std::basic_string(data_, size_); - } - - std::string as_string() const { - return std::string(data_, size_); - } - - // We also define ToString() here, since many other string-like - // interfaces name the routine that converts to a C++ string - // "ToString", and it's confusing to have the method that does that - // for a StringPiece be called "as_string()". We also leave the - // "as_string()" method defined here for existing code. - std::string ToString() const { - return std::string(data_, size_); - } - - void CopyToString(std::string* target) const { - target->assign(data_, size_); - } - - void AppendToString(std::string* target) const { - target->append(data_, size_); - } - - size_type copy(char* buf, size_type n, size_type pos = 0) const; - StringPiece substr(size_type pos = 0, size_type n = npos) const; - - int compare(const StringPiece& x) const { - size_type min_size = std::min(size(), x.size()); - if (min_size > 0) { - int r = memcmp(data(), x.data(), min_size); - if (r < 0) return -1; - if (r > 0) return 1; - } - if (size() < x.size()) return -1; - if (size() > x.size()) return 1; - return 0; - } - - // Does "this" start with "x"? - bool starts_with(const StringPiece& x) const { - return x.empty() || - (size() >= x.size() && memcmp(data(), x.data(), x.size()) == 0); - } - - // Does "this" end with "x"? - bool ends_with(const StringPiece& x) const { - return x.empty() || - (size() >= x.size() && - memcmp(data() + (size() - x.size()), x.data(), x.size()) == 0); - } - - bool contains(const StringPiece& s) const { - return find(s) != npos; - } - - size_type find(const StringPiece& s, size_type pos = 0) const; - size_type find(char c, size_type pos = 0) const; - size_type rfind(const StringPiece& s, size_type pos = npos) const; - size_type rfind(char c, size_type pos = npos) const; - - private: - const_pointer data_; - size_type size_; -}; - -inline bool operator==(const StringPiece& x, const StringPiece& y) { - StringPiece::size_type len = x.size(); - if (len != y.size()) return false; - return x.data() == y.data() || len == 0 || - memcmp(x.data(), y.data(), len) == 0; -} - -inline bool operator!=(const StringPiece& x, const StringPiece& y) { - return !(x == y); -} - -inline bool operator<(const StringPiece& x, const StringPiece& y) { - StringPiece::size_type min_size = std::min(x.size(), y.size()); - int r = min_size == 0 ? 0 : memcmp(x.data(), y.data(), min_size); - return (r < 0) || (r == 0 && x.size() < y.size()); -} - -inline bool operator>(const StringPiece& x, const StringPiece& y) { - return y < x; -} - -inline bool operator<=(const StringPiece& x, const StringPiece& y) { - return !(x > y); -} - -inline bool operator>=(const StringPiece& x, const StringPiece& y) { - return !(x < y); -} - -// Allow StringPiece to be logged. -std::ostream& operator<<(std::ostream& o, const StringPiece& p); - -} // namespace duckdb_re2 - -#endif // RE2_STRINGPIECE_H_ - - -// LICENSE_CHANGE_END - - -namespace duckdb_re2 { -class Prog; -class Regexp; -} // namespace duckdb_re2 - -namespace duckdb_re2 { - -// Interface for regular expression matching. Also corresponds to a -// pre-compiled regular expression. An "RE2" object is safe for -// concurrent use by multiple threads. -class RE2 { - public: - // We convert user-passed pointers into special Arg objects - class Arg; - class Options; - - // Defined in set.h. - class Set; - - enum ErrorCode { - NoError = 0, - - // Unexpected error - ErrorInternal, - - // Parse errors - ErrorBadEscape, // bad escape sequence - ErrorBadCharClass, // bad character class - ErrorBadCharRange, // bad character class range - ErrorMissingBracket, // missing closing ] - ErrorMissingParen, // missing closing ) - ErrorTrailingBackslash, // trailing \ at end of regexp - ErrorRepeatArgument, // repeat argument missing, e.g. "*" - ErrorRepeatSize, // bad repetition argument - ErrorRepeatOp, // bad repetition operator - ErrorBadPerlOp, // bad perl operator - ErrorBadUTF8, // invalid UTF-8 in regexp - ErrorBadNamedCapture, // bad named capture group - ErrorPatternTooLarge // pattern too large (compile failed) - }; - - // Predefined common options. - // If you need more complicated things, instantiate - // an Option class, possibly passing one of these to - // the Option constructor, change the settings, and pass that - // Option class to the RE2 constructor. - enum CannedOptions { - DefaultOptions = 0, - Latin1, // treat input as Latin-1 (default UTF-8) - POSIX, // POSIX syntax, leftmost-longest match - Quiet // do not log about regexp parse errors - }; + static RESULT_TYPE Operation(INPUT_TYPE input) { + data_t digest[MD5Context::MD5_HASH_LENGTH_BINARY]; - // Need to have the const char* and const std::string& forms for implicit - // conversions when passing string literals to FullMatch and PartialMatch. - // Otherwise the StringPiece form would be sufficient. -#ifndef SWIG - RE2(const char* pattern); - RE2(const std::string& pattern); -#endif - RE2(const StringPiece& pattern); - RE2(const StringPiece& pattern, const Options& options); - ~RE2(); + MD5Context context; + context.Add(input); + context.Finish(digest); + return *reinterpret_cast(digest); + } +}; - // Returns whether RE2 was created properly. - bool ok() const { return error_code() == NoError; } +template +struct MD5Number64Operator { + template + static RESULT_TYPE Operation(INPUT_TYPE input) { + data_t digest[MD5Context::MD5_HASH_LENGTH_BINARY]; - // The string specification for this RE2. E.g. - // RE2 re("ab*c?d+"); - // re.pattern(); // "ab*c?d+" - const std::string& pattern() const { return pattern_; } + MD5Context context; + context.Add(input); + context.Finish(digest); + return *reinterpret_cast(&digest[lower ? 8 : 0]); + } +}; - // If RE2 could not be created properly, returns an error string. - // Else returns the empty string. - const std::string& error() const { return *error_; } +static void MD5Function(DataChunk &args, ExpressionState &state, Vector &result) { + auto &input = args.data[0]; - // If RE2 could not be created properly, returns an error code. - // Else returns RE2::NoError (== 0). - ErrorCode error_code() const { return error_code_; } + UnaryExecutor::ExecuteString(input, result, args.size()); +} - // If RE2 could not be created properly, returns the offending - // portion of the regexp. - const std::string& error_arg() const { return error_arg_; } +static void MD5NumberFunction(DataChunk &args, ExpressionState &state, Vector &result) { + auto &input = args.data[0]; - // Returns the program size, a very approximate measure of a regexp's "cost". - // Larger numbers are more expensive than smaller numbers. - int ProgramSize() const; - int ReverseProgramSize() const; + UnaryExecutor::Execute(input, result, args.size()); +} - // EXPERIMENTAL! SUBJECT TO CHANGE! - // Outputs the program fanout as a histogram bucketed by powers of 2. - // Returns the number of the largest non-empty bucket. - int ProgramFanout(std::map* histogram) const; - int ReverseProgramFanout(std::map* histogram) const; +static void MD5NumberUpperFunction(DataChunk &args, ExpressionState &state, Vector &result) { + auto &input = args.data[0]; - // Returns the underlying Regexp; not for general use. - // Returns entire_regexp_ so that callers don't need - // to know about prefix_ and prefix_foldcase_. - duckdb_re2::Regexp* Regexp() const { return entire_regexp_; } + UnaryExecutor::Execute>(input, result, args.size()); +} - /***** The array-based matching interface ******/ +static void MD5NumberLowerFunction(DataChunk &args, ExpressionState &state, Vector &result) { + auto &input = args.data[0]; - // The functions here have names ending in 'N' and are used to implement - // the functions whose names are the prefix before the 'N'. It is sometimes - // useful to invoke them directly, but the syntax is awkward, so the 'N'-less - // versions should be preferred. - static bool FullMatchN(const StringPiece& text, const RE2& re, - const Arg* const args[], int n); - static bool PartialMatchN(const StringPiece& text, const RE2& re, - const Arg* const args[], int n); - static bool ConsumeN(StringPiece* input, const RE2& re, - const Arg* const args[], int n); - static bool FindAndConsumeN(StringPiece* input, const RE2& re, - const Arg* const args[], int n); + UnaryExecutor::Execute>(input, result, args.size()); +} -#ifndef SWIG - private: - template - static inline bool Apply(F f, SP sp, const RE2& re) { - return f(sp, re, NULL, 0); - } +void MD5Fun::RegisterFunction(BuiltinFunctions &set) { + set.AddFunction(ScalarFunction("md5", // name of the function + {LogicalType::VARCHAR}, // argument list + LogicalType::VARCHAR, // return type + MD5Function)); // pointer to function implementation - template - static inline bool Apply(F f, SP sp, const RE2& re, const A&... a) { - const Arg* const args[] = {&a...}; - const int n = sizeof...(a); - return f(sp, re, args, n); - } + set.AddFunction(ScalarFunction("md5_number", // name of the function + {LogicalType::VARCHAR}, // argument list + LogicalType::HUGEINT, // return type + MD5NumberFunction)); // pointer to function implementation - public: - // In order to allow FullMatch() et al. to be called with a varying number - // of arguments of varying types, we use two layers of variadic templates. - // The first layer constructs the temporary Arg objects. The second layer - // (above) constructs the array of pointers to the temporary Arg objects. + set.AddFunction(ScalarFunction("md5_number_upper", // name of the function + {LogicalType::VARCHAR}, // argument list + LogicalType::UBIGINT, // return type + MD5NumberUpperFunction)); // pointer to function implementation - /***** The useful part: the matching interface *****/ + set.AddFunction(ScalarFunction("md5_number_lower", // name of the function + {LogicalType::VARCHAR}, // argument list + LogicalType::UBIGINT, // return type + MD5NumberLowerFunction)); // pointer to function implementation +} - // Matches "text" against "re". If pointer arguments are - // supplied, copies matched sub-patterns into them. - // - // You can pass in a "const char*" or a "std::string" for "text". - // You can pass in a "const char*" or a "std::string" or a "RE2" for "re". - // - // The provided pointer arguments can be pointers to any scalar numeric - // type, or one of: - // std::string (matched piece is copied to string) - // StringPiece (StringPiece is mutated to point to matched piece) - // T (where "bool T::ParseFrom(const char*, size_t)" exists) - // (void*)NULL (the corresponding matched sub-pattern is not copied) - // - // Returns true iff all of the following conditions are satisfied: - // a. "text" matches "re" exactly - // b. The number of matched sub-patterns is >= number of supplied pointers - // c. The "i"th argument has a suitable type for holding the - // string captured as the "i"th sub-pattern. If you pass in - // NULL for the "i"th argument, or pass fewer arguments than - // number of sub-patterns, "i"th captured sub-pattern is - // ignored. - // - // CAVEAT: An optional sub-pattern that does not exist in the - // matched string is assigned the empty string. Therefore, the - // following will return false (because the empty string is not a - // valid number): - // int number; - // RE2::FullMatch("abc", "[a-z]+(\\d+)?", &number); - template - static bool FullMatch(const StringPiece& text, const RE2& re, A&&... a) { - return Apply(FullMatchN, text, re, Arg(std::forward(a))...); - } +} // namespace duckdb - // Exactly like FullMatch(), except that "re" is allowed to match - // a substring of "text". - template - static bool PartialMatch(const StringPiece& text, const RE2& re, A&&... a) { - return Apply(PartialMatchN, text, re, Arg(std::forward(a))...); - } - // Like FullMatch() and PartialMatch(), except that "re" has to match - // a prefix of the text, and "input" is advanced past the matched - // text. Note: "input" is modified iff this routine returns true - // and "re" matched a non-empty substring of "text". - template - static bool Consume(StringPiece* input, const RE2& re, A&&... a) { - return Apply(ConsumeN, input, re, Arg(std::forward(a))...); - } - // Like Consume(), but does not anchor the match at the beginning of - // the text. That is, "re" need not start its match at the beginning - // of "input". For example, "FindAndConsume(s, "(\\w+)", &word)" finds - // the next word in "s" and stores it in "word". - template - static bool FindAndConsume(StringPiece* input, const RE2& re, A&&... a) { - return Apply(FindAndConsumeN, input, re, Arg(std::forward(a))...); - } -#endif +#include +#include - // Replace the first match of "re" in "str" with "rewrite". - // Within "rewrite", backslash-escaped digits (\1 to \9) can be - // used to insert text matching corresponding parenthesized group - // from the pattern. \0 in "rewrite" refers to the entire matching - // text. E.g., - // - // std::string s = "yabba dabba doo"; - // CHECK(RE2::Replace(&s, "b+", "d")); - // - // will leave "s" containing "yada dabba doo" - // - // Returns true if the pattern matches and a replacement occurs, - // false otherwise. - static bool Replace(std::string* str, - const RE2& re, - const StringPiece& rewrite); +namespace duckdb { - // Like Replace(), except replaces successive non-overlapping occurrences - // of the pattern in the string with the rewrite. E.g. - // - // std::string s = "yabba dabba doo"; - // CHECK(RE2::GlobalReplace(&s, "b+", "d")); - // - // will leave "s" containing "yada dada doo" - // Replacements are not subject to re-matching. - // - // Because GlobalReplace only replaces non-overlapping matches, - // replacing "ana" within "banana" makes only one replacement, not two. - // - // Returns the number of replacements made. - static int GlobalReplace(std::string* str, - const RE2& re, - const StringPiece& rewrite); +static int64_t MismatchesScalarFunction(Vector &result, const string_t str, string_t tgt) { + idx_t str_len = str.GetSize(); + idx_t tgt_len = tgt.GetSize(); - // Like Replace, except that if the pattern matches, "rewrite" - // is copied into "out" with substitutions. The non-matching - // portions of "text" are ignored. - // - // Returns true iff a match occurred and the extraction happened - // successfully; if no match occurs, the string is left unaffected. - // - // REQUIRES: "text" must not alias any part of "*out". - static bool Extract(const StringPiece& text, - const RE2& re, - const StringPiece& rewrite, - std::string* out); + if (str_len != tgt_len) { + throw InvalidInputException("Mismatch Function: Strings must be of equal length!"); + } + if (str_len < 1) { + throw InvalidInputException("Mismatch Function: Strings must be of length > 0!"); + } - // Escapes all potentially meaningful regexp characters in - // 'unquoted'. The returned string, used as a regular expression, - // will exactly match the original string. For example, - // 1.5-2.0? - // may become: - // 1\.5\-2\.0\? - static std::string QuoteMeta(const StringPiece& unquoted); + idx_t mismatches = 0; + auto str_str = str.GetDataUnsafe(); + auto tgt_str = tgt.GetDataUnsafe(); - // Computes range for any strings matching regexp. The min and max can in - // some cases be arbitrarily precise, so the caller gets to specify the - // maximum desired length of string returned. - // - // Assuming PossibleMatchRange(&min, &max, N) returns successfully, any - // string s that is an anchored match for this regexp satisfies - // min <= s && s <= max. - // - // Note that PossibleMatchRange() will only consider the first copy of an - // infinitely repeated element (i.e., any regexp element followed by a '*' or - // '+' operator). Regexps with "{N}" constructions are not affected, as those - // do not compile down to infinite repetitions. - // - // Returns true on success, false on error. - bool PossibleMatchRange(std::string* min, std::string* max, - int maxlen) const; + for (idx_t idx = 0; idx < str_len; ++idx) { + if (str_str[idx] != tgt_str[idx]) { + mismatches++; + } + } + return (int64_t)mismatches; +} - // Generic matching interface +static void MismatchesFunction(DataChunk &args, ExpressionState &state, Vector &result) { + auto &str_vec = args.data[0]; + auto &tgt_vec = args.data[1]; - // Type of match. - enum Anchor { - UNANCHORED, // No anchoring - ANCHOR_START, // Anchor at start only - ANCHOR_BOTH // Anchor at start and end - }; + BinaryExecutor::Execute( + str_vec, tgt_vec, result, args.size(), + [&](string_t str, string_t tgt) { return MismatchesScalarFunction(result, str, tgt); }); +} - // Return the number of capturing subpatterns, or -1 if the - // regexp wasn't valid on construction. The overall match ($0) - // does not count: if the regexp is "(a)(b)", returns 2. - int NumberOfCapturingGroups() const { return num_captures_; } +void MismatchesFun::RegisterFunction(BuiltinFunctions &set) { + ScalarFunctionSet mismatches("mismatches"); + mismatches.AddFunction(ScalarFunction("mismatches", {LogicalType::VARCHAR, LogicalType::VARCHAR}, + LogicalType::BIGINT, + MismatchesFunction)); // Pointer to function implementation + set.AddFunction(mismatches); - // Return a map from names to capturing indices. - // The map records the index of the leftmost group - // with the given name. - // Only valid until the re is deleted. - const std::map& NamedCapturingGroups() const; + ScalarFunctionSet hamming("hamming"); + hamming.AddFunction(ScalarFunction("mismatches", {LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::BIGINT, + MismatchesFunction)); // Pointer to function implementation + set.AddFunction(hamming); +} - // Return a map from capturing indices to names. - // The map has no entries for unnamed groups. - // Only valid until the re is deleted. - const std::map& CapturingGroupNames() const; +} // namespace duckdb - // General matching routine. - // Match against text starting at offset startpos - // and stopping the search at offset endpos. - // Returns true if match found, false if not. - // On a successful match, fills in submatch[] (up to nsubmatch entries) - // with information about submatches. - // I.e. matching RE2("(foo)|(bar)baz") on "barbazbla" will return true, with - // submatch[0] = "barbaz", submatch[1].data() = NULL, submatch[2] = "bar", - // submatch[3].data() = NULL, ..., up to submatch[nsubmatch-1].data() = NULL. - // Caveat: submatch[] may be clobbered even on match failure. - // - // Don't ask for more match information than you will use: - // runs much faster with nsubmatch == 1 than nsubmatch > 1, and - // runs even faster if nsubmatch == 0. - // Doesn't make sense to use nsubmatch > 1 + NumberOfCapturingGroups(), - // but will be handled correctly. - // - // Passing text == StringPiece(NULL, 0) will be handled like any other - // empty string, but note that on return, it will not be possible to tell - // whether submatch i matched the empty string or did not match: - // either way, submatch[i].data() == NULL. - bool Match(const StringPiece& text, - size_t startpos, - size_t endpos, - Anchor re_anchor, - StringPiece* submatch, - int nsubmatch) const; - // Check that the given rewrite string is suitable for use with this - // regular expression. It checks that: - // * The regular expression has enough parenthesized subexpressions - // to satisfy all of the \N tokens in rewrite - // * The rewrite string doesn't have any syntax errors. E.g., - // '\' followed by anything other than a digit or '\'. - // A true return value guarantees that Replace() and Extract() won't - // fail because of a bad rewrite string. - bool CheckRewriteString(const StringPiece& rewrite, - std::string* error) const; - // Returns the maximum submatch needed for the rewrite to be done by - // Replace(). E.g. if rewrite == "foo \\2,\\1", returns 2. - static int MaxSubmatch(const StringPiece& rewrite); - // Append the "rewrite" string, with backslash subsitutions from "vec", - // to string "out". - // Returns true on success. This method can fail because of a malformed - // rewrite string. CheckRewriteString guarantees that the rewrite will - // be sucessful. - bool Rewrite(std::string* out, - const StringPiece& rewrite, - const StringPiece* vec, - int veclen) const; +namespace duckdb { - // Constructor options - class Options { - public: - // The options are (defaults in parentheses): - // - // utf8 (true) text and pattern are UTF-8; otherwise Latin-1 - // posix_syntax (false) restrict regexps to POSIX egrep syntax - // longest_match (false) search for longest match, not first match - // log_errors (true) log syntax and execution errors to ERROR - // max_mem (see below) approx. max memory footprint of RE2 - // literal (false) interpret string as literal, not regexp - // never_nl (false) never match \n, even if it is in regexp - // dot_nl (false) dot matches everything including new line - // never_capture (false) parse all parens as non-capturing - // case_sensitive (true) match is case-sensitive (regexp can override - // with (?i) unless in posix_syntax mode) - // - // The following options are only consulted when posix_syntax == true. - // When posix_syntax == false, these features are always enabled and - // cannot be turned off; to perform multi-line matching in that case, - // begin the regexp with (?m). - // perl_classes (false) allow Perl's \d \s \w \D \S \W - // word_boundary (false) allow Perl's \b \B (word boundary and not) - // one_line (false) ^ and $ only match beginning and end of text - // - // The max_mem option controls how much memory can be used - // to hold the compiled form of the regexp (the Prog) and - // its cached DFA graphs. Code Search placed limits on the number - // of Prog instructions and DFA states: 10,000 for both. - // In RE2, those limits would translate to about 240 KB per Prog - // and perhaps 2.5 MB per DFA (DFA state sizes vary by regexp; RE2 does a - // better job of keeping them small than Code Search did). - // Each RE2 has two Progs (one forward, one reverse), and each Prog - // can have two DFAs (one first match, one longest match). - // That makes 4 DFAs: - // - // forward, first-match - used for UNANCHORED or ANCHOR_START searches - // if opt.longest_match() == false - // forward, longest-match - used for all ANCHOR_BOTH searches, - // and the other two kinds if - // opt.longest_match() == true - // reverse, first-match - never used - // reverse, longest-match - used as second phase for unanchored searches - // - // The RE2 memory budget is statically divided between the two - // Progs and then the DFAs: two thirds to the forward Prog - // and one third to the reverse Prog. The forward Prog gives half - // of what it has left over to each of its DFAs. The reverse Prog - // gives it all to its longest-match DFA. - // - // Once a DFA fills its budget, it flushes its cache and starts over. - // If this happens too often, RE2 falls back on the NFA implementation. +struct NFCNormalizeOperator { + template + static RESULT_TYPE Operation(INPUT_TYPE input, Vector &result) { + auto input_data = input.GetDataUnsafe(); + auto input_length = input.GetSize(); + if (StripAccentsFun::IsAscii(input_data, input_length)) { + return input; + } + auto normalized_str = Utf8Proc::Normalize(input_data, input_length); + D_ASSERT(normalized_str); + auto result_str = StringVector::AddString(result, normalized_str); + free(normalized_str); + return result_str; + } +}; - // For now, make the default budget something close to Code Search. - static const int kDefaultMaxMem = 8<<20; +static void NFCNormalizeFunction(DataChunk &args, ExpressionState &state, Vector &result) { + D_ASSERT(args.ColumnCount() == 1); - enum Encoding { - EncodingUTF8 = 1, - EncodingLatin1 - }; + UnaryExecutor::ExecuteString(args.data[0], result, args.size()); + StringVector::AddHeapReference(result, args.data[0]); +} - Options() : - encoding_(EncodingUTF8), - posix_syntax_(false), - longest_match_(false), - log_errors_(true), - max_mem_(kDefaultMaxMem), - literal_(false), - never_nl_(false), - dot_nl_(false), - never_capture_(false), - case_sensitive_(true), - perl_classes_(false), - word_boundary_(false), - one_line_(false) { - } +ScalarFunction NFCNormalizeFun::GetFunction() { + return ScalarFunction("nfc_normalize", {LogicalType::VARCHAR}, LogicalType::VARCHAR, NFCNormalizeFunction); +} - /*implicit*/ Options(CannedOptions); +void NFCNormalizeFun::RegisterFunction(BuiltinFunctions &set) { + set.AddFunction(NFCNormalizeFun::GetFunction()); +} - Encoding encoding() const { return encoding_; } - void set_encoding(Encoding encoding) { encoding_ = encoding; } +} // namespace duckdb - // Legacy interface to encoding. - // TODO(rsc): Remove once clients have been converted. - bool utf8() const { return encoding_ == EncodingUTF8; } - void set_utf8(bool b) { - if (b) { - encoding_ = EncodingUTF8; - } else { - encoding_ = EncodingLatin1; - } - } - bool posix_syntax() const { return posix_syntax_; } - void set_posix_syntax(bool b) { posix_syntax_ = b; } - bool longest_match() const { return longest_match_; } - void set_longest_match(bool b) { longest_match_ = b; } - bool log_errors() const { return log_errors_; } - void set_log_errors(bool b) { log_errors_ = b; } - int64_t max_mem() const { return max_mem_; } - void set_max_mem(int64_t m) { max_mem_ = m; } - bool literal() const { return literal_; } - void set_literal(bool b) { literal_ = b; } - bool never_nl() const { return never_nl_; } - void set_never_nl(bool b) { never_nl_ = b; } - bool dot_nl() const { return dot_nl_; } - void set_dot_nl(bool b) { dot_nl_ = b; } - bool never_capture() const { return never_capture_; } - void set_never_capture(bool b) { never_capture_ = b; } - bool case_sensitive() const { return case_sensitive_; } - void set_case_sensitive(bool b) { case_sensitive_ = b; } +namespace duckdb { - bool perl_classes() const { return perl_classes_; } - void set_perl_classes(bool b) { perl_classes_ = b; } +static pair PadCountChars(const idx_t len, const char *data, const idx_t size) { + // Count how much of str will fit in the output + auto str = reinterpret_cast(data); + idx_t nbytes = 0; + idx_t nchars = 0; + for (; nchars < len && nbytes < size; ++nchars) { + utf8proc_int32_t codepoint; + auto bytes = utf8proc_iterate(str + nbytes, size - nbytes, &codepoint); + D_ASSERT(bytes > 0); + nbytes += bytes; + } - bool word_boundary() const { return word_boundary_; } - void set_word_boundary(bool b) { word_boundary_ = b; } + return pair(nbytes, nchars); +} - bool one_line() const { return one_line_; } - void set_one_line(bool b) { one_line_ = b; } +static bool InsertPadding(const idx_t len, const string_t &pad, vector &result) { + // Copy the padding until the output is long enough + auto data = pad.GetDataUnsafe(); + auto size = pad.GetSize(); - void Copy(const Options& src) { - *this = src; - } + // Check whether we need data that we don't have + if (len > 0 && size == 0) { + return false; + } - int ParseFlags() const; + // Insert characters until we have all we need. + auto str = reinterpret_cast(data); + idx_t nbytes = 0; + for (idx_t nchars = 0; nchars < len; ++nchars) { + // If we are at the end of the pad, flush all of it and loop back + if (nbytes >= size) { + result.insert(result.end(), data, data + size); + nbytes = 0; + } - private: - Encoding encoding_; - bool posix_syntax_; - bool longest_match_; - bool log_errors_; - int64_t max_mem_; - bool literal_; - bool never_nl_; - bool dot_nl_; - bool never_capture_; - bool case_sensitive_; - bool perl_classes_; - bool word_boundary_; - bool one_line_; - }; + // Write the next character + utf8proc_int32_t codepoint; + auto bytes = utf8proc_iterate(str + nbytes, size - nbytes, &codepoint); + D_ASSERT(bytes > 0); + nbytes += bytes; + } - // Returns the options set in the constructor. - const Options& options() const { return options_; } + // Flush the remaining pad + result.insert(result.end(), data, data + nbytes); - // Argument converters; see below. - static inline Arg CRadix(short* x); - static inline Arg CRadix(unsigned short* x); - static inline Arg CRadix(int* x); - static inline Arg CRadix(unsigned int* x); - static inline Arg CRadix(long* x); - static inline Arg CRadix(unsigned long* x); - static inline Arg CRadix(long long* x); - static inline Arg CRadix(unsigned long long* x); + return true; +} - static inline Arg Hex(short* x); - static inline Arg Hex(unsigned short* x); - static inline Arg Hex(int* x); - static inline Arg Hex(unsigned int* x); - static inline Arg Hex(long* x); - static inline Arg Hex(unsigned long* x); - static inline Arg Hex(long long* x); - static inline Arg Hex(unsigned long long* x); +static string_t LeftPadFunction(const string_t &str, const int32_t len, const string_t &pad, vector &result) { + // Reuse the buffer + result.clear(); - static inline Arg Octal(short* x); - static inline Arg Octal(unsigned short* x); - static inline Arg Octal(int* x); - static inline Arg Octal(unsigned int* x); - static inline Arg Octal(long* x); - static inline Arg Octal(unsigned long* x); - static inline Arg Octal(long long* x); - static inline Arg Octal(unsigned long long* x); + // Get information about the base string + auto data_str = str.GetDataUnsafe(); + auto size_str = str.GetSize(); - private: - void Init(const StringPiece& pattern, const Options& options); + // Count how much of str will fit in the output + auto written = PadCountChars(len, data_str, size_str); - bool DoMatch(const StringPiece& text, - Anchor re_anchor, - size_t* consumed, - const Arg* const args[], - int n) const; + // Left pad by the number of characters still needed + if (!InsertPadding(len - written.second, pad, result)) { + throw Exception("Insufficient padding in LPAD."); + } - duckdb_re2::Prog* ReverseProg() const; + // Append as much of the original string as fits + result.insert(result.end(), data_str, data_str + written.first); - std::string pattern_; // string regular expression - Options options_; // option flags - std::string prefix_; // required prefix (before regexp_) - bool prefix_foldcase_; // prefix is ASCII case-insensitive - duckdb_re2::Regexp* entire_regexp_; // parsed regular expression - duckdb_re2::Regexp* suffix_regexp_; // parsed regular expression, prefix removed - duckdb_re2::Prog* prog_; // compiled program for regexp - int num_captures_; // Number of capturing groups - bool is_one_pass_; // can use prog_->SearchOnePass? + return string_t(result.data(), result.size()); +} - mutable duckdb_re2::Prog* rprog_; // reverse program for regexp - mutable const std::string* error_; // Error indicator - // (or points to empty string) - mutable ErrorCode error_code_; // Error code - mutable std::string error_arg_; // Fragment of regexp showing error +struct LeftPadOperator { + static inline string_t Operation(const string_t &str, const int32_t len, const string_t &pad, + vector &result) { + return LeftPadFunction(str, len, pad, result); + } +}; - // Map from capture names to indices - mutable const std::map* named_groups_; +static string_t RightPadFunction(const string_t &str, const int32_t len, const string_t &pad, vector &result) { + // Reuse the buffer + result.clear(); - // Map from capture indices to names - mutable const std::map* group_names_; + // Get information about the base string + auto data_str = str.GetDataUnsafe(); + auto size_str = str.GetSize(); - // Onces for lazy computations. - mutable std::once_flag rprog_once_; - mutable std::once_flag named_groups_once_; - mutable std::once_flag group_names_once_; + // Count how much of str will fit in the output + auto written = PadCountChars(len, data_str, size_str); - RE2(const RE2&) = delete; - RE2& operator=(const RE2&) = delete; -}; + // Append as much of the original string as fits + result.insert(result.end(), data_str, data_str + written.first); -/***** Implementation details *****/ + // Right pad by the number of characters still needed + if (!InsertPadding(len - written.second, pad, result)) { + throw Exception("Insufficient padding in RPAD."); + }; -// Hex/Octal/Binary? + return string_t(result.data(), result.size()); +} -// Special class for parsing into objects that define a ParseFrom() method -template -class _RE2_MatchObject { - public: - static inline bool Parse(const char* str, size_t n, void* dest) { - if (dest == NULL) return true; - T* object = reinterpret_cast(dest); - return object->ParseFrom(str, n); - } +struct RightPadOperator { + static inline string_t Operation(const string_t &str, const int32_t len, const string_t &pad, + vector &result) { + return RightPadFunction(str, len, pad, result); + } }; -class RE2::Arg { - public: - // Empty constructor so we can declare arrays of RE2::Arg - Arg(); +template +static void PadFunction(DataChunk &args, ExpressionState &state, Vector &result) { + auto &str_vector = args.data[0]; + auto &len_vector = args.data[1]; + auto &pad_vector = args.data[2]; - // Constructor specially designed for NULL arguments - Arg(void*); - Arg(std::nullptr_t); + vector buffer; + TernaryExecutor::Execute( + str_vector, len_vector, pad_vector, result, args.size(), [&](string_t str, int32_t len, string_t pad) { + len = MaxValue(len, 0); + return StringVector::AddString(result, OP::Operation(str, len, pad, buffer)); + }); +} - typedef bool (*Parser)(const char* str, size_t n, void* dest); +void LpadFun::RegisterFunction(BuiltinFunctions &set) { + set.AddFunction(ScalarFunction("lpad", // name of the function + {LogicalType::VARCHAR, LogicalType::INTEGER, // argument list + LogicalType::VARCHAR}, + LogicalType::VARCHAR, // return type + PadFunction)); // pointer to function implementation +} -// Type-specific parsers -#define MAKE_PARSER(type, name) \ - Arg(type* p) : arg_(p), parser_(name) {} \ - Arg(type* p, Parser parser) : arg_(p), parser_(parser) {} +void RpadFun::RegisterFunction(BuiltinFunctions &set) { + set.AddFunction(ScalarFunction("rpad", // name of the function + {LogicalType::VARCHAR, LogicalType::INTEGER, // argument list + LogicalType::VARCHAR}, + LogicalType::VARCHAR, // return type + PadFunction)); // pointer to function implementation +} - MAKE_PARSER(char, parse_char) - MAKE_PARSER(signed char, parse_schar) - MAKE_PARSER(unsigned char, parse_uchar) - MAKE_PARSER(float, parse_float) - MAKE_PARSER(double, parse_double) - MAKE_PARSER(std::string, parse_string) - MAKE_PARSER(StringPiece, parse_stringpiece) +} // namespace duckdb - MAKE_PARSER(short, parse_short) - MAKE_PARSER(unsigned short, parse_ushort) - MAKE_PARSER(int, parse_int) - MAKE_PARSER(unsigned int, parse_uint) - MAKE_PARSER(long, parse_long) - MAKE_PARSER(unsigned long, parse_ulong) - MAKE_PARSER(long long, parse_longlong) - MAKE_PARSER(unsigned long long, parse_ulonglong) -#undef MAKE_PARSER - // Generic constructor templates - template Arg(T* p) - : arg_(p), parser_(_RE2_MatchObject::Parse) { } - template Arg(T* p, Parser parser) - : arg_(p), parser_(parser) { } - // Parse the data - bool Parse(const char* str, size_t n) const; - private: - void* arg_; - Parser parser_; +namespace duckdb { - static bool parse_null (const char* str, size_t n, void* dest); - static bool parse_char (const char* str, size_t n, void* dest); - static bool parse_schar (const char* str, size_t n, void* dest); - static bool parse_uchar (const char* str, size_t n, void* dest); - static bool parse_float (const char* str, size_t n, void* dest); - static bool parse_double (const char* str, size_t n, void* dest); - static bool parse_string (const char* str, size_t n, void* dest); - static bool parse_stringpiece (const char* str, size_t n, void* dest); +static bool PrefixFunction(const string_t &str, const string_t &pattern); -#define DECLARE_INTEGER_PARSER(name) \ - private: \ - static bool parse_##name(const char* str, size_t n, void* dest); \ - static bool parse_##name##_radix(const char* str, size_t n, void* dest, \ - int radix); \ - \ - public: \ - static bool parse_##name##_hex(const char* str, size_t n, void* dest); \ - static bool parse_##name##_octal(const char* str, size_t n, void* dest); \ - static bool parse_##name##_cradix(const char* str, size_t n, void* dest); +struct PrefixOperator { + template + static inline TR Operation(TA left, TB right) { + return PrefixFunction(left, right); + } +}; +static bool PrefixFunction(const string_t &str, const string_t &pattern) { + auto str_length = str.GetSize(); + auto patt_length = pattern.GetSize(); + if (patt_length > str_length) { + return false; + } + if (patt_length <= string_t::PREFIX_LENGTH) { + // short prefix + if (patt_length == 0) { + // length = 0, return true + return true; + } - DECLARE_INTEGER_PARSER(short) - DECLARE_INTEGER_PARSER(ushort) - DECLARE_INTEGER_PARSER(int) - DECLARE_INTEGER_PARSER(uint) - DECLARE_INTEGER_PARSER(long) - DECLARE_INTEGER_PARSER(ulong) - DECLARE_INTEGER_PARSER(longlong) - DECLARE_INTEGER_PARSER(ulonglong) + // prefix early out + const char *str_pref = str.GetPrefix(); + const char *patt_pref = pattern.GetPrefix(); + for (idx_t i = 0; i < patt_length; ++i) { + if (str_pref[i] != patt_pref[i]) { + return false; + } + } + return true; + } else { + // prefix early out + const char *str_pref = str.GetPrefix(); + const char *patt_pref = pattern.GetPrefix(); + for (idx_t i = 0; i < string_t::PREFIX_LENGTH; ++i) { + if (str_pref[i] != patt_pref[i]) { + // early out + return false; + } + } + // compare the rest of the prefix + const char *str_data = str.GetDataUnsafe(); + const char *patt_data = pattern.GetDataUnsafe(); + D_ASSERT(patt_length <= str_length); + for (idx_t i = string_t::PREFIX_LENGTH; i < patt_length; ++i) { + if (str_data[i] != patt_data[i]) { + return false; + } + } + return true; + } +} -#undef DECLARE_INTEGER_PARSER +ScalarFunction PrefixFun::GetFunction() { + return ScalarFunction("prefix", // name of the function + {LogicalType::VARCHAR, LogicalType::VARCHAR}, // argument list + LogicalType::BOOLEAN, // return type + ScalarFunction::BinaryFunction); +} -}; +void PrefixFun::RegisterFunction(BuiltinFunctions &set) { + set.AddFunction(GetFunction()); +} -inline RE2::Arg::Arg() : arg_(NULL), parser_(parse_null) { } -inline RE2::Arg::Arg(void* p) : arg_(p), parser_(parse_null) { } -inline RE2::Arg::Arg(std::nullptr_t p) : arg_(p), parser_(parse_null) { } +} // namespace duckdb -inline bool RE2::Arg::Parse(const char* str, size_t n) const { - return (*parser_)(str, n, arg_); -} -// This part of the parser, appropriate only for ints, deals with bases -#define MAKE_INTEGER_PARSER(type, name) \ - inline RE2::Arg RE2::Hex(type* ptr) { \ - return RE2::Arg(ptr, RE2::Arg::parse_##name##_hex); \ - } \ - inline RE2::Arg RE2::Octal(type* ptr) { \ - return RE2::Arg(ptr, RE2::Arg::parse_##name##_octal); \ - } \ - inline RE2::Arg RE2::CRadix(type* ptr) { \ - return RE2::Arg(ptr, RE2::Arg::parse_##name##_cradix); \ - } -MAKE_INTEGER_PARSER(short, short) -MAKE_INTEGER_PARSER(unsigned short, ushort) -MAKE_INTEGER_PARSER(int, int) -MAKE_INTEGER_PARSER(unsigned int, uint) -MAKE_INTEGER_PARSER(long, long) -MAKE_INTEGER_PARSER(unsigned long, ulong) -MAKE_INTEGER_PARSER(long long, longlong) -MAKE_INTEGER_PARSER(unsigned long long, ulonglong) -#undef MAKE_INTEGER_PARSER -#ifndef SWIG +namespace duckdb { -// Helper for writing global or static RE2s safely. -// Write -// static LazyRE2 re = {".*"}; -// and then use *re instead of writing -// static RE2 re(".*"); -// The former is more careful about multithreaded -// situations than the latter. -// -// N.B. This class never deletes the RE2 object that -// it constructs: that's a feature, so that it can be used -// for global and function static variables. -class LazyRE2 { - private: - struct NoArg {}; +struct FMTPrintf { + template + static string OP(const char *format_str, std::vector> &format_args) { + return duckdb_fmt::vsprintf( + format_str, duckdb_fmt::basic_format_args(format_args.data(), static_cast(format_args.size()))); + } +}; - public: - typedef RE2 element_type; // support std::pointer_traits +struct FMTFormat { + template + static string OP(const char *format_str, std::vector> &format_args) { + return duckdb_fmt::vformat( + format_str, duckdb_fmt::basic_format_args(format_args.data(), static_cast(format_args.size()))); + } +}; - // Constructor omitted to preserve braced initialization in C++98. +unique_ptr BindPrintfFunction(ClientContext &context, ScalarFunction &bound_function, + vector> &arguments) { + for (idx_t i = 1; i < arguments.size(); i++) { + switch (arguments[i]->return_type.id()) { + case LogicalTypeId::BOOLEAN: + case LogicalTypeId::TINYINT: + case LogicalTypeId::SMALLINT: + case LogicalTypeId::INTEGER: + case LogicalTypeId::BIGINT: + case LogicalTypeId::FLOAT: + case LogicalTypeId::DOUBLE: + case LogicalTypeId::VARCHAR: + // these types are natively supported + bound_function.arguments.push_back(arguments[i]->return_type); + break; + case LogicalTypeId::DECIMAL: + // decimal type: add cast to double + bound_function.arguments.emplace_back(LogicalType::DOUBLE); + break; + default: + // all other types: add cast to string + bound_function.arguments.emplace_back(LogicalType::VARCHAR); + break; + } + } + return nullptr; +} - // Pretend to be a pointer to Type (never NULL due to on-demand creation): - RE2& operator*() const { return *get(); } - RE2* operator->() const { return get(); } +template +static void PrintfFunction(DataChunk &args, ExpressionState &state, Vector &result) { + auto &format_string = args.data[0]; + auto &result_validity = FlatVector::Validity(result); + result.SetVectorType(VectorType::CONSTANT_VECTOR); + result_validity.Initialize(args.size()); + for (idx_t i = 0; i < args.ColumnCount(); i++) { + switch (args.data[i].GetVectorType()) { + case VectorType::CONSTANT_VECTOR: + if (ConstantVector::IsNull(args.data[i])) { + // constant null! result is always NULL regardless of other input + result.SetVectorType(VectorType::CONSTANT_VECTOR); + ConstantVector::SetNull(result, true); + return; + } + break; + default: + // FLAT VECTOR, we can directly OR the nullmask + args.data[i].Normalify(args.size()); + result.SetVectorType(VectorType::FLAT_VECTOR); + result_validity.Combine(FlatVector::Validity(args.data[i]), args.size()); + break; + } + } + idx_t count = result.GetVectorType() == VectorType::CONSTANT_VECTOR ? 1 : args.size(); - // Named accessor/initializer: - RE2* get() const { - std::call_once(once_, &LazyRE2::Init, this); - return ptr_; - } + auto format_data = FlatVector::GetData(format_string); + auto result_data = FlatVector::GetData(result); + for (idx_t idx = 0; idx < count; idx++) { + if (result.GetVectorType() == VectorType::FLAT_VECTOR && FlatVector::IsNull(result, idx)) { + // this entry is NULL: skip it + continue; + } - // All data fields must be public to support {"foo"} initialization. - const char* pattern_; - RE2::CannedOptions options_; - NoArg barrier_against_excess_initializers_; + // first fetch the format string + auto fmt_idx = format_string.GetVectorType() == VectorType::CONSTANT_VECTOR ? 0 : idx; + auto format_string = format_data[fmt_idx].GetString(); - mutable RE2* ptr_; - mutable std::once_flag once_; + // now gather all the format arguments + std::vector> format_args; + std::vector> string_args; - private: - static void Init(const LazyRE2* lazy_re2) { - lazy_re2->ptr_ = new RE2(lazy_re2->pattern_, lazy_re2->options_); - } + for (idx_t col_idx = 1; col_idx < args.ColumnCount(); col_idx++) { + auto &col = args.data[col_idx]; + idx_t arg_idx = col.GetVectorType() == VectorType::CONSTANT_VECTOR ? 0 : idx; + switch (col.GetType().id()) { + case LogicalTypeId::BOOLEAN: { + auto arg_data = FlatVector::GetData(col); + format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); + break; + } + case LogicalTypeId::TINYINT: { + auto arg_data = FlatVector::GetData(col); + format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); + break; + } + case LogicalTypeId::SMALLINT: { + auto arg_data = FlatVector::GetData(col); + format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); + break; + } + case LogicalTypeId::INTEGER: { + auto arg_data = FlatVector::GetData(col); + format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); + break; + } + case LogicalTypeId::BIGINT: { + auto arg_data = FlatVector::GetData(col); + format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); + break; + } + case LogicalTypeId::FLOAT: { + auto arg_data = FlatVector::GetData(col); + format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); + break; + } + case LogicalTypeId::DOUBLE: { + auto arg_data = FlatVector::GetData(col); + format_args.emplace_back(duckdb_fmt::internal::make_arg(arg_data[arg_idx])); + break; + } + case LogicalTypeId::VARCHAR: { + auto arg_data = FlatVector::GetData(col); + auto string_view = + duckdb_fmt::basic_string_view(arg_data[arg_idx].GetDataUnsafe(), arg_data[arg_idx].GetSize()); + format_args.emplace_back(duckdb_fmt::internal::make_arg(string_view)); + break; + } + default: + throw InternalException("Unexpected type for printf format"); + } + } + // finally actually perform the format + string dynamic_result = FORMAT_FUN::template OP(format_string.c_str(), format_args); + result_data[idx] = StringVector::AddString(result, dynamic_result); + } +} - void operator=(const LazyRE2&); // disallowed -}; -#endif // SWIG +void PrintfFun::RegisterFunction(BuiltinFunctions &set) { + // duckdb_fmt::printf_context, duckdb_fmt::vsprintf + ScalarFunction printf_fun = + ScalarFunction("printf", {LogicalType::VARCHAR}, LogicalType::VARCHAR, + PrintfFunction, false, BindPrintfFunction); + printf_fun.varargs = LogicalType::ANY; + set.AddFunction(printf_fun); -} // namespace duckdb_re2 + // duckdb_fmt::format_context, duckdb_fmt::vformat + ScalarFunction format_fun = + ScalarFunction("format", {LogicalType::VARCHAR}, LogicalType::VARCHAR, + PrintfFunction, false, BindPrintfFunction); + format_fun.varargs = LogicalType::ANY; + set.AddFunction(format_fun); +} + +} // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/function/scalar/regexp.hpp +// +// +//===----------------------------------------------------------------------===// -using duckdb_re2::RE2; -using duckdb_re2::LazyRE2; -#endif // RE2_RE2_H_ -// LICENSE_CHANGE_END namespace duckdb { @@ -91925,6 +98713,10 @@ static void ParseRegexOptions(const string &options, duckdb_re2::RE2::Options &r // case-insensitive matching result.set_case_sensitive(false); break; + case 'l': + // literal matching + result.set_literal(true); + break; case 'm': case 'n': case 'p': @@ -92166,34 +98958,36 @@ static unique_ptr RegexExtractBind(ClientContext &context, ScalarF void RegexpFun::RegisterFunction(BuiltinFunctions &set) { ScalarFunctionSet regexp_full_match("regexp_full_match"); regexp_full_match.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::BOOLEAN, - RegexpMatchesFunction, false, RegexpMatchesBind, + RegexpMatchesFunction, false, false, RegexpMatchesBind, nullptr, nullptr, RegexInitLocalState)); regexp_full_match.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::BOOLEAN, RegexpMatchesFunction, false, - RegexpMatchesBind, nullptr, nullptr, RegexInitLocalState)); + false, RegexpMatchesBind, nullptr, nullptr, RegexInitLocalState)); ScalarFunctionSet regexp_partial_match("regexp_matches"); regexp_partial_match.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::BOOLEAN, - RegexpMatchesFunction, false, RegexpMatchesBind, - nullptr, nullptr, RegexInitLocalState)); + RegexpMatchesFunction, false, false, + RegexpMatchesBind, nullptr, nullptr, RegexInitLocalState)); regexp_partial_match.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::BOOLEAN, RegexpMatchesFunction, - false, RegexpMatchesBind, nullptr, nullptr, RegexInitLocalState)); + false, false, RegexpMatchesBind, nullptr, nullptr, + RegexInitLocalState)); ScalarFunctionSet regexp_replace("regexp_replace"); regexp_replace.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR}, - LogicalType::VARCHAR, RegexReplaceFunction, false, RegexReplaceBind)); + LogicalType::VARCHAR, RegexReplaceFunction, false, false, + RegexReplaceBind)); regexp_replace.AddFunction( ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR}, - LogicalType::VARCHAR, RegexReplaceFunction, false, RegexReplaceBind)); + LogicalType::VARCHAR, RegexReplaceFunction, false, false, RegexReplaceBind)); ScalarFunctionSet regexp_extract("regexp_extract"); regexp_extract.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR}, LogicalType::VARCHAR, - RegexExtractFunction, false, RegexExtractBind, nullptr, nullptr, + RegexExtractFunction, false, false, RegexExtractBind, nullptr, nullptr, RegexExtractInitLocalState)); regexp_extract.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::INTEGER}, - LogicalType::VARCHAR, RegexExtractFunction, false, RegexExtractBind, - nullptr, nullptr, RegexExtractInitLocalState)); + LogicalType::VARCHAR, RegexExtractFunction, false, false, + RegexExtractBind, nullptr, nullptr, RegexExtractInitLocalState)); set.AddFunction(regexp_full_match); set.AddFunction(regexp_partial_match); @@ -92886,10 +99680,10 @@ static unique_ptr SubstringPropagateStats(ClientContext &context void SubstringFun::RegisterFunction(BuiltinFunctions &set) { ScalarFunctionSet substr("substring"); substr.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::BIGINT, LogicalType::BIGINT}, - LogicalType::VARCHAR, SubstringFunction, false, nullptr, nullptr, + LogicalType::VARCHAR, SubstringFunction, false, false, nullptr, nullptr, SubstringPropagateStats)); substr.AddFunction(ScalarFunction({LogicalType::VARCHAR, LogicalType::BIGINT}, LogicalType::VARCHAR, - SubstringFunction, false, nullptr, nullptr, SubstringPropagateStats)); + SubstringFunction, false, false, nullptr, nullptr, SubstringPropagateStats)); set.AddFunction(substr); substr.name = "substr"; set.AddFunction(substr); @@ -93419,6 +100213,307 @@ void StructPackFun::RegisterFunction(BuiltinFunctions &set) { +namespace duckdb { + +// aggregate state export + +struct ExportAggregateBindData : public FunctionData { + AggregateFunction &aggr; + idx_t state_size; + + explicit ExportAggregateBindData(AggregateFunction &aggr_p, idx_t state_size_p) + : aggr(aggr_p), state_size(state_size_p) { + } + + unique_ptr Copy() override { + + return make_unique(aggr, state_size); + } + + static ExportAggregateBindData &GetFrom(ExpressionState &state) { + auto &func_expr = (BoundFunctionExpression &)state.expr; + return (ExportAggregateBindData &)*func_expr.bind_info; + } +}; + +struct CombineState : public FunctionData { + idx_t state_size; + + unique_ptr state_buffer0, state_buffer1; + Vector state_vector0, state_vector1; + + explicit CombineState(idx_t state_size_p) + : state_size(state_size_p), state_buffer0(unique_ptr(new data_t[state_size_p])), + state_buffer1(unique_ptr(new data_t[state_size_p])), + state_vector0(Value::POINTER((uintptr_t)state_buffer0.get())), + state_vector1(Value::POINTER((uintptr_t)state_buffer1.get())) { + } + + unique_ptr Copy() override { + return make_unique(state_size); + } +}; + +static unique_ptr InitCombineState(const BoundFunctionExpression &expr, FunctionData *bind_data_p) { + auto &bind_data = *(ExportAggregateBindData *)bind_data_p; + return make_unique(bind_data.state_size); +} + +struct FinalizeState : public FunctionData { + idx_t state_size; + unique_ptr state_buffer; + Vector addresses; + + explicit FinalizeState(idx_t state_size_p) + : state_size(state_size_p), + state_buffer(unique_ptr(new data_t[STANDARD_VECTOR_SIZE * AlignValue(state_size_p)])), + addresses(LogicalType::POINTER) { + } + + unique_ptr Copy() override { + return make_unique(state_size); + } +}; + +static unique_ptr InitFinalizeState(const BoundFunctionExpression &expr, FunctionData *bind_data_p) { + auto &bind_data = *(ExportAggregateBindData *)bind_data_p; + return make_unique(bind_data.state_size); +} + +static void AggregateStateFinalize(DataChunk &input, ExpressionState &state_p, Vector &result) { + auto &bind_data = ExportAggregateBindData::GetFrom(state_p); + auto &local_state = (FinalizeState &)*((ExecuteFunctionState &)state_p).local_state; + + D_ASSERT(bind_data.state_size == bind_data.aggr.state_size()); + D_ASSERT(input.data.size() == 1); + D_ASSERT(input.data[0].GetType().id() == LogicalTypeId::AGGREGATE_STATE); + auto aligned_state_size = AlignValue(bind_data.state_size); + + auto state_vec_ptr = FlatVector::GetData(local_state.addresses); + + VectorData state_data; + input.data[0].Orrify(input.size(), state_data); + for (idx_t i = 0; i < input.size(); i++) { + auto state_idx = state_data.sel->get_index(i); + auto state_entry = &((string_t *)state_data.data)[state_idx]; + auto target_ptr = (const char *)local_state.state_buffer.get() + aligned_state_size * i; + + if (state_data.validity.RowIsValid(state_idx)) { + D_ASSERT(state_entry->GetSize() == bind_data.state_size); + memcpy((void *)target_ptr, state_entry->GetDataUnsafe(), bind_data.state_size); + } else { + // create a dummy state because finalize does not understand NULLs in its input + // we put the NULL back in explicitly below + bind_data.aggr.initialize((data_ptr_t)target_ptr); + } + state_vec_ptr[i] = (data_ptr_t)target_ptr; + } + + bind_data.aggr.finalize(local_state.addresses, nullptr, result, input.size(), 0); + + for (idx_t i = 0; i < input.size(); i++) { + auto state_idx = state_data.sel->get_index(i); + if (!state_data.validity.RowIsValid(state_idx)) { + FlatVector::SetNull(result, i, true); + } + } +} + +static void AggregateStateCombine(DataChunk &input, ExpressionState &state_p, Vector &result) { + auto &bind_data = ExportAggregateBindData::GetFrom(state_p); + auto &local_state = (CombineState &)*((ExecuteFunctionState &)state_p).local_state; + + D_ASSERT(bind_data.state_size == bind_data.aggr.state_size()); + + D_ASSERT(input.data.size() == 2); + D_ASSERT(input.data[0].GetType().id() == LogicalTypeId::AGGREGATE_STATE); + D_ASSERT(input.data[0].GetType() == result.GetType()); + + if (input.data[0].GetType().InternalType() != input.data[1].GetType().InternalType()) { + throw IOException("Aggregate state combine type mismatch, expect %s, got %s", + input.data[0].GetType().ToString(), input.data[1].GetType().ToString()); + } + + VectorData state0_data, state1_data; + input.data[0].Orrify(input.size(), state0_data); + input.data[1].Orrify(input.size(), state1_data); + + auto result_ptr = FlatVector::GetData(result); + + for (idx_t i = 0; i < input.size(); i++) { + auto state0_idx = state0_data.sel->get_index(i); + auto state1_idx = state1_data.sel->get_index(i); + + auto &state0 = ((string_t *)state0_data.data)[state0_idx]; + auto &state1 = ((string_t *)state1_data.data)[state1_idx]; + + // if both are NULL, we return NULL. If either of them is not, the result is that one + if (!state0_data.validity.RowIsValid(state0_idx) && !state1_data.validity.RowIsValid(state1_idx)) { + FlatVector::SetNull(result, i, true); + continue; + } + if (state0_data.validity.RowIsValid(state0_idx) && !state1_data.validity.RowIsValid(state1_idx)) { + result_ptr[i] = + StringVector::AddStringOrBlob(result, (const char *)state0.GetDataUnsafe(), bind_data.state_size); + continue; + } + if (!state0_data.validity.RowIsValid(state0_idx) && state1_data.validity.RowIsValid(state1_idx)) { + result_ptr[i] = + StringVector::AddStringOrBlob(result, (const char *)state1.GetDataUnsafe(), bind_data.state_size); + continue; + } + + // we actually have to combine + if (state0.GetSize() != bind_data.state_size || state1.GetSize() != bind_data.state_size) { + throw IOException("Aggregate state size mismatch, expect %llu, got %llu and %llu", bind_data.state_size, + state0.GetSize(), state1.GetSize()); + } + + memcpy(local_state.state_buffer0.get(), state0.GetDataUnsafe(), bind_data.state_size); + memcpy(local_state.state_buffer1.get(), state1.GetDataUnsafe(), bind_data.state_size); + + bind_data.aggr.combine(local_state.state_vector0, local_state.state_vector1, 1); + + result_ptr[i] = + StringVector::AddStringOrBlob(result, (const char *)local_state.state_buffer1.get(), bind_data.state_size); + } +} + +static unique_ptr BindAggregateState(ClientContext &context, ScalarFunction &bound_function, + vector> &arguments) { + + // grab the aggregate type and bind the aggregate again + + // the aggregate name and types are in the logical type of the aggregate state, make sure its sane + auto &arg_return_type = arguments[0]->return_type; + for (auto &arg_type : bound_function.arguments) { + arg_type = arg_return_type; + } + + if (arg_return_type.id() != LogicalTypeId::AGGREGATE_STATE) { + throw BinderException("Can only FINALIZE aggregate state, not %s", arg_return_type.ToString()); + } + // combine + if (arguments.size() == 2 && arguments[0]->return_type != arguments[1]->return_type && + arguments[1]->return_type.id() != LogicalTypeId::BLOB) { + throw BinderException("Cannot COMBINE aggregate states from different functions, %s <> %s", + arguments[0]->return_type.ToString(), arguments[1]->return_type.ToString()); + } + + // following error states are only reachable when someone messes up creating the state_type which is impossible from + // SQL + + auto state_type = AggregateStateType::GetStateType(arg_return_type); + + // now we can look up the function in the catalog again and bind it + auto func = Catalog::GetCatalog(context).GetEntry(context, CatalogType::SCALAR_FUNCTION_ENTRY, DEFAULT_SCHEMA, + state_type.function_name); + if (func->type != CatalogType::AGGREGATE_FUNCTION_ENTRY) { + throw InternalException("Could not find aggregate %s", state_type.function_name); + } + auto aggr = (AggregateFunctionCatalogEntry *)func; + + string error; + idx_t best_function = Function::BindFunction(aggr->name, aggr->functions, state_type.bound_argument_types, error); + if (best_function == DConstants::INVALID_INDEX) { + throw InternalException("Could not re-bind exported aggregate %s: %s", state_type.function_name, error); + } + auto &bound_aggr = aggr->functions[best_function]; + if (bound_aggr.return_type != state_type.return_type || bound_aggr.arguments != state_type.bound_argument_types) { + throw InternalException("Type mismatch for exported aggregate %s", state_type.function_name); + } + + if (bound_function.name == "finalize") { + bound_function.return_type = bound_aggr.return_type; + } else { + D_ASSERT(bound_function.name == "combine"); + bound_function.return_type = arg_return_type; + } + + return make_unique(bound_aggr, bound_aggr.state_size()); +} + +static void ExportAggregateFinalize(Vector &state, FunctionData *bind_data_p, Vector &result, idx_t count, + idx_t offset) { + D_ASSERT(offset == 0); + auto bind_data = (ExportAggregateFunctionBindData *)bind_data_p; + auto state_size = bind_data->aggregate->function.state_size(); + auto blob_ptr = FlatVector::GetData(result); + auto addresses_ptr = FlatVector::GetData(state); + for (idx_t row_idx = 0; row_idx < count; row_idx++) { + auto data_ptr = addresses_ptr[row_idx]; + blob_ptr[row_idx] = StringVector::AddStringOrBlob(result, (const char *)data_ptr, state_size); + } +} + +ExportAggregateFunctionBindData::ExportAggregateFunctionBindData(unique_ptr aggregate_p) { + D_ASSERT(aggregate_p->type == ExpressionType::BOUND_AGGREGATE); + aggregate = unique_ptr((BoundAggregateExpression *)aggregate_p.release()); +} + +unique_ptr ExportAggregateFunctionBindData::Copy() { + return make_unique(aggregate->Copy()); +} + +unique_ptr +ExportAggregateFunction::Bind(unique_ptr child_aggregate) { + auto &bound_function = child_aggregate->function; + if (!bound_function.combine) { + throw BinderException("Cannot use EXPORT_STATE for non-combinable function %s", bound_function.name); + } + if (bound_function.bind) { + throw BinderException("Cannot use EXPORT_STATE on aggregate functions with custom binders"); + } + if (bound_function.destructor) { + throw BinderException("Cannot use EXPORT_STATE on aggregate functions with custom destructors"); + } + // this should be required + D_ASSERT(bound_function.state_size); + D_ASSERT(bound_function.finalize); + D_ASSERT(!bound_function.window); + + D_ASSERT(child_aggregate->function.return_type.id() != LogicalTypeId::INVALID); +#ifdef DEBUG + for (auto &arg_type : child_aggregate->function.arguments) { + D_ASSERT(arg_type.id() != LogicalTypeId::INVALID); + } +#endif + auto export_bind_data = make_unique(child_aggregate->Copy()); + aggregate_state_t state_type(child_aggregate->function.name, child_aggregate->function.return_type, + child_aggregate->function.arguments); + auto return_type = LogicalType::AGGREGATE_STATE(move(state_type)); + + auto export_function = + AggregateFunction("aggregate_state_export_" + bound_function.name, bound_function.arguments, return_type, + bound_function.state_size, bound_function.initialize, bound_function.update, + bound_function.combine, ExportAggregateFinalize, bound_function.simple_update, + /* can't bind this again */ nullptr, /* no dynamic state yet */ nullptr, + /* can't propagate statistics */ nullptr, nullptr); + + return make_unique(export_function, move(child_aggregate->children), + move(child_aggregate->filter), move(export_bind_data), + child_aggregate->distinct); +} + +ScalarFunction ExportAggregateFunction::GetFinalize() { + return ScalarFunction("finalize", {LogicalTypeId::AGGREGATE_STATE}, LogicalTypeId::INVALID, AggregateStateFinalize, + false, BindAggregateState, nullptr, nullptr, InitFinalizeState); +} + +ScalarFunction ExportAggregateFunction::GetCombine() { + return ScalarFunction("combine", {LogicalTypeId::AGGREGATE_STATE, LogicalTypeId::ANY}, + LogicalTypeId::AGGREGATE_STATE, AggregateStateCombine, false, BindAggregateState, nullptr, + nullptr, InitCombineState); +} + +} // namespace duckdb + + + + + + + namespace duckdb { @@ -93468,10 +100563,7 @@ static void CurrentSchemasFunction(DataChunk &input, ExpressionState &state, Vec // txid_current static void TransactionIdCurrent(DataChunk &input, ExpressionState &state, Vector &result) { - auto &func_expr = (BoundFunctionExpression &)state.expr; - auto &info = (SystemBindData &)*func_expr.bind_info; - - auto &transaction = Transaction::GetTransaction(info.context); + auto &transaction = Transaction::GetTransaction(SystemBindData::GetFrom(state).context); auto val = Value::BIGINT(transaction.start_time); result.Reference(val); } @@ -93494,6 +100586,8 @@ void SystemFun::RegisterFunction(BuiltinFunctions &set) { set.AddFunction( ScalarFunction("txid_current", {}, LogicalType::BIGINT, TransactionIdCurrent, false, BindSystemFunction)); set.AddFunction(ScalarFunction("version", {}, LogicalType::VARCHAR, VersionFunction)); + set.AddFunction(ExportAggregateFunction::GetCombine()); + set.AddFunction(ExportAggregateFunction::GetFinalize()); } } // namespace duckdb @@ -93582,7 +100676,7 @@ static void GenerateUUIDFunction(DataChunk &args, ExpressionState &state, Vector } void UUIDFun::RegisterFunction(BuiltinFunctions &set) { - ScalarFunction uuid_function({}, LogicalType::UUID, GenerateUUIDFunction, true, UUIDRandomBind); + ScalarFunction uuid_function({}, LogicalType::UUID, GenerateUUIDFunction, false, true, UUIDRandomBind); // generate a random uuid set.AddFunction({"uuid", "gen_random_uuid"}, uuid_function); } @@ -93595,18 +100689,19 @@ namespace duckdb { ScalarFunction::ScalarFunction(string name, vector arguments, LogicalType return_type, scalar_function_t function, bool has_side_effects, bind_scalar_function_t bind, dependency_function_t dependency, function_statistics_t statistics, - init_local_state_t init_local_state, LogicalType varargs) - : BaseScalarFunction(move(name), move(arguments), move(return_type), has_side_effects, move(varargs)), + init_local_state_t init_local_state, LogicalType varargs, bool propagate_null_values) + : BaseScalarFunction(move(name), move(arguments), move(return_type), has_side_effects, move(varargs), + propagate_null_values), function(move(function)), bind(bind), init_local_state(init_local_state), dependency(dependency), statistics(statistics) { } ScalarFunction::ScalarFunction(vector arguments, LogicalType return_type, scalar_function_t function, - bool has_side_effects, bind_scalar_function_t bind, dependency_function_t dependency, - function_statistics_t statistics, init_local_state_t init_local_state, - LogicalType varargs) + bool propagate_null_values, bool has_side_effects, bind_scalar_function_t bind, + dependency_function_t dependency, function_statistics_t statistics, + init_local_state_t init_local_state, LogicalType varargs) : ScalarFunction(string(), move(arguments), move(return_type), move(function), has_side_effects, bind, dependency, - statistics, init_local_state, move(varargs)) { + statistics, init_local_state, move(varargs), propagate_null_values) { } bool ScalarFunction::operator==(const ScalarFunction &rhs) const { @@ -93663,10 +100758,38 @@ void ScalarFunction::NopFunction(DataChunk &input, ExpressionState &state, Vecto } } // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/function/scalar_macro_function.hpp +// +// +//===----------------------------------------------------------------------===// + +namespace duckdb { + +ScalarMacroFunction::ScalarMacroFunction(unique_ptr expression) + : MacroFunction(MacroType::SCALAR_MACRO), expression(move(expression)) { +} + +ScalarMacroFunction::ScalarMacroFunction(void) : MacroFunction(MacroType::SCALAR_MACRO) { +} + +unique_ptr ScalarMacroFunction::Copy() { + auto result = make_unique(); + result->expression = expression->Copy(); + CopyProperties(*result); + + return move(result); +} + +} // namespace duckdb + + @@ -93804,11 +100927,8 @@ struct ArrowTableFunction { private: //! Binds an arrow table - static unique_ptr ArrowScanBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names); + static unique_ptr ArrowScanBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names); //! Actual conversion from Arrow to DuckDB static void ArrowToDuckDB(ArrowScanState &scan_state, std::unordered_map> &arrow_convert_data, @@ -94005,18 +101125,20 @@ LogicalType GetArrowLogicalType(ArrowSchema &schema, } } -unique_ptr ArrowTableFunction::ArrowScanBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, +unique_ptr ArrowTableFunction::ArrowScanBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { typedef unique_ptr (*stream_factory_produce_t)( uintptr_t stream_factory_ptr, std::pair, std::vector> & project_columns, TableFilterCollection * filters); - auto stream_factory_ptr = inputs[0].GetPointer(); - auto stream_factory_produce = (stream_factory_produce_t)inputs[1].GetPointer(); - auto rows_per_thread = inputs[2].GetValue(); + + typedef void (*stream_factory_get_schema_t)(uintptr_t stream_factory_ptr, ArrowSchemaWrapper & schema); + + auto stream_factory_ptr = input.inputs[0].GetPointer(); + auto stream_factory_produce = (stream_factory_produce_t)input.inputs[1].GetPointer(); + auto stream_factory_get_schema = (stream_factory_get_schema_t)input.inputs[2].GetPointer(); + auto rows_per_thread = input.inputs[3].GetValue(); + std::pair, std::vector> project_columns; #ifndef DUCKDB_NO_THREADS @@ -94026,15 +101148,7 @@ unique_ptr ArrowTableFunction::ArrowScanBind(ClientContext &contex auto res = make_unique(rows_per_thread, stream_factory_produce, stream_factory_ptr); #endif auto &data = *res; - auto stream = stream_factory_produce(stream_factory_ptr, project_columns, nullptr); - - data.number_of_rows = stream->number_of_rows; - if (!stream) { - throw InvalidInputException("arrow_scan: NULL pointer passed"); - } - - stream->GetSchema(data.schema_root); - + stream_factory_get_schema(stream_factory_ptr, data.schema_root); for (idx_t col_idx = 0; col_idx < (idx_t)data.schema_root.arrow_schema.n_children; col_idx++) { auto &schema = *data.schema_root.arrow_schema.children[col_idx]; if (!schema.release) { @@ -94437,6 +101551,7 @@ void ColumnArrowToDuckDB(Vector &vector, ArrowArray &array, ArrowScanState &scan case LogicalTypeId::SMALLINT: case LogicalTypeId::INTEGER: case LogicalTypeId::FLOAT: + case LogicalTypeId::DOUBLE: case LogicalTypeId::UTINYINT: case LogicalTypeId::USMALLINT: case LogicalTypeId::UINTEGER: @@ -94450,18 +101565,7 @@ void ColumnArrowToDuckDB(Vector &vector, ArrowArray &array, ArrowScanState &scan DirectConversion(vector, array, scan_state, nested_offset); break; } - case LogicalTypeId::DOUBLE: { - DirectConversion(vector, array, scan_state, nested_offset); - //! Need to check if there are NaNs, if yes, must turn that to null - auto data = (double *)vector.GetData(); - auto &mask = FlatVector::Validity(vector); - for (idx_t row_idx = 0; row_idx < size; row_idx++) { - if (!Value::DoubleIsValid(data[row_idx])) { - mask.SetInvalid(row_idx); - } - } - break; - } + case LogicalTypeId::JSON: case LogicalTypeId::VARCHAR: { auto original_type = arrow_convert_data[col_idx]->variable_sz_type[arrow_convert_idx.first++]; auto cdata = (char *)array.buffers[2]; @@ -94474,7 +101578,6 @@ void ColumnArrowToDuckDB(Vector &vector, ArrowArray &array, ArrowScanState &scan offsets = (uint64_t *)array.buffers[1] + array.offset + nested_offset; } SetVectorString(vector, size, cdata, offsets); - } else { auto offsets = (uint32_t *)array.buffers[1] + array.offset + scan_state.chunk_offset; if (nested_offset != -1) { @@ -94482,7 +101585,6 @@ void ColumnArrowToDuckDB(Vector &vector, ArrowArray &array, ArrowScanState &scan } SetVectorString(vector, size, cdata, offsets); } - break; } case LogicalTypeId::DATE: { @@ -94836,8 +101938,7 @@ void ArrowTableFunction::ArrowToDuckDB(ArrowScanState &scan_state, if (array.length != scan_state.chunk->arrow_array.length) { throw InvalidInputException("arrow_scan: array length mismatch"); } - output.data[idx].GetBuffer()->SetAuxiliaryData(make_unique(scan_state.chunk), - VectorAuxiliaryDataType::ARROW_AUXILIARY); + output.data[idx].GetBuffer()->SetAuxiliaryData(make_unique(scan_state.chunk)); if (array.dictionary) { ColumnArrowToDuckDBDictionary(output.data[idx], array, scan_state, output.size(), arrow_convert_data, col_idx, arrow_convert_idx); @@ -94957,11 +102058,11 @@ double ArrowTableFunction::ArrowProgress(ClientContext &context, const FunctionD void ArrowTableFunction::RegisterFunction(BuiltinFunctions &set) { TableFunctionSet arrow("arrow_scan"); - arrow.AddFunction(TableFunction({LogicalType::POINTER, LogicalType::POINTER, LogicalType::UBIGINT}, - ArrowScanFunction, ArrowScanBind, ArrowScanInit, nullptr, nullptr, nullptr, - ArrowScanCardinality, nullptr, nullptr, ArrowScanMaxThreads, - ArrowScanInitParallelState, ArrowScanFunctionParallel, ArrowScanParallelInit, - ArrowScanParallelStateNext, true, true, ArrowProgress)); + arrow.AddFunction( + TableFunction({LogicalType::POINTER, LogicalType::POINTER, LogicalType::POINTER, LogicalType::UBIGINT}, + ArrowScanFunction, ArrowScanBind, ArrowScanInit, nullptr, nullptr, nullptr, ArrowScanCardinality, + nullptr, nullptr, ArrowScanMaxThreads, ArrowScanInitParallelState, ArrowScanFunctionParallel, + ArrowScanParallelInit, ArrowScanParallelStateNext, true, true, ArrowProgress)); set.AddFunction(arrow); } @@ -95011,11 +102112,8 @@ struct UnnestTableFunction { namespace duckdb { -static unique_ptr CheckpointBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { +static unique_ptr CheckpointBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { return_types.emplace_back(LogicalType::BOOLEAN); names.emplace_back("Success"); return nullptr; @@ -95115,7 +102213,6 @@ struct ReadCSVTableFunction { - #include namespace duckdb { @@ -95297,7 +102394,7 @@ static unique_ptr ReadCSVBind(ClientContext &context, CopyInfo &in string file_pattern = info.file_path; auto &fs = FileSystem::GetFileSystem(context); - bind_data->files = fs.Glob(file_pattern); + bind_data->files = fs.Glob(file_pattern, context); if (bind_data->files.empty()) { throw IOException("No files found that match the pattern \"%s\"", file_pattern); } @@ -95534,10 +102631,11 @@ static unique_ptr WriteCSVInitializeLocal(ClientContext &cont return move(local_data); } -static unique_ptr WriteCSVInitializeGlobal(ClientContext &context, FunctionData &bind_data) { +static unique_ptr WriteCSVInitializeGlobal(ClientContext &context, FunctionData &bind_data, + const string &file_path) { auto &csv_data = (WriteCSVData &)bind_data; auto &options = csv_data.options; - auto global_data = make_unique(FileSystem::GetFileSystem(context), csv_data.files[0], + auto global_data = make_unique(FileSystem::GetFileSystem(context), file_path, FileSystem::GetFileOpener(context), options.compression); if (options.header) { @@ -95631,6 +102729,7 @@ static void WriteCSVCombine(ClientContext &context, FunctionData &bind_data, Glo //===--------------------------------------------------------------------===// void WriteCSVFinalize(ClientContext &context, FunctionData &bind_data, GlobalFunctionData &gstate) { auto &global_state = (GlobalWriteCSVData &)gstate; + global_state.handle->Close(); global_state.handle.reset(); } @@ -95665,18 +102764,15 @@ struct GlobFunctionBindData : public TableFunctionData { vector files; }; -static unique_ptr GlobFunctionBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { +static unique_ptr GlobFunctionBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { auto &config = DBConfig::GetConfig(context); if (!config.enable_external_access) { throw PermissionException("Globbing is disabled through configuration"); } auto result = make_unique(); auto &fs = FileSystem::GetFileSystem(context); - result->files = fs.Glob(StringValue::Get(inputs[0])); + result->files = fs.Glob(StringValue::Get(input.inputs[0]), context); return_types.emplace_back(LogicalType::VARCHAR); names.emplace_back("file"); return move(result); @@ -95826,6 +102922,7 @@ struct TestAllTypesFun { + namespace duckdb { struct PragmaDetailedProfilingOutputOperatorData : public FunctionOperatorData { @@ -95842,10 +102939,7 @@ struct PragmaDetailedProfilingOutputData : public TableFunctionData { vector types; }; -static unique_ptr PragmaDetailedProfilingOutputBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, +static unique_ptr PragmaDetailedProfilingOutputBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { names.emplace_back("OPERATOR_ID"); @@ -96019,10 +103113,9 @@ struct PragmaLastProfilingOutputData : public TableFunctionData { vector types; }; -static unique_ptr -PragmaLastProfilingOutputBind(ClientContext &context, vector &inputs, named_parameter_map_t &named_parameters, - vector &input_table_types, vector &input_table_names, - vector &return_types, vector &names) { +static unique_ptr PragmaLastProfilingOutputBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, + vector &names) { names.emplace_back("OPERATOR_ID"); return_types.emplace_back(LogicalType::INTEGER); @@ -96135,11 +103228,10 @@ struct RangeFunctionBindData : public TableFunctionData { }; template -static unique_ptr -RangeFunctionBind(ClientContext &context, vector &inputs, named_parameter_map_t &named_parameters, - vector &input_table_types, vector &input_table_names, - vector &return_types, vector &names) { +static unique_ptr RangeFunctionBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { auto result = make_unique(); + auto &inputs = input.inputs; if (inputs.size() < 2) { // single argument: only the end is specified result->start = 0; @@ -96246,11 +103338,10 @@ struct RangeDateTimeBindData : public TableFunctionData { }; template -static unique_ptr -RangeDateTimeBind(ClientContext &context, vector &inputs, named_parameter_map_t &named_parameters, - vector &input_table_types, vector &input_table_names, - vector &return_types, vector &names) { +static unique_ptr RangeDateTimeBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { auto result = make_unique(); + auto &inputs = input.inputs; D_ASSERT(inputs.size() == 3); result->start = inputs[0].GetValue(); result->end = inputs[1].GetValue(); @@ -96421,14 +103512,11 @@ class TableFunctionRef : public TableRef { } // namespace duckdb - #include namespace duckdb { -static unique_ptr ReadCSVBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, vector &input_table_names, +static unique_ptr ReadCSVBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { auto &config = DBConfig::GetConfig(context); if (!config.enable_external_access) { @@ -96437,15 +103525,15 @@ static unique_ptr ReadCSVBind(ClientContext &context, vector(); auto &options = result->options; - auto &file_pattern = StringValue::Get(inputs[0]); + auto &file_pattern = StringValue::Get(input.inputs[0]); auto &fs = FileSystem::GetFileSystem(context); - result->files = fs.Glob(file_pattern); + result->files = fs.Glob(file_pattern, context); if (result->files.empty()) { throw IOException("No files found that match the pattern \"%s\"", file_pattern); } - for (auto &kv : named_parameters) { + for (auto &kv : input.named_parameters) { auto loption = StringUtil::Lower(kv.first); if (loption == "auto_detect") { options.auto_detect = BooleanValue::Get(kv.second); @@ -96525,7 +103613,7 @@ static unique_ptr ReadCSVBind(ClientContext &context, vector ReadCSVInit(ClientContext &context, cons return move(result); } -static unique_ptr ReadCSVAutoBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { - named_parameters["auto_detect"] = Value::BOOLEAN(true); - return ReadCSVBind(context, inputs, named_parameters, input_table_types, input_table_names, return_types, names); +static unique_ptr ReadCSVAutoBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { + input.named_parameters["auto_detect"] = Value::BOOLEAN(true); + return ReadCSVBind(context, input, return_types, names); } static void ReadCSVFunction(ClientContext &context, const FunctionData *bind_data_p, @@ -96673,7 +103758,8 @@ void ReadCSVTableFunction::RegisterFunction(BuiltinFunctions &set) { set.AddFunction(read_csv_auto); } -unique_ptr ReadCSVReplacement(const string &table_name, void *data) { +unique_ptr ReadCSVReplacement(ClientContext &context, const string &table_name, + ReplacementScanData *data) { auto lower_name = StringUtil::Lower(table_name); // remove any compression if (StringUtil::EndsWith(lower_name, ".gz")) { @@ -96719,11 +103805,10 @@ struct RepeatOperatorData : public FunctionOperatorData { idx_t current_count; }; -static unique_ptr RepeatBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, vector &input_table_names, +static unique_ptr RepeatBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { // the repeat function returns the type of the first argument + auto &inputs = input.inputs; return_types.push_back(inputs[0].type()); names.push_back(inputs[0].ToString()); return make_unique(inputs[0], inputs[1].GetValue()); @@ -96766,18 +103851,15 @@ void RepeatTableFunction::RegisterFunction(BuiltinFunctions &set) { namespace duckdb { -static unique_ptr SummaryFunctionBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, +static unique_ptr SummaryFunctionBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { return_types.emplace_back(LogicalType::VARCHAR); names.emplace_back("summary"); - for (idx_t i = 0; i < input_table_types.size(); i++) { - return_types.push_back(input_table_types[i]); - names.emplace_back(input_table_names[i]); + for (idx_t i = 0; i < input.input_table_types.size(); i++) { + return_types.push_back(input.input_table_types[i]); + names.emplace_back(input.input_table_names[i]); } return make_unique(); @@ -96834,11 +103916,8 @@ struct DuckDBColumnsData : public FunctionOperatorData { idx_t column_offset; }; -static unique_ptr DuckDBColumnsBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { +static unique_ptr DuckDBColumnsBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { names.emplace_back("schema_oid"); return_types.emplace_back(LogicalType::BIGINT); @@ -97158,6 +104237,7 @@ void DuckDBColumnsFun::RegisterFunction(BuiltinFunctions &set) { + namespace duckdb { struct DuckDBConstraintsData : public FunctionOperatorData { @@ -97169,10 +104249,7 @@ struct DuckDBConstraintsData : public FunctionOperatorData { idx_t constraint_offset; }; -static unique_ptr DuckDBConstraintsBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, +static unique_ptr DuckDBConstraintsBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { names.emplace_back("schema_name"); return_types.emplace_back(LogicalType::VARCHAR); @@ -97316,7 +104393,13 @@ void DuckDBConstraintsFunction(ClientContext &context, const FunctionData *bind_ column_index_list.push_back(bound_not_null.index); break; } - case ConstraintType::FOREIGN_KEY: + case ConstraintType::FOREIGN_KEY: { + auto &bound_foreign_key = (BoundForeignKeyConstraint &)bound_constraint; + for (auto &col_idx : bound_foreign_key.info.fk_keys) { + column_index_list.push_back(column_t(col_idx)); + } + break; + } default: throw NotImplementedException("Unimplemented constraint for duckdb_constraints"); } @@ -97373,10 +104456,7 @@ struct DuckDBDependenciesData : public FunctionOperatorData { idx_t offset; }; -static unique_ptr DuckDBDependenciesBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, +static unique_ptr DuckDBDependenciesBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { names.emplace_back("classid"); return_types.emplace_back(LogicalType::BIGINT); @@ -97485,6 +104565,10 @@ void DuckDBDependenciesFun::RegisterFunction(BuiltinFunctions &set) { + + + + namespace duckdb { struct DuckDBFunctionsData : public FunctionOperatorData { @@ -97496,10 +104580,7 @@ struct DuckDBFunctionsData : public FunctionOperatorData { idx_t offset_in_entry; }; -static unique_ptr DuckDBFunctionsBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, +static unique_ptr DuckDBFunctionsBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { names.emplace_back("schema_name"); return_types.emplace_back(LogicalType::VARCHAR); @@ -97647,7 +104728,7 @@ struct AggregateFunctionExtractor { }; struct MacroExtractor { - static idx_t FunctionCount(MacroCatalogEntry &entry) { + static idx_t FunctionCount(ScalarMacroCatalogEntry &entry) { return 1; } @@ -97655,15 +104736,69 @@ struct MacroExtractor { return Value("macro"); } - static Value GetFunctionDescription(MacroCatalogEntry &entry, idx_t offset) { + static Value GetFunctionDescription(ScalarMacroCatalogEntry &entry, idx_t offset) { + return Value(); + } + + static Value GetReturnType(ScalarMacroCatalogEntry &entry, idx_t offset) { + return Value(); + } + + static Value GetParameters(ScalarMacroCatalogEntry &entry, idx_t offset) { + vector results; + for (auto ¶m : entry.function->parameters) { + D_ASSERT(param->type == ExpressionType::COLUMN_REF); + auto &colref = (ColumnRefExpression &)*param; + results.emplace_back(colref.GetColumnName()); + } + for (auto ¶m_entry : entry.function->default_parameters) { + results.emplace_back(param_entry.first); + } + return Value::LIST(LogicalType::VARCHAR, move(results)); + } + + static Value GetParameterTypes(ScalarMacroCatalogEntry &entry, idx_t offset) { + vector results; + for (idx_t i = 0; i < entry.function->parameters.size(); i++) { + results.emplace_back(LogicalType::VARCHAR); + } + for (idx_t i = 0; i < entry.function->default_parameters.size(); i++) { + results.emplace_back(LogicalType::VARCHAR); + } + return Value::LIST(LogicalType::VARCHAR, move(results)); + } + + static Value GetVarArgs(ScalarMacroCatalogEntry &entry, idx_t offset) { + return Value(); + } + + static Value GetMacroDefinition(ScalarMacroCatalogEntry &entry, idx_t offset) { + if (entry.function->type == MacroType::SCALAR_MACRO) { + auto &func = (ScalarMacroFunction &)*entry.function; + return func.expression->ToString(); + } + return Value(); + } +}; + +struct TableMacroExtractor { + static idx_t FunctionCount(TableMacroCatalogEntry &entry) { + return 1; + } + + static Value GetFunctionType() { + return Value("table_macro"); + } + + static Value GetFunctionDescription(TableMacroCatalogEntry &entry, idx_t offset) { return Value(); } - static Value GetReturnType(MacroCatalogEntry &entry, idx_t offset) { + static Value GetReturnType(TableMacroCatalogEntry &entry, idx_t offset) { return Value(); } - static Value GetParameters(MacroCatalogEntry &entry, idx_t offset) { + static Value GetParameters(TableMacroCatalogEntry &entry, idx_t offset) { vector results; for (auto ¶m : entry.function->parameters) { D_ASSERT(param->type == ExpressionType::COLUMN_REF); @@ -97676,7 +104811,7 @@ struct MacroExtractor { return Value::LIST(LogicalType::VARCHAR, move(results)); } - static Value GetParameterTypes(MacroCatalogEntry &entry, idx_t offset) { + static Value GetParameterTypes(TableMacroCatalogEntry &entry, idx_t offset) { vector results; for (idx_t i = 0; i < entry.function->parameters.size(); i++) { results.emplace_back(LogicalType::VARCHAR); @@ -97687,12 +104822,16 @@ struct MacroExtractor { return Value::LIST(LogicalType::VARCHAR, move(results)); } - static Value GetVarArgs(MacroCatalogEntry &entry, idx_t offset) { + static Value GetVarArgs(TableMacroCatalogEntry &entry, idx_t offset) { return Value(); } - static Value GetMacroDefinition(MacroCatalogEntry &entry, idx_t offset) { - return entry.function->expression->ToString(); + static Value GetMacroDefinition(TableMacroCatalogEntry &entry, idx_t offset) { + if (entry.function->type == MacroType::SCALAR_MACRO) { + auto &func = (ScalarMacroFunction &)*entry.function; + return func.expression->ToString(); + } + return Value(); } }; @@ -97853,9 +104992,14 @@ void DuckDBFunctionsFunction(ClientContext &context, const FunctionData *bind_da finished = ExtractFunctionData( standard_entry, data.offset_in_entry, output, count); break; + case CatalogType::TABLE_MACRO_ENTRY: + finished = ExtractFunctionData( + standard_entry, data.offset_in_entry, output, count); + break; + case CatalogType::MACRO_ENTRY: - finished = ExtractFunctionData(standard_entry, data.offset_in_entry, - output, count); + finished = ExtractFunctionData( + standard_entry, data.offset_in_entry, output, count); break; case CatalogType::TABLE_FUNCTION_ENTRY: finished = ExtractFunctionData( @@ -97907,11 +105051,8 @@ struct DuckDBIndexesData : public FunctionOperatorData { idx_t offset; }; -static unique_ptr DuckDBIndexesBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { +static unique_ptr DuckDBIndexesBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { names.emplace_back("schema_name"); return_types.emplace_back(LogicalType::VARCHAR); @@ -97993,9 +105134,9 @@ void DuckDBIndexesFunction(ClientContext &context, const FunctionData *bind_data auto table_entry = catalog.GetEntry(context, CatalogType::TABLE_ENTRY, index.info->schema, index.info->table); output.SetValue(5, count, Value::BIGINT(table_entry->oid)); // is_unique, BOOLEAN - output.SetValue(6, count, Value::BOOLEAN(index.index->is_unique)); + output.SetValue(6, count, Value::BOOLEAN(index.index->IsUnique())); // is_primary, BOOLEAN - output.SetValue(7, count, Value::BOOLEAN(index.index->is_primary)); + output.SetValue(7, count, Value::BOOLEAN(index.index->IsPrimary())); // expressions, VARCHAR output.SetValue(8, count, Value()); // sql, VARCHAR @@ -98027,11 +105168,8 @@ struct DuckDBKeywordsData : public FunctionOperatorData { idx_t offset; }; -static unique_ptr DuckDBKeywordsBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { +static unique_ptr DuckDBKeywordsBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { names.emplace_back("keyword_name"); return_types.emplace_back(LogicalType::VARCHAR); @@ -98112,11 +105250,8 @@ struct DuckDBSchemasData : public FunctionOperatorData { idx_t offset; }; -static unique_ptr DuckDBSchemasBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { +static unique_ptr DuckDBSchemasBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { names.emplace_back("oid"); return_types.emplace_back(LogicalType::BIGINT); @@ -98197,10 +105332,7 @@ struct DuckDBSequencesData : public FunctionOperatorData { idx_t offset; }; -static unique_ptr DuckDBSequencesBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, +static unique_ptr DuckDBSequencesBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { names.emplace_back("schema_name"); return_types.emplace_back(LogicalType::VARCHAR); @@ -98332,11 +105464,8 @@ struct DuckDBSettingsData : public FunctionOperatorData { idx_t offset; }; -static unique_ptr DuckDBSettingsBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { +static unique_ptr DuckDBSettingsBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { names.emplace_back("name"); return_types.emplace_back(LogicalType::VARCHAR); @@ -98441,11 +105570,8 @@ struct DuckDBTablesData : public FunctionOperatorData { idx_t offset; }; -static unique_ptr DuckDBTablesBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { +static unique_ptr DuckDBTablesBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { names.emplace_back("schema_name"); return_types.emplace_back(LogicalType::VARCHAR); @@ -98594,11 +105720,8 @@ struct DuckDBTypesData : public FunctionOperatorData { idx_t offset; }; -static unique_ptr DuckDBTypesBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { +static unique_ptr DuckDBTypesBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { names.emplace_back("schema_name"); return_types.emplace_back(LogicalType::VARCHAR); @@ -98733,11 +105856,8 @@ struct DuckDBViewsData : public FunctionOperatorData { idx_t offset; }; -static unique_ptr DuckDBViewsBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { +static unique_ptr DuckDBViewsBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { names.emplace_back("schema_name"); return_types.emplace_back(LogicalType::VARCHAR); @@ -98844,11 +105964,8 @@ struct PragmaCollateData : public FunctionOperatorData { idx_t offset; }; -static unique_ptr PragmaCollateBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { +static unique_ptr PragmaCollateBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { names.emplace_back("collname"); return_types.emplace_back(LogicalType::VARCHAR); @@ -98904,10 +106021,7 @@ struct PragmaDatabaseListData : public FunctionOperatorData { bool finished; }; -static unique_ptr PragmaDatabaseListBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, +static unique_ptr PragmaDatabaseListBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { names.emplace_back("seq"); return_types.emplace_back(LogicalType::INTEGER); @@ -98965,10 +106079,7 @@ struct PragmaDatabaseSizeData : public FunctionOperatorData { bool finished; }; -static unique_ptr PragmaDatabaseSizeBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, +static unique_ptr PragmaDatabaseSizeBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { names.emplace_back("database_size"); return_types.emplace_back(LogicalType::VARCHAR); @@ -99020,7 +106131,8 @@ void PragmaDatabaseSizeFunction(ClientContext &context, const FunctionData *bind auto free_blocks = block_manager.FreeBlocks(); auto used_blocks = total_blocks - free_blocks; auto bytes = (total_blocks * block_size); - auto wal_size = storage.GetWriteAheadLog()->GetWALSize(); + auto wal = storage.GetWriteAheadLog(); + auto wal_size = wal ? wal->GetWALSize() : 0; output.data[0].SetValue(0, Value(StringUtil::BytesToHumanReadableString(bytes))); output.data[1].SetValue(0, Value::BIGINT(block_size)); output.data[2].SetValue(0, Value::BIGINT(total_blocks)); @@ -99069,10 +106181,7 @@ struct PragmaFunctionsData : public FunctionOperatorData { idx_t offset_in_entry; }; -static unique_ptr PragmaFunctionsBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, +static unique_ptr PragmaFunctionsBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { names.emplace_back("name"); return_types.emplace_back(LogicalType::VARCHAR); @@ -99205,10 +106314,7 @@ struct PragmaStorageOperatorData : public FunctionOperatorData { idx_t offset; }; -static unique_ptr PragmaStorageInfoBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, +static unique_ptr PragmaStorageInfoBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { names.emplace_back("row_group_id"); return_types.emplace_back(LogicalType::BIGINT); @@ -99252,7 +106358,7 @@ static unique_ptr PragmaStorageInfoBind(ClientContext &context, ve names.emplace_back("block_offset"); return_types.emplace_back(LogicalType::BIGINT); - auto qname = QualifiedName::Parse(inputs[0].GetValue()); + auto qname = QualifiedName::Parse(input.inputs[0].GetValue()); // look up the table name in the catalog auto &catalog = Catalog::GetCatalog(context); @@ -99332,10 +106438,7 @@ struct PragmaTableOperatorData : public FunctionOperatorData { idx_t offset; }; -static unique_ptr PragmaTableInfoBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, +static unique_ptr PragmaTableInfoBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { names.emplace_back("cid"); return_types.emplace_back(LogicalType::INTEGER); @@ -99355,7 +106458,7 @@ static unique_ptr PragmaTableInfoBind(ClientContext &context, vect names.emplace_back("pk"); return_types.emplace_back(LogicalType::BOOLEAN); - auto qname = QualifiedName::Parse(inputs[0].GetValue()); + auto qname = QualifiedName::Parse(input.inputs[0].GetValue()); // look up the table name in the catalog auto &catalog = Catalog::GetCatalog(context); @@ -99487,6 +106590,8 @@ void PragmaTableInfo::RegisterFunction(BuiltinFunctions &set) { } // namespace duckdb +#include +#include namespace duckdb { @@ -99541,6 +106646,7 @@ static vector GetTestTypes() { result.emplace_back(LogicalType::DECIMAL(18, 6), "dec_18_6"); result.emplace_back(LogicalType::DECIMAL(38, 10), "dec38_10"); result.emplace_back(LogicalType::UUID, "uuid"); + // interval interval_t min_interval; min_interval.months = 0; @@ -99555,6 +106661,7 @@ static vector GetTestTypes() { Value::INTERVAL(max_interval)); // strings/blobs result.emplace_back(LogicalType::VARCHAR, "varchar", Value("🦆🦆🦆🦆🦆🦆"), Value("goose")); + result.emplace_back(LogicalType::JSON, "json", Value("🦆🦆🦆🦆🦆🦆"), Value("goose")); result.emplace_back(LogicalType::BLOB, "blob", Value::BLOB("thisisalongblob\\x00withnullbytes"), Value("\\x00\\x00\\x00a")); @@ -99587,6 +106694,13 @@ static vector GetTestTypes() { Value(LogicalType::INTEGER), Value::INTEGER(-42)}); result.emplace_back(int_list_type, "int_array", empty_int_list, int_list); + auto double_list_type = LogicalType::LIST(LogicalType::DOUBLE); + auto empty_double_list = Value::EMPTYLIST(LogicalType::DOUBLE); + auto double_list = Value::LIST( + {Value::DOUBLE(42), Value::DOUBLE(NAN), Value::DOUBLE(std::numeric_limits::infinity()), + Value::DOUBLE(-std::numeric_limits::infinity()), Value(LogicalType::DOUBLE), Value::DOUBLE(-42)}); + result.emplace_back(double_list_type, "double_array", empty_double_list, double_list); + auto varchar_list_type = LogicalType::LIST(LogicalType::VARCHAR); auto empty_varchar_list = Value::EMPTYLIST(LogicalType::VARCHAR); auto varchar_list = @@ -99652,11 +106766,8 @@ static vector GetTestTypes() { return result; } -static unique_ptr TestAllTypesBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { +static unique_ptr TestAllTypesBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { auto test_types = GetTestTypes(); for (auto &test_type : test_types) { return_types.push_back(move(test_type.type)); @@ -100252,10 +107363,9 @@ struct UnnestOperatorData : public FunctionOperatorData { idx_t current_count; }; -static unique_ptr UnnestBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, vector &input_table_names, +static unique_ptr UnnestBind(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names) { + auto &inputs = input.inputs; return_types.push_back(ListType::GetChildType(inputs[0].type())); names.push_back(inputs[0].ToString()); return make_unique(inputs[0]); @@ -100289,6 +107399,8 @@ void UnnestTableFunction::RegisterFunction(BuiltinFunctions &set) { +#include + namespace duckdb { struct PragmaVersionData : public FunctionOperatorData { @@ -100297,11 +107409,8 @@ struct PragmaVersionData : public FunctionOperatorData { bool finished; }; -static unique_ptr PragmaVersionBind(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, vector &return_types, - vector &names) { +static unique_ptr PragmaVersionBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { names.emplace_back("library_version"); return_types.emplace_back(LogicalType::VARCHAR); names.emplace_back("source_id"); @@ -100342,7 +107451,15 @@ const char *DuckDB::LibraryVersion() { string DuckDB::Platform() { string os = "linux"; +#if INTPTR_MAX == INT64_MAX string arch = "amd64"; +#elif INTPTR_MAX == INT32_MAX + string arch = "i686"; +#else +#error Unknown pointer size or missing size macros! +#endif + string postfix = ""; + #ifdef _WIN32 os = "windows"; #elif defined(__APPLE__) @@ -100351,7 +107468,14 @@ string DuckDB::Platform() { #if defined(__aarch64__) || defined(__ARM_ARCH_ISA_A64) arch = "arm64"; #endif - return os + "_" + arch; + +#if !defined(_GLIBCXX_USE_CXX11_ABI) || _GLIBCXX_USE_CXX11_ABI == 0 + if (os == "linux") { + postfix = "_gcc4"; + } +#endif + + return os + "_" + arch + postfix; } } // namespace duckdb @@ -100362,6 +107486,9 @@ namespace duckdb { FunctionOperatorData::~FunctionOperatorData() { } +TableFunctionInfo::~TableFunctionInfo() { +} + TableFilterCollection::TableFilterCollection(TableFilterSet *table_filters) : table_filters(table_filters) { } @@ -100401,6 +107528,35 @@ TableFunction::TableFunction() : SimpleNamedParameterFunction("", {}) { } } // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/function/table_macro_function.hpp +// +// +//===----------------------------------------------------------------------===// +//! The SelectStatement of the view + + + + +namespace duckdb { + +TableMacroFunction::TableMacroFunction(unique_ptr query_node) + : MacroFunction(MacroType::TABLE_MACRO), query_node(move(query_node)) { +} + +TableMacroFunction::TableMacroFunction(void) : MacroFunction(MacroType::TABLE_MACRO) { +} + +unique_ptr TableMacroFunction::Copy() { + auto result = make_unique(); + result->query_node = query_node->Copy(); + this->CopyProperties(*result); + return move(result); +} + +} // namespace duckdb @@ -100439,8 +107595,6 @@ void UDFWrapper::RegisterAggrFunction(AggregateFunction aggr_function, ClientCon - - namespace duckdb { BaseAppender::BaseAppender() : column(0) { @@ -100637,17 +107791,11 @@ void BaseAppender::Append(string_t value) { template <> void BaseAppender::Append(float value) { - if (!Value::FloatIsValid(value)) { - throw InvalidInputException("Float value is out of range!"); - } AppendValueInternal(value); } template <> void BaseAppender::Append(double value) { - if (!Value::DoubleIsValid(value)) { - throw InvalidInputException("Double value is out of range!"); - } AppendValueInternal(value); } @@ -100693,6 +107841,16 @@ void BaseAppender::AppendValue(const Value &value) { column++; } +void BaseAppender::AppendDataChunk(DataChunk &chunk) { + if (chunk.GetTypes() != types) { + throw InvalidInputException("Type mismatch in Append DataChunk and the types required for appender"); + } + collection.Append(chunk); + if (collection.ChunkCount() >= FLUSH_COUNT) { + Flush(); + } +} + void BaseAppender::FlushChunk() { if (chunk->size() == 0) { return; @@ -100751,6 +107909,7 @@ void BaseAppender::Close() { + #include #include @@ -100781,9 +107940,25 @@ struct AppenderWrapper { string error; }; +enum class CAPIResultSetType : uint8_t { + CAPI_RESULT_TYPE_NONE = 0, + CAPI_RESULT_TYPE_MATERIALIZED, + CAPI_RESULT_TYPE_DEPRECATED +}; + +struct DuckDBResultData { + //! The underlying query result + unique_ptr result; + // Results can only use either the new API or the old API, not a mix of the two + // They start off as "none" and switch to one or the other when an API method is used + CAPIResultSetType result_set_type; +}; + duckdb_type ConvertCPPTypeToC(const LogicalType &type); +LogicalTypeId ConvertCTypeToCPP(duckdb_type c_type); idx_t GetCTypeSize(duckdb_type type); -duckdb_state duckdb_translate_result(MaterializedQueryResult *result, duckdb_result *out); +duckdb_state duckdb_translate_result(unique_ptr result, duckdb_result *out); +bool deprecated_materialize_result(duckdb_result *result); } // namespace duckdb @@ -100983,6 +108158,14 @@ duckdb_state duckdb_appender_close(duckdb_appender appender) { return duckdb_appender_run_function(appender, [&](Appender &appender) { appender.Close(); }); } +duckdb_state duckdb_append_data_chunk(duckdb_appender appender, duckdb_data_chunk chunk) { + if (!chunk) { + return DuckDBError; + } + auto data_chunk = (duckdb::DataChunk *)chunk; + return duckdb_appender_run_function(appender, [&](Appender &appender) { appender.AppendDataChunk(*data_chunk); }); +} + using duckdb::ArrowResultWrapper; using duckdb::Connection; @@ -101006,7 +108189,7 @@ duckdb_state duckdb_query_arrow_schema(duckdb_arrow result, duckdb_arrow_schema return DuckDBSuccess; } auto wrapper = (ArrowResultWrapper *)result; - wrapper->result->ToArrowSchema((ArrowSchema *)*out_schema); + QueryResult::ToArrowSchema((ArrowSchema *)*out_schema, wrapper->result->types, wrapper->result->names); return DuckDBSuccess; } @@ -101144,6 +108327,178 @@ void duckdb_destroy_config(duckdb_config *config) { +#include + +duckdb_data_chunk duckdb_create_data_chunk(duckdb_logical_type *ctypes, idx_t column_count) { + if (!ctypes) { + return nullptr; + } + duckdb::vector types; + for (idx_t i = 0; i < column_count; i++) { + auto ltype = (duckdb::LogicalType *)ctypes[i]; + types.push_back(*ltype); + } + + auto result = new duckdb::DataChunk(); + result->Initialize(types); + return result; +} + +void duckdb_destroy_data_chunk(duckdb_data_chunk *chunk) { + if (chunk && *chunk) { + auto dchunk = (duckdb::DataChunk *)*chunk; + delete dchunk; + *chunk = nullptr; + } +} + +void duckdb_data_chunk_reset(duckdb_data_chunk chunk) { + if (!chunk) { + return; + } + auto dchunk = (duckdb::DataChunk *)chunk; + dchunk->Reset(); +} + +idx_t duckdb_data_chunk_get_column_count(duckdb_data_chunk chunk) { + if (!chunk) { + return 0; + } + auto dchunk = (duckdb::DataChunk *)chunk; + return dchunk->ColumnCount(); +} + +duckdb_vector duckdb_data_chunk_get_vector(duckdb_data_chunk chunk, idx_t col_idx) { + if (!chunk || col_idx >= duckdb_data_chunk_get_column_count(chunk)) { + return nullptr; + } + auto dchunk = (duckdb::DataChunk *)chunk; + return &dchunk->data[col_idx]; +} + +idx_t duckdb_data_chunk_get_size(duckdb_data_chunk chunk) { + if (!chunk) { + return 0; + } + auto dchunk = (duckdb::DataChunk *)chunk; + return dchunk->size(); +} + +void duckdb_data_chunk_set_size(duckdb_data_chunk chunk, idx_t size) { + if (!chunk) { + return; + } + auto dchunk = (duckdb::DataChunk *)chunk; + dchunk->SetCardinality(size); +} + +duckdb_logical_type duckdb_vector_get_column_type(duckdb_vector vector) { + if (!vector) { + return nullptr; + } + auto v = (duckdb::Vector *)vector; + return new duckdb::LogicalType(v->GetType()); +} + +void *duckdb_vector_get_data(duckdb_vector vector) { + if (!vector) { + return nullptr; + } + auto v = (duckdb::Vector *)vector; + return duckdb::FlatVector::GetData(*v); +} + +uint64_t *duckdb_vector_get_validity(duckdb_vector vector) { + if (!vector) { + return nullptr; + } + auto v = (duckdb::Vector *)vector; + return duckdb::FlatVector::Validity(*v).GetData(); +} + +void duckdb_vector_ensure_validity_writable(duckdb_vector vector) { + if (!vector) { + return; + } + auto v = (duckdb::Vector *)vector; + auto &validity = duckdb::FlatVector::Validity(*v); + validity.EnsureWritable(); +} + +void duckdb_vector_assign_string_element(duckdb_vector vector, idx_t index, const char *str) { + duckdb_vector_assign_string_element_len(vector, index, str, strlen(str)); +} + +void duckdb_vector_assign_string_element_len(duckdb_vector vector, idx_t index, const char *str, idx_t str_len) { + if (!vector) { + return; + } + auto v = (duckdb::Vector *)vector; + auto data = duckdb::FlatVector::GetData(*v); + data[index] = duckdb::StringVector::AddString(*v, str, str_len); +} + +duckdb_vector duckdb_list_vector_get_child(duckdb_vector vector) { + if (!vector) { + return nullptr; + } + auto v = (duckdb::Vector *)vector; + return &duckdb::ListVector::GetEntry(*v); +} + +idx_t duckdb_list_vector_get_size(duckdb_vector vector) { + if (!vector) { + return 0; + } + auto v = (duckdb::Vector *)vector; + return duckdb::ListVector::GetListSize(*v); +} + +duckdb_vector duckdb_struct_vector_get_child(duckdb_vector vector, idx_t index) { + if (!vector) { + return nullptr; + } + auto v = (duckdb::Vector *)vector; + return duckdb::StructVector::GetEntries(*v)[index].get(); +} + +bool duckdb_validity_row_is_valid(uint64_t *validity, idx_t row) { + if (!validity) { + return true; + } + idx_t entry_idx = row / 64; + idx_t idx_in_entry = row % 64; + return validity[entry_idx] & (1 << idx_in_entry); +} + +void duckdb_validity_set_row_validity(uint64_t *validity, idx_t row, bool valid) { + if (valid) { + duckdb_validity_set_row_valid(validity, row); + } else { + duckdb_validity_set_row_invalid(validity, row); + } +} + +void duckdb_validity_set_row_invalid(uint64_t *validity, idx_t row) { + if (!validity) { + return; + } + idx_t entry_idx = row / 64; + idx_t idx_in_entry = row % 64; + validity[entry_idx] &= ~(1 << idx_in_entry); +} + +void duckdb_validity_set_row_valid(uint64_t *validity, idx_t row) { + if (!validity) { + return; + } + idx_t entry_idx = row / 64; + idx_t idx_in_entry = row % 64; + validity[entry_idx] |= 1 << idx_in_entry; +} + + + using duckdb::Date; @@ -101281,12 +108636,107 @@ void duckdb_disconnect(duckdb_connection *connection) { duckdb_state duckdb_query(duckdb_connection connection, const char *query, duckdb_result *out) { Connection *conn = (Connection *)connection; auto result = conn->Query(query); - return duckdb_translate_result(result.get(), out); + return duckdb_translate_result(move(result), out); +} + + +void duckdb_destroy_value(duckdb_value *value) { + if (value && *value) { + auto val = (duckdb::Value *)*value; + delete val; + *value = nullptr; + } +} + +duckdb_value duckdb_create_varchar_length(const char *text, idx_t length) { + return (duckdb_value) new duckdb::Value(std::string(text, length)); +} + +duckdb_value duckdb_create_varchar(const char *text) { + return duckdb_create_varchar_length(text, strlen(text)); +} + +duckdb_value duckdb_create_int64(int64_t input) { + auto val = duckdb::Value::BIGINT(input); + return (duckdb_value) new duckdb::Value(val); +} + +char *duckdb_get_varchar(duckdb_value value) { + auto val = (duckdb::Value *)value; + auto str_val = val->CastAs(duckdb::LogicalType::VARCHAR); + auto &str = duckdb::StringValue::Get(str_val); + + auto result = (char *)malloc(sizeof(char *) * (str.size() + 1)); + memcpy(result, str.c_str(), str.size()); + result[str.size()] = '\0'; + return result; +} + +int64_t duckdb_get_int64(duckdb_value value) { + auto val = (duckdb::Value *)value; + if (!val->TryCastAs(duckdb::LogicalType::BIGINT)) { + return 0; + } + return duckdb::BigIntValue::Get(*val); } namespace duckdb { +LogicalTypeId ConvertCTypeToCPP(duckdb_type c_type) { + switch (c_type) { + case DUCKDB_TYPE_BOOLEAN: + return LogicalTypeId::BOOLEAN; + case DUCKDB_TYPE_TINYINT: + return LogicalTypeId::TINYINT; + case DUCKDB_TYPE_SMALLINT: + return LogicalTypeId::SMALLINT; + case DUCKDB_TYPE_INTEGER: + return LogicalTypeId::INTEGER; + case DUCKDB_TYPE_BIGINT: + return LogicalTypeId::BIGINT; + case DUCKDB_TYPE_UTINYINT: + return LogicalTypeId::UTINYINT; + case DUCKDB_TYPE_USMALLINT: + return LogicalTypeId::USMALLINT; + case DUCKDB_TYPE_UINTEGER: + return LogicalTypeId::UINTEGER; + case DUCKDB_TYPE_UBIGINT: + return LogicalTypeId::UBIGINT; + case DUCKDB_TYPE_HUGEINT: + return LogicalTypeId::HUGEINT; + case DUCKDB_TYPE_FLOAT: + return LogicalTypeId::FLOAT; + case DUCKDB_TYPE_DOUBLE: + return LogicalTypeId::DOUBLE; + case DUCKDB_TYPE_TIMESTAMP: + return LogicalTypeId::TIMESTAMP; + case DUCKDB_TYPE_DATE: + return LogicalTypeId::DATE; + case DUCKDB_TYPE_TIME: + return LogicalTypeId::TIME; + case DUCKDB_TYPE_VARCHAR: + return LogicalTypeId::VARCHAR; + case DUCKDB_TYPE_JSON: + return LogicalTypeId::JSON; + case DUCKDB_TYPE_BLOB: + return LogicalTypeId::BLOB; + case DUCKDB_TYPE_INTERVAL: + return LogicalTypeId::INTERVAL; + case DUCKDB_TYPE_TIMESTAMP_S: + return LogicalTypeId::TIMESTAMP_SEC; + case DUCKDB_TYPE_TIMESTAMP_MS: + return LogicalTypeId::TIMESTAMP_MS; + case DUCKDB_TYPE_TIMESTAMP_NS: + return LogicalTypeId::TIMESTAMP_NS; + case DUCKDB_TYPE_UUID: + return LogicalTypeId::UUID; + default: // LCOV_EXCL_START + D_ASSERT(0); + return LogicalTypeId::INVALID; + } // LCOV_EXCL_STOP +} + duckdb_type ConvertCPPTypeToC(const LogicalType &sql_type) { switch (sql_type.id()) { case LogicalTypeId::BOOLEAN: @@ -101314,11 +108764,14 @@ duckdb_type ConvertCPPTypeToC(const LogicalType &sql_type) { case LogicalTypeId::DOUBLE: return DUCKDB_TYPE_DOUBLE; case LogicalTypeId::TIMESTAMP: + case LogicalTypeId::TIMESTAMP_TZ: + return DUCKDB_TYPE_TIMESTAMP; case LogicalTypeId::TIMESTAMP_SEC: + return DUCKDB_TYPE_TIMESTAMP_S; case LogicalTypeId::TIMESTAMP_MS: + return DUCKDB_TYPE_TIMESTAMP_MS; case LogicalTypeId::TIMESTAMP_NS: - case LogicalTypeId::TIMESTAMP_TZ: - return DUCKDB_TYPE_TIMESTAMP; + return DUCKDB_TYPE_TIMESTAMP_NS; case LogicalTypeId::DATE: return DUCKDB_TYPE_DATE; case LogicalTypeId::TIME: @@ -101326,15 +108779,30 @@ duckdb_type ConvertCPPTypeToC(const LogicalType &sql_type) { return DUCKDB_TYPE_TIME; case LogicalTypeId::VARCHAR: return DUCKDB_TYPE_VARCHAR; + case LogicalTypeId::JSON: + return DUCKDB_TYPE_JSON; case LogicalTypeId::BLOB: return DUCKDB_TYPE_BLOB; case LogicalTypeId::INTERVAL: return DUCKDB_TYPE_INTERVAL; + case LogicalTypeId::DECIMAL: + return DUCKDB_TYPE_DECIMAL; + case LogicalTypeId::ENUM: + return DUCKDB_TYPE_ENUM; + case LogicalTypeId::LIST: + return DUCKDB_TYPE_LIST; + case LogicalTypeId::STRUCT: + return DUCKDB_TYPE_STRUCT; + case LogicalTypeId::MAP: + return DUCKDB_TYPE_MAP; + case LogicalTypeId::UUID: + return DUCKDB_TYPE_UUID; default: // LCOV_EXCL_START D_ASSERT(0); return DUCKDB_TYPE_INVALID; } // LCOV_EXCL_STOP } + idx_t GetCTypeSize(duckdb_type type) { switch (type) { case DUCKDB_TYPE_BOOLEAN: @@ -101356,6 +108824,7 @@ idx_t GetCTypeSize(duckdb_type type) { case DUCKDB_TYPE_UBIGINT: return sizeof(uint64_t); case DUCKDB_TYPE_HUGEINT: + case DUCKDB_TYPE_UUID: return sizeof(duckdb_hugeint); case DUCKDB_TYPE_FLOAT: return sizeof(float); @@ -101366,6 +108835,9 @@ idx_t GetCTypeSize(duckdb_type type) { case DUCKDB_TYPE_TIME: return sizeof(duckdb_time); case DUCKDB_TYPE_TIMESTAMP: + case DUCKDB_TYPE_TIMESTAMP_S: + case DUCKDB_TYPE_TIMESTAMP_MS: + case DUCKDB_TYPE_TIMESTAMP_NS: return sizeof(duckdb_timestamp); case DUCKDB_TYPE_VARCHAR: return sizeof(const char *); @@ -101373,6 +108845,8 @@ idx_t GetCTypeSize(duckdb_type type) { return sizeof(duckdb_blob); case DUCKDB_TYPE_INTERVAL: return sizeof(duckdb_interval); + case DUCKDB_TYPE_DECIMAL: + return sizeof(duckdb_hugeint); default: // LCOV_EXCL_START // unsupported type D_ASSERT(0); @@ -101390,6 +108864,12 @@ void duckdb_free(void *ptr) { free(ptr); } +idx_t duckdb_vector_size() { + return STANDARD_VECTOR_SIZE; +} + + + using duckdb::Hugeint; @@ -101405,7 +108885,7 @@ double duckdb_hugeint_to_double(duckdb_hugeint val) { duckdb_hugeint duckdb_double_to_hugeint(double val) { hugeint_t internal_result; - if (!Value::DoubleIsValid(val) || !Hugeint::TryConvert(val, internal_result)) { + if (!Value::DoubleIsFinite(val) || !Hugeint::TryConvert(val, internal_result)) { internal_result.lower = 0; internal_result.upper = 0; } @@ -101416,6 +108896,171 @@ duckdb_hugeint duckdb_double_to_hugeint(double val) { return result; } +double duckdb_decimal_to_double(duckdb_decimal val) { + double result; + hugeint_t value; + value.lower = val.value.lower; + value.upper = val.value.upper; + duckdb::TryCastFromDecimal::Operation(value, result, nullptr, val.width, val.scale); + return result; +} + + +duckdb_logical_type duckdb_create_logical_type(duckdb_type type) { + return new duckdb::LogicalType(duckdb::ConvertCTypeToCPP(type)); +} + +duckdb_logical_type duckdb_create_decimal_type(uint8_t width, uint8_t scale) { + return new duckdb::LogicalType(duckdb::LogicalType::DECIMAL(width, scale)); +} + +duckdb_type duckdb_get_type_id(duckdb_logical_type type) { + if (!type) { + return DUCKDB_TYPE_INVALID; + } + auto ltype = (duckdb::LogicalType *)type; + return duckdb::ConvertCPPTypeToC(*ltype); +} + +void duckdb_destroy_logical_type(duckdb_logical_type *type) { + if (type && *type) { + auto ltype = (duckdb::LogicalType *)*type; + delete ltype; + *type = nullptr; + } +} + +uint8_t duckdb_decimal_width(duckdb_logical_type type) { + if (!type) { + return 0; + } + auto <ype = *((duckdb::LogicalType *)type); + if (ltype.id() != duckdb::LogicalTypeId::DECIMAL) { + return 0; + } + return duckdb::DecimalType::GetWidth(ltype); +} + +uint8_t duckdb_decimal_scale(duckdb_logical_type type) { + if (!type) { + return 0; + } + auto <ype = *((duckdb::LogicalType *)type); + if (ltype.id() != duckdb::LogicalTypeId::DECIMAL) { + return 0; + } + return duckdb::DecimalType::GetScale(ltype); +} + +duckdb_type duckdb_decimal_internal_type(duckdb_logical_type type) { + if (!type) { + return DUCKDB_TYPE_INVALID; + } + auto <ype = *((duckdb::LogicalType *)type); + if (ltype.id() != duckdb::LogicalTypeId::DECIMAL) { + return DUCKDB_TYPE_INVALID; + } + switch (ltype.InternalType()) { + case duckdb::PhysicalType::INT16: + return DUCKDB_TYPE_SMALLINT; + case duckdb::PhysicalType::INT32: + return DUCKDB_TYPE_INTEGER; + case duckdb::PhysicalType::INT64: + return DUCKDB_TYPE_BIGINT; + case duckdb::PhysicalType::INT128: + return DUCKDB_TYPE_HUGEINT; + default: + return DUCKDB_TYPE_INVALID; + } +} + +duckdb_type duckdb_enum_internal_type(duckdb_logical_type type) { + if (!type) { + return DUCKDB_TYPE_INVALID; + } + auto <ype = *((duckdb::LogicalType *)type); + if (ltype.id() != duckdb::LogicalTypeId::ENUM) { + return DUCKDB_TYPE_INVALID; + } + switch (ltype.InternalType()) { + case duckdb::PhysicalType::UINT8: + return DUCKDB_TYPE_UTINYINT; + case duckdb::PhysicalType::UINT16: + return DUCKDB_TYPE_USMALLINT; + case duckdb::PhysicalType::UINT32: + return DUCKDB_TYPE_UINTEGER; + default: + return DUCKDB_TYPE_INVALID; + } +} + +uint32_t duckdb_enum_dictionary_size(duckdb_logical_type type) { + if (!type) { + return 0; + } + auto <ype = *((duckdb::LogicalType *)type); + if (ltype.id() != duckdb::LogicalTypeId::ENUM) { + return 0; + } + return duckdb::EnumType::GetSize(ltype); +} + +char *duckdb_enum_dictionary_value(duckdb_logical_type type, idx_t index) { + if (!type) { + return nullptr; + } + auto <ype = *((duckdb::LogicalType *)type); + if (ltype.id() != duckdb::LogicalTypeId::ENUM) { + return nullptr; + } + auto &vector = duckdb::EnumType::GetValuesInsertOrder(ltype); + auto value = vector.GetValue(index); + return strdup(duckdb::StringValue::Get(value).c_str()); +} + +duckdb_logical_type duckdb_list_type_child_type(duckdb_logical_type type) { + if (!type) { + return nullptr; + } + auto <ype = *((duckdb::LogicalType *)type); + if (ltype.id() != duckdb::LogicalTypeId::LIST) { + return nullptr; + } + return new duckdb::LogicalType(duckdb::ListType::GetChildType(ltype)); +} + +idx_t duckdb_struct_type_child_count(duckdb_logical_type type) { + if (!type) { + return 0; + } + auto <ype = *((duckdb::LogicalType *)type); + if (ltype.InternalType() != duckdb::PhysicalType::STRUCT) { + return 0; + } + return duckdb::StructType::GetChildCount(ltype); +} + +char *duckdb_struct_type_child_name(duckdb_logical_type type, idx_t index) { + if (!type) { + return nullptr; + } + auto <ype = *((duckdb::LogicalType *)type); + if (ltype.InternalType() != duckdb::PhysicalType::STRUCT) { + return nullptr; + } + return strdup(duckdb::StructType::GetChildName(ltype, index).c_str()); +} + +duckdb_logical_type duckdb_struct_type_child_type(duckdb_logical_type type, idx_t index) { + if (!type) { + return nullptr; + } + auto <ype = *((duckdb::LogicalType *)type); + if (ltype.InternalType() != duckdb::PhysicalType::STRUCT) { + return nullptr; + } + return new duckdb::LogicalType(duckdb::StructType::GetChildType(ltype, index)); +} @@ -101475,7 +109120,7 @@ static duckdb_state duckdb_bind_value(duckdb_prepared_statement prepared_stateme if (!wrapper || !wrapper->statement || !wrapper->statement->success) { return DuckDBError; } - if (param_idx > wrapper->statement->n_param) { + if (param_idx <= 0 || param_idx > wrapper->statement->n_param) { return DuckDBError; } if (param_idx > wrapper->values.size()) { @@ -101529,16 +109174,10 @@ duckdb_state duckdb_bind_uint64(duckdb_prepared_statement prepared_statement, id } duckdb_state duckdb_bind_float(duckdb_prepared_statement prepared_statement, idx_t param_idx, float val) { - if (!Value::FloatIsValid(val)) { - return DuckDBError; - } return duckdb_bind_value(prepared_statement, param_idx, Value::FLOAT(val)); } duckdb_state duckdb_bind_double(duckdb_prepared_statement prepared_statement, idx_t param_idx, double val) { - if (!Value::DoubleIsValid(val)) { - return DuckDBError; - } return duckdb_bind_value(prepared_statement, param_idx, Value::DOUBLE(val)); } @@ -101560,12 +109199,20 @@ duckdb_state duckdb_bind_interval(duckdb_prepared_statement prepared_statement, } duckdb_state duckdb_bind_varchar(duckdb_prepared_statement prepared_statement, idx_t param_idx, const char *val) { - return duckdb_bind_value(prepared_statement, param_idx, Value(val)); + try { + return duckdb_bind_value(prepared_statement, param_idx, Value(val)); + } catch (...) { + return DuckDBError; + } } duckdb_state duckdb_bind_varchar_length(duckdb_prepared_statement prepared_statement, idx_t param_idx, const char *val, idx_t length) { - return duckdb_bind_value(prepared_statement, param_idx, Value(std::string(val, length))); + try { + return duckdb_bind_value(prepared_statement, param_idx, Value(std::string(val, length))); + } catch (...) { + return DuckDBError; + } } duckdb_state duckdb_bind_blob(duckdb_prepared_statement prepared_statement, idx_t param_idx, const void *data, @@ -101583,9 +109230,7 @@ duckdb_state duckdb_execute_prepared(duckdb_prepared_statement prepared_statemen return DuckDBError; } auto result = wrapper->statement->Execute(wrapper->values, false); - D_ASSERT(result->type == QueryResultType::MATERIALIZED_RESULT); - auto mat_res = (MaterializedQueryResult *)result.get(); - return duckdb_translate_result(mat_res, out_result); + return duckdb_translate_result(move(result), out_result); } void duckdb_destroy_prepare(duckdb_prepared_statement *prepared_statement) { @@ -101601,12 +109246,94 @@ void duckdb_destroy_prepare(duckdb_prepared_statement *prepared_statement) { + + + +namespace duckdb { + +struct CAPIReplacementScanData : public ReplacementScanData { + ~CAPIReplacementScanData() { + if (delete_callback) { + delete_callback(extra_data); + } + } + + duckdb_replacement_callback_t callback; + void *extra_data; + duckdb_delete_callback_t delete_callback; +}; + +struct CAPIReplacementScanInfo { + CAPIReplacementScanInfo(CAPIReplacementScanData *data) : data(data) { + } + + CAPIReplacementScanData *data; + string function_name; + vector parameters; +}; + +unique_ptr duckdb_capi_replacement_callback(ClientContext &context, const string &table_name, + ReplacementScanData *data) { + auto &scan_data = (CAPIReplacementScanData &)*data; + + CAPIReplacementScanInfo info(&scan_data); + scan_data.callback((duckdb_replacement_scan_info)&info, table_name.c_str(), scan_data.extra_data); + if (info.function_name.empty()) { + // no function provided: bail-out + return nullptr; + } + auto table_function = make_unique(); + vector> children; + for (auto ¶m : info.parameters) { + children.push_back(make_unique(move(param))); + } + table_function->function = make_unique(info.function_name, move(children)); + return table_function; +} + +} // namespace duckdb + +void duckdb_add_replacement_scan(duckdb_database db, duckdb_replacement_callback_t replacement, void *extra_data, + duckdb_delete_callback_t delete_callback) { + if (!db || !replacement) { + return; + } + auto wrapper = (duckdb::DatabaseData *)db; + auto scan_info = duckdb::make_unique(); + scan_info->callback = replacement; + scan_info->extra_data = extra_data; + scan_info->delete_callback = delete_callback; + + auto &config = duckdb::DBConfig::GetConfig(*wrapper->database->instance); + config.replacement_scans.push_back( + duckdb::ReplacementScan(duckdb::duckdb_capi_replacement_callback, move(scan_info))); +} + +void duckdb_replacement_scan_set_function_name(duckdb_replacement_scan_info info_p, const char *function_name) { + if (!info_p || !function_name) { + return; + } + auto info = (duckdb::CAPIReplacementScanInfo *)info_p; + info->function_name = function_name; +} + +void duckdb_replacement_scan_add_parameter(duckdb_replacement_scan_info info_p, duckdb_value parameter) { + if (!info_p || !parameter) { + return; + } + auto info = (duckdb::CAPIReplacementScanInfo *)info_p; + auto val = (duckdb::Value *)parameter; + info->parameters.push_back(*val); +} + + + namespace duckdb { template -void WriteData(duckdb_result *out, ChunkCollection &source, idx_t col) { +void WriteData(duckdb_column *column, ChunkCollection &source, idx_t col) { idx_t row = 0; - auto target = (T *)out->__deprecated_columns[col].__deprecated_data; + auto target = (T *)column->__deprecated_data; for (auto &chunk : source.Chunks()) { auto source = FlatVector::GetData(chunk->data[col]); auto &mask = FlatVector::Validity(chunk->data[col]); @@ -101620,210 +109347,317 @@ void WriteData(duckdb_result *out, ChunkCollection &source, idx_t col) { } } -duckdb_state duckdb_translate_result(MaterializedQueryResult *result, duckdb_result *out) { - D_ASSERT(result); - if (!out) { - // no result to write to, only return the status - return result->success ? DuckDBSuccess : DuckDBError; - } - memset(out, 0, sizeof(duckdb_result)); - if (!result->success) { - // write the error message - out->__deprecated_error_message = strdup(result->error.c_str()); - return DuckDBError; - } - // copy the data - // first write the meta data - out->__deprecated_column_count = result->types.size(); - out->__deprecated_row_count = result->collection.Count(); - out->__deprecated_rows_changed = 0; - if (out->__deprecated_row_count > 0 && StatementTypeReturnChanges(result->statement_type)) { - // update total changes - auto row_changes = result->GetValue(0, 0); - if (!row_changes.IsNull() && row_changes.TryCastAs(LogicalType::BIGINT)) { - out->__deprecated_rows_changed = row_changes.GetValue(); - } - } - out->__deprecated_columns = (duckdb_column *)duckdb_malloc(sizeof(duckdb_column) * out->__deprecated_column_count); - if (!out->__deprecated_columns) { // LCOV_EXCL_START +duckdb_state deprecated_duckdb_translate_column(MaterializedQueryResult &result, duckdb_column *column, idx_t col) { + idx_t row_count = result.collection.Count(); + column->__deprecated_nullmask = (bool *)duckdb_malloc(sizeof(bool) * result.collection.Count()); + column->__deprecated_data = duckdb_malloc(GetCTypeSize(column->__deprecated_type) * row_count); + if (!column->__deprecated_nullmask || !column->__deprecated_data) { // LCOV_EXCL_START // malloc failure return DuckDBError; } // LCOV_EXCL_STOP - // zero initialize the columns (so we can cleanly delete it in case a malloc fails) - memset(out->__deprecated_columns, 0, sizeof(duckdb_column) * out->__deprecated_column_count); - for (idx_t i = 0; i < out->__deprecated_column_count; i++) { - out->__deprecated_columns[i].__deprecated_type = ConvertCPPTypeToC(result->types[i]); - out->__deprecated_columns[i].__deprecated_name = strdup(result->names[i].c_str()); - out->__deprecated_columns[i].__deprecated_nullmask = - (bool *)duckdb_malloc(sizeof(bool) * out->__deprecated_row_count); - out->__deprecated_columns[i].__deprecated_data = - duckdb_malloc(GetCTypeSize(out->__deprecated_columns[i].__deprecated_type) * out->__deprecated_row_count); - if (!out->__deprecated_columns[i].__deprecated_nullmask || !out->__deprecated_columns[i].__deprecated_name || - !out->__deprecated_columns[i].__deprecated_data) { // LCOV_EXCL_START - // malloc failure - return DuckDBError; - } // LCOV_EXCL_STOP + // first convert the nullmask + idx_t row = 0; + for (auto &chunk : result.collection.Chunks()) { + for (idx_t k = 0; k < chunk->size(); k++) { + column->__deprecated_nullmask[row++] = FlatVector::IsNull(chunk->data[col], k); + } } - // now write the data - for (idx_t col = 0; col < out->__deprecated_column_count; col++) { - // first set the nullmask + // then write the data + switch (result.types[col].id()) { + case LogicalTypeId::BOOLEAN: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::TINYINT: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::SMALLINT: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::INTEGER: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::BIGINT: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::UTINYINT: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::USMALLINT: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::UINTEGER: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::UBIGINT: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::FLOAT: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::DOUBLE: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::DATE: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::TIME: + case LogicalTypeId::TIME_TZ: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::TIMESTAMP: + case LogicalTypeId::TIMESTAMP_TZ: + WriteData(column, result.collection, col); + break; + case LogicalTypeId::VARCHAR: { idx_t row = 0; - for (auto &chunk : result->collection.Chunks()) { + auto target = (const char **)column->__deprecated_data; + for (auto &chunk : result.collection.Chunks()) { + auto source = FlatVector::GetData(chunk->data[col]); for (idx_t k = 0; k < chunk->size(); k++) { - out->__deprecated_columns[col].__deprecated_nullmask[row++] = FlatVector::IsNull(chunk->data[col], k); + if (!FlatVector::IsNull(chunk->data[col], k)) { + target[row] = (char *)duckdb_malloc(source[k].GetSize() + 1); + assert(target[row]); + memcpy((void *)target[row], source[k].GetDataUnsafe(), source[k].GetSize()); + auto write_arr = (char *)target[row]; + write_arr[source[k].GetSize()] = '\0'; + } else { + target[row] = nullptr; + } + row++; } } - // then write the data - switch (result->types[col].id()) { - case LogicalTypeId::BOOLEAN: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::TINYINT: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::SMALLINT: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::INTEGER: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::BIGINT: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::UTINYINT: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::USMALLINT: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::UINTEGER: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::UBIGINT: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::FLOAT: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::DOUBLE: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::DATE: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::TIME: - case LogicalTypeId::TIME_TZ: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::TIMESTAMP: - case LogicalTypeId::TIMESTAMP_TZ: - WriteData(out, result->collection, col); - break; - case LogicalTypeId::VARCHAR: { - idx_t row = 0; - auto target = (const char **)out->__deprecated_columns[col].__deprecated_data; - for (auto &chunk : result->collection.Chunks()) { - auto source = FlatVector::GetData(chunk->data[col]); - for (idx_t k = 0; k < chunk->size(); k++) { - if (!FlatVector::IsNull(chunk->data[col], k)) { - target[row] = (char *)duckdb_malloc(source[k].GetSize() + 1); - assert(target[row]); - memcpy((void *)target[row], source[k].GetDataUnsafe(), source[k].GetSize()); - auto write_arr = (char *)target[row]; - write_arr[source[k].GetSize()] = '\0'; + break; + } + case LogicalTypeId::BLOB: { + idx_t row = 0; + auto target = (duckdb_blob *)column->__deprecated_data; + for (auto &chunk : result.collection.Chunks()) { + auto source = FlatVector::GetData(chunk->data[col]); + for (idx_t k = 0; k < chunk->size(); k++) { + if (!FlatVector::IsNull(chunk->data[col], k)) { + target[row].data = (char *)duckdb_malloc(source[k].GetSize()); + target[row].size = source[k].GetSize(); + assert(target[row].data); + memcpy((void *)target[row].data, source[k].GetDataUnsafe(), source[k].GetSize()); + } else { + target[row].data = nullptr; + target[row].size = 0; + } + row++; + } + } + break; + } + case LogicalTypeId::TIMESTAMP_NS: + case LogicalTypeId::TIMESTAMP_MS: + case LogicalTypeId::TIMESTAMP_SEC: { + idx_t row = 0; + auto target = (timestamp_t *)column->__deprecated_data; + for (auto &chunk : result.collection.Chunks()) { + auto source = FlatVector::GetData(chunk->data[col]); + + for (idx_t k = 0; k < chunk->size(); k++) { + if (!FlatVector::IsNull(chunk->data[col], k)) { + if (result.types[col].id() == LogicalTypeId::TIMESTAMP_NS) { + target[row] = Timestamp::FromEpochNanoSeconds(source[k].value); + } else if (result.types[col].id() == LogicalTypeId::TIMESTAMP_MS) { + target[row] = Timestamp::FromEpochMs(source[k].value); } else { - target[row] = nullptr; + D_ASSERT(result.types[col].id() == LogicalTypeId::TIMESTAMP_SEC); + target[row] = Timestamp::FromEpochSeconds(source[k].value); } - row++; } + row++; + } + } + break; + } + case LogicalTypeId::HUGEINT: { + idx_t row = 0; + auto target = (duckdb_hugeint *)column->__deprecated_data; + for (auto &chunk : result.collection.Chunks()) { + auto source = FlatVector::GetData(chunk->data[col]); + for (idx_t k = 0; k < chunk->size(); k++) { + if (!FlatVector::IsNull(chunk->data[col], k)) { + target[row].lower = source[k].lower; + target[row].upper = source[k].upper; + } + row++; } - break; } - case LogicalTypeId::BLOB: { - idx_t row = 0; - auto target = (duckdb_blob *)out->__deprecated_columns[col].__deprecated_data; - for (auto &chunk : result->collection.Chunks()) { - auto source = FlatVector::GetData(chunk->data[col]); + break; + } + case LogicalTypeId::INTERVAL: { + idx_t row = 0; + auto target = (duckdb_interval *)column->__deprecated_data; + for (auto &chunk : result.collection.Chunks()) { + auto source = FlatVector::GetData(chunk->data[col]); + for (idx_t k = 0; k < chunk->size(); k++) { + if (!FlatVector::IsNull(chunk->data[col], k)) { + target[row].days = source[k].days; + target[row].months = source[k].months; + target[row].micros = source[k].micros; + } + row++; + } + } + break; + } + case LogicalTypeId::DECIMAL: { + // get data + idx_t row = 0; + auto target = (hugeint_t *)column->__deprecated_data; + switch (result.types[col].InternalType()) { + case PhysicalType::INT16: { + for (auto &chunk : result.collection.Chunks()) { + auto source = FlatVector::GetData(chunk->data[col]); for (idx_t k = 0; k < chunk->size(); k++) { if (!FlatVector::IsNull(chunk->data[col], k)) { - target[row].data = (char *)duckdb_malloc(source[k].GetSize()); - target[row].size = source[k].GetSize(); - assert(target[row].data); - memcpy((void *)target[row].data, source[k].GetDataUnsafe(), source[k].GetSize()); - } else { - target[row].data = nullptr; - target[row].size = 0; + target[row].lower = source[k]; + target[row].upper = 0; } row++; } } break; } - case LogicalTypeId::TIMESTAMP_NS: - case LogicalTypeId::TIMESTAMP_MS: - case LogicalTypeId::TIMESTAMP_SEC: { - idx_t row = 0; - auto target = (timestamp_t *)out->__deprecated_columns[col].__deprecated_data; - for (auto &chunk : result->collection.Chunks()) { - auto source = FlatVector::GetData(chunk->data[col]); - + case PhysicalType::INT32: { + for (auto &chunk : result.collection.Chunks()) { + auto source = FlatVector::GetData(chunk->data[col]); for (idx_t k = 0; k < chunk->size(); k++) { if (!FlatVector::IsNull(chunk->data[col], k)) { - if (result->types[col].id() == LogicalTypeId::TIMESTAMP_NS) { - target[row] = Timestamp::FromEpochNanoSeconds(source[k].value); - } else if (result->types[col].id() == LogicalTypeId::TIMESTAMP_MS) { - target[row] = Timestamp::FromEpochMs(source[k].value); - } else { - D_ASSERT(result->types[col].id() == LogicalTypeId::TIMESTAMP_SEC); - target[row] = Timestamp::FromEpochSeconds(source[k].value); - } + target[row].lower = source[k]; + target[row].upper = 0; } row++; } } break; } - case LogicalTypeId::HUGEINT: { - idx_t row = 0; - auto target = (duckdb_hugeint *)out->__deprecated_columns[col].__deprecated_data; - for (auto &chunk : result->collection.Chunks()) { - auto source = FlatVector::GetData(chunk->data[col]); + case PhysicalType::INT64: { + for (auto &chunk : result.collection.Chunks()) { + auto source = FlatVector::GetData(chunk->data[col]); for (idx_t k = 0; k < chunk->size(); k++) { if (!FlatVector::IsNull(chunk->data[col], k)) { - target[row].lower = source[k].lower; - target[row].upper = source[k].upper; + target[row].lower = source[k]; + target[row].upper = 0; } row++; } } break; } - case LogicalTypeId::INTERVAL: { - idx_t row = 0; - auto target = (duckdb_interval *)out->__deprecated_columns[col].__deprecated_data; - for (auto &chunk : result->collection.Chunks()) { - auto source = FlatVector::GetData(chunk->data[col]); + case PhysicalType::INT128: { + for (auto &chunk : result.collection.Chunks()) { + auto source = FlatVector::GetData(chunk->data[col]); for (idx_t k = 0; k < chunk->size(); k++) { if (!FlatVector::IsNull(chunk->data[col], k)) { - target[row].days = source[k].days; - target[row].months = source[k].months; - target[row].micros = source[k].micros; + target[row].lower = source[k].lower; + target[row].upper = source[k].upper; } row++; } } break; } - default: // LCOV_EXCL_START - // unsupported type for C API - D_ASSERT(0); - return DuckDBError; - } // LCOV_EXCL_STOP + default: + throw std::runtime_error("Unsupported physical type for Decimal" + + TypeIdToString(result.types[col].InternalType())); + } + break; + } + default: // LCOV_EXCL_START + return DuckDBError; + } // LCOV_EXCL_STOP + return DuckDBSuccess; +} + +duckdb_state duckdb_translate_result(unique_ptr result_p, duckdb_result *out) { + auto &result = *result_p; + D_ASSERT(result_p); + if (!out) { + // no result to write to, only return the status + return result.success ? DuckDBSuccess : DuckDBError; + } + + memset(out, 0, sizeof(duckdb_result)); + + // initialize the result_data object + auto result_data = new DuckDBResultData(); + result_data->result = move(result_p); + result_data->result_set_type = CAPIResultSetType::CAPI_RESULT_TYPE_NONE; + out->internal_data = result_data; + + if (!result.success) { + // write the error message + out->__deprecated_error_message = (char *)result.error.c_str(); + return DuckDBError; } + // copy the data + // first write the meta data + out->__deprecated_column_count = result.ColumnCount(); + out->__deprecated_rows_changed = 0; return DuckDBSuccess; } +bool deprecated_materialize_result(duckdb_result *result) { + if (!result) { + return false; + } + auto result_data = (duckdb::DuckDBResultData *)result->internal_data; + if (!result_data->result->success) { + return false; + } + if (result_data->result_set_type == CAPIResultSetType::CAPI_RESULT_TYPE_DEPRECATED) { + // already materialized into deprecated result format + return true; + } + if (result_data->result_set_type == CAPIResultSetType::CAPI_RESULT_TYPE_MATERIALIZED) { + // already used as a new result set + return false; + } + // materialize as deprecated result set + result_data->result_set_type = CAPIResultSetType::CAPI_RESULT_TYPE_DEPRECATED; + auto column_count = result_data->result->ColumnCount(); + result->__deprecated_columns = (duckdb_column *)duckdb_malloc(sizeof(duckdb_column) * column_count); + if (!result->__deprecated_columns) { // LCOV_EXCL_START + // malloc failure + return DuckDBError; + } // LCOV_EXCL_STOP + if (result_data->result->type == QueryResultType::STREAM_RESULT) { + // if we are dealing with a stream result, convert it to a materialized result first + auto &stream_result = (StreamQueryResult &)*result_data->result; + result_data->result = stream_result.Materialize(); + } + D_ASSERT(result_data->result->type == QueryResultType::MATERIALIZED_RESULT); + auto &materialized = (MaterializedQueryResult &)*result_data->result; + + // convert the result to a materialized result + // zero initialize the columns (so we can cleanly delete it in case a malloc fails) + memset(result->__deprecated_columns, 0, sizeof(duckdb_column) * column_count); + for (idx_t i = 0; i < column_count; i++) { + result->__deprecated_columns[i].__deprecated_type = ConvertCPPTypeToC(result_data->result->types[i]); + result->__deprecated_columns[i].__deprecated_name = (char *)result_data->result->names[i].c_str(); + } + result->__deprecated_row_count = materialized.collection.Count(); + if (result->__deprecated_row_count > 0 && StatementTypeReturnChanges(materialized.statement_type)) { + // update total changes + auto row_changes = materialized.GetValue(0, 0); + if (!row_changes.IsNull() && row_changes.TryCastAs(LogicalType::BIGINT)) { + result->__deprecated_rows_changed = row_changes.GetValue(); + } + } + // now write the data + for (idx_t col = 0; col < column_count; col++) { + auto state = deprecated_duckdb_translate_column(materialized, &result->__deprecated_columns[col], col); + if (state != DuckDBSuccess) { + return false; + } + } + return true; +} + } // namespace duckdb static void DuckdbDestroyColumn(duckdb_column column, idx_t count) { @@ -101850,56 +109684,70 @@ static void DuckdbDestroyColumn(duckdb_column column, idx_t count) { if (column.__deprecated_nullmask) { duckdb_free(column.__deprecated_nullmask); } - if (column.__deprecated_name) { - duckdb_free(column.__deprecated_name); - } } void duckdb_destroy_result(duckdb_result *result) { - if (result->__deprecated_error_message) { - duckdb_free(result->__deprecated_error_message); - } if (result->__deprecated_columns) { for (idx_t i = 0; i < result->__deprecated_column_count; i++) { DuckdbDestroyColumn(result->__deprecated_columns[i], result->__deprecated_row_count); } duckdb_free(result->__deprecated_columns); } + if (result->internal_data) { + auto result_data = (duckdb::DuckDBResultData *)result->internal_data; + delete result_data; + } memset(result, 0, sizeof(duckdb_result)); } const char *duckdb_column_name(duckdb_result *result, idx_t col) { - if (!result || col >= result->__deprecated_column_count) { + if (!result || col >= duckdb_column_count(result)) { return nullptr; } - return result->__deprecated_columns[col].__deprecated_name; + auto &result_data = *((duckdb::DuckDBResultData *)result->internal_data); + return result_data.result->names[col].c_str(); } duckdb_type duckdb_column_type(duckdb_result *result, idx_t col) { - if (!result || col >= result->__deprecated_column_count) { + if (!result || col >= duckdb_column_count(result)) { return DUCKDB_TYPE_INVALID; } - return result->__deprecated_columns[col].__deprecated_type; + auto &result_data = *((duckdb::DuckDBResultData *)result->internal_data); + return duckdb::ConvertCPPTypeToC(result_data.result->types[col]); +} + +duckdb_logical_type duckdb_column_logical_type(duckdb_result *result, idx_t col) { + if (!result || col >= duckdb_column_count(result)) { + return nullptr; + } + auto &result_data = *((duckdb::DuckDBResultData *)result->internal_data); + return new duckdb::LogicalType(result_data.result->types[col]); } idx_t duckdb_column_count(duckdb_result *result) { if (!result) { return 0; } - return result->__deprecated_column_count; + auto &result_data = *((duckdb::DuckDBResultData *)result->internal_data); + return result_data.result->ColumnCount(); } idx_t duckdb_row_count(duckdb_result *result) { if (!result) { return 0; } - return result->__deprecated_row_count; + auto &result_data = *((duckdb::DuckDBResultData *)result->internal_data); + auto &materialized = (duckdb::MaterializedQueryResult &)*result_data.result; + return materialized.collection.Count(); } idx_t duckdb_rows_changed(duckdb_result *result) { if (!result) { return 0; } + if (!duckdb::deprecated_materialize_result(result)) { + return 0; + } return result->__deprecated_rows_changed; } @@ -101907,6 +109755,9 @@ void *duckdb_column_data(duckdb_result *result, idx_t col) { if (!result || col >= result->__deprecated_column_count) { return nullptr; } + if (!duckdb::deprecated_materialize_result(result)) { + return nullptr; + } return result->__deprecated_columns[col].__deprecated_data; } @@ -101914,14 +109765,431 @@ bool *duckdb_nullmask_data(duckdb_result *result, idx_t col) { if (!result || col >= result->__deprecated_column_count) { return nullptr; } + if (!duckdb::deprecated_materialize_result(result)) { + return nullptr; + } return result->__deprecated_columns[col].__deprecated_nullmask; } -char *duckdb_result_error(duckdb_result *result) { +const char *duckdb_result_error(duckdb_result *result) { if (!result) { return nullptr; } - return result->__deprecated_error_message; + auto &result_data = *((duckdb::DuckDBResultData *)result->internal_data); + return result_data.result->success ? nullptr : result_data.result->error.c_str(); +} + +idx_t duckdb_result_chunk_count(duckdb_result result) { + if (!result.internal_data) { + return 0; + } + auto &result_data = *((duckdb::DuckDBResultData *)result.internal_data); + if (result_data.result_set_type == duckdb::CAPIResultSetType::CAPI_RESULT_TYPE_DEPRECATED) { + return 0; + } + D_ASSERT(result_data.result->type == duckdb::QueryResultType::MATERIALIZED_RESULT); + auto &materialized = (duckdb::MaterializedQueryResult &)*result_data.result; + return materialized.collection.ChunkCount(); +} + +duckdb_data_chunk duckdb_result_get_chunk(duckdb_result result, idx_t chunk_idx) { + if (!result.internal_data) { + return nullptr; + } + auto &result_data = *((duckdb::DuckDBResultData *)result.internal_data); + if (result_data.result_set_type == duckdb::CAPIResultSetType::CAPI_RESULT_TYPE_DEPRECATED) { + return nullptr; + } + result_data.result_set_type = duckdb::CAPIResultSetType::CAPI_RESULT_TYPE_MATERIALIZED; + auto &materialized = (duckdb::MaterializedQueryResult &)*result_data.result; + if (chunk_idx >= materialized.collection.ChunkCount()) { + return nullptr; + } + auto chunk = duckdb::make_unique(); + chunk->InitializeEmpty(materialized.collection.Types()); + chunk->Reference(*materialized.collection.Chunks()[chunk_idx]); + return chunk.release(); +} + + + + + + +namespace duckdb { + +struct CTableFunctionInfo : public TableFunctionInfo { + ~CTableFunctionInfo() { + if (extra_info && delete_callback) { + delete_callback(extra_info); + } + extra_info = nullptr; + delete_callback = nullptr; + } + + duckdb_table_function_bind_t bind = nullptr; + duckdb_table_function_init_t init = nullptr; + duckdb_table_function_t function = nullptr; + void *extra_info = nullptr; + duckdb_delete_callback_t delete_callback = nullptr; +}; + +struct CTableBindData : public FunctionData { + ~CTableBindData() { + if (bind_data && delete_callback) { + delete_callback(bind_data); + } + bind_data = nullptr; + delete_callback = nullptr; + } + + CTableFunctionInfo *info = nullptr; + void *bind_data = nullptr; + duckdb_delete_callback_t delete_callback = nullptr; +}; + +struct CTableInternalBindInfo { + CTableInternalBindInfo(ClientContext &context, TableFunctionBindInput &input, vector &return_types, + vector &names, CTableBindData &bind_data, CTableFunctionInfo &function_info) + : context(context), input(input), return_types(return_types), names(names), bind_data(bind_data), + function_info(function_info), success(true) { + } + + ClientContext &context; + TableFunctionBindInput &input; + vector &return_types; + vector &names; + CTableBindData &bind_data; + CTableFunctionInfo &function_info; + bool success; + string error; +}; + +struct CTableInitData : public FunctionOperatorData { + ~CTableInitData() { + if (init_data && delete_callback) { + delete_callback(init_data); + } + init_data = nullptr; + delete_callback = nullptr; + } + + void *init_data = nullptr; + duckdb_delete_callback_t delete_callback = nullptr; +}; + +struct CTableInternalInitInfo { + CTableInternalInitInfo(CTableBindData &bind_data, CTableInitData &init_data, const vector &column_ids, + TableFilterCollection *filters) + : bind_data(bind_data), init_data(init_data), column_ids(column_ids), filters(filters), success(true) { + } + + CTableBindData &bind_data; + CTableInitData &init_data; + const vector &column_ids; + TableFilterCollection *filters; + bool success; + string error; +}; + +struct CTableInternalFunctionInfo { + CTableInternalFunctionInfo(CTableBindData &bind_data, CTableInitData &init_data) + : bind_data(bind_data), init_data(init_data), success(true) { + } + + CTableBindData &bind_data; + CTableInitData &init_data; + bool success; + string error; +}; + +unique_ptr CTableFunctionBind(ClientContext &context, TableFunctionBindInput &input, + vector &return_types, vector &names) { + auto info = (CTableFunctionInfo *)input.info; + D_ASSERT(info->bind && info->function && info->init); + auto result = make_unique(); + CTableInternalBindInfo bind_info(context, input, return_types, names, *result, *info); + info->bind(&bind_info); + if (!bind_info.success) { + throw Exception(bind_info.error); + } + + result->info = info; + return move(result); +} + +unique_ptr CTableFunctionInit(ClientContext &context, const FunctionData *bind_data_p, + const vector &column_ids, + TableFilterCollection *filters) { + auto &bind_data = (CTableBindData &)*bind_data_p; + auto result = make_unique(); + + CTableInternalInitInfo init_info(bind_data, *result, column_ids, filters); + bind_data.info->init(&init_info); + if (!init_info.success) { + throw Exception(init_info.error); + } + return move(result); +} + +void CTableFunction(ClientContext &context, const FunctionData *bind_data_p, FunctionOperatorData *operator_state, + DataChunk *input, DataChunk &output) { + auto &bind_data = (CTableBindData &)*bind_data_p; + auto &init_data = (CTableInitData &)*operator_state; + CTableInternalFunctionInfo function_info(bind_data, init_data); + bind_data.info->function(&function_info, &output); + if (!function_info.success) { + throw Exception(function_info.error); + } +} + +} // namespace duckdb + +//===--------------------------------------------------------------------===// +// Table Function +//===--------------------------------------------------------------------===// +duckdb_table_function duckdb_create_table_function() { + auto function = new duckdb::TableFunction("", {}, duckdb::CTableFunction, duckdb::CTableFunctionBind, + duckdb::CTableFunctionInit); + function->function_info = duckdb::make_shared(); + return function; +} + +void duckdb_destroy_table_function(duckdb_table_function *function) { + if (function && *function) { + auto tf = (duckdb::TableFunction *)*function; + delete tf; + *function = nullptr; + } +} + +void duckdb_table_function_set_name(duckdb_table_function function, const char *name) { + if (!function || !name) { + return; + } + auto tf = (duckdb::TableFunction *)function; + tf->name = name; +} + +void duckdb_table_function_add_parameter(duckdb_table_function function, duckdb_logical_type type) { + if (!function || !type) { + return; + } + auto tf = (duckdb::TableFunction *)function; + auto logical_type = (duckdb::LogicalType *)type; + tf->arguments.push_back(*logical_type); +} + +void duckdb_table_function_set_extra_info(duckdb_table_function function, void *extra_info, + duckdb_delete_callback_t destroy) { + if (!function) { + return; + } + auto tf = (duckdb::TableFunction *)function; + auto info = (duckdb::CTableFunctionInfo *)tf->function_info.get(); + info->extra_info = extra_info; + info->delete_callback = destroy; +} + +void duckdb_table_function_set_bind(duckdb_table_function function, duckdb_table_function_bind_t bind) { + if (!function || !bind) { + return; + } + auto tf = (duckdb::TableFunction *)function; + auto info = (duckdb::CTableFunctionInfo *)tf->function_info.get(); + info->bind = bind; +} + +void duckdb_table_function_set_init(duckdb_table_function function, duckdb_table_function_init_t init) { + if (!function || !init) { + return; + } + auto tf = (duckdb::TableFunction *)function; + auto info = (duckdb::CTableFunctionInfo *)tf->function_info.get(); + info->init = init; +} + +void duckdb_table_function_set_function(duckdb_table_function table_function, duckdb_table_function_t function) { + if (!table_function || !function) { + return; + } + auto tf = (duckdb::TableFunction *)table_function; + auto info = (duckdb::CTableFunctionInfo *)tf->function_info.get(); + info->function = function; +} + +void duckdb_table_function_supports_projection_pushdown(duckdb_table_function table_function, bool pushdown) { + if (!table_function) { + return; + } + auto tf = (duckdb::TableFunction *)table_function; + tf->projection_pushdown = pushdown; +} + +duckdb_state duckdb_register_table_function(duckdb_connection connection, duckdb_table_function function) { + if (!connection || !function) { + return DuckDBError; + } + auto con = (duckdb::Connection *)connection; + auto tf = (duckdb::TableFunction *)function; + auto info = (duckdb::CTableFunctionInfo *)tf->function_info.get(); + if (tf->name.empty() || !info->bind || !info->init || !info->function) { + return DuckDBError; + } + con->context->RunFunctionInTransaction([&]() { + auto &catalog = duckdb::Catalog::GetCatalog(*con->context); + duckdb::CreateTableFunctionInfo tf_info(*tf); + + // create the function in the catalog + catalog.CreateTableFunction(*con->context, &tf_info); + }); + return DuckDBSuccess; +} + +//===--------------------------------------------------------------------===// +// Bind Interface +//===--------------------------------------------------------------------===// +void *duckdb_bind_get_extra_info(duckdb_bind_info info) { + if (!info) { + return nullptr; + } + auto bind_info = (duckdb::CTableInternalBindInfo *)info; + return bind_info->function_info.extra_info; +} + +void duckdb_bind_add_result_column(duckdb_bind_info info, const char *name, duckdb_logical_type type) { + if (!info || !name || !type) { + return; + } + auto bind_info = (duckdb::CTableInternalBindInfo *)info; + bind_info->names.push_back(name); + bind_info->return_types.push_back(*((duckdb::LogicalType *)type)); +} + +idx_t duckdb_bind_get_parameter_count(duckdb_bind_info info) { + if (!info) { + return 0; + } + auto bind_info = (duckdb::CTableInternalBindInfo *)info; + return bind_info->input.inputs.size(); +} + +duckdb_value duckdb_bind_get_parameter(duckdb_bind_info info, idx_t index) { + if (!info || index >= duckdb_bind_get_parameter_count(info)) { + return nullptr; + } + auto bind_info = (duckdb::CTableInternalBindInfo *)info; + return new duckdb::Value(bind_info->input.inputs[index]); +} + +void duckdb_bind_set_bind_data(duckdb_bind_info info, void *bind_data, duckdb_delete_callback_t destroy) { + if (!info) { + return; + } + auto bind_info = (duckdb::CTableInternalBindInfo *)info; + bind_info->bind_data.bind_data = bind_data; + bind_info->bind_data.delete_callback = destroy; +} + +void duckdb_bind_set_error(duckdb_bind_info info, const char *error) { + if (!info || !error) { + return; + } + auto function_info = (duckdb::CTableInternalBindInfo *)info; + function_info->error = error; + function_info->success = false; +} + +//===--------------------------------------------------------------------===// +// Init Interface +//===--------------------------------------------------------------------===// +void *duckdb_init_get_extra_info(duckdb_init_info info) { + if (!info) { + return nullptr; + } + auto init_info = (duckdb::CTableInternalInitInfo *)info; + return init_info->bind_data.info->extra_info; +} + +void *duckdb_init_get_bind_data(duckdb_init_info info) { + if (!info) { + return nullptr; + } + auto init_info = (duckdb::CTableInternalInitInfo *)info; + return init_info->bind_data.bind_data; +} + +void duckdb_init_set_init_data(duckdb_init_info info, void *init_data, duckdb_delete_callback_t destroy) { + if (!info) { + return; + } + auto init_info = (duckdb::CTableInternalInitInfo *)info; + init_info->init_data.init_data = init_data; + init_info->init_data.delete_callback = destroy; +} + +void duckdb_init_set_error(duckdb_init_info info, const char *error) { + if (!info || !error) { + return; + } + auto function_info = (duckdb::CTableInternalInitInfo *)info; + function_info->error = error; + function_info->success = false; +} + +idx_t duckdb_init_get_column_count(duckdb_init_info info) { + if (!info) { + return 0; + } + auto function_info = (duckdb::CTableInternalInitInfo *)info; + return function_info->column_ids.size(); +} + +idx_t duckdb_init_get_column_index(duckdb_init_info info, idx_t column_index) { + if (!info) { + return 0; + } + auto function_info = (duckdb::CTableInternalInitInfo *)info; + if (column_index >= function_info->column_ids.size()) { + return 0; + } + return function_info->column_ids[column_index]; +} + +//===--------------------------------------------------------------------===// +// Function Interface +//===--------------------------------------------------------------------===// +void *duckdb_function_get_extra_info(duckdb_function_info info) { + if (!info) { + return nullptr; + } + auto function_info = (duckdb::CTableInternalFunctionInfo *)info; + return function_info->bind_data.info->extra_info; +} + +void *duckdb_function_get_bind_data(duckdb_function_info info) { + if (!info) { + return nullptr; + } + auto function_info = (duckdb::CTableInternalFunctionInfo *)info; + return function_info->bind_data.bind_data; +} + +void *duckdb_function_get_init_data(duckdb_function_info info) { + if (!info) { + return nullptr; + } + auto function_info = (duckdb::CTableInternalFunctionInfo *)info; + return function_info->init_data.init_data; +} + +void duckdb_function_set_error(duckdb_function_info info, const char *error) { + if (!info || !error) { + return; + } + auto function_info = (duckdb::CTableInternalFunctionInfo *)info; + function_info->error = error; + function_info->success = false; } @@ -102067,14 +110335,32 @@ using duckdb::UnsafeFetch; template RESULT_TYPE TryCastCInternal(duckdb_result *result, idx_t col, idx_t row) { RESULT_TYPE result_value; - if (!OP::template Operation(UnsafeFetch(result, col, row), result_value)) { + try { + if (!OP::template Operation(UnsafeFetch(result, col, row), + result_value)) { + return FetchDefaultValue::Operation(); + } + } catch (...) { return FetchDefaultValue::Operation(); } return result_value; } +static bool CanUseDeprecatedFetch(duckdb_result *result, idx_t col, idx_t row) { + if (!result) { + return false; + } + if (!duckdb::deprecated_materialize_result(result)) { + return false; + } + if (col >= result->__deprecated_column_count || row >= result->__deprecated_row_count) { + return false; + } + return true; +} + static bool CanFetchValue(duckdb_result *result, idx_t col, idx_t row) { - if (!result || col >= result->__deprecated_column_count || row >= result->__deprecated_row_count) { + if (!CanUseDeprecatedFetch(result, col, row)) { return false; } if (result->__deprecated_columns[col].__deprecated_nullmask[row]) { @@ -102119,6 +110405,8 @@ static RESULT_TYPE GetInternalCValue(duckdb_result *result, idx_t col, idx_t row return TryCastCInternal(result, col, row); case DUCKDB_TYPE_HUGEINT: return TryCastCInternal(result, col, row); + case DUCKDB_TYPE_DECIMAL: + return TryCastCInternal(result, col, row); case DUCKDB_TYPE_INTERVAL: return TryCastCInternal(result, col, row); case DUCKDB_TYPE_VARCHAR: @@ -102155,6 +110443,18 @@ int64_t duckdb_value_int64(duckdb_result *result, idx_t col, idx_t row) { return GetInternalCValue(result, col, row); } +duckdb_decimal duckdb_value_decimal(duckdb_result *result, idx_t col, idx_t row) { + duckdb_decimal result_value; + + auto result_data = (duckdb::DuckDBResultData *)result->internal_data; + result_data->result->types[col].GetDecimalProperties(result_value.width, result_value.scale); + + auto internal_value = GetInternalCValue(result, col, row); + result_value.value.lower = internal_value.lower; + result_value.value.upper = internal_value.upper; + return result_value; +} + duckdb_hugeint duckdb_value_hugeint(duckdb_result *result, idx_t col, idx_t row) { duckdb_hugeint result_value; auto internal_value = GetInternalCValue(result, col, row); @@ -102242,12 +110542,13 @@ duckdb_blob duckdb_value_blob(duckdb_result *result, idx_t col, idx_t row) { } bool duckdb_value_is_null(duckdb_result *result, idx_t col, idx_t row) { - if (!result || col >= result->__deprecated_column_count || row >= result->__deprecated_row_count) { + if (!CanUseDeprecatedFetch(result, col, row)) { return false; } return result->__deprecated_columns[col].__deprecated_nullmask[row]; } + //===----------------------------------------------------------------------===// // DuckDB // @@ -102502,67 +110803,6 @@ class DropStatement : public SQLStatement { } // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/statement/execute_statement.hpp -// -// -//===----------------------------------------------------------------------===// - - - - - - - -namespace duckdb { - -class ExecuteStatement : public SQLStatement { -public: - ExecuteStatement(); - - string name; - vector> values; - -protected: - ExecuteStatement(const ExecuteStatement &other); - -public: - unique_ptr Copy() const override; -}; -} // namespace duckdb - - -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/statement/prepare_statement.hpp -// -// -//===----------------------------------------------------------------------===// - - - - - - -namespace duckdb { - -class PrepareStatement : public SQLStatement { -public: - PrepareStatement(); - - unique_ptr statement; - string name; - -protected: - PrepareStatement(const PrepareStatement &other); - -public: - unique_ptr Copy() const override; -}; -} // namespace duckdb @@ -102726,7 +110966,6 @@ class PragmaHandler { - namespace duckdb { struct ActiveQueryContext { @@ -103444,7 +111683,7 @@ string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query, D_ASSERT(orig_expr_list.size() == de_expr_list.size() && cp_expr_list.size() == de_expr_list.size()); for (idx_t i = 0; i < orig_expr_list.size(); i++) { // run the ToString, to verify that it doesn't crash - orig_expr_list[i]->ToString(); + auto str = orig_expr_list[i]->ToString(); // check that the expressions are equivalent D_ASSERT(orig_expr_list[i]->Equals(de_expr_list[i].get())); D_ASSERT(orig_expr_list[i]->Equals(cp_expr_list[i].get())); @@ -103454,6 +111693,17 @@ string ClientContext::VerifyQuery(ClientContextLock &lock, const string &query, D_ASSERT(orig_expr_list[i]->Hash() == cp_expr_list[i]->Hash()); D_ASSERT(!orig_expr_list[i]->Equals(nullptr)); + orig_expr_list[i]->Verify(); + de_expr_list[i]->Verify(); + cp_expr_list[i]->Verify(); + + // ToString round trip + if (orig_expr_list[i]->HasSubquery()) { + continue; + } + auto parsed_list = Parser::ParseExpressionList(str); + D_ASSERT(parsed_list.size() == 1); + D_ASSERT(parsed_list[0]->Equals(orig_expr_list[i].get())); } // now perform additional checking within the expressions for (idx_t outer_idx = 0; outer_idx < orig_expr_list.size(); outer_idx++) { @@ -104255,7 +112505,7 @@ class SelectStatement; class QueryRelation : public Relation { public: - QueryRelation(ClientContext &context, unique_ptr select_stmt, string alias); + QueryRelation(const std::shared_ptr &context, unique_ptr select_stmt, string alias); ~QueryRelation(); unique_ptr select_stmt; @@ -104293,8 +112543,8 @@ namespace duckdb { class ReadCSVRelation : public Relation { public: - ReadCSVRelation(ClientContext &context, string csv_file, vector columns, bool auto_detect = false, - string alias = string()); + ReadCSVRelation(const std::shared_ptr &context, string csv_file, vector columns, + bool auto_detect = false, string alias = string()); string csv_file; bool auto_detect; @@ -104328,7 +112578,7 @@ namespace duckdb { class TableRelation : public Relation { public: - TableRelation(ClientContext &context, unique_ptr description); + TableRelation(const std::shared_ptr &context, unique_ptr description); unique_ptr description; @@ -104363,10 +112613,10 @@ namespace duckdb { class TableFunctionRelation : public Relation { public: - TableFunctionRelation(ClientContext &context, string name, vector parameters, + TableFunctionRelation(const std::shared_ptr &context, string name, vector parameters, named_parameter_map_t named_parameters, shared_ptr input_relation_p = nullptr); - TableFunctionRelation(ClientContext &context, string name, vector parameters, + TableFunctionRelation(const std::shared_ptr &context, string name, vector parameters, shared_ptr input_relation_p = nullptr); string name; @@ -104403,9 +112653,10 @@ namespace duckdb { class ValueRelation : public Relation { public: - ValueRelation(ClientContext &context, const vector> &values, vector names, + ValueRelation(const std::shared_ptr &context, const vector> &values, + vector names, string alias = "values"); + ValueRelation(const std::shared_ptr &context, const string &values, vector names, string alias = "values"); - ValueRelation(ClientContext &context, const string &values, vector names, string alias = "values"); vector>> expressions; vector names; @@ -104440,7 +112691,7 @@ namespace duckdb { class ViewRelation : public Relation { public: - ViewRelation(ClientContext &context, string schema_name, string view_name); + ViewRelation(const std::shared_ptr &context, string schema_name, string view_name); string schema_name; string view_name; @@ -104485,21 +112736,26 @@ class ConnectionManager { void AddConnection(ClientContext &context) { lock_guard lock(connections_lock); - connections.push_back(weak_ptr(context.shared_from_this())); + connections.insert(make_pair(&context, weak_ptr(context.shared_from_this()))); + } + + void RemoveConnection(ClientContext &context) { + lock_guard lock(connections_lock); + connections.erase(&context); } vector> GetConnectionList() { vector> result; - for (size_t i = 0; i < connections.size(); i++) { - auto connection = connections[i].lock(); + for (auto &it : connections) { + auto connection = it.second.lock(); if (!connection) { - connections.erase(connections.begin() + i); - i--; + connections.erase(it.first); continue; } else { result.push_back(move(connection)); } } + return result; } @@ -104508,7 +112764,7 @@ class ConnectionManager { public: mutex connections_lock; - vector> connections; + unordered_map> connections; }; } // namespace duckdb @@ -104527,6 +112783,10 @@ Connection::Connection(DatabaseInstance &database) : context(make_shareddb).RemoveConnection(*context); +} + string Connection::GetProfilingInformation(ProfilerPrintFormat format) { auto &profiler = QueryProfiler::Get(*context); if (format == ProfilerPrintFormat::JSON) { @@ -104635,7 +112895,7 @@ shared_ptr Connection::Table(const string &schema_name, const string & if (!table_info) { throw Exception("Table does not exist!"); } - return make_shared(*context, move(table_info)); + return make_shared(context, move(table_info)); } shared_ptr Connection::View(const string &tname) { @@ -104643,7 +112903,7 @@ shared_ptr Connection::View(const string &tname) { } shared_ptr Connection::View(const string &schema_name, const string &table_name) { - return make_shared(*context, schema_name, table_name); + return make_shared(context, schema_name, table_name); } shared_ptr Connection::TableFunction(const string &fname) { @@ -104654,11 +112914,11 @@ shared_ptr Connection::TableFunction(const string &fname) { shared_ptr Connection::TableFunction(const string &fname, const vector &values, const named_parameter_map_t &named_parameters) { - return make_shared(*context, fname, values, named_parameters); + return make_shared(context, fname, values, named_parameters); } shared_ptr Connection::TableFunction(const string &fname, const vector &values) { - return make_shared(*context, fname, values); + return make_shared(context, fname, values); } shared_ptr Connection::Values(const vector> &values) { @@ -104668,7 +112928,7 @@ shared_ptr Connection::Values(const vector> &values) { shared_ptr Connection::Values(const vector> &values, const vector &column_names, const string &alias) { - return make_shared(*context, values, column_names, alias); + return make_shared(context, values, column_names, alias); } shared_ptr Connection::Values(const string &values) { @@ -104677,7 +112937,7 @@ shared_ptr Connection::Values(const string &values) { } shared_ptr Connection::Values(const string &values, const vector &column_names, const string &alias) { - return make_shared(*context, values, column_names, alias); + return make_shared(context, values, column_names, alias); } shared_ptr Connection::ReadCSV(const string &csv_file) { @@ -104689,7 +112949,7 @@ shared_ptr Connection::ReadCSV(const string &csv_file) { for (idx_t i = 0; i < reader.sql_types.size(); i++) { column_list.emplace_back(reader.col_names[i], reader.sql_types[i]); } - return make_shared(*context, csv_file, move(column_list), true); + return make_shared(context, csv_file, move(column_list), true); } shared_ptr Connection::ReadCSV(const string &csv_file, const vector &columns) { @@ -104702,19 +112962,19 @@ shared_ptr Connection::ReadCSV(const string &csv_file, const vector(*context, csv_file, move(column_list)); + return make_shared(context, csv_file, move(column_list)); } unordered_set Connection::GetTableNames(const string &query) { return context->GetTableNames(query); } -shared_ptr Connection::RelationFromQuery(const string &query, string alias, const string &error) { - return RelationFromQuery(QueryRelation::ParseStatement(*context, query, error), move(alias)); +shared_ptr Connection::RelationFromQuery(const string &query, const string &alias, const string &error) { + return RelationFromQuery(QueryRelation::ParseStatement(*context, query, error), alias); } -shared_ptr Connection::RelationFromQuery(unique_ptr select_stmt, string alias) { - return make_shared(*context, move(select_stmt), move(alias)); +shared_ptr Connection::RelationFromQuery(unique_ptr select_stmt, const string &alias) { + return make_shared(context, move(select_stmt), alias); } void Connection::BeginTransaction() { @@ -105071,38 +113331,51 @@ void DuckDB::SetExtensionLoaded(const std::string &name) { -#ifdef BUILD_ICU_EXTENSION +#if defined(BUILD_ICU_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) #include "icu-extension.hpp" #endif -#ifdef BUILD_PARQUET_EXTENSION +#if defined(BUILD_PARQUET_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) #include "parquet-extension.hpp" #endif -#ifdef BUILD_TPCH_EXTENSION +#if defined(BUILD_TPCH_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) #include "tpch-extension.hpp" #endif -#ifdef BUILD_TPCDS_EXTENSION +#if defined(BUILD_TPCDS_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) #include "tpcds-extension.hpp" #endif -#ifdef BUILD_FTS_EXTENSION +#if defined(BUILD_SUBSTRAIT_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) +#include "substrait-extension.hpp" +#endif + +#if defined(BUILD_FTS_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) #include "fts-extension.hpp" #endif -#ifdef BUILD_HTTPFS_EXTENSION +#if defined(BUILD_HTTPFS_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) #include "httpfs-extension.hpp" #endif -#ifdef BUILD_VISUALIZER_EXTENSION +#if defined(BUILD_VISUALIZER_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) #include "visualizer-extension.hpp" #endif +#if defined(BUILD_JSON_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) +#include "json-extension.hpp" +#endif + +#if defined(BUILD_EXCEL_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) +#include "excel-extension.hpp" +#endif + namespace duckdb { void ExtensionHelper::LoadAllExtensions(DuckDB &db) { - unordered_set extensions {"parquet", "icu", "tpch", "tpcds", "fts", "httpfs", "visualizer"}; + unordered_set extensions {"parquet", "icu", "tpch", "tpcds", "fts", + "httpfs", "substrait", "visualizer", "json", "excel"}; for (auto &ext : extensions) { LoadExtensionInternal(db, ext, true); } @@ -105134,52 +113407,74 @@ ExtensionLoadResult ExtensionHelper::LoadExtensionInternal(DuckDB &db, const std } #endif if (extension == "parquet") { -#ifdef BUILD_PARQUET_EXTENSION +#if defined(BUILD_PARQUET_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) db.LoadExtension(); #else // parquet extension required but not build: skip this test return ExtensionLoadResult::NOT_LOADED; #endif } else if (extension == "icu") { -#ifdef BUILD_ICU_EXTENSION +#if defined(BUILD_ICU_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) db.LoadExtension(); #else // icu extension required but not build: skip this test return ExtensionLoadResult::NOT_LOADED; #endif } else if (extension == "tpch") { -#ifdef BUILD_TPCH_EXTENSION +#if defined(BUILD_TPCH_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) db.LoadExtension(); #else // icu extension required but not build: skip this test return ExtensionLoadResult::NOT_LOADED; +#endif + } else if (extension == "substrait") { +#if defined(BUILD_SUBSTRAIT_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) + + db.LoadExtension(); +#else + // substrait extension required but not build: skip this test + return ExtensionLoadResult::NOT_LOADED; #endif } else if (extension == "tpcds") { -#ifdef BUILD_TPCDS_EXTENSION +#if defined(BUILD_TPCDS_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) db.LoadExtension(); #else // icu extension required but not build: skip this test return ExtensionLoadResult::NOT_LOADED; #endif } else if (extension == "fts") { -#ifdef BUILD_FTS_EXTENSION +#if defined(BUILD_FTS_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) db.LoadExtension(); #else // fts extension required but not build: skip this test return ExtensionLoadResult::NOT_LOADED; #endif } else if (extension == "httpfs") { -#ifdef BUILD_HTTPFS_EXTENSION +#if defined(BUILD_HTTPFS_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) db.LoadExtension(); #else return ExtensionLoadResult::NOT_LOADED; #endif } else if (extension == "visualizer") { -#ifdef BUILD_VISUALIZER_EXTENSION +#if defined(BUILD_VISUALIZER_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) db.LoadExtension(); #else // visualizer extension required but not build: skip this test return ExtensionLoadResult::NOT_LOADED; +#endif + } else if (extension == "json") { +#if defined(BUILD_JSON_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) + db.LoadExtension(); +#else + // json extension required but not build: skip this test + return ExtensionLoadResult::NOT_LOADED; +#endif + } else if (extension == "excel") { +#if defined(BUILD_EXCEL_EXTENSION) && !defined(DISABLE_BUILTIN_EXTENSIONS) + db.LoadExtension(); +#else + // excel extension required but not build: skip this test + return ExtensionLoadResult::NOT_LOADED; #endif } else { // unknown extension @@ -105196,13 +113491,17 @@ ExtensionLoadResult ExtensionHelper::LoadExtensionInternal(DuckDB &db, const std // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #7 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #8 // See the end of this file for a list +// taken from: https://github.com/yhirose/cpp-httplib/blob/v0.10.2/httplib.h +// Note: some modifications are made to file + + // // httplib.hpp // -// Copyright (c) 2020 Yuji Hirose. All rights reserved. +// Copyright (c) 2021 Yuji Hirose. All rights reserved. // MIT License // @@ -105266,6 +113565,10 @@ ExtensionLoadResult ExtensionHelper::LoadExtensionInternal(DuckDB &db, const std #define CPPHTTPLIB_REQUEST_URI_MAX_LENGTH 8192 #endif +#ifndef CPPHTTPLIB_HEADER_MAX_LENGTH +#define CPPHTTPLIB_HEADER_MAX_LENGTH 8192 +#endif + #ifndef CPPHTTPLIB_REDIRECT_MAX_COUNT #define CPPHTTPLIB_REDIRECT_MAX_COUNT 20 #endif @@ -105301,6 +113604,10 @@ ExtensionLoadResult ExtensionHelper::LoadExtensionInternal(DuckDB &db, const std #define CPPHTTPLIB_SEND_FLAGS 0 #endif +#ifndef CPPHTTPLIB_LISTEN_BACKLOG +#define CPPHTTPLIB_LISTEN_BACKLOG 5 +#endif + /* * Headers */ @@ -105387,7 +113694,9 @@ using socket_t = SOCKET; #include using socket_t = int; +#ifndef INVALID_SOCKET #define INVALID_SOCKET (-1) +#endif #endif //_WIN32 #include @@ -105408,13 +113717,24 @@ using socket_t = int; #include #include #include -#include +#include #include #include #include #include + + #ifdef CPPHTTPLIB_OPENSSL_SUPPORT +// these are defined in wincrypt.h and it breaks compilation if BoringSSL is +// used +#ifdef _WIN32 +#undef X509_NAME +#undef X509_CERT_PAIR +#undef X509_EXTENSIONS +#undef PKCS7_SIGNER_INFO +#endif + #include #include #include @@ -105427,11 +113747,15 @@ using socket_t = int; #include #include +// Disabled OpenSSL version check for CI +//#if OPENSSL_VERSION_NUMBER < 0x1010100fL +//#error Sorry, OpenSSL versions prior to 1.1.1 are not supported +//#endif #if OPENSSL_VERSION_NUMBER < 0x10100000L #include inline const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *asn1) { - return M_ASN1_STRING_data(asn1); + return M_ASN1_STRING_data(asn1); } #endif #endif @@ -105467,25 +113791,25 @@ namespace detail { template typename std::enable_if::value, std::unique_ptr>::type -make_unique(Args &&... args) { - return std::unique_ptr(new T(std::forward(args)...)); +make_unique(Args &&...args) { + return std::unique_ptr(new T(std::forward(args)...)); } template typename std::enable_if::value, std::unique_ptr>::type make_unique(std::size_t n) { - typedef typename std::remove_extent::type RT; - return std::unique_ptr(new RT[n]); + typedef typename std::remove_extent::type RT; + return std::unique_ptr(new RT[n]); } struct ci { - bool operator()(const std::string &s1, const std::string &s2) const { - return std::lexicographical_compare(s1.begin(), s1.end(), s2.begin(), - s2.end(), - [](unsigned char c1, unsigned char c2) { - return ::tolower(c1) < ::tolower(c2); - }); - } + bool operator()(const std::string &s1, const std::string &s2) const { + return std::lexicographical_compare(s1.begin(), s1.end(), s2.begin(), + s2.end(), + [](unsigned char c1, unsigned char c2) { + return ::tolower(c1) < ::tolower(c2); + }); + } }; } // namespace detail @@ -105493,7 +113817,8 @@ struct ci { using Headers = std::multimap; using Params = std::multimap; -using Match = std::smatch; +using Match = duckdb_re2::Match; +using Regex = duckdb_re2::Regex; using Progress = std::function; @@ -105501,44 +113826,44 @@ struct Response; using ResponseHandler = std::function; struct MultipartFormData { - std::string name; - std::string content; - std::string filename; - std::string content_type; + std::string name; + std::string content; + std::string filename; + std::string content_type; }; using MultipartFormDataItems = std::vector; using MultipartFormDataMap = std::multimap; class DataSink { public: - DataSink() : os(&sb_), sb_(*this) {} + DataSink() : os(&sb_), sb_(*this) {} - DataSink(const DataSink &) = delete; - DataSink &operator=(const DataSink &) = delete; - DataSink(DataSink &&) = delete; - DataSink &operator=(DataSink &&) = delete; + DataSink(const DataSink &) = delete; + DataSink &operator=(const DataSink &) = delete; + DataSink(DataSink &&) = delete; + DataSink &operator=(DataSink &&) = delete; - std::function write; - std::function done; - std::function is_writable; - std::ostream os; + std::function write; + std::function done; + std::function is_writable; + std::ostream os; private: - class data_sink_streambuf : public std::streambuf { - public: - explicit data_sink_streambuf(DataSink &sink) : sink_(sink) {} + class data_sink_streambuf : public std::streambuf { + public: + explicit data_sink_streambuf(DataSink &sink) : sink_(sink) {} - protected: - std::streamsize xsputn(const char *s, std::streamsize n) { - sink_.write(s, static_cast(n)); - return n; - } + protected: + std::streamsize xsputn(const char *s, std::streamsize n) { + sink_.write(s, static_cast(n)); + return n; + } - private: - DataSink &sink_; - }; + private: + DataSink &sink_; + }; - data_sink_streambuf sb_; + data_sink_streambuf sb_; }; using ContentProvider = @@ -105547,6 +113872,8 @@ using ContentProvider = using ContentProviderWithoutLength = std::function; +using ContentProviderResourceReleaser = std::function; + using ContentReceiverWithProgress = std::function; @@ -105559,1702 +113886,2187 @@ using MultipartContentHeader = class ContentReader { public: - using Reader = std::function; - using MultipartReader = std::function; + using Reader = std::function; + using MultipartReader = std::function; - ContentReader(Reader reader, MultipartReader multipart_reader) - : reader_(std::move(reader)), - multipart_reader_(std::move(multipart_reader)) {} + ContentReader(Reader reader, MultipartReader multipart_reader) + : reader_(std::move(reader)), + multipart_reader_(std::move(multipart_reader)) {} - bool operator()(MultipartContentHeader header, - ContentReceiver receiver) const { - return multipart_reader_(std::move(header), std::move(receiver)); - } + bool operator()(MultipartContentHeader header, + ContentReceiver receiver) const { + return multipart_reader_(std::move(header), std::move(receiver)); + } - bool operator()(ContentReceiver receiver) const { - return reader_(std::move(receiver)); - } + bool operator()(ContentReceiver receiver) const { + return reader_(std::move(receiver)); + } - Reader reader_; - MultipartReader multipart_reader_; + Reader reader_; + MultipartReader multipart_reader_; }; using Range = std::pair; using Ranges = std::vector; struct Request { - std::string method; - std::string path; - Headers headers; - std::string body; - - std::string remote_addr; - int remote_port = -1; - - // for server - std::string version; - std::string target; - Params params; - MultipartFormDataMap files; - Ranges ranges; - Match matches; - - // for client + std::string method; + std::string path; + Headers headers; + std::string body; + + std::string remote_addr; + int remote_port = -1; + + // for server + std::string version; + std::string target; + Params params; + MultipartFormDataMap files; + Ranges ranges; + Match matches; + + // for client + ResponseHandler response_handler; + ContentReceiverWithProgress content_receiver; + Progress progress; #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - const SSL *ssl; + const SSL *ssl = nullptr; #endif - bool has_header(const char *key) const; - std::string get_header_value(const char *key, size_t id = 0) const; - template - T get_header_value(const char *key, size_t id = 0) const; - size_t get_header_value_count(const char *key) const; - void set_header(const char *key, const char *val); - void set_header(const char *key, const std::string &val); + bool has_header(const char *key) const; + std::string get_header_value(const char *key, size_t id = 0) const; + template + T get_header_value(const char *key, size_t id = 0) const; + size_t get_header_value_count(const char *key) const; + void set_header(const char *key, const char *val); + void set_header(const char *key, const std::string &val); - bool has_param(const char *key) const; - std::string get_param_value(const char *key, size_t id = 0) const; - size_t get_param_value_count(const char *key) const; + bool has_param(const char *key) const; + std::string get_param_value(const char *key, size_t id = 0) const; + size_t get_param_value_count(const char *key) const; - bool is_multipart_form_data() const; + bool is_multipart_form_data() const; - bool has_file(const char *key) const; - MultipartFormData get_file_value(const char *key) const; + bool has_file(const char *key) const; + MultipartFormData get_file_value(const char *key) const; - // private members... - size_t redirect_count_ = CPPHTTPLIB_REDIRECT_MAX_COUNT; - ResponseHandler response_handler_; - ContentReceiverWithProgress content_receiver_; - size_t content_length_ = 0; - ContentProvider content_provider_; - bool is_chunked_content_provider_ = false; - Progress progress_; - size_t authorization_count_ = 0; + // private members... + size_t redirect_count_ = CPPHTTPLIB_REDIRECT_MAX_COUNT; + size_t content_length_ = 0; + ContentProvider content_provider_; + bool is_chunked_content_provider_ = false; + size_t authorization_count_ = 0; }; struct Response { - std::string version; - int status = -1; - std::string reason; - Headers headers; - std::string body; - std::string location; // Redirect location - - bool has_header(const char *key) const; - std::string get_header_value(const char *key, size_t id = 0) const; - template - T get_header_value(const char *key, size_t id = 0) const; - size_t get_header_value_count(const char *key) const; - void set_header(const char *key, const char *val); - void set_header(const char *key, const std::string &val); - - void set_redirect(const char *url, int status = 302); - void set_redirect(const std::string &url, int status = 302); - void set_content(const char *s, size_t n, const char *content_type); - void set_content(const std::string &s, const char *content_type); - - void set_content_provider( - size_t length, const char *content_type, ContentProvider provider, - const std::function &resource_releaser = nullptr); - - void set_content_provider( - const char *content_type, ContentProviderWithoutLength provider, - const std::function &resource_releaser = nullptr); - - void set_chunked_content_provider( - const char *content_type, ContentProviderWithoutLength provider, - const std::function &resource_releaser = nullptr); - - Response() = default; - Response(const Response &) = default; - Response &operator=(const Response &) = default; - Response(Response &&) = default; - Response &operator=(Response &&) = default; - ~Response() { - if (content_provider_resource_releaser_) { - content_provider_resource_releaser_(); - } - } + std::string version; + int status = -1; + std::string reason; + Headers headers; + std::string body; + std::string location; // Redirect location + + bool has_header(const char *key) const; + std::string get_header_value(const char *key, size_t id = 0) const; + template + T get_header_value(const char *key, size_t id = 0) const; + size_t get_header_value_count(const char *key) const; + void set_header(const char *key, const char *val); + void set_header(const char *key, const std::string &val); - // private members... - size_t content_length_ = 0; - ContentProvider content_provider_; - std::function content_provider_resource_releaser_; - bool is_chunked_content_provider_ = false; + void set_redirect(const char *url, int status = 302); + void set_redirect(const std::string &url, int status = 302); + void set_content(const char *s, size_t n, const char *content_type); + void set_content(const std::string &s, const char *content_type); + + void set_content_provider( + size_t length, const char *content_type, ContentProvider provider, + ContentProviderResourceReleaser resource_releaser = nullptr); + + void set_content_provider( + const char *content_type, ContentProviderWithoutLength provider, + ContentProviderResourceReleaser resource_releaser = nullptr); + + void set_chunked_content_provider( + const char *content_type, ContentProviderWithoutLength provider, + ContentProviderResourceReleaser resource_releaser = nullptr); + + Response() = default; + Response(const Response &) = default; + Response &operator=(const Response &) = default; + Response(Response &&) = default; + Response &operator=(Response &&) = default; + ~Response() { + if (content_provider_resource_releaser_) { + content_provider_resource_releaser_(content_provider_success_); + } + } + + // private members... + size_t content_length_ = 0; + ContentProvider content_provider_; + ContentProviderResourceReleaser content_provider_resource_releaser_; + bool is_chunked_content_provider_ = false; + bool content_provider_success_ = false; }; class Stream { public: - virtual ~Stream() = default; + virtual ~Stream() = default; - virtual bool is_readable() const = 0; - virtual bool is_writable() const = 0; + virtual bool is_readable() const = 0; + virtual bool is_writable() const = 0; - virtual ssize_t read(char *ptr, size_t size) = 0; - virtual ssize_t write(const char *ptr, size_t size) = 0; - virtual void get_remote_ip_and_port(std::string &ip, int &port) const = 0; - virtual socket_t socket() const = 0; + virtual ssize_t read(char *ptr, size_t size) = 0; + virtual ssize_t write(const char *ptr, size_t size) = 0; + virtual void get_remote_ip_and_port(std::string &ip, int &port) const = 0; + virtual socket_t socket() const = 0; - template - ssize_t write_format(const char *fmt, const Args &... args); - ssize_t write(const char *ptr); - ssize_t write(const std::string &s); + template + ssize_t write_format(const char *fmt, const Args &...args); + ssize_t write(const char *ptr); + ssize_t write(const std::string &s); }; class TaskQueue { public: - TaskQueue() = default; - virtual ~TaskQueue() = default; + TaskQueue() = default; + virtual ~TaskQueue() = default; - virtual void enqueue(std::function fn) = 0; - virtual void shutdown() = 0; + virtual void enqueue(std::function fn) = 0; + virtual void shutdown() = 0; - virtual void on_idle(){}; + virtual void on_idle() {} }; class ThreadPool : public TaskQueue { public: - explicit ThreadPool(size_t n) : shutdown_(false) { - while (n) { - threads_.emplace_back(worker(*this)); - n--; - } - } + explicit ThreadPool(size_t n) : shutdown_(false) { + while (n) { + threads_.emplace_back(worker(*this)); + n--; + } + } - ThreadPool(const ThreadPool &) = delete; - ~ThreadPool() override = default; + ThreadPool(const ThreadPool &) = delete; + ~ThreadPool() override = default; - void enqueue(std::function fn) override { - std::unique_lock lock(mutex_); - jobs_.push_back(std::move(fn)); - cond_.notify_one(); - } + void enqueue(std::function fn) override { + std::unique_lock lock(mutex_); + jobs_.push_back(std::move(fn)); + cond_.notify_one(); + } - void shutdown() override { - // Stop all worker threads... - { - std::unique_lock lock(mutex_); - shutdown_ = true; - } + void shutdown() override { + // Stop all worker threads... + { + std::unique_lock lock(mutex_); + shutdown_ = true; + } - cond_.notify_all(); + cond_.notify_all(); - // Join... - for (auto &t : threads_) { - t.join(); - } - } + // Join... + for (auto &t : threads_) { + t.join(); + } + } private: - struct worker { - explicit worker(ThreadPool &pool) : pool_(pool) {} + struct worker { + explicit worker(ThreadPool &pool) : pool_(pool) {} - void operator()() { - for (;;) { - std::function fn; - { - std::unique_lock lock(pool_.mutex_); + void operator()() { + for (;;) { + std::function fn; + { + std::unique_lock lock(pool_.mutex_); - pool_.cond_.wait( - lock, [&] { return !pool_.jobs_.empty() || pool_.shutdown_; }); + pool_.cond_.wait( + lock, [&] { return !pool_.jobs_.empty() || pool_.shutdown_; }); - if (pool_.shutdown_ && pool_.jobs_.empty()) { break; } + if (pool_.shutdown_ && pool_.jobs_.empty()) { break; } - fn = pool_.jobs_.front(); - pool_.jobs_.pop_front(); - } + fn = pool_.jobs_.front(); + pool_.jobs_.pop_front(); + } - assert(true == static_cast(fn)); - fn(); - } - } + assert(true == static_cast(fn)); + fn(); + } + } - ThreadPool &pool_; - }; - friend struct worker; + ThreadPool &pool_; + }; + friend struct worker; - std::vector threads_; - std::list> jobs_; + std::vector threads_; + std::list> jobs_; - bool shutdown_; + bool shutdown_; - std::condition_variable cond_; - std::mutex mutex_; + std::condition_variable cond_; + std::mutex mutex_; }; using Logger = std::function; using SocketOptions = std::function; -inline void default_socket_options(socket_t sock) { - int yes = 1; -#ifdef _WIN32 - setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&yes), - sizeof(yes)); - setsockopt(sock, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, - reinterpret_cast(&yes), sizeof(yes)); -#else -#ifdef SO_REUSEPORT - setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, reinterpret_cast(&yes), - sizeof(yes)); -#else - setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&yes), - sizeof(yes)); -#endif -#endif -} +void default_socket_options(socket_t sock); class Server { public: - using Handler = std::function; + using Handler = std::function; - using ExceptionHandler = - std::function; + using ExceptionHandler = + std::function; - enum class HandlerResponse { - Handled, - Unhandled, - }; - using HandlerWithResponse = - std::function; - - using HandlerWithContentReader = std::function; - - using Expect100ContinueHandler = - std::function; - - Server(); - - virtual ~Server(); - - virtual bool is_valid() const; - - Server &Get(const char *pattern, Handler handler); - Server &Get(const char *pattern, size_t pattern_len, Handler handler); - Server &Post(const char *pattern, Handler handler); - Server &Post(const char *pattern, size_t pattern_len, Handler handler); - Server &Post(const char *pattern, HandlerWithContentReader handler); - Server &Post(const char *pattern, size_t pattern_len, - HandlerWithContentReader handler); - Server &Put(const char *pattern, Handler handler); - Server &Put(const char *pattern, size_t pattern_len, Handler handler); - Server &Put(const char *pattern, HandlerWithContentReader handler); - Server &Put(const char *pattern, size_t pattern_len, - HandlerWithContentReader handler); - Server &Patch(const char *pattern, Handler handler); - Server &Patch(const char *pattern, size_t pattern_len, Handler handler); - Server &Patch(const char *pattern, HandlerWithContentReader handler); - Server &Patch(const char *pattern, size_t pattern_len, - HandlerWithContentReader handler); - Server &Delete(const char *pattern, Handler handler); - Server &Delete(const char *pattern, size_t pattern_len, Handler handler); - Server &Delete(const char *pattern, HandlerWithContentReader handler); - Server &Delete(const char *pattern, size_t pattern_len, - HandlerWithContentReader handler); - Server &Options(const char *pattern, Handler handler); - Server &Options(const char *pattern, size_t pattern_len, Handler handler); - - bool set_base_dir(const char *dir, const char *mount_point = nullptr); - bool set_mount_point(const char *mount_point, const char *dir, - Headers headers = Headers()); - bool remove_mount_point(const char *mount_point); - Server &set_file_extension_and_mimetype_mapping(const char *ext, - const char *mime); - Server &set_file_request_handler(Handler handler); - - Server &set_error_handler(HandlerWithResponse handler); - Server &set_error_handler(Handler handler); - Server &set_exception_handler(ExceptionHandler handler); - Server &set_pre_routing_handler(HandlerWithResponse handler); - Server &set_post_routing_handler(Handler handler); - - Server &set_expect_100_continue_handler(Expect100ContinueHandler handler); - Server &set_logger(Logger logger); - - Server &set_tcp_nodelay(bool on); - Server &set_socket_options(SocketOptions socket_options); - - Server &set_keep_alive_max_count(size_t count); - Server &set_keep_alive_timeout(time_t sec); - Server &set_read_timeout(time_t sec, time_t usec = 0); - Server &set_write_timeout(time_t sec, time_t usec = 0); - Server &set_idle_interval(time_t sec, time_t usec = 0); - - Server &set_payload_max_length(size_t length); - - bool bind_to_port(const char *host, int port, int socket_flags = 0); - int bind_to_any_port(const char *host, int socket_flags = 0); - bool listen_after_bind(); - - bool listen(const char *host, int port, int socket_flags = 0); - - bool is_running() const; - void stop(); - - std::function new_task_queue; + enum class HandlerResponse { + Handled, + Unhandled, + }; + using HandlerWithResponse = + std::function; + + using HandlerWithContentReader = std::function; + + using Expect100ContinueHandler = + std::function; + + Server(); + + virtual ~Server(); + + virtual bool is_valid() const; + + Server &Get(const std::string &pattern, Handler handler); + Server &Post(const std::string &pattern, Handler handler); + Server &Post(const std::string &pattern, HandlerWithContentReader handler); + Server &Put(const std::string &pattern, Handler handler); + Server &Put(const std::string &pattern, HandlerWithContentReader handler); + Server &Patch(const std::string &pattern, Handler handler); + Server &Patch(const std::string &pattern, HandlerWithContentReader handler); + Server &Delete(const std::string &pattern, Handler handler); + Server &Delete(const std::string &pattern, HandlerWithContentReader handler); + Server &Options(const std::string &pattern, Handler handler); + + bool set_base_dir(const std::string &dir, + const std::string &mount_point = std::string()); + bool set_mount_point(const std::string &mount_point, const std::string &dir, + Headers headers = Headers()); + bool remove_mount_point(const std::string &mount_point); + Server &set_file_extension_and_mimetype_mapping(const char *ext, + const char *mime); + Server &set_file_request_handler(Handler handler); + + Server &set_error_handler(HandlerWithResponse handler); + Server &set_error_handler(Handler handler); + Server &set_exception_handler(ExceptionHandler handler); + Server &set_pre_routing_handler(HandlerWithResponse handler); + Server &set_post_routing_handler(Handler handler); + + Server &set_expect_100_continue_handler(Expect100ContinueHandler handler); + Server &set_logger(Logger logger); + + Server &set_address_family(int family); + Server &set_tcp_nodelay(bool on); + Server &set_socket_options(SocketOptions socket_options); + + Server &set_default_headers(Headers headers); + + Server &set_keep_alive_max_count(size_t count); + Server &set_keep_alive_timeout(time_t sec); + + Server &set_read_timeout(time_t sec, time_t usec = 0); + template + Server &set_read_timeout(const std::chrono::duration &duration); + + Server &set_write_timeout(time_t sec, time_t usec = 0); + template + Server &set_write_timeout(const std::chrono::duration &duration); + + Server &set_idle_interval(time_t sec, time_t usec = 0); + template + Server &set_idle_interval(const std::chrono::duration &duration); + + Server &set_payload_max_length(size_t length); + + bool bind_to_port(const char *host, int port, int socket_flags = 0); + int bind_to_any_port(const char *host, int socket_flags = 0); + bool listen_after_bind(); + + bool listen(const char *host, int port, int socket_flags = 0); + + bool is_running() const; + void stop(); + + std::function new_task_queue; protected: - bool process_request(Stream &strm, bool close_connection, - bool &connection_closed, - const std::function &setup_request); - - std::atomic svr_sock_; - size_t keep_alive_max_count_ = CPPHTTPLIB_KEEPALIVE_MAX_COUNT; - time_t keep_alive_timeout_sec_ = CPPHTTPLIB_KEEPALIVE_TIMEOUT_SECOND; - time_t read_timeout_sec_ = CPPHTTPLIB_READ_TIMEOUT_SECOND; - time_t read_timeout_usec_ = CPPHTTPLIB_READ_TIMEOUT_USECOND; - time_t write_timeout_sec_ = CPPHTTPLIB_WRITE_TIMEOUT_SECOND; - time_t write_timeout_usec_ = CPPHTTPLIB_WRITE_TIMEOUT_USECOND; - time_t idle_interval_sec_ = CPPHTTPLIB_IDLE_INTERVAL_SECOND; - time_t idle_interval_usec_ = CPPHTTPLIB_IDLE_INTERVAL_USECOND; - size_t payload_max_length_ = CPPHTTPLIB_PAYLOAD_MAX_LENGTH; + bool process_request(Stream &strm, bool close_connection, + bool &connection_closed, + const std::function &setup_request); + + std::atomic svr_sock_; + size_t keep_alive_max_count_ = CPPHTTPLIB_KEEPALIVE_MAX_COUNT; + time_t keep_alive_timeout_sec_ = CPPHTTPLIB_KEEPALIVE_TIMEOUT_SECOND; + time_t read_timeout_sec_ = CPPHTTPLIB_READ_TIMEOUT_SECOND; + time_t read_timeout_usec_ = CPPHTTPLIB_READ_TIMEOUT_USECOND; + time_t write_timeout_sec_ = CPPHTTPLIB_WRITE_TIMEOUT_SECOND; + time_t write_timeout_usec_ = CPPHTTPLIB_WRITE_TIMEOUT_USECOND; + time_t idle_interval_sec_ = CPPHTTPLIB_IDLE_INTERVAL_SECOND; + time_t idle_interval_usec_ = CPPHTTPLIB_IDLE_INTERVAL_USECOND; + size_t payload_max_length_ = CPPHTTPLIB_PAYLOAD_MAX_LENGTH; private: - using Handlers = std::vector>; - using HandlersForContentReader = - std::vector>; - - socket_t create_server_socket(const char *host, int port, int socket_flags, - SocketOptions socket_options) const; - int bind_internal(const char *host, int port, int socket_flags); - bool listen_internal(); - - bool routing(Request &req, Response &res, Stream &strm); - bool handle_file_request(const Request &req, Response &res, - bool head = false); - bool dispatch_request(Request &req, Response &res, const Handlers &handlers); - bool - dispatch_request_for_content_reader(Request &req, Response &res, - ContentReader content_reader, - const HandlersForContentReader &handlers); - - bool parse_request_line(const char *s, Request &req); - void apply_ranges(const Request &req, Response &res, - std::string &content_type, std::string &boundary); - bool write_response(Stream &strm, bool close_connection, const Request &req, - Response &res); - bool write_response_with_content(Stream &strm, bool close_connection, - const Request &req, Response &res); - bool write_response_core(Stream &strm, bool close_connection, - const Request &req, Response &res, - bool need_apply_ranges); - bool write_content_with_provider(Stream &strm, const Request &req, - Response &res, const std::string &boundary, - const std::string &content_type); - bool read_content(Stream &strm, Request &req, Response &res); - bool - read_content_with_content_receiver(Stream &strm, Request &req, Response &res, - ContentReceiver receiver, - MultipartContentHeader multipart_header, - ContentReceiver multipart_receiver); - bool read_content_core(Stream &strm, Request &req, Response &res, - ContentReceiver receiver, - MultipartContentHeader mulitpart_header, - ContentReceiver multipart_receiver); - - virtual bool process_and_close_socket(socket_t sock); - - struct MountPointEntry { - std::string mount_point; - std::string base_dir; - Headers headers; - }; - std::vector base_dirs_; - - std::atomic is_running_; - std::map file_extension_and_mimetype_map_; - Handler file_request_handler_; - Handlers get_handlers_; - Handlers post_handlers_; - HandlersForContentReader post_handlers_for_content_reader_; - Handlers put_handlers_; - HandlersForContentReader put_handlers_for_content_reader_; - Handlers patch_handlers_; - HandlersForContentReader patch_handlers_for_content_reader_; - Handlers delete_handlers_; - HandlersForContentReader delete_handlers_for_content_reader_; - Handlers options_handlers_; - HandlerWithResponse error_handler_; - ExceptionHandler exception_handler_; - HandlerWithResponse pre_routing_handler_; - Handler post_routing_handler_; - Logger logger_; - Expect100ContinueHandler expect_100_continue_handler_; - - bool tcp_nodelay_ = CPPHTTPLIB_TCP_NODELAY; - SocketOptions socket_options_ = default_socket_options; -}; - -enum Error { - Success = 0, - Unknown, - Connection, - BindIPAddress, - Read, - Write, - ExceedRedirectCount, - Canceled, - SSLConnection, - SSLLoadingCerts, - SSLServerVerification, - UnsupportedMultipartBoundaryChars, - Compression, -}; + using Handlers = std::vector>; + using HandlersForContentReader = + std::vector>; + + socket_t create_server_socket(const char *host, int port, int socket_flags, + SocketOptions socket_options) const; + int bind_internal(const char *host, int port, int socket_flags); + bool listen_internal(); + + bool routing(Request &req, Response &res, Stream &strm); + bool handle_file_request(const Request &req, Response &res, + bool head = false); + bool dispatch_request(Request &req, Response &res, const Handlers &handlers); + bool + dispatch_request_for_content_reader(Request &req, Response &res, + ContentReader content_reader, + const HandlersForContentReader &handlers); + + bool parse_request_line(const char *s, Request &req); + void apply_ranges(const Request &req, Response &res, + std::string &content_type, std::string &boundary); + bool write_response(Stream &strm, bool close_connection, const Request &req, + Response &res); + bool write_response_with_content(Stream &strm, bool close_connection, + const Request &req, Response &res); + bool write_response_core(Stream &strm, bool close_connection, + const Request &req, Response &res, + bool need_apply_ranges); + bool write_content_with_provider(Stream &strm, const Request &req, + Response &res, const std::string &boundary, + const std::string &content_type); + bool read_content(Stream &strm, Request &req, Response &res); + bool + read_content_with_content_receiver(Stream &strm, Request &req, Response &res, + ContentReceiver receiver, + MultipartContentHeader multipart_header, + ContentReceiver multipart_receiver); + bool read_content_core(Stream &strm, Request &req, Response &res, + ContentReceiver receiver, + MultipartContentHeader mulitpart_header, + ContentReceiver multipart_receiver); + + virtual bool process_and_close_socket(socket_t sock); + + struct MountPointEntry { + std::string mount_point; + std::string base_dir; + Headers headers; + }; + std::vector base_dirs_; + + std::atomic is_running_; + std::map file_extension_and_mimetype_map_; + Handler file_request_handler_; + Handlers get_handlers_; + Handlers post_handlers_; + HandlersForContentReader post_handlers_for_content_reader_; + Handlers put_handlers_; + HandlersForContentReader put_handlers_for_content_reader_; + Handlers patch_handlers_; + HandlersForContentReader patch_handlers_for_content_reader_; + Handlers delete_handlers_; + HandlersForContentReader delete_handlers_for_content_reader_; + Handlers options_handlers_; + HandlerWithResponse error_handler_; + ExceptionHandler exception_handler_; + HandlerWithResponse pre_routing_handler_; + Handler post_routing_handler_; + Logger logger_; + Expect100ContinueHandler expect_100_continue_handler_; + + int address_family_ = AF_UNSPEC; + bool tcp_nodelay_ = CPPHTTPLIB_TCP_NODELAY; + SocketOptions socket_options_ = default_socket_options; + + Headers default_headers_; +}; + +enum class Error { + Success = 0, + Unknown, + Connection, + BindIPAddress, + Read, + Write, + ExceedRedirectCount, + Canceled, + SSLConnection, + SSLLoadingCerts, + SSLServerVerification, + UnsupportedMultipartBoundaryChars, + Compression, + ConnectionTimeout, +}; + +std::string to_string(const Error error); + +std::ostream &operator<<(std::ostream &os, const Error &obj); class Result { public: - Result(std::unique_ptr res, Error err) - : res_(std::move(res)), err_(err) {} - operator bool() const { return res_ != nullptr; } - bool operator==(std::nullptr_t) const { return res_ == nullptr; } - bool operator!=(std::nullptr_t) const { return res_ != nullptr; } - const Response &value() const { return *res_; } - Response &value() { return *res_; } - const Response &operator*() const { return *res_; } - Response &operator*() { return *res_; } - const Response *operator->() const { return res_.get(); } - Response *operator->() { return res_.get(); } - Error error() const { return err_; } + Result(std::unique_ptr &&res, Error err, + Headers &&request_headers = Headers{}) + : res_(std::move(res)), err_(err), + request_headers_(std::move(request_headers)) {} + // Response + operator bool() const { return res_ != nullptr; } + bool operator==(std::nullptr_t) const { return res_ == nullptr; } + bool operator!=(std::nullptr_t) const { return res_ != nullptr; } + const Response &value() const { return *res_; } + Response &value() { return *res_; } + const Response &operator*() const { return *res_; } + Response &operator*() { return *res_; } + const Response *operator->() const { return res_.get(); } + Response *operator->() { return res_.get(); } + + // Error + Error error() const { return err_; } + + // Request Headers + bool has_request_header(const char *key) const; + std::string get_request_header_value(const char *key, size_t id = 0) const; + template + T get_request_header_value(const char *key, size_t id = 0) const; + size_t get_request_header_value_count(const char *key) const; private: - std::unique_ptr res_; - Error err_; + std::unique_ptr res_; + Error err_; + Headers request_headers_; }; class ClientImpl { public: - explicit ClientImpl(const std::string &host); - - explicit ClientImpl(const std::string &host, int port); - - explicit ClientImpl(const std::string &host, int port, - const std::string &client_cert_path, - const std::string &client_key_path); - - virtual ~ClientImpl(); - - virtual bool is_valid() const; - - Result Get(const char *path); - Result Get(const char *path, const Headers &headers); - Result Get(const char *path, Progress progress); - Result Get(const char *path, const Headers &headers, Progress progress); - Result Get(const char *path, ContentReceiver content_receiver); - Result Get(const char *path, const Headers &headers, - ContentReceiver content_receiver); - Result Get(const char *path, ContentReceiver content_receiver, - Progress progress); - Result Get(const char *path, const Headers &headers, - ContentReceiver content_receiver, Progress progress); - Result Get(const char *path, ResponseHandler response_handler, - ContentReceiver content_receiver); - Result Get(const char *path, const Headers &headers, - ResponseHandler response_handler, - ContentReceiver content_receiver); - Result Get(const char *path, ResponseHandler response_handler, - ContentReceiver content_receiver, Progress progress); - Result Get(const char *path, const Headers &headers, - ResponseHandler response_handler, ContentReceiver content_receiver, - Progress progress); - - Result Get(const char *path, const Params ¶ms, const Headers &headers, - Progress progress = nullptr); - Result Get(const char *path, const Params ¶ms, const Headers &headers, - ContentReceiver content_receiver, Progress progress = nullptr); - Result Get(const char *path, const Params ¶ms, const Headers &headers, - ResponseHandler response_handler, ContentReceiver content_receiver, - Progress progress = nullptr); - - Result Head(const char *path); - Result Head(const char *path, const Headers &headers); - - Result Post(const char *path); - Result Post(const char *path, const char *body, size_t content_length, - const char *content_type); - Result Post(const char *path, const Headers &headers, const char *body, - size_t content_length, const char *content_type); - Result Post(const char *path, const std::string &body, - const char *content_type); - Result Post(const char *path, const Headers &headers, const std::string &body, - const char *content_type); - Result Post(const char *path, size_t content_length, - ContentProvider content_provider, const char *content_type); - Result Post(const char *path, ContentProviderWithoutLength content_provider, - const char *content_type); - Result Post(const char *path, const Headers &headers, size_t content_length, - ContentProvider content_provider, const char *content_type); - Result Post(const char *path, const Headers &headers, - ContentProviderWithoutLength content_provider, - const char *content_type); - Result Post(const char *path, const Params ¶ms); - Result Post(const char *path, const Headers &headers, const Params ¶ms); - Result Post(const char *path, const MultipartFormDataItems &items); - Result Post(const char *path, const Headers &headers, - const MultipartFormDataItems &items); - Result Post(const char *path, const Headers &headers, - const MultipartFormDataItems &items, const std::string &boundary); - - Result Put(const char *path); - Result Put(const char *path, const char *body, size_t content_length, - const char *content_type); - Result Put(const char *path, const Headers &headers, const char *body, - size_t content_length, const char *content_type); - Result Put(const char *path, const std::string &body, - const char *content_type); - Result Put(const char *path, const Headers &headers, const std::string &body, - const char *content_type); - Result Put(const char *path, size_t content_length, - ContentProvider content_provider, const char *content_type); - Result Put(const char *path, ContentProviderWithoutLength content_provider, - const char *content_type); - Result Put(const char *path, const Headers &headers, size_t content_length, - ContentProvider content_provider, const char *content_type); - Result Put(const char *path, const Headers &headers, - ContentProviderWithoutLength content_provider, - const char *content_type); - Result Put(const char *path, const Params ¶ms); - Result Put(const char *path, const Headers &headers, const Params ¶ms); - - Result Patch(const char *path); - Result Patch(const char *path, const char *body, size_t content_length, - const char *content_type); - Result Patch(const char *path, const Headers &headers, const char *body, - size_t content_length, const char *content_type); - Result Patch(const char *path, const std::string &body, - const char *content_type); - Result Patch(const char *path, const Headers &headers, - const std::string &body, const char *content_type); - Result Patch(const char *path, size_t content_length, - ContentProvider content_provider, const char *content_type); - Result Patch(const char *path, ContentProviderWithoutLength content_provider, - const char *content_type); - Result Patch(const char *path, const Headers &headers, size_t content_length, - ContentProvider content_provider, const char *content_type); - Result Patch(const char *path, const Headers &headers, - ContentProviderWithoutLength content_provider, - const char *content_type); - - Result Delete(const char *path); - Result Delete(const char *path, const Headers &headers); - Result Delete(const char *path, const char *body, size_t content_length, - const char *content_type); - Result Delete(const char *path, const Headers &headers, const char *body, - size_t content_length, const char *content_type); - Result Delete(const char *path, const std::string &body, - const char *content_type); - Result Delete(const char *path, const Headers &headers, - const std::string &body, const char *content_type); - - Result Options(const char *path); - Result Options(const char *path, const Headers &headers); - - bool send(const Request &req, Response &res, Error &error); - Result send(const Request &req); - - size_t is_socket_open() const; - - void stop(); - - void set_default_headers(Headers headers); - - void set_tcp_nodelay(bool on); - void set_socket_options(SocketOptions socket_options); - - void set_connection_timeout(time_t sec, time_t usec = 0); - void set_read_timeout(time_t sec, time_t usec = 0); - void set_write_timeout(time_t sec, time_t usec = 0); - - void set_basic_auth(const char *username, const char *password); - void set_bearer_token_auth(const char *token); + explicit ClientImpl(const std::string &host); + + explicit ClientImpl(const std::string &host, int port); + + explicit ClientImpl(const std::string &host, int port, + const std::string &client_cert_path, + const std::string &client_key_path); + + virtual ~ClientImpl(); + + virtual bool is_valid() const; + + Result Get(const char *path); + Result Get(const char *path, const Headers &headers); + Result Get(const char *path, Progress progress); + Result Get(const char *path, const Headers &headers, Progress progress); + Result Get(const char *path, ContentReceiver content_receiver); + Result Get(const char *path, const Headers &headers, + ContentReceiver content_receiver); + Result Get(const char *path, ContentReceiver content_receiver, + Progress progress); + Result Get(const char *path, const Headers &headers, + ContentReceiver content_receiver, Progress progress); + Result Get(const char *path, ResponseHandler response_handler, + ContentReceiver content_receiver); + Result Get(const char *path, const Headers &headers, + ResponseHandler response_handler, + ContentReceiver content_receiver); + Result Get(const char *path, ResponseHandler response_handler, + ContentReceiver content_receiver, Progress progress); + Result Get(const char *path, const Headers &headers, + ResponseHandler response_handler, ContentReceiver content_receiver, + Progress progress); + + Result Get(const char *path, const Params ¶ms, const Headers &headers, + Progress progress = nullptr); + Result Get(const char *path, const Params ¶ms, const Headers &headers, + ContentReceiver content_receiver, Progress progress = nullptr); + Result Get(const char *path, const Params ¶ms, const Headers &headers, + ResponseHandler response_handler, ContentReceiver content_receiver, + Progress progress = nullptr); + + Result Head(const char *path); + Result Head(const char *path, const Headers &headers); + + Result Post(const char *path); + Result Post(const char *path, const char *body, size_t content_length, + const char *content_type); + Result Post(const char *path, const Headers &headers, const char *body, + size_t content_length, const char *content_type); + Result Post(const char *path, const std::string &body, + const char *content_type); + Result Post(const char *path, const Headers &headers, const std::string &body, + const char *content_type); + Result Post(const char *path, size_t content_length, + ContentProvider content_provider, const char *content_type); + Result Post(const char *path, ContentProviderWithoutLength content_provider, + const char *content_type); + Result Post(const char *path, const Headers &headers, size_t content_length, + ContentProvider content_provider, const char *content_type); + Result Post(const char *path, const Headers &headers, + ContentProviderWithoutLength content_provider, + const char *content_type); + Result Post(const char *path, const Params ¶ms); + Result Post(const char *path, const Headers &headers, const Params ¶ms); + Result Post(const char *path, const MultipartFormDataItems &items); + Result Post(const char *path, const Headers &headers, + const MultipartFormDataItems &items); + Result Post(const char *path, const Headers &headers, + const MultipartFormDataItems &items, const std::string &boundary); + + Result Put(const char *path); + Result Put(const char *path, const char *body, size_t content_length, + const char *content_type); + Result Put(const char *path, const Headers &headers, const char *body, + size_t content_length, const char *content_type); + Result Put(const char *path, const std::string &body, + const char *content_type); + Result Put(const char *path, const Headers &headers, const std::string &body, + const char *content_type); + Result Put(const char *path, size_t content_length, + ContentProvider content_provider, const char *content_type); + Result Put(const char *path, ContentProviderWithoutLength content_provider, + const char *content_type); + Result Put(const char *path, const Headers &headers, size_t content_length, + ContentProvider content_provider, const char *content_type); + Result Put(const char *path, const Headers &headers, + ContentProviderWithoutLength content_provider, + const char *content_type); + Result Put(const char *path, const Params ¶ms); + Result Put(const char *path, const Headers &headers, const Params ¶ms); + + Result Patch(const char *path); + Result Patch(const char *path, const char *body, size_t content_length, + const char *content_type); + Result Patch(const char *path, const Headers &headers, const char *body, + size_t content_length, const char *content_type); + Result Patch(const char *path, const std::string &body, + const char *content_type); + Result Patch(const char *path, const Headers &headers, + const std::string &body, const char *content_type); + Result Patch(const char *path, size_t content_length, + ContentProvider content_provider, const char *content_type); + Result Patch(const char *path, ContentProviderWithoutLength content_provider, + const char *content_type); + Result Patch(const char *path, const Headers &headers, size_t content_length, + ContentProvider content_provider, const char *content_type); + Result Patch(const char *path, const Headers &headers, + ContentProviderWithoutLength content_provider, + const char *content_type); + + Result Delete(const char *path); + Result Delete(const char *path, const Headers &headers); + Result Delete(const char *path, const char *body, size_t content_length, + const char *content_type); + Result Delete(const char *path, const Headers &headers, const char *body, + size_t content_length, const char *content_type); + Result Delete(const char *path, const std::string &body, + const char *content_type); + Result Delete(const char *path, const Headers &headers, + const std::string &body, const char *content_type); + + Result Options(const char *path); + Result Options(const char *path, const Headers &headers); + + bool send(Request &req, Response &res, Error &error); + Result send(const Request &req); + + size_t is_socket_open() const; + + void stop(); + + void set_hostname_addr_map(const std::map addr_map); + + void set_default_headers(Headers headers); + + void set_address_family(int family); + void set_tcp_nodelay(bool on); + void set_socket_options(SocketOptions socket_options); + + void set_connection_timeout(time_t sec, time_t usec = 0); + template + void + set_connection_timeout(const std::chrono::duration &duration); + + void set_read_timeout(time_t sec, time_t usec = 0); + template + void set_read_timeout(const std::chrono::duration &duration); + + void set_write_timeout(time_t sec, time_t usec = 0); + template + void set_write_timeout(const std::chrono::duration &duration); + + void set_basic_auth(const char *username, const char *password); + void set_bearer_token_auth(const char *token); #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - void set_digest_auth(const char *username, const char *password); + void set_digest_auth(const char *username, const char *password); #endif - void set_keep_alive(bool on); - void set_follow_location(bool on); + void set_keep_alive(bool on); + void set_follow_location(bool on); - void set_compress(bool on); + void set_url_encode(bool on); - void set_decompress(bool on); + void set_compress(bool on); - void set_interface(const char *intf); + void set_decompress(bool on); + + void set_interface(const char *intf); + + void set_proxy(const char *host, int port); + void set_proxy_basic_auth(const char *username, const char *password); + void set_proxy_bearer_token_auth(const char *token); +#ifdef CPPHTTPLIB_OPENSSL_SUPPORT + void set_proxy_digest_auth(const char *username, const char *password); +#endif - void set_proxy(const char *host, int port); - void set_proxy_basic_auth(const char *username, const char *password); - void set_proxy_bearer_token_auth(const char *token); #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - void set_proxy_digest_auth(const char *username, const char *password); + void set_ca_cert_path(const char *ca_cert_file_path, + const char *ca_cert_dir_path = nullptr); + void set_ca_cert_store(X509_STORE *ca_cert_store); #endif #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - void enable_server_certificate_verification(bool enabled); + void enable_server_certificate_verification(bool enabled); #endif - void set_logger(Logger logger); + void set_logger(Logger logger); protected: - struct Socket { - socket_t sock = INVALID_SOCKET; + struct Socket { + socket_t sock = INVALID_SOCKET; #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - SSL *ssl = nullptr; + SSL *ssl = nullptr; #endif - bool is_open() const { return sock != INVALID_SOCKET; } - }; + bool is_open() const { return sock != INVALID_SOCKET; } + }; + + Result send_(Request &&req); + + virtual bool create_and_connect_socket(Socket &socket, Error &error); - virtual bool create_and_connect_socket(Socket &socket, Error &error); - - // All of: - // shutdown_ssl - // shutdown_socket - // close_socket - // should ONLY be called when socket_mutex_ is locked. - // Also, shutdown_ssl and close_socket should also NOT be called concurrently - // with a DIFFERENT thread sending requests using that socket. - virtual void shutdown_ssl(Socket &socket, bool shutdown_gracefully); - void shutdown_socket(Socket &socket); - void close_socket(Socket &socket); - - // Similar to shutdown_ssl and close_socket, this should NOT be called - // concurrently with a DIFFERENT thread sending requests from the socket - void lock_socket_and_shutdown_and_close(); - - bool process_request(Stream &strm, const Request &req, Response &res, - bool close_connection, Error &error); - - bool write_content_with_provider(Stream &strm, const Request &req, - Error &error); - - void copy_settings(const ClientImpl &rhs); - - // Socket endoint information - const std::string host_; - const int port_; - const std::string host_and_port_; - - // Current open socket - Socket socket_; - mutable std::mutex socket_mutex_; - std::recursive_mutex request_mutex_; - - // These are all protected under socket_mutex - size_t socket_requests_in_flight_ = 0; - std::thread::id socket_requests_are_from_thread_ = std::thread::id(); - bool socket_should_be_closed_when_request_is_done_ = false; - - // Default headers - Headers default_headers_; - - // Settings - std::string client_cert_path_; - std::string client_key_path_; - - time_t connection_timeout_sec_ = CPPHTTPLIB_CONNECTION_TIMEOUT_SECOND; - time_t connection_timeout_usec_ = CPPHTTPLIB_CONNECTION_TIMEOUT_USECOND; - time_t read_timeout_sec_ = CPPHTTPLIB_READ_TIMEOUT_SECOND; - time_t read_timeout_usec_ = CPPHTTPLIB_READ_TIMEOUT_USECOND; - time_t write_timeout_sec_ = CPPHTTPLIB_WRITE_TIMEOUT_SECOND; - time_t write_timeout_usec_ = CPPHTTPLIB_WRITE_TIMEOUT_USECOND; - - std::string basic_auth_username_; - std::string basic_auth_password_; - std::string bearer_token_auth_token_; + // All of: + // shutdown_ssl + // shutdown_socket + // close_socket + // should ONLY be called when socket_mutex_ is locked. + // Also, shutdown_ssl and close_socket should also NOT be called concurrently + // with a DIFFERENT thread sending requests using that socket. + virtual void shutdown_ssl(Socket &socket, bool shutdown_gracefully); + void shutdown_socket(Socket &socket); + void close_socket(Socket &socket); + + bool process_request(Stream &strm, Request &req, Response &res, + bool close_connection, Error &error); + + bool write_content_with_provider(Stream &strm, const Request &req, + Error &error); + + void copy_settings(const ClientImpl &rhs); + + // Socket endoint information + const std::string host_; + const int port_; + const std::string host_and_port_; + + // Current open socket + Socket socket_; + mutable std::mutex socket_mutex_; + std::recursive_mutex request_mutex_; + + // These are all protected under socket_mutex + size_t socket_requests_in_flight_ = 0; + std::thread::id socket_requests_are_from_thread_ = std::thread::id(); + bool socket_should_be_closed_when_request_is_done_ = false; + + // Hostname-IP map + std::map addr_map_; + + // Default headers + Headers default_headers_; + + // Settings + std::string client_cert_path_; + std::string client_key_path_; + + time_t connection_timeout_sec_ = CPPHTTPLIB_CONNECTION_TIMEOUT_SECOND; + time_t connection_timeout_usec_ = CPPHTTPLIB_CONNECTION_TIMEOUT_USECOND; + time_t read_timeout_sec_ = CPPHTTPLIB_READ_TIMEOUT_SECOND; + time_t read_timeout_usec_ = CPPHTTPLIB_READ_TIMEOUT_USECOND; + time_t write_timeout_sec_ = CPPHTTPLIB_WRITE_TIMEOUT_SECOND; + time_t write_timeout_usec_ = CPPHTTPLIB_WRITE_TIMEOUT_USECOND; + + std::string basic_auth_username_; + std::string basic_auth_password_; + std::string bearer_token_auth_token_; #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - std::string digest_auth_username_; - std::string digest_auth_password_; + std::string digest_auth_username_; + std::string digest_auth_password_; #endif - bool keep_alive_ = false; - bool follow_location_ = false; + bool keep_alive_ = false; + bool follow_location_ = false; + + bool url_encode_ = true; - bool tcp_nodelay_ = CPPHTTPLIB_TCP_NODELAY; - SocketOptions socket_options_ = nullptr; + int address_family_ = AF_UNSPEC; + bool tcp_nodelay_ = CPPHTTPLIB_TCP_NODELAY; + SocketOptions socket_options_ = nullptr; - bool compress_ = false; - bool decompress_ = true; + bool compress_ = false; + bool decompress_ = true; - std::string interface_; + std::string interface_; - std::string proxy_host_; - int proxy_port_ = -1; + std::string proxy_host_; + int proxy_port_ = -1; - std::string proxy_basic_auth_username_; - std::string proxy_basic_auth_password_; - std::string proxy_bearer_token_auth_token_; + std::string proxy_basic_auth_username_; + std::string proxy_basic_auth_password_; + std::string proxy_bearer_token_auth_token_; #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - std::string proxy_digest_auth_username_; - std::string proxy_digest_auth_password_; + std::string proxy_digest_auth_username_; + std::string proxy_digest_auth_password_; +#endif + +#ifdef CPPHTTPLIB_OPENSSL_SUPPORT + std::string ca_cert_file_path_; + std::string ca_cert_dir_path_; + + X509_STORE *ca_cert_store_ = nullptr; #endif #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - bool server_certificate_verification_ = true; + bool server_certificate_verification_ = true; #endif - Logger logger_; + Logger logger_; private: - socket_t create_client_socket(Error &error) const; - bool read_response_line(Stream &strm, const Request &req, Response &res); - bool write_request(Stream &strm, const Request &req, bool close_connection, - Error &error); - bool redirect(const Request &req, Response &res, Error &error); - bool handle_request(Stream &strm, const Request &req, Response &res, - bool close_connection, Error &error); - std::unique_ptr send_with_content_provider( - const char *method, const char *path, const Headers &headers, - const char *body, size_t content_length, ContentProvider content_provider, - ContentProviderWithoutLength content_provider_without_length, - const char *content_type, Error &error); - Result send_with_content_provider( - const char *method, const char *path, const Headers &headers, - const char *body, size_t content_length, ContentProvider content_provider, - ContentProviderWithoutLength content_provider_without_length, - const char *content_type); - - virtual bool process_socket(const Socket &socket, - std::function callback); - virtual bool is_ssl() const; + socket_t create_client_socket(Error &error) const; + bool read_response_line(Stream &strm, const Request &req, Response &res); + bool write_request(Stream &strm, Request &req, bool close_connection, + Error &error); + bool redirect(Request &req, Response &res, Error &error); + bool handle_request(Stream &strm, Request &req, Response &res, + bool close_connection, Error &error); + std::unique_ptr send_with_content_provider( + Request &req, + // const char *method, const char *path, const Headers &headers, + const char *body, size_t content_length, ContentProvider content_provider, + ContentProviderWithoutLength content_provider_without_length, + const char *content_type, Error &error); + Result send_with_content_provider( + const char *method, const char *path, const Headers &headers, + const char *body, size_t content_length, ContentProvider content_provider, + ContentProviderWithoutLength content_provider_without_length, + const char *content_type); + + std::string adjust_host_string(const std::string &host) const; + + virtual bool process_socket(const Socket &socket, + std::function callback); + virtual bool is_ssl() const; }; class Client { public: - // Universal interface - explicit Client(const char *scheme_host_port); - - explicit Client(const char *scheme_host_port, - const std::string &client_cert_path, - const std::string &client_key_path); - - // HTTP only interface - explicit Client(const std::string &host, int port); - - explicit Client(const std::string &host, int port, - const std::string &client_cert_path, - const std::string &client_key_path); - - ~Client(); - - bool is_valid() const; - - Result Get(const char *path); - Result Get(const char *path, const Headers &headers); - Result Get(const char *path, Progress progress); - Result Get(const char *path, const Headers &headers, Progress progress); - Result Get(const char *path, ContentReceiver content_receiver); - Result Get(const char *path, const Headers &headers, - ContentReceiver content_receiver); - Result Get(const char *path, ContentReceiver content_receiver, - Progress progress); - Result Get(const char *path, const Headers &headers, - ContentReceiver content_receiver, Progress progress); - Result Get(const char *path, ResponseHandler response_handler, - ContentReceiver content_receiver); - Result Get(const char *path, const Headers &headers, - ResponseHandler response_handler, - ContentReceiver content_receiver); - Result Get(const char *path, const Headers &headers, - ResponseHandler response_handler, ContentReceiver content_receiver, - Progress progress); - Result Get(const char *path, ResponseHandler response_handler, - ContentReceiver content_receiver, Progress progress); - - Result Get(const char *path, const Params ¶ms, const Headers &headers, - Progress progress = nullptr); - Result Get(const char *path, const Params ¶ms, const Headers &headers, - ContentReceiver content_receiver, Progress progress = nullptr); - Result Get(const char *path, const Params ¶ms, const Headers &headers, - ResponseHandler response_handler, ContentReceiver content_receiver, - Progress progress = nullptr); - - Result Head(const char *path); - Result Head(const char *path, const Headers &headers); - - Result Post(const char *path); - Result Post(const char *path, const char *body, size_t content_length, - const char *content_type); - Result Post(const char *path, const Headers &headers, const char *body, - size_t content_length, const char *content_type); - Result Post(const char *path, const std::string &body, - const char *content_type); - Result Post(const char *path, const Headers &headers, const std::string &body, - const char *content_type); - Result Post(const char *path, size_t content_length, - ContentProvider content_provider, const char *content_type); - Result Post(const char *path, ContentProviderWithoutLength content_provider, - const char *content_type); - Result Post(const char *path, const Headers &headers, size_t content_length, - ContentProvider content_provider, const char *content_type); - Result Post(const char *path, const Headers &headers, - ContentProviderWithoutLength content_provider, - const char *content_type); - Result Post(const char *path, const Params ¶ms); - Result Post(const char *path, const Headers &headers, const Params ¶ms); - Result Post(const char *path, const MultipartFormDataItems &items); - Result Post(const char *path, const Headers &headers, - const MultipartFormDataItems &items); - Result Post(const char *path, const Headers &headers, - const MultipartFormDataItems &items, const std::string &boundary); - Result Put(const char *path); - Result Put(const char *path, const char *body, size_t content_length, - const char *content_type); - Result Put(const char *path, const Headers &headers, const char *body, - size_t content_length, const char *content_type); - Result Put(const char *path, const std::string &body, - const char *content_type); - Result Put(const char *path, const Headers &headers, const std::string &body, - const char *content_type); - Result Put(const char *path, size_t content_length, - ContentProvider content_provider, const char *content_type); - Result Put(const char *path, ContentProviderWithoutLength content_provider, - const char *content_type); - Result Put(const char *path, const Headers &headers, size_t content_length, - ContentProvider content_provider, const char *content_type); - Result Put(const char *path, const Headers &headers, - ContentProviderWithoutLength content_provider, - const char *content_type); - Result Put(const char *path, const Params ¶ms); - Result Put(const char *path, const Headers &headers, const Params ¶ms); - Result Patch(const char *path); - Result Patch(const char *path, const char *body, size_t content_length, - const char *content_type); - Result Patch(const char *path, const Headers &headers, const char *body, - size_t content_length, const char *content_type); - Result Patch(const char *path, const std::string &body, - const char *content_type); - Result Patch(const char *path, const Headers &headers, - const std::string &body, const char *content_type); - Result Patch(const char *path, size_t content_length, - ContentProvider content_provider, const char *content_type); - Result Patch(const char *path, ContentProviderWithoutLength content_provider, - const char *content_type); - Result Patch(const char *path, const Headers &headers, size_t content_length, - ContentProvider content_provider, const char *content_type); - Result Patch(const char *path, const Headers &headers, - ContentProviderWithoutLength content_provider, - const char *content_type); - - Result Delete(const char *path); - Result Delete(const char *path, const Headers &headers); - Result Delete(const char *path, const char *body, size_t content_length, - const char *content_type); - Result Delete(const char *path, const Headers &headers, const char *body, - size_t content_length, const char *content_type); - Result Delete(const char *path, const std::string &body, - const char *content_type); - Result Delete(const char *path, const Headers &headers, - const std::string &body, const char *content_type); - - Result Options(const char *path); - Result Options(const char *path, const Headers &headers); - - bool send(const Request &req, Response &res, Error &error); - Result send(const Request &req); - - size_t is_socket_open() const; - - void stop(); - - void set_default_headers(Headers headers); - - void set_tcp_nodelay(bool on); - void set_socket_options(SocketOptions socket_options); - - void set_connection_timeout(time_t sec, time_t usec = 0); - void set_read_timeout(time_t sec, time_t usec = 0); - void set_write_timeout(time_t sec, time_t usec = 0); - - void set_basic_auth(const char *username, const char *password); - void set_bearer_token_auth(const char *token); + // Universal interface + explicit Client(const std::string &scheme_host_port); + + explicit Client(const std::string &scheme_host_port, + const std::string &client_cert_path, + const std::string &client_key_path); + + // HTTP only interface + explicit Client(const std::string &host, int port); + + explicit Client(const std::string &host, int port, + const std::string &client_cert_path, + const std::string &client_key_path); + + Client(Client &&) = default; + + ~Client(); + + bool is_valid() const; + + Result Get(const char *path); + Result Get(const char *path, const Headers &headers); + Result Get(const char *path, Progress progress); + Result Get(const char *path, const Headers &headers, Progress progress); + Result Get(const char *path, ContentReceiver content_receiver); + Result Get(const char *path, const Headers &headers, + ContentReceiver content_receiver); + Result Get(const char *path, ContentReceiver content_receiver, + Progress progress); + Result Get(const char *path, const Headers &headers, + ContentReceiver content_receiver, Progress progress); + Result Get(const char *path, ResponseHandler response_handler, + ContentReceiver content_receiver); + Result Get(const char *path, const Headers &headers, + ResponseHandler response_handler, + ContentReceiver content_receiver); + Result Get(const char *path, const Headers &headers, + ResponseHandler response_handler, ContentReceiver content_receiver, + Progress progress); + Result Get(const char *path, ResponseHandler response_handler, + ContentReceiver content_receiver, Progress progress); + + Result Get(const char *path, const Params ¶ms, const Headers &headers, + Progress progress = nullptr); + Result Get(const char *path, const Params ¶ms, const Headers &headers, + ContentReceiver content_receiver, Progress progress = nullptr); + Result Get(const char *path, const Params ¶ms, const Headers &headers, + ResponseHandler response_handler, ContentReceiver content_receiver, + Progress progress = nullptr); + + Result Head(const char *path); + Result Head(const char *path, const Headers &headers); + + Result Post(const char *path); + Result Post(const char *path, const char *body, size_t content_length, + const char *content_type); + Result Post(const char *path, const Headers &headers, const char *body, + size_t content_length, const char *content_type); + Result Post(const char *path, const std::string &body, + const char *content_type); + Result Post(const char *path, const Headers &headers, const std::string &body, + const char *content_type); + Result Post(const char *path, size_t content_length, + ContentProvider content_provider, const char *content_type); + Result Post(const char *path, ContentProviderWithoutLength content_provider, + const char *content_type); + Result Post(const char *path, const Headers &headers, size_t content_length, + ContentProvider content_provider, const char *content_type); + Result Post(const char *path, const Headers &headers, + ContentProviderWithoutLength content_provider, + const char *content_type); + Result Post(const char *path, const Params ¶ms); + Result Post(const char *path, const Headers &headers, const Params ¶ms); + Result Post(const char *path, const MultipartFormDataItems &items); + Result Post(const char *path, const Headers &headers, + const MultipartFormDataItems &items); + Result Post(const char *path, const Headers &headers, + const MultipartFormDataItems &items, const std::string &boundary); + Result Put(const char *path); + Result Put(const char *path, const char *body, size_t content_length, + const char *content_type); + Result Put(const char *path, const Headers &headers, const char *body, + size_t content_length, const char *content_type); + Result Put(const char *path, const std::string &body, + const char *content_type); + Result Put(const char *path, const Headers &headers, const std::string &body, + const char *content_type); + Result Put(const char *path, size_t content_length, + ContentProvider content_provider, const char *content_type); + Result Put(const char *path, ContentProviderWithoutLength content_provider, + const char *content_type); + Result Put(const char *path, const Headers &headers, size_t content_length, + ContentProvider content_provider, const char *content_type); + Result Put(const char *path, const Headers &headers, + ContentProviderWithoutLength content_provider, + const char *content_type); + Result Put(const char *path, const Params ¶ms); + Result Put(const char *path, const Headers &headers, const Params ¶ms); + Result Patch(const char *path); + Result Patch(const char *path, const char *body, size_t content_length, + const char *content_type); + Result Patch(const char *path, const Headers &headers, const char *body, + size_t content_length, const char *content_type); + Result Patch(const char *path, const std::string &body, + const char *content_type); + Result Patch(const char *path, const Headers &headers, + const std::string &body, const char *content_type); + Result Patch(const char *path, size_t content_length, + ContentProvider content_provider, const char *content_type); + Result Patch(const char *path, ContentProviderWithoutLength content_provider, + const char *content_type); + Result Patch(const char *path, const Headers &headers, size_t content_length, + ContentProvider content_provider, const char *content_type); + Result Patch(const char *path, const Headers &headers, + ContentProviderWithoutLength content_provider, + const char *content_type); + + Result Delete(const char *path); + Result Delete(const char *path, const Headers &headers); + Result Delete(const char *path, const char *body, size_t content_length, + const char *content_type); + Result Delete(const char *path, const Headers &headers, const char *body, + size_t content_length, const char *content_type); + Result Delete(const char *path, const std::string &body, + const char *content_type); + Result Delete(const char *path, const Headers &headers, + const std::string &body, const char *content_type); + + Result Options(const char *path); + Result Options(const char *path, const Headers &headers); + + bool send(Request &req, Response &res, Error &error); + Result send(const Request &req); + + size_t is_socket_open() const; + + void stop(); + + void set_hostname_addr_map(const std::map addr_map); + + void set_default_headers(Headers headers); + + void set_address_family(int family); + void set_tcp_nodelay(bool on); + void set_socket_options(SocketOptions socket_options); + + void set_connection_timeout(time_t sec, time_t usec = 0); + template + void + set_connection_timeout(const std::chrono::duration &duration); + + void set_read_timeout(time_t sec, time_t usec = 0); + template + void set_read_timeout(const std::chrono::duration &duration); + + void set_write_timeout(time_t sec, time_t usec = 0); + template + void set_write_timeout(const std::chrono::duration &duration); + + void set_basic_auth(const char *username, const char *password); + void set_bearer_token_auth(const char *token); #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - void set_digest_auth(const char *username, const char *password); + void set_digest_auth(const char *username, const char *password); #endif - void set_keep_alive(bool on); - void set_follow_location(bool on); + void set_keep_alive(bool on); + void set_follow_location(bool on); - void set_compress(bool on); + void set_url_encode(bool on); - void set_decompress(bool on); + void set_compress(bool on); - void set_interface(const char *intf); + void set_decompress(bool on); - void set_proxy(const char *host, int port); - void set_proxy_basic_auth(const char *username, const char *password); - void set_proxy_bearer_token_auth(const char *token); + void set_interface(const char *intf); + + void set_proxy(const char *host, int port); + void set_proxy_basic_auth(const char *username, const char *password); + void set_proxy_bearer_token_auth(const char *token); #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - void set_proxy_digest_auth(const char *username, const char *password); + void set_proxy_digest_auth(const char *username, const char *password); #endif #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - void enable_server_certificate_verification(bool enabled); + void enable_server_certificate_verification(bool enabled); #endif - void set_logger(Logger logger); + void set_logger(Logger logger); - // SSL + // SSL #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - void set_ca_cert_path(const char *ca_cert_file_path, - const char *ca_cert_dir_path = nullptr); + void set_ca_cert_path(const char *ca_cert_file_path, + const char *ca_cert_dir_path = nullptr); - void set_ca_cert_store(X509_STORE *ca_cert_store); + void set_ca_cert_store(X509_STORE *ca_cert_store); - long get_openssl_verify_result() const; + long get_openssl_verify_result() const; - SSL_CTX *ssl_context() const; + SSL_CTX *ssl_context() const; #endif private: - std::unique_ptr cli_; + std::unique_ptr cli_; #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - bool is_ssl_ = false; + bool is_ssl_ = false; #endif }; #ifdef CPPHTTPLIB_OPENSSL_SUPPORT class SSLServer : public Server { public: - SSLServer(const char *cert_path, const char *private_key_path, - const char *client_ca_cert_file_path = nullptr, - const char *client_ca_cert_dir_path = nullptr); + SSLServer(const char *cert_path, const char *private_key_path, + const char *client_ca_cert_file_path = nullptr, + const char *client_ca_cert_dir_path = nullptr); + + SSLServer(X509 *cert, EVP_PKEY *private_key, + X509_STORE *client_ca_cert_store = nullptr); - SSLServer(X509 *cert, EVP_PKEY *private_key, - X509_STORE *client_ca_cert_store = nullptr); + SSLServer( + const std::function &setup_ssl_ctx_callback); - ~SSLServer() override; + ~SSLServer() override; - bool is_valid() const override; + bool is_valid() const override; + + SSL_CTX *ssl_context() const; private: - bool process_and_close_socket(socket_t sock) override; + bool process_and_close_socket(socket_t sock) override; - SSL_CTX *ctx_; - std::mutex ctx_mutex_; + SSL_CTX *ctx_; + std::mutex ctx_mutex_; }; class SSLClient : public ClientImpl { public: - explicit SSLClient(const std::string &host); + explicit SSLClient(const std::string &host); + + explicit SSLClient(const std::string &host, int port); + + explicit SSLClient(const std::string &host, int port, + const std::string &client_cert_path, + const std::string &client_key_path); + + explicit SSLClient(const std::string &host, int port, X509 *client_cert, + EVP_PKEY *client_key); + + ~SSLClient() override; + + bool is_valid() const override; + + void set_ca_cert_store(X509_STORE *ca_cert_store); + + long get_openssl_verify_result() const; + + SSL_CTX *ssl_context() const; + +private: + bool create_and_connect_socket(Socket &socket, Error &error) override; + void shutdown_ssl(Socket &socket, bool shutdown_gracefully) override; + void shutdown_ssl_impl(Socket &socket, bool shutdown_socket); + + bool process_socket(const Socket &socket, + std::function callback) override; + bool is_ssl() const override; + + bool connect_with_proxy(Socket &sock, Response &res, bool &success, + Error &error); + bool initialize_ssl(Socket &socket, Error &error); + + bool load_certs(); + + bool verify_host(X509 *server_cert) const; + bool verify_host_with_subject_alt_name(X509 *server_cert) const; + bool verify_host_with_common_name(X509 *server_cert) const; + bool check_host_name(const char *pattern, size_t pattern_len) const; + + SSL_CTX *ctx_; + std::mutex ctx_mutex_; + std::once_flag initialize_cert_; + + std::vector host_components_; + + long verify_result_ = 0; + + friend class ClientImpl; +}; +#endif + +/* + * Implementation of template methods. + */ + +namespace detail { + +template +inline void duration_to_sec_and_usec(const T &duration, U callback) { + auto sec = std::chrono::duration_cast(duration).count(); + auto usec = std::chrono::duration_cast( + duration - std::chrono::seconds(sec)) + .count(); + callback(sec, usec); +} - explicit SSLClient(const std::string &host, int port); +template +inline T get_header_value(const Headers & /*headers*/, const char * /*key*/, + size_t /*id*/ = 0, uint64_t /*def*/ = 0) {} + +template <> +inline uint64_t get_header_value(const Headers &headers, + const char *key, size_t id, + uint64_t def) { + auto rng = headers.equal_range(key); + auto it = rng.first; + std::advance(it, static_cast(id)); + if (it != rng.second) { + return std::strtoull(it->second.data(), nullptr, 10); + } + return def; +} + +} // namespace detail - explicit SSLClient(const std::string &host, int port, - const std::string &client_cert_path, - const std::string &client_key_path); +template +inline T Request::get_header_value(const char *key, size_t id) const { + return detail::get_header_value(headers, key, id, 0); +} - explicit SSLClient(const std::string &host, int port, X509 *client_cert, - EVP_PKEY *client_key); +template +inline T Response::get_header_value(const char *key, size_t id) const { + return detail::get_header_value(headers, key, id, 0); +} - ~SSLClient() override; +template +inline ssize_t Stream::write_format(const char *fmt, const Args &...args) { + const auto bufsiz = 2048; + std::array buf{}; - bool is_valid() const override; +#if defined(_MSC_VER) && _MSC_VER < 1900 + auto sn = _snprintf_s(buf.data(), bufsiz, _TRUNCATE, fmt, args...); +#else + auto sn = snprintf(buf.data(), buf.size() - 1, fmt, args...); +#endif + if (sn <= 0) { return sn; } - void set_ca_cert_path(const char *ca_cert_file_path, - const char *ca_cert_dir_path = nullptr); + auto n = static_cast(sn); - void set_ca_cert_store(X509_STORE *ca_cert_store); + if (n >= buf.size() - 1) { + std::vector glowable_buf(buf.size()); - long get_openssl_verify_result() const; + while (n >= glowable_buf.size() - 1) { + glowable_buf.resize(glowable_buf.size() * 2); +#if defined(_MSC_VER) && _MSC_VER < 1900 + n = static_cast(_snprintf_s(&glowable_buf[0], glowable_buf.size(), + glowable_buf.size() - 1, fmt, + args...)); +#else + n = static_cast( + snprintf(&glowable_buf[0], glowable_buf.size() - 1, fmt, args...)); +#endif + } + return write(&glowable_buf[0], n); + } else { + return write(buf.data(), n); + } +} - SSL_CTX *ssl_context() const; +inline void default_socket_options(socket_t sock) { + int yes = 1; +#ifdef _WIN32 + setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&yes), + sizeof(yes)); + setsockopt(sock, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, + reinterpret_cast(&yes), sizeof(yes)); +#else +#ifdef SO_REUSEPORT + setsockopt(sock, SOL_SOCKET, SO_REUSEPORT, reinterpret_cast(&yes), + sizeof(yes)); +#else + setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast(&yes), + sizeof(yes)); +#endif +#endif +} + +template +inline Server & +Server::set_read_timeout(const std::chrono::duration &duration) { + detail::duration_to_sec_and_usec( + duration, [&](time_t sec, time_t usec) { set_read_timeout(sec, usec); }); + return *this; +} + +template +inline Server & +Server::set_write_timeout(const std::chrono::duration &duration) { + detail::duration_to_sec_and_usec( + duration, [&](time_t sec, time_t usec) { set_write_timeout(sec, usec); }); + return *this; +} + +template +inline Server & +Server::set_idle_interval(const std::chrono::duration &duration) { + detail::duration_to_sec_and_usec( + duration, [&](time_t sec, time_t usec) { set_idle_interval(sec, usec); }); + return *this; +} + +inline std::string to_string(const Error error) { + switch (error) { + case Error::Success: return "Success"; + case Error::Connection: return "Connection"; + case Error::BindIPAddress: return "BindIPAddress"; + case Error::Read: return "Read"; + case Error::Write: return "Write"; + case Error::ExceedRedirectCount: return "ExceedRedirectCount"; + case Error::Canceled: return "Canceled"; + case Error::SSLConnection: return "SSLConnection"; + case Error::SSLLoadingCerts: return "SSLLoadingCerts"; + case Error::SSLServerVerification: return "SSLServerVerification"; + case Error::UnsupportedMultipartBoundaryChars: + return "UnsupportedMultipartBoundaryChars"; + case Error::Compression: return "Compression"; + case Error::ConnectionTimeout: return "ConnectionTimeout"; + case Error::Unknown: return "Unknown"; + default: break; + } + + return "Invalid"; +} + +inline std::ostream &operator<<(std::ostream &os, const Error &obj) { + os << to_string(obj); + os << " (" << static_cast::type>(obj) << ')'; + return os; +} + +template +inline T Result::get_request_header_value(const char *key, size_t id) const { + return detail::get_header_value(request_headers_, key, id, 0); +} + +template +inline void ClientImpl::set_connection_timeout( + const std::chrono::duration &duration) { + detail::duration_to_sec_and_usec(duration, [&](time_t sec, time_t usec) { + set_connection_timeout(sec, usec); + }); +} + +template +inline void ClientImpl::set_read_timeout( + const std::chrono::duration &duration) { + detail::duration_to_sec_and_usec( + duration, [&](time_t sec, time_t usec) { set_read_timeout(sec, usec); }); +} + +template +inline void ClientImpl::set_write_timeout( + const std::chrono::duration &duration) { + detail::duration_to_sec_and_usec( + duration, [&](time_t sec, time_t usec) { set_write_timeout(sec, usec); }); +} + +template +inline void Client::set_connection_timeout( + const std::chrono::duration &duration) { + cli_->set_connection_timeout(duration); +} + +template +inline void +Client::set_read_timeout(const std::chrono::duration &duration) { + cli_->set_read_timeout(duration); +} + +template +inline void +Client::set_write_timeout(const std::chrono::duration &duration) { + cli_->set_write_timeout(duration); +} + +/* + * Forward declarations and types that will be part of the .h file if split into + * .h + .cc. + */ + +std::string hosted_at(const char *hostname); + +void hosted_at(const char *hostname, std::vector &addrs); + +std::string append_query_params(const char *path, const Params ¶ms); + +std::pair make_range_header(Ranges ranges); + +std::pair +make_basic_authentication_header(const std::string &username, + const std::string &password, + bool is_proxy = false); + +namespace detail { + +std::string encode_query_param(const std::string &value); + +std::string decode_url(const std::string &s, bool convert_plus_to_space); + +void read_file(const std::string &path, std::string &out); + +std::string trim_copy(const std::string &s); + +void split(const char *b, const char *e, char d, + std::function fn); + +bool process_client_socket(socket_t sock, time_t read_timeout_sec, + time_t read_timeout_usec, time_t write_timeout_sec, + time_t write_timeout_usec, + std::function callback); + +socket_t create_client_socket( + const char *host, const char *ip, int port, int address_family, + bool tcp_nodelay, SocketOptions socket_options, + time_t connection_timeout_sec, time_t connection_timeout_usec, + time_t read_timeout_sec, time_t read_timeout_usec, time_t write_timeout_sec, + time_t write_timeout_usec, const std::string &intf, Error &error); + +const char *get_header_value(const Headers &headers, const char *key, + size_t id = 0, const char *def = nullptr); + +std::string params_to_query_str(const Params ¶ms); + +void parse_query_text(const std::string &s, Params ¶ms); + +bool parse_range_header(const std::string &s, Ranges &ranges); + +int close_socket(socket_t sock); + +ssize_t send_socket(socket_t sock, const void *ptr, size_t size, int flags); + +ssize_t read_socket(socket_t sock, void *ptr, size_t size, int flags); + +enum class EncodingType { None = 0, Gzip, Brotli }; + +EncodingType encoding_type(const Request &req, const Response &res); + +class BufferStream : public Stream { +public: + BufferStream() = default; + ~BufferStream() override = default; + + bool is_readable() const override; + bool is_writable() const override; + ssize_t read(char *ptr, size_t size) override; + ssize_t write(const char *ptr, size_t size) override; + void get_remote_ip_and_port(std::string &ip, int &port) const override; + socket_t socket() const override; + + const std::string &get_buffer() const; + +private: + std::string buffer; + size_t position = 0; +}; + +class compressor { +public: + virtual ~compressor() = default; + + typedef std::function Callback; + virtual bool compress(const char *data, size_t data_length, bool last, + Callback callback) = 0; +}; + +class decompressor { +public: + virtual ~decompressor() = default; + + virtual bool is_valid() const = 0; + + typedef std::function Callback; + virtual bool decompress(const char *data, size_t data_length, + Callback callback) = 0; +}; + +class nocompressor : public compressor { +public: + virtual ~nocompressor() = default; + + bool compress(const char *data, size_t data_length, bool /*last*/, + Callback callback) override; +}; + +#ifdef CPPHTTPLIB_ZLIB_SUPPORT +class gzip_compressor : public compressor { +public: + gzip_compressor(); + ~gzip_compressor(); + + bool compress(const char *data, size_t data_length, bool last, + Callback callback) override; private: - bool create_and_connect_socket(Socket &socket, Error &error) override; - void shutdown_ssl(Socket &socket, bool shutdown_gracefully) override; + bool is_valid_ = false; + z_stream strm_; +}; + +class gzip_decompressor : public decompressor { +public: + gzip_decompressor(); + ~gzip_decompressor(); + + bool is_valid() const override; - bool process_socket(const Socket &socket, - std::function callback) override; - bool is_ssl() const override; + bool decompress(const char *data, size_t data_length, + Callback callback) override; + +private: + bool is_valid_ = false; + z_stream strm_; +}; +#endif - bool connect_with_proxy(Socket &sock, Response &res, bool &success, - Error &error); - bool initialize_ssl(Socket &socket, Error &error); +#ifdef CPPHTTPLIB_BROTLI_SUPPORT +class brotli_compressor : public compressor { +public: + brotli_compressor(); + ~brotli_compressor(); - bool load_certs(); + bool compress(const char *data, size_t data_length, bool last, + Callback callback) override; - bool verify_host(X509 *server_cert) const; - bool verify_host_with_subject_alt_name(X509 *server_cert) const; - bool verify_host_with_common_name(X509 *server_cert) const; - bool check_host_name(const char *pattern, size_t pattern_len) const; +private: + BrotliEncoderState *state_ = nullptr; +}; - SSL_CTX *ctx_; - std::mutex ctx_mutex_; - std::once_flag initialize_cert_; +class brotli_decompressor : public decompressor { +public: + brotli_decompressor(); + ~brotli_decompressor(); - std::vector host_components_; + bool is_valid() const override; - std::string ca_cert_file_path_; - std::string ca_cert_dir_path_; - long verify_result_ = 0; + bool decompress(const char *data, size_t data_length, + Callback callback) override; - friend class ClientImpl; +private: + BrotliDecoderResult decoder_r; + BrotliDecoderState *decoder_s = nullptr; }; #endif +// NOTE: until the read size reaches `fixed_buffer_size`, use `fixed_buffer` +// to store data. The call can set memory on stack for performance. +class stream_line_reader { +public: + stream_line_reader(Stream &strm, char *fixed_buffer, + size_t fixed_buffer_size); + const char *ptr() const; + size_t size() const; + bool end_with_crlf() const; + bool getline(); + +private: + void append(char c); + + Stream &strm_; + char *fixed_buffer_; + const size_t fixed_buffer_size_; + size_t fixed_buffer_used_size_ = 0; + std::string glowable_buffer_; +}; + +} // namespace detail + // ---------------------------------------------------------------------------- /* - * Implementation + * Implementation that will be part of the .cc file if split into .h + .cc. */ namespace detail { inline bool is_hex(char c, int &v) { - if (0x20 <= c && isdigit(c)) { - v = c - '0'; - return true; - } else if ('A' <= c && c <= 'F') { - v = c - 'A' + 10; - return true; - } else if ('a' <= c && c <= 'f') { - v = c - 'a' + 10; - return true; - } - return false; + if (0x20 <= c && isdigit(c)) { + v = c - '0'; + return true; + } else if ('A' <= c && c <= 'F') { + v = c - 'A' + 10; + return true; + } else if ('a' <= c && c <= 'f') { + v = c - 'a' + 10; + return true; + } + return false; } inline bool from_hex_to_i(const std::string &s, size_t i, size_t cnt, int &val) { - if (i >= s.size()) { return false; } - - val = 0; - for (; cnt; i++, cnt--) { - if (!s[i]) { return false; } - int v = 0; - if (is_hex(s[i], v)) { - val = val * 16 + v; - } else { - return false; - } - } - return true; + if (i >= s.size()) { return false; } + + val = 0; + for (; cnt; i++, cnt--) { + if (!s[i]) { return false; } + int v = 0; + if (is_hex(s[i], v)) { + val = val * 16 + v; + } else { + return false; + } + } + return true; } inline std::string from_i_to_hex(size_t n) { - const char *charset = "0123456789abcdef"; - std::string ret; - do { - ret = charset[n & 15] + ret; - n >>= 4; - } while (n > 0); - return ret; + const char *charset = "0123456789abcdef"; + std::string ret; + do { + ret = charset[n & 15] + ret; + n >>= 4; + } while (n > 0); + return ret; } inline size_t to_utf8(int code, char *buff) { - if (code < 0x0080) { - buff[0] = (code & 0x7F); - return 1; - } else if (code < 0x0800) { - buff[0] = static_cast(0xC0 | ((code >> 6) & 0x1F)); - buff[1] = static_cast(0x80 | (code & 0x3F)); - return 2; - } else if (code < 0xD800) { - buff[0] = static_cast(0xE0 | ((code >> 12) & 0xF)); - buff[1] = static_cast(0x80 | ((code >> 6) & 0x3F)); - buff[2] = static_cast(0x80 | (code & 0x3F)); - return 3; - } else if (code < 0xE000) { // D800 - DFFF is invalid... - return 0; - } else if (code < 0x10000) { - buff[0] = static_cast(0xE0 | ((code >> 12) & 0xF)); - buff[1] = static_cast(0x80 | ((code >> 6) & 0x3F)); - buff[2] = static_cast(0x80 | (code & 0x3F)); - return 3; - } else if (code < 0x110000) { - buff[0] = static_cast(0xF0 | ((code >> 18) & 0x7)); - buff[1] = static_cast(0x80 | ((code >> 12) & 0x3F)); - buff[2] = static_cast(0x80 | ((code >> 6) & 0x3F)); - buff[3] = static_cast(0x80 | (code & 0x3F)); - return 4; - } + if (code < 0x0080) { + buff[0] = (code & 0x7F); + return 1; + } else if (code < 0x0800) { + buff[0] = static_cast(0xC0 | ((code >> 6) & 0x1F)); + buff[1] = static_cast(0x80 | (code & 0x3F)); + return 2; + } else if (code < 0xD800) { + buff[0] = static_cast(0xE0 | ((code >> 12) & 0xF)); + buff[1] = static_cast(0x80 | ((code >> 6) & 0x3F)); + buff[2] = static_cast(0x80 | (code & 0x3F)); + return 3; + } else if (code < 0xE000) { // D800 - DFFF is invalid... + return 0; + } else if (code < 0x10000) { + buff[0] = static_cast(0xE0 | ((code >> 12) & 0xF)); + buff[1] = static_cast(0x80 | ((code >> 6) & 0x3F)); + buff[2] = static_cast(0x80 | (code & 0x3F)); + return 3; + } else if (code < 0x110000) { + buff[0] = static_cast(0xF0 | ((code >> 18) & 0x7)); + buff[1] = static_cast(0x80 | ((code >> 12) & 0x3F)); + buff[2] = static_cast(0x80 | ((code >> 6) & 0x3F)); + buff[3] = static_cast(0x80 | (code & 0x3F)); + return 4; + } - // NOTREACHED - return 0; + // NOTREACHED + return 0; } // NOTE: This code came up with the following stackoverflow post: // https://stackoverflow.com/questions/180947/base64-decode-snippet-in-c inline std::string base64_encode(const std::string &in) { - static const auto lookup = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + static const auto lookup = + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - std::string out; - out.reserve(in.size()); + std::string out; + out.reserve(in.size()); - int val = 0; - int valb = -6; + int val = 0; + int valb = -6; - for (auto c : in) { - val = (val << 8) + static_cast(c); - valb += 8; - while (valb >= 0) { - out.push_back(lookup[(val >> valb) & 0x3F]); - valb -= 6; - } - } + for (auto c : in) { + val = (val << 8) + static_cast(c); + valb += 8; + while (valb >= 0) { + out.push_back(lookup[(val >> valb) & 0x3F]); + valb -= 6; + } + } - if (valb > -6) { out.push_back(lookup[((val << 8) >> (valb + 8)) & 0x3F]); } + if (valb > -6) { out.push_back(lookup[((val << 8) >> (valb + 8)) & 0x3F]); } - while (out.size() % 4) { - out.push_back('='); - } + while (out.size() % 4) { + out.push_back('='); + } - return out; + return out; } inline bool is_file(const std::string &path) { - struct stat st; - return stat(path.c_str(), &st) >= 0 && S_ISREG(st.st_mode); +#ifdef _WIN32 + return _access_s(path.c_str(), 0) == 0; +#else + struct stat st; + return stat(path.c_str(), &st) >= 0 && S_ISREG(st.st_mode); +#endif } inline bool is_dir(const std::string &path) { - struct stat st; - return stat(path.c_str(), &st) >= 0 && S_ISDIR(st.st_mode); + struct stat st; + return stat(path.c_str(), &st) >= 0 && S_ISDIR(st.st_mode); } inline bool is_valid_path(const std::string &path) { - size_t level = 0; - size_t i = 0; + size_t level = 0; + size_t i = 0; - // Skip slash - while (i < path.size() && path[i] == '/') { - i++; - } + // Skip slash + while (i < path.size() && path[i] == '/') { + i++; + } - while (i < path.size()) { - // Read component - auto beg = i; - while (i < path.size() && path[i] != '/') { - i++; - } + while (i < path.size()) { + // Read component + auto beg = i; + while (i < path.size() && path[i] != '/') { + i++; + } - auto len = i - beg; - assert(len > 0); + auto len = i - beg; + assert(len > 0); - if (!path.compare(beg, len, ".")) { - ; - } else if (!path.compare(beg, len, "..")) { - if (level == 0) { return false; } - level--; - } else { - level++; - } + if (!path.compare(beg, len, ".")) { + ; + } else if (!path.compare(beg, len, "..")) { + if (level == 0) { return false; } + level--; + } else { + level++; + } - // Skip slash - while (i < path.size() && path[i] == '/') { - i++; - } - } + // Skip slash + while (i < path.size() && path[i] == '/') { + i++; + } + } - return true; + return true; } inline std::string encode_query_param(const std::string &value) { - std::ostringstream escaped; - escaped.fill('0'); - escaped << std::hex; - - for (auto c : value) { - if (std::isalnum(static_cast(c)) || c == '-' || c == '_' || - c == '.' || c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' || - c == ')') { - escaped << c; - } else { - escaped << std::uppercase; - escaped << '%' << std::setw(2) - << static_cast(static_cast(c)); - escaped << std::nouppercase; - } - } + std::ostringstream escaped; + escaped.fill('0'); + escaped << std::hex; + + for (auto c : value) { + if (std::isalnum(static_cast(c)) || c == '-' || c == '_' || + c == '.' || c == '!' || c == '~' || c == '*' || c == '\'' || c == '(' || + c == ')') { + escaped << c; + } else { + escaped << std::uppercase; + escaped << '%' << std::setw(2) + << static_cast(static_cast(c)); + escaped << std::nouppercase; + } + } - return escaped.str(); + return escaped.str(); } inline std::string encode_url(const std::string &s) { - std::string result; - - for (size_t i = 0; s[i]; i++) { - switch (s[i]) { - case ' ': result += "%20"; break; - case '+': result += "%2B"; break; - case '\r': result += "%0D"; break; - case '\n': result += "%0A"; break; - case '\'': result += "%27"; break; - case ',': result += "%2C"; break; - // case ':': result += "%3A"; break; // ok? probably... - case ';': result += "%3B"; break; - default: - auto c = static_cast(s[i]); - if (c >= 0x80) { - result += '%'; - char hex[4]; - auto len = snprintf(hex, sizeof(hex) - 1, "%02X", c); - assert(len == 2); - result.append(hex, static_cast(len)); - } else { - result += s[i]; - } - break; - } - } + std::string result; + result.reserve(s.size()); + + for (size_t i = 0; s[i]; i++) { + switch (s[i]) { + case ' ': result += "%20"; break; + case '+': result += "%2B"; break; + case '\r': result += "%0D"; break; + case '\n': result += "%0A"; break; + case '\'': result += "%27"; break; + case ',': result += "%2C"; break; + // case ':': result += "%3A"; break; // ok? probably... + case ';': result += "%3B"; break; + default: + auto c = static_cast(s[i]); + if (c >= 0x80) { + result += '%'; + char hex[4]; + auto len = snprintf(hex, sizeof(hex) - 1, "%02X", c); + assert(len == 2); + result.append(hex, static_cast(len)); + } else { + result += s[i]; + } + break; + } + } - return result; + return result; } inline std::string decode_url(const std::string &s, bool convert_plus_to_space) { - std::string result; - - for (size_t i = 0; i < s.size(); i++) { - if (s[i] == '%' && i + 1 < s.size()) { - if (s[i + 1] == 'u') { - int val = 0; - if (from_hex_to_i(s, i + 2, 4, val)) { - // 4 digits Unicode codes - char buff[4]; - size_t len = to_utf8(val, buff); - if (len > 0) { result.append(buff, len); } - i += 5; // 'u0000' - } else { - result += s[i]; - } - } else { - int val = 0; - if (from_hex_to_i(s, i + 1, 2, val)) { - // 2 digits hex codes - result += static_cast(val); - i += 2; // '00' - } else { - result += s[i]; - } - } - } else if (convert_plus_to_space && s[i] == '+') { - result += ' '; - } else { - result += s[i]; - } - } + std::string result; + + for (size_t i = 0; i < s.size(); i++) { + if (s[i] == '%' && i + 1 < s.size()) { + if (s[i + 1] == 'u') { + int val = 0; + if (from_hex_to_i(s, i + 2, 4, val)) { + // 4 digits Unicode codes + char buff[4]; + size_t len = to_utf8(val, buff); + if (len > 0) { result.append(buff, len); } + i += 5; // 'u0000' + } else { + result += s[i]; + } + } else { + int val = 0; + if (from_hex_to_i(s, i + 1, 2, val)) { + // 2 digits hex codes + result += static_cast(val); + i += 2; // '00' + } else { + result += s[i]; + } + } + } else if (convert_plus_to_space && s[i] == '+') { + result += ' '; + } else { + result += s[i]; + } + } - return result; + return result; } inline void read_file(const std::string &path, std::string &out) { - std::ifstream fs(path, std::ios_base::binary); - fs.seekg(0, std::ios_base::end); - auto size = fs.tellg(); - fs.seekg(0); - out.resize(static_cast(size)); - fs.read(&out[0], static_cast(size)); + std::ifstream fs(path, std::ios_base::binary); + fs.seekg(0, std::ios_base::end); + auto size = fs.tellg(); + fs.seekg(0); + out.resize(static_cast(size)); + fs.read(&out[0], static_cast(size)); } inline std::string file_extension(const std::string &path) { - std::smatch m; - static auto re = std::regex("\\.([a-zA-Z0-9]+)$"); - if (std::regex_search(path, m, re)) { return m[1].str(); } - return std::string(); + Match m; + static Regex re("\\.([a-zA-Z0-9]+)$"); + if (duckdb_re2::RegexSearch(path, m, re)) { return m.str(1); } + return std::string(); } inline bool is_space_or_tab(char c) { return c == ' ' || c == '\t'; } inline std::pair trim(const char *b, const char *e, size_t left, size_t right) { - while (b + left < e && is_space_or_tab(b[left])) { - left++; - } - while (right > 0 && is_space_or_tab(b[right - 1])) { - right--; - } - return std::make_pair(left, right); + while (b + left < e && is_space_or_tab(b[left])) { + left++; + } + while (right > 0 && is_space_or_tab(b[right - 1])) { + right--; + } + return std::make_pair(left, right); } inline std::string trim_copy(const std::string &s) { - auto r = trim(s.data(), s.data() + s.size(), 0, s.size()); - return s.substr(r.first, r.second - r.first); + auto r = trim(s.data(), s.data() + s.size(), 0, s.size()); + return s.substr(r.first, r.second - r.first); } -template void split(const char *b, const char *e, char d, Fn fn) { - size_t i = 0; - size_t beg = 0; +inline void split(const char *b, const char *e, char d, + std::function fn) { + size_t i = 0; + size_t beg = 0; - while (e ? (b + i < e) : (b[i] != '\0')) { - if (b[i] == d) { - auto r = trim(b, e, beg, i); - if (r.first < r.second) { fn(&b[r.first], &b[r.second]); } - beg = i + 1; - } - i++; - } + while (e ? (b + i < e) : (b[i] != '\0')) { + if (b[i] == d) { + auto r = trim(b, e, beg, i); + if (r.first < r.second) { fn(&b[r.first], &b[r.second]); } + beg = i + 1; + } + i++; + } - if (i) { - auto r = trim(b, e, beg, i); - if (r.first < r.second) { fn(&b[r.first], &b[r.second]); } - } + if (i) { + auto r = trim(b, e, beg, i); + if (r.first < r.second) { fn(&b[r.first], &b[r.second]); } + } } -// NOTE: until the read size reaches `fixed_buffer_size`, use `fixed_buffer` -// to store data. The call can set memory on stack for performance. -class stream_line_reader { -public: - stream_line_reader(Stream &strm, char *fixed_buffer, size_t fixed_buffer_size) - : strm_(strm), fixed_buffer_(fixed_buffer), - fixed_buffer_size_(fixed_buffer_size) {} - - const char *ptr() const { - if (glowable_buffer_.empty()) { - return fixed_buffer_; - } else { - return glowable_buffer_.data(); - } - } +inline stream_line_reader::stream_line_reader(Stream &strm, char *fixed_buffer, + size_t fixed_buffer_size) + : strm_(strm), fixed_buffer_(fixed_buffer), + fixed_buffer_size_(fixed_buffer_size) {} - size_t size() const { - if (glowable_buffer_.empty()) { - return fixed_buffer_used_size_; - } else { - return glowable_buffer_.size(); - } - } +inline const char *stream_line_reader::ptr() const { + if (glowable_buffer_.empty()) { + return fixed_buffer_; + } else { + return glowable_buffer_.data(); + } +} - bool end_with_crlf() const { - auto end = ptr() + size(); - return size() >= 2 && end[-2] == '\r' && end[-1] == '\n'; - } +inline size_t stream_line_reader::size() const { + if (glowable_buffer_.empty()) { + return fixed_buffer_used_size_; + } else { + return glowable_buffer_.size(); + } +} - bool getline() { - fixed_buffer_used_size_ = 0; - glowable_buffer_.clear(); +inline bool stream_line_reader::end_with_crlf() const { + auto end = ptr() + size(); + return size() >= 2 && end[-2] == '\r' && end[-1] == '\n'; +} - for (size_t i = 0;; i++) { - char byte; - auto n = strm_.read(&byte, 1); +inline bool stream_line_reader::getline() { + fixed_buffer_used_size_ = 0; + glowable_buffer_.clear(); - if (n < 0) { - return false; - } else if (n == 0) { - if (i == 0) { - return false; - } else { - break; - } - } + for (size_t i = 0;; i++) { + char byte; + auto n = strm_.read(&byte, 1); - append(byte); + if (n < 0) { + return false; + } else if (n == 0) { + if (i == 0) { + return false; + } else { + break; + } + } - if (byte == '\n') { break; } - } + append(byte); - return true; - } + if (byte == '\n') { break; } + } -private: - void append(char c) { - if (fixed_buffer_used_size_ < fixed_buffer_size_ - 1) { - fixed_buffer_[fixed_buffer_used_size_++] = c; - fixed_buffer_[fixed_buffer_used_size_] = '\0'; - } else { - if (glowable_buffer_.empty()) { - assert(fixed_buffer_[fixed_buffer_used_size_] == '\0'); - glowable_buffer_.assign(fixed_buffer_, fixed_buffer_used_size_); - } - glowable_buffer_ += c; - } - } + return true; +} - Stream &strm_; - char *fixed_buffer_; - const size_t fixed_buffer_size_; - size_t fixed_buffer_used_size_ = 0; - std::string glowable_buffer_; -}; +inline void stream_line_reader::append(char c) { + if (fixed_buffer_used_size_ < fixed_buffer_size_ - 1) { + fixed_buffer_[fixed_buffer_used_size_++] = c; + fixed_buffer_[fixed_buffer_used_size_] = '\0'; + } else { + if (glowable_buffer_.empty()) { + assert(fixed_buffer_[fixed_buffer_used_size_] == '\0'); + glowable_buffer_.assign(fixed_buffer_, fixed_buffer_used_size_); + } + glowable_buffer_ += c; + } +} inline int close_socket(socket_t sock) { #ifdef _WIN32 - return closesocket(sock); + return closesocket(sock); #else - return close(sock); + return close(sock); #endif } template inline ssize_t handle_EINTR(T fn) { - ssize_t res = false; - while (true) { - res = fn(); - if (res < 0 && errno == EINTR) { continue; } - break; - } - return res; + ssize_t res = false; + while (true) { + res = fn(); + if (res < 0 && errno == EINTR) { continue; } + break; + } + return res; +} + +inline ssize_t read_socket(socket_t sock, void *ptr, size_t size, int flags) { + return handle_EINTR([&]() { + return recv(sock, +#ifdef _WIN32 + static_cast(ptr), static_cast(size), +#else + ptr, size, +#endif + flags); + }); +} + +inline ssize_t send_socket(socket_t sock, const void *ptr, size_t size, + int flags) { + return handle_EINTR([&]() { + return send(sock, +#ifdef _WIN32 + static_cast(ptr), static_cast(size), +#else + ptr, size, +#endif + flags); + }); } inline ssize_t select_read(socket_t sock, time_t sec, time_t usec) { #ifdef CPPHTTPLIB_USE_POLL - struct pollfd pfd_read; - pfd_read.fd = sock; - pfd_read.events = POLLIN; + struct pollfd pfd_read; + pfd_read.fd = sock; + pfd_read.events = POLLIN; - auto timeout = static_cast(sec * 1000 + usec / 1000); + auto timeout = static_cast(sec * 1000 + usec / 1000); - return handle_EINTR([&]() { return poll(&pfd_read, 1, timeout); }); + return handle_EINTR([&]() { return poll(&pfd_read, 1, timeout); }); #else #ifndef _WIN32 - if (sock >= FD_SETSIZE) { return 1; } + if (sock >= FD_SETSIZE) { return 1; } #endif - fd_set fds; - FD_ZERO(&fds); - FD_SET(sock, &fds); + fd_set fds; + FD_ZERO(&fds); + FD_SET(sock, &fds); - timeval tv; - tv.tv_sec = static_cast(sec); - tv.tv_usec = static_cast(usec); + timeval tv; + tv.tv_sec = static_cast(sec); + tv.tv_usec = static_cast(usec); - return handle_EINTR([&]() { - return select(static_cast(sock + 1), &fds, nullptr, nullptr, &tv); - }); + return handle_EINTR([&]() { + return select(static_cast(sock + 1), &fds, nullptr, nullptr, &tv); + }); #endif } inline ssize_t select_write(socket_t sock, time_t sec, time_t usec) { #ifdef CPPHTTPLIB_USE_POLL - struct pollfd pfd_read; - pfd_read.fd = sock; - pfd_read.events = POLLOUT; + struct pollfd pfd_read; + pfd_read.fd = sock; + pfd_read.events = POLLOUT; - auto timeout = static_cast(sec * 1000 + usec / 1000); + auto timeout = static_cast(sec * 1000 + usec / 1000); - return handle_EINTR([&]() { return poll(&pfd_read, 1, timeout); }); + return handle_EINTR([&]() { return poll(&pfd_read, 1, timeout); }); #else #ifndef _WIN32 - if (sock >= FD_SETSIZE) { return 1; } + if (sock >= FD_SETSIZE) { return 1; } #endif - fd_set fds; - FD_ZERO(&fds); - FD_SET(sock, &fds); + fd_set fds; + FD_ZERO(&fds); + FD_SET(sock, &fds); - timeval tv; - tv.tv_sec = static_cast(sec); - tv.tv_usec = static_cast(usec); + timeval tv; + tv.tv_sec = static_cast(sec); + tv.tv_usec = static_cast(usec); - return handle_EINTR([&]() { - return select(static_cast(sock + 1), nullptr, &fds, nullptr, &tv); - }); + return handle_EINTR([&]() { + return select(static_cast(sock + 1), nullptr, &fds, nullptr, &tv); + }); #endif } -inline bool wait_until_socket_is_ready(socket_t sock, time_t sec, time_t usec) { +inline Error wait_until_socket_is_ready(socket_t sock, time_t sec, time_t usec) { #ifdef CPPHTTPLIB_USE_POLL - struct pollfd pfd_read; - pfd_read.fd = sock; - pfd_read.events = POLLIN | POLLOUT; + struct pollfd pfd_read; + pfd_read.fd = sock; + pfd_read.events = POLLIN | POLLOUT; - auto timeout = static_cast(sec * 1000 + usec / 1000); + auto timeout = static_cast(sec * 1000 + usec / 1000); - auto poll_res = handle_EINTR([&]() { return poll(&pfd_read, 1, timeout); }); + auto poll_res = handle_EINTR([&]() { return poll(&pfd_read, 1, timeout); }); - if (poll_res > 0 && pfd_read.revents & (POLLIN | POLLOUT)) { - int error = 0; - socklen_t len = sizeof(error); - auto res = getsockopt(sock, SOL_SOCKET, SO_ERROR, - reinterpret_cast(&error), &len); - return res >= 0 && !error; - } - return false; + if (poll_res == 0) { + return Error::ConnectionTimeout; + } + + if (poll_res > 0 && pfd_read.revents & (POLLIN | POLLOUT)) { + int error = 0; + socklen_t len = sizeof(error); + auto res = getsockopt(sock, SOL_SOCKET, SO_ERROR, + reinterpret_cast(&error), &len); + auto successful = res >= 0 && !error; + return successful ? Error::Success : Error::Connection; + } + + return Error::Connection; #else #ifndef _WIN32 - if (sock >= FD_SETSIZE) { return false; } + if (sock >= FD_SETSIZE) { return Error::Connection; } #endif - fd_set fdsr; - FD_ZERO(&fdsr); - FD_SET(sock, &fdsr); + fd_set fdsr; + FD_ZERO(&fdsr); + FD_SET(sock, &fdsr); - auto fdsw = fdsr; - auto fdse = fdsr; + auto fdsw = fdsr; + auto fdse = fdsr; - timeval tv; - tv.tv_sec = static_cast(sec); - tv.tv_usec = static_cast(usec); + timeval tv; + tv.tv_sec = static_cast(sec); + tv.tv_usec = static_cast(usec); - auto ret = handle_EINTR([&]() { - return select(static_cast(sock + 1), &fdsr, &fdsw, &fdse, &tv); - }); + auto ret = handle_EINTR([&]() { + return select(static_cast(sock + 1), &fdsr, &fdsw, &fdse, &tv); + }); - if (ret > 0 && (FD_ISSET(sock, &fdsr) || FD_ISSET(sock, &fdsw))) { - int error = 0; - socklen_t len = sizeof(error); - return getsockopt(sock, SOL_SOCKET, SO_ERROR, - reinterpret_cast(&error), &len) >= 0 && - !error; - } - return false; + if (ret == 0) { + return Error::ConnectionTimeout; + } + + if (ret > 0 && (FD_ISSET(sock, &fdsr) || FD_ISSET(sock, &fdsw))) { + int error = 0; + socklen_t len = sizeof(error); + auto res = getsockopt(sock, SOL_SOCKET, SO_ERROR, + reinterpret_cast(&error), &len); + auto successful = res >= 0 && !error; + return successful ? Error::Success : Error::Connection; + } + return Error::Connection; #endif } +inline bool is_socket_alive(socket_t sock) { + const auto val = detail::select_read(sock, 0, 0); + if (val == 0) { + return true; + } else if (val < 0 && errno == EBADF) { + return false; + } + char buf[1]; + return detail::read_socket(sock, &buf[0], sizeof(buf), MSG_PEEK) > 0; +} + class SocketStream : public Stream { public: - SocketStream(socket_t sock, time_t read_timeout_sec, time_t read_timeout_usec, - time_t write_timeout_sec, time_t write_timeout_usec); - ~SocketStream() override; + SocketStream(socket_t sock, time_t read_timeout_sec, time_t read_timeout_usec, + time_t write_timeout_sec, time_t write_timeout_usec); + ~SocketStream() override; - bool is_readable() const override; - bool is_writable() const override; - ssize_t read(char *ptr, size_t size) override; - ssize_t write(const char *ptr, size_t size) override; - void get_remote_ip_and_port(std::string &ip, int &port) const override; - socket_t socket() const override; + bool is_readable() const override; + bool is_writable() const override; + ssize_t read(char *ptr, size_t size) override; + ssize_t write(const char *ptr, size_t size) override; + void get_remote_ip_and_port(std::string &ip, int &port) const override; + socket_t socket() const override; private: - socket_t sock_; - time_t read_timeout_sec_; - time_t read_timeout_usec_; - time_t write_timeout_sec_; - time_t write_timeout_usec_; + socket_t sock_; + time_t read_timeout_sec_; + time_t read_timeout_usec_; + time_t write_timeout_sec_; + time_t write_timeout_usec_; + + std::vector read_buff_; + size_t read_buff_off_ = 0; + size_t read_buff_content_size_ = 0; + + static const size_t read_buff_size_ = 1024 * 4; }; #ifdef CPPHTTPLIB_OPENSSL_SUPPORT class SSLSocketStream : public Stream { public: - SSLSocketStream(socket_t sock, SSL *ssl, time_t read_timeout_sec, - time_t read_timeout_usec, time_t write_timeout_sec, - time_t write_timeout_usec); - ~SSLSocketStream() override; - - bool is_readable() const override; - bool is_writable() const override; - ssize_t read(char *ptr, size_t size) override; - ssize_t write(const char *ptr, size_t size) override; - void get_remote_ip_and_port(std::string &ip, int &port) const override; - socket_t socket() const override; + SSLSocketStream(socket_t sock, SSL *ssl, time_t read_timeout_sec, + time_t read_timeout_usec, time_t write_timeout_sec, + time_t write_timeout_usec); + ~SSLSocketStream() override; + + bool is_readable() const override; + bool is_writable() const override; + ssize_t read(char *ptr, size_t size) override; + ssize_t write(const char *ptr, size_t size) override; + void get_remote_ip_and_port(std::string &ip, int &port) const override; + socket_t socket() const override; private: - socket_t sock_; - SSL *ssl_; - time_t read_timeout_sec_; - time_t read_timeout_usec_; - time_t write_timeout_sec_; - time_t write_timeout_usec_; + socket_t sock_; + SSL *ssl_; + time_t read_timeout_sec_; + time_t read_timeout_usec_; + time_t write_timeout_sec_; + time_t write_timeout_usec_; }; #endif -class BufferStream : public Stream { -public: - BufferStream() = default; - ~BufferStream() override = default; - - bool is_readable() const override; - bool is_writable() const override; - ssize_t read(char *ptr, size_t size) override; - ssize_t write(const char *ptr, size_t size) override; - void get_remote_ip_and_port(std::string &ip, int &port) const override; - socket_t socket() const override; - - const std::string &get_buffer() const; - -private: - std::string buffer; - size_t position = 0; -}; - inline bool keep_alive(socket_t sock, time_t keep_alive_timeout_sec) { - using namespace std::chrono; - auto start = steady_clock::now(); - while (true) { - auto val = select_read(sock, 0, 10000); - if (val < 0) { - return false; - } else if (val == 0) { - auto current = steady_clock::now(); - auto duration = duration_cast(current - start); - auto timeout = keep_alive_timeout_sec * 1000; - if (duration.count() > timeout) { return false; } - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - } else { - return true; - } - } + using namespace std::chrono; + auto start = steady_clock::now(); + while (true) { + auto val = select_read(sock, 0, 10000); + if (val < 0) { + return false; + } else if (val == 0) { + auto current = steady_clock::now(); + auto duration = duration_cast(current - start); + auto timeout = keep_alive_timeout_sec * 1000; + if (duration.count() > timeout) { return false; } + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + } else { + return true; + } + } } template inline bool -process_server_socket_core(socket_t sock, size_t keep_alive_max_count, +process_server_socket_core(const std::atomic &svr_sock, socket_t sock, + size_t keep_alive_max_count, time_t keep_alive_timeout_sec, T callback) { - assert(keep_alive_max_count > 0); - auto ret = false; - auto count = keep_alive_max_count; - while (count > 0 && keep_alive(sock, keep_alive_timeout_sec)) { - auto close_connection = count == 1; - auto connection_closed = false; - ret = callback(close_connection, connection_closed); - if (!ret || connection_closed) { break; } - count--; - } - return ret; + assert(keep_alive_max_count > 0); + auto ret = false; + auto count = keep_alive_max_count; + while (svr_sock != INVALID_SOCKET && count > 0 && + keep_alive(sock, keep_alive_timeout_sec)) { + auto close_connection = count == 1; + auto connection_closed = false; + ret = callback(close_connection, connection_closed); + if (!ret || connection_closed) { break; } + count--; + } + return ret; } template inline bool -process_server_socket(socket_t sock, size_t keep_alive_max_count, +process_server_socket(const std::atomic &svr_sock, socket_t sock, + size_t keep_alive_max_count, time_t keep_alive_timeout_sec, time_t read_timeout_sec, time_t read_timeout_usec, time_t write_timeout_sec, time_t write_timeout_usec, T callback) { - return process_server_socket_core( - sock, keep_alive_max_count, keep_alive_timeout_sec, - [&](bool close_connection, bool &connection_closed) { - SocketStream strm(sock, read_timeout_sec, read_timeout_usec, - write_timeout_sec, write_timeout_usec); - return callback(strm, close_connection, connection_closed); - }); + return process_server_socket_core( + svr_sock, sock, keep_alive_max_count, keep_alive_timeout_sec, + [&](bool close_connection, bool &connection_closed) { + SocketStream strm(sock, read_timeout_sec, read_timeout_usec, + write_timeout_sec, write_timeout_usec); + return callback(strm, close_connection, connection_closed); + }); } -template inline bool process_client_socket(socket_t sock, time_t read_timeout_sec, time_t read_timeout_usec, time_t write_timeout_sec, - time_t write_timeout_usec, T callback) { - SocketStream strm(sock, read_timeout_sec, read_timeout_usec, - write_timeout_sec, write_timeout_usec); - return callback(strm); + time_t write_timeout_usec, + std::function callback) { + SocketStream strm(sock, read_timeout_sec, read_timeout_usec, + write_timeout_sec, write_timeout_usec); + return callback(strm); } inline int shutdown_socket(socket_t sock) { #ifdef _WIN32 - return shutdown(sock, SD_BOTH); + return shutdown(sock, SD_BOTH); #else - return shutdown(sock, SHUT_RDWR); + return shutdown(sock, SHUT_RDWR); #endif } template -socket_t create_socket(const char *host, int port, int socket_flags, - bool tcp_nodelay, SocketOptions socket_options, +socket_t create_socket(const char *host, const char *ip, int port, + int address_family, int socket_flags, bool tcp_nodelay, + SocketOptions socket_options, BindOrConnect bind_or_connect) { - // Get address info - struct addrinfo hints; - struct addrinfo *result; - - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = socket_flags; - hints.ai_protocol = 0; + // Get address info + const char *node = nullptr; + struct addrinfo hints; + struct addrinfo *result; + + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = 0; + + if (ip[0] != '\0') { + node = ip; + // Ask getaddrinfo to convert IP in c-string to address + hints.ai_family = AF_UNSPEC; + hints.ai_flags = AI_NUMERICHOST; + } else { + node = host; + hints.ai_family = address_family; + hints.ai_flags = socket_flags; + } - auto service = std::to_string(port); + auto service = std::to_string(port); - if (getaddrinfo(host, service.c_str(), &hints, &result)) { -#ifdef __linux__ - res_init(); + if (getaddrinfo(node, service.c_str(), &hints, &result)) { +#if defined __linux__ && !defined __ANDROID__ + res_init(); #endif - return INVALID_SOCKET; - } + return INVALID_SOCKET; + } - for (auto rp = result; rp; rp = rp->ai_next) { - // Create a socket + for (auto rp = result; rp; rp = rp->ai_next) { + // Create a socket #ifdef _WIN32 - auto sock = WSASocketW(rp->ai_family, rp->ai_socktype, rp->ai_protocol, - nullptr, 0, WSA_FLAG_NO_HANDLE_INHERIT); - /** + auto sock = + WSASocketW(rp->ai_family, rp->ai_socktype, rp->ai_protocol, nullptr, 0, + WSA_FLAG_NO_HANDLE_INHERIT | WSA_FLAG_OVERLAPPED); + /** * Since the WSA_FLAG_NO_HANDLE_INHERIT is only supported on Windows 7 SP1 * and above the socket creation fails on older Windows Systems. * @@ -107267,87 +116079,87 @@ socket_t create_socket(const char *host, int port, int socket_flags, * This flag is supported on Windows 7 with SP1, Windows Server 2008 R2 with * SP1, and later * - */ - if (sock == INVALID_SOCKET) { - sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); - } + */ + if (sock == INVALID_SOCKET) { + sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); + } #else - auto sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); + auto sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); #endif - if (sock == INVALID_SOCKET) { continue; } + if (sock == INVALID_SOCKET) { continue; } #ifndef _WIN32 - if (fcntl(sock, F_SETFD, FD_CLOEXEC) == -1) { continue; } + if (fcntl(sock, F_SETFD, FD_CLOEXEC) == -1) { continue; } #endif - if (tcp_nodelay) { - int yes = 1; - setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&yes), - sizeof(yes)); - } + if (tcp_nodelay) { + int yes = 1; + setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, reinterpret_cast(&yes), + sizeof(yes)); + } - if (socket_options) { socket_options(sock); } + if (socket_options) { socket_options(sock); } - if (rp->ai_family == AF_INET6) { - int no = 0; - setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, reinterpret_cast(&no), - sizeof(no)); - } + if (rp->ai_family == AF_INET6) { + int no = 0; + setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, reinterpret_cast(&no), + sizeof(no)); + } - // bind or connect - if (bind_or_connect(sock, *rp)) { - freeaddrinfo(result); - return sock; - } + // bind or connect + if (bind_or_connect(sock, *rp)) { + freeaddrinfo(result); + return sock; + } - close_socket(sock); - } + close_socket(sock); + } - freeaddrinfo(result); - return INVALID_SOCKET; + freeaddrinfo(result); + return INVALID_SOCKET; } inline void set_nonblocking(socket_t sock, bool nonblocking) { #ifdef _WIN32 - auto flags = nonblocking ? 1UL : 0UL; - ioctlsocket(sock, FIONBIO, &flags); + auto flags = nonblocking ? 1UL : 0UL; + ioctlsocket(sock, FIONBIO, &flags); #else - auto flags = fcntl(sock, F_GETFL, 0); - fcntl(sock, F_SETFL, - nonblocking ? (flags | O_NONBLOCK) : (flags & (~O_NONBLOCK))); + auto flags = fcntl(sock, F_GETFL, 0); + fcntl(sock, F_SETFL, + nonblocking ? (flags | O_NONBLOCK) : (flags & (~O_NONBLOCK))); #endif } inline bool is_connection_error() { #ifdef _WIN32 - return WSAGetLastError() != WSAEWOULDBLOCK; + return WSAGetLastError() != WSAEWOULDBLOCK; #else - return errno != EINPROGRESS; + return errno != EINPROGRESS; #endif } inline bool bind_ip_address(socket_t sock, const char *host) { - struct addrinfo hints; - struct addrinfo *result; + struct addrinfo hints; + struct addrinfo *result; - memset(&hints, 0, sizeof(struct addrinfo)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_protocol = 0; + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = 0; - if (getaddrinfo(host, "0", &hints, &result)) { return false; } + if (getaddrinfo(host, "0", &hints, &result)) { return false; } - auto ret = false; - for (auto rp = result; rp; rp = rp->ai_next) { - const auto &ai = *rp; - if (!::bind(sock, ai.ai_addr, static_cast(ai.ai_addrlen))) { - ret = true; - break; - } - } + auto ret = false; + for (auto rp = result; rp; rp = rp->ai_next) { + const auto &ai = *rp; + if (!::bind(sock, ai.ai_addr, static_cast(ai.ai_addrlen))) { + ret = true; + break; + } + } - freeaddrinfo(result); - return ret; + freeaddrinfo(result); + return ret; } #if !defined _WIN32 && !defined ANDROID @@ -107356,115 +116168,153 @@ inline bool bind_ip_address(socket_t sock, const char *host) { #ifdef USE_IF2IP inline std::string if2ip(const std::string &ifn) { - struct ifaddrs *ifap; - getifaddrs(&ifap); - for (auto ifa = ifap; ifa; ifa = ifa->ifa_next) { - if (ifa->ifa_addr && ifn == ifa->ifa_name) { - if (ifa->ifa_addr->sa_family == AF_INET) { - auto sa = reinterpret_cast(ifa->ifa_addr); - char buf[INET_ADDRSTRLEN]; - if (inet_ntop(AF_INET, &sa->sin_addr, buf, INET_ADDRSTRLEN)) { - freeifaddrs(ifap); - return std::string(buf, INET_ADDRSTRLEN); - } - } - } - } - freeifaddrs(ifap); - return std::string(); + struct ifaddrs *ifap; + getifaddrs(&ifap); + for (auto ifa = ifap; ifa; ifa = ifa->ifa_next) { + if (ifa->ifa_addr && ifn == ifa->ifa_name) { + if (ifa->ifa_addr->sa_family == AF_INET) { + auto sa = reinterpret_cast(ifa->ifa_addr); + char buf[INET_ADDRSTRLEN]; + if (inet_ntop(AF_INET, &sa->sin_addr, buf, INET_ADDRSTRLEN)) { + freeifaddrs(ifap); + return std::string(buf, INET_ADDRSTRLEN); + } + } + } + } + freeifaddrs(ifap); + return std::string(); } #endif -inline socket_t create_client_socket(const char *host, int port, - bool tcp_nodelay, - SocketOptions socket_options, - time_t timeout_sec, time_t timeout_usec, - const std::string &intf, Error &error) { - auto sock = create_socket( - host, port, 0, tcp_nodelay, std::move(socket_options), - [&](socket_t sock, struct addrinfo &ai) -> bool { - if (!intf.empty()) { +inline socket_t create_client_socket( + const char *host, const char *ip, int port, int address_family, + bool tcp_nodelay, SocketOptions socket_options, + time_t connection_timeout_sec, time_t connection_timeout_usec, + time_t read_timeout_sec, time_t read_timeout_usec, time_t write_timeout_sec, + time_t write_timeout_usec, const std::string &intf, Error &error) { + auto sock = create_socket( + host, ip, port, address_family, 0, tcp_nodelay, std::move(socket_options), + [&](socket_t sock2, struct addrinfo &ai) -> bool { + if (!intf.empty()) { #ifdef USE_IF2IP - auto ip = if2ip(intf); - if (ip.empty()) { ip = intf; } - if (!bind_ip_address(sock, ip.c_str())) { - error = Error::BindIPAddress; - return false; - } + auto ip = if2ip(intf); + if (ip.empty()) { ip = intf; } + if (!bind_ip_address(sock2, ip.c_str())) { + error = Error::BindIPAddress; + return false; + } #endif - } + } - set_nonblocking(sock, true); + set_nonblocking(sock2, true); - auto ret = - ::connect(sock, ai.ai_addr, static_cast(ai.ai_addrlen)); + auto ret = + ::connect(sock2, ai.ai_addr, static_cast(ai.ai_addrlen)); - if (ret < 0) { - if (is_connection_error() || - !wait_until_socket_is_ready(sock, timeout_sec, timeout_usec)) { - close_socket(sock); - error = Error::Connection; - return false; - } - } + if (ret < 0) { + if (is_connection_error()) { + error = Error::Connection; + return false; + } + error = wait_until_socket_is_ready(sock2, connection_timeout_sec, + connection_timeout_usec); + if (error != Error::Success) { + return false; + } + } - set_nonblocking(sock, false); - error = Error::Success; - return true; - }); + set_nonblocking(sock2, false); - if (sock != INVALID_SOCKET) { - error = Error::Success; - } else { - if (error == Error::Success) { error = Error::Connection; } - } + { +#ifdef _WIN32 + auto timeout = static_cast(read_timeout_sec * 1000 + + read_timeout_usec / 1000); + setsockopt(sock2, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, + sizeof(timeout)); +#else + timeval tv; + tv.tv_sec = static_cast(read_timeout_sec); + tv.tv_usec = static_cast(read_timeout_usec); + setsockopt(sock2, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)); +#endif + } + { + +#ifdef _WIN32 + auto timeout = static_cast(write_timeout_sec * 1000 + + write_timeout_usec / 1000); + setsockopt(sock2, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, + sizeof(timeout)); +#else + timeval tv; + tv.tv_sec = static_cast(write_timeout_sec); + tv.tv_usec = static_cast(write_timeout_usec); + setsockopt(sock2, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv)); +#endif + } + + error = Error::Success; + return true; + }); + + if (sock != INVALID_SOCKET) { + error = Error::Success; + } else { + if (error == Error::Success) { error = Error::Connection; } + } - return sock; + return sock; } -inline void get_remote_ip_and_port(const struct sockaddr_storage &addr, +inline bool get_remote_ip_and_port(const struct sockaddr_storage &addr, socklen_t addr_len, std::string &ip, int &port) { - if (addr.ss_family == AF_INET) { - port = ntohs(reinterpret_cast(&addr)->sin_port); - } else if (addr.ss_family == AF_INET6) { - port = - ntohs(reinterpret_cast(&addr)->sin6_port); - } + if (addr.ss_family == AF_INET) { + port = ntohs(reinterpret_cast(&addr)->sin_port); + } else if (addr.ss_family == AF_INET6) { + port = + ntohs(reinterpret_cast(&addr)->sin6_port); + } else { + return false; + } - std::array ipstr{}; - if (!getnameinfo(reinterpret_cast(&addr), addr_len, - ipstr.data(), static_cast(ipstr.size()), nullptr, - 0, NI_NUMERICHOST)) { - ip = ipstr.data(); - } + std::array ipstr{}; + if (getnameinfo(reinterpret_cast(&addr), addr_len, + ipstr.data(), static_cast(ipstr.size()), nullptr, + 0, NI_NUMERICHOST)) { + return false; + } + + ip = ipstr.data(); + return true; } inline void get_remote_ip_and_port(socket_t sock, std::string &ip, int &port) { - struct sockaddr_storage addr; - socklen_t addr_len = sizeof(addr); + struct sockaddr_storage addr; + socklen_t addr_len = sizeof(addr); - if (!getpeername(sock, reinterpret_cast(&addr), - &addr_len)) { - get_remote_ip_and_port(addr, addr_len, ip, port); - } + if (!getpeername(sock, reinterpret_cast(&addr), + &addr_len)) { + get_remote_ip_and_port(addr, addr_len, ip, port); + } } inline constexpr unsigned int str2tag_core(const char *s, size_t l, unsigned int h) { - return (l == 0) ? h - : str2tag_core(s + 1, l - 1, - (h * 33) ^ static_cast(*s)); + return (l == 0) ? h + : str2tag_core(s + 1, l - 1, + (h * 33) ^ static_cast(*s)); } inline unsigned int str2tag(const std::string &s) { - return str2tag_core(s.data(), s.size(), 0); + return str2tag_core(s.data(), s.size(), 0); } namespace udl { -inline constexpr unsigned int operator"" _(const char *s, size_t l) { - return str2tag_core(s, l, 0); +inline constexpr unsigned int operator"" _t(const char *s, size_t l) { + return str2tag_core(s, l, 0); } } // namespace udl @@ -107472,742 +116322,705 @@ inline constexpr unsigned int operator"" _(const char *s, size_t l) { inline const char * find_content_type(const std::string &path, const std::map &user_data) { - auto ext = file_extension(path); - - auto it = user_data.find(ext); - if (it != user_data.end()) { return it->second.c_str(); } - - using udl::operator"" _; - - switch (str2tag(ext)) { - default: return nullptr; - case "css"_: return "text/css"; - case "csv"_: return "text/csv"; - case "txt"_: return "text/plain"; - case "vtt"_: return "text/vtt"; - case "htm"_: - case "html"_: return "text/html"; - - case "apng"_: return "image/apng"; - case "avif"_: return "image/avif"; - case "bmp"_: return "image/bmp"; - case "gif"_: return "image/gif"; - case "png"_: return "image/png"; - case "svg"_: return "image/svg+xml"; - case "webp"_: return "image/webp"; - case "ico"_: return "image/x-icon"; - case "tif"_: return "image/tiff"; - case "tiff"_: return "image/tiff"; - case "jpg"_: - case "jpeg"_: return "image/jpeg"; - - case "mp4"_: return "video/mp4"; - case "mpeg"_: return "video/mpeg"; - case "webm"_: return "video/webm"; - - case "mp3"_: return "audio/mp3"; - case "mpga"_: return "audio/mpeg"; - case "weba"_: return "audio/webm"; - case "wav"_: return "audio/wave"; - - case "otf"_: return "font/otf"; - case "ttf"_: return "font/ttf"; - case "woff"_: return "font/woff"; - case "woff2"_: return "font/woff2"; - - case "7z"_: return "application/x-7z-compressed"; - case "atom"_: return "application/atom+xml"; - case "pdf"_: return "application/pdf"; - case "js"_: - case "mjs"_: return "application/javascript"; - case "json"_: return "application/json"; - case "rss"_: return "application/rss+xml"; - case "tar"_: return "application/x-tar"; - case "xht"_: - case "xhtml"_: return "application/xhtml+xml"; - case "xslt"_: return "application/xslt+xml"; - case "xml"_: return "application/xml"; - case "gz"_: return "application/gzip"; - case "zip"_: return "application/zip"; - case "wasm"_: return "application/wasm"; - } + auto ext = file_extension(path); + + auto it = user_data.find(ext); + if (it != user_data.end()) { return it->second.c_str(); } + + using udl::operator"" _t; + + switch (str2tag(ext)) { + default: return nullptr; + case "css"_t: return "text/css"; + case "csv"_t: return "text/csv"; + case "txt"_t: return "text/plain"; + case "vtt"_t: return "text/vtt"; + case "htm"_t: + case "html"_t: return "text/html"; + + case "apng"_t: return "image/apng"; + case "avif"_t: return "image/avif"; + case "bmp"_t: return "image/bmp"; + case "gif"_t: return "image/gif"; + case "png"_t: return "image/png"; + case "svg"_t: return "image/svg+xml"; + case "webp"_t: return "image/webp"; + case "ico"_t: return "image/x-icon"; + case "tif"_t: return "image/tiff"; + case "tiff"_t: return "image/tiff"; + case "jpg"_t: + case "jpeg"_t: return "image/jpeg"; + + case "mp4"_t: return "video/mp4"; + case "mpeg"_t: return "video/mpeg"; + case "webm"_t: return "video/webm"; + + case "mp3"_t: return "audio/mp3"; + case "mpga"_t: return "audio/mpeg"; + case "weba"_t: return "audio/webm"; + case "wav"_t: return "audio/wave"; + + case "otf"_t: return "font/otf"; + case "ttf"_t: return "font/ttf"; + case "woff"_t: return "font/woff"; + case "woff2"_t: return "font/woff2"; + + case "7z"_t: return "application/x-7z-compressed"; + case "atom"_t: return "application/atom+xml"; + case "pdf"_t: return "application/pdf"; + case "js"_t: + case "mjs"_t: return "application/javascript"; + case "json"_t: return "application/json"; + case "rss"_t: return "application/rss+xml"; + case "tar"_t: return "application/x-tar"; + case "xht"_t: + case "xhtml"_t: return "application/xhtml+xml"; + case "xslt"_t: return "application/xslt+xml"; + case "xml"_t: return "application/xml"; + case "gz"_t: return "application/gzip"; + case "zip"_t: return "application/zip"; + case "wasm"_t: return "application/wasm"; + } } inline const char *status_message(int status) { - switch (status) { - case 100: return "Continue"; - case 101: return "Switching Protocol"; - case 102: return "Processing"; - case 103: return "Early Hints"; - case 200: return "OK"; - case 201: return "Created"; - case 202: return "Accepted"; - case 203: return "Non-Authoritative Information"; - case 204: return "No Content"; - case 205: return "Reset Content"; - case 206: return "Partial Content"; - case 207: return "Multi-Status"; - case 208: return "Already Reported"; - case 226: return "IM Used"; - case 300: return "Multiple Choice"; - case 301: return "Moved Permanently"; - case 302: return "Found"; - case 303: return "See Other"; - case 304: return "Not Modified"; - case 305: return "Use Proxy"; - case 306: return "unused"; - case 307: return "Temporary Redirect"; - case 308: return "Permanent Redirect"; - case 400: return "Bad Request"; - case 401: return "Unauthorized"; - case 402: return "Payment Required"; - case 403: return "Forbidden"; - case 404: return "Not Found"; - case 405: return "Method Not Allowed"; - case 406: return "Not Acceptable"; - case 407: return "Proxy Authentication Required"; - case 408: return "Request Timeout"; - case 409: return "Conflict"; - case 410: return "Gone"; - case 411: return "Length Required"; - case 412: return "Precondition Failed"; - case 413: return "Payload Too Large"; - case 414: return "URI Too Long"; - case 415: return "Unsupported Media Type"; - case 416: return "Range Not Satisfiable"; - case 417: return "Expectation Failed"; - case 418: return "I'm a teapot"; - case 421: return "Misdirected Request"; - case 422: return "Unprocessable Entity"; - case 423: return "Locked"; - case 424: return "Failed Dependency"; - case 425: return "Too Early"; - case 426: return "Upgrade Required"; - case 428: return "Precondition Required"; - case 429: return "Too Many Requests"; - case 431: return "Request Header Fields Too Large"; - case 451: return "Unavailable For Legal Reasons"; - case 501: return "Not Implemented"; - case 502: return "Bad Gateway"; - case 503: return "Service Unavailable"; - case 504: return "Gateway Timeout"; - case 505: return "HTTP Version Not Supported"; - case 506: return "Variant Also Negotiates"; - case 507: return "Insufficient Storage"; - case 508: return "Loop Detected"; - case 510: return "Not Extended"; - case 511: return "Network Authentication Required"; + switch (status) { + case 100: return "Continue"; + case 101: return "Switching Protocol"; + case 102: return "Processing"; + case 103: return "Early Hints"; + case 200: return "OK"; + case 201: return "Created"; + case 202: return "Accepted"; + case 203: return "Non-Authoritative Information"; + case 204: return "No Content"; + case 205: return "Reset Content"; + case 206: return "Partial Content"; + case 207: return "Multi-Status"; + case 208: return "Already Reported"; + case 226: return "IM Used"; + case 300: return "Multiple Choice"; + case 301: return "Moved Permanently"; + case 302: return "Found"; + case 303: return "See Other"; + case 304: return "Not Modified"; + case 305: return "Use Proxy"; + case 306: return "unused"; + case 307: return "Temporary Redirect"; + case 308: return "Permanent Redirect"; + case 400: return "Bad Request"; + case 401: return "Unauthorized"; + case 402: return "Payment Required"; + case 403: return "Forbidden"; + case 404: return "Not Found"; + case 405: return "Method Not Allowed"; + case 406: return "Not Acceptable"; + case 407: return "Proxy Authentication Required"; + case 408: return "Request Timeout"; + case 409: return "Conflict"; + case 410: return "Gone"; + case 411: return "Length Required"; + case 412: return "Precondition Failed"; + case 413: return "Payload Too Large"; + case 414: return "URI Too Long"; + case 415: return "Unsupported Media Type"; + case 416: return "Range Not Satisfiable"; + case 417: return "Expectation Failed"; + case 418: return "I'm a teapot"; + case 421: return "Misdirected Request"; + case 422: return "Unprocessable Entity"; + case 423: return "Locked"; + case 424: return "Failed Dependency"; + case 425: return "Too Early"; + case 426: return "Upgrade Required"; + case 428: return "Precondition Required"; + case 429: return "Too Many Requests"; + case 431: return "Request Header Fields Too Large"; + case 451: return "Unavailable For Legal Reasons"; + case 501: return "Not Implemented"; + case 502: return "Bad Gateway"; + case 503: return "Service Unavailable"; + case 504: return "Gateway Timeout"; + case 505: return "HTTP Version Not Supported"; + case 506: return "Variant Also Negotiates"; + case 507: return "Insufficient Storage"; + case 508: return "Loop Detected"; + case 510: return "Not Extended"; + case 511: return "Network Authentication Required"; - default: - case 500: return "Internal Server Error"; - } + default: + case 500: return "Internal Server Error"; + } } inline bool can_compress_content_type(const std::string &content_type) { - return (!content_type.find("text/") && content_type != "text/event-stream") || - content_type == "image/svg+xml" || - content_type == "application/javascript" || - content_type == "application/json" || - content_type == "application/xml" || - content_type == "application/xhtml+xml"; + return (!content_type.rfind("text/", 0) && + content_type != "text/event-stream") || + content_type == "image/svg+xml" || + content_type == "application/javascript" || + content_type == "application/json" || + content_type == "application/xml" || + content_type == "application/protobuf" || + content_type == "application/xhtml+xml"; } -enum class EncodingType { None = 0, Gzip, Brotli }; - inline EncodingType encoding_type(const Request &req, const Response &res) { - auto ret = - detail::can_compress_content_type(res.get_header_value("Content-Type")); - if (!ret) { return EncodingType::None; } + auto ret = + detail::can_compress_content_type(res.get_header_value("Content-Type")); + if (!ret) { return EncodingType::None; } - const auto &s = req.get_header_value("Accept-Encoding"); - (void)(s); + const auto &s = req.get_header_value("Accept-Encoding"); + (void)(s); #ifdef CPPHTTPLIB_BROTLI_SUPPORT - // TODO: 'Accept-Encoding' has br, not br;q=0 - ret = s.find("br") != std::string::npos; - if (ret) { return EncodingType::Brotli; } + // TODO: 'Accept-Encoding' has br, not br;q=0 + ret = s.find("br") != std::string::npos; + if (ret) { return EncodingType::Brotli; } #endif #ifdef CPPHTTPLIB_ZLIB_SUPPORT - // TODO: 'Accept-Encoding' has gzip, not gzip;q=0 - ret = s.find("gzip") != std::string::npos; - if (ret) { return EncodingType::Gzip; } + // TODO: 'Accept-Encoding' has gzip, not gzip;q=0 + ret = s.find("gzip") != std::string::npos; + if (ret) { return EncodingType::Gzip; } #endif - return EncodingType::None; + return EncodingType::None; } -class compressor { -public: - virtual ~compressor(){}; +inline bool nocompressor::compress(const char *data, size_t data_length, + bool /*last*/, Callback callback) { + if (!data_length) { return true; } + return callback(data, data_length); +} - typedef std::function Callback; - virtual bool compress(const char *data, size_t data_length, bool last, - Callback callback) = 0; -}; +#ifdef CPPHTTPLIB_ZLIB_SUPPORT +inline gzip_compressor::gzip_compressor() { + std::memset(&strm_, 0, sizeof(strm_)); + strm_.zalloc = Z_NULL; + strm_.zfree = Z_NULL; + strm_.opaque = Z_NULL; -class decompressor { -public: - virtual ~decompressor() {} + is_valid_ = deflateInit2(&strm_, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 31, 8, + Z_DEFAULT_STRATEGY) == Z_OK; +} - virtual bool is_valid() const = 0; +inline gzip_compressor::~gzip_compressor() { deflateEnd(&strm_); } - typedef std::function Callback; - virtual bool decompress(const char *data, size_t data_length, - Callback callback) = 0; -}; +inline bool gzip_compressor::compress(const char *data, size_t data_length, + bool last, Callback callback) { + assert(is_valid_); -class nocompressor : public compressor { -public: - ~nocompressor(){}; + do { + constexpr size_t max_avail_in = + (std::numeric_limits::max)(); - bool compress(const char *data, size_t data_length, bool /*last*/, - Callback callback) override { - if (!data_length) { return true; } - return callback(data, data_length); - } -}; + strm_.avail_in = static_cast( + (std::min)(data_length, max_avail_in)); + strm_.next_in = const_cast(reinterpret_cast(data)); -#ifdef CPPHTTPLIB_ZLIB_SUPPORT -class gzip_compressor : public compressor { -public: - gzip_compressor() { - std::memset(&strm_, 0, sizeof(strm_)); - strm_.zalloc = Z_NULL; - strm_.zfree = Z_NULL; - strm_.opaque = Z_NULL; - - is_valid_ = deflateInit2(&strm_, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 31, 8, - Z_DEFAULT_STRATEGY) == Z_OK; - } + data_length -= strm_.avail_in; + data += strm_.avail_in; - ~gzip_compressor() { deflateEnd(&strm_); } + auto flush = (last && data_length == 0) ? Z_FINISH : Z_NO_FLUSH; + int ret = Z_OK; - bool compress(const char *data, size_t data_length, bool last, - Callback callback) override { - assert(is_valid_); + std::array buff{}; + do { + strm_.avail_out = static_cast(buff.size()); + strm_.next_out = reinterpret_cast(buff.data()); - auto flush = last ? Z_FINISH : Z_NO_FLUSH; + ret = deflate(&strm_, flush); + if (ret == Z_STREAM_ERROR) { return false; } - strm_.avail_in = static_cast(data_length); - strm_.next_in = const_cast(reinterpret_cast(data)); + if (!callback(buff.data(), buff.size() - strm_.avail_out)) { + return false; + } + } while (strm_.avail_out == 0); - int ret = Z_OK; + assert((flush == Z_FINISH && ret == Z_STREAM_END) || + (flush == Z_NO_FLUSH && ret == Z_OK)); + assert(strm_.avail_in == 0); - std::array buff{}; - do { - strm_.avail_out = buff.size(); - strm_.next_out = reinterpret_cast(buff.data()); + } while (data_length > 0); - ret = deflate(&strm_, flush); - if (ret == Z_STREAM_ERROR) { return false; } + return true; +} - if (!callback(buff.data(), buff.size() - strm_.avail_out)) { - return false; - } - } while (strm_.avail_out == 0); +inline gzip_decompressor::gzip_decompressor() { + std::memset(&strm_, 0, sizeof(strm_)); + strm_.zalloc = Z_NULL; + strm_.zfree = Z_NULL; + strm_.opaque = Z_NULL; - assert((last && ret == Z_STREAM_END) || (!last && ret == Z_OK)); - assert(strm_.avail_in == 0); - return true; - } + // 15 is the value of wbits, which should be at the maximum possible value + // to ensure that any gzip stream can be decoded. The offset of 32 specifies + // that the stream type should be automatically detected either gzip or + // deflate. + is_valid_ = inflateInit2(&strm_, 32 + 15) == Z_OK; +} -private: - bool is_valid_ = false; - z_stream strm_; -}; +inline gzip_decompressor::~gzip_decompressor() { inflateEnd(&strm_); } -class gzip_decompressor : public decompressor { -public: - gzip_decompressor() { - std::memset(&strm_, 0, sizeof(strm_)); - strm_.zalloc = Z_NULL; - strm_.zfree = Z_NULL; - strm_.opaque = Z_NULL; - - // 15 is the value of wbits, which should be at the maximum possible value - // to ensure that any gzip stream can be decoded. The offset of 32 specifies - // that the stream type should be automatically detected either gzip or - // deflate. - is_valid_ = inflateInit2(&strm_, 32 + 15) == Z_OK; - } +inline bool gzip_decompressor::is_valid() const { return is_valid_; } - ~gzip_decompressor() { inflateEnd(&strm_); } +inline bool gzip_decompressor::decompress(const char *data, size_t data_length, + Callback callback) { + assert(is_valid_); - bool is_valid() const override { return is_valid_; } + int ret = Z_OK; - bool decompress(const char *data, size_t data_length, - Callback callback) override { - assert(is_valid_); + do { + constexpr size_t max_avail_in = + (std::numeric_limits::max)(); - int ret = Z_OK; + strm_.avail_in = static_cast( + (std::min)(data_length, max_avail_in)); + strm_.next_in = const_cast(reinterpret_cast(data)); - strm_.avail_in = static_cast(data_length); - strm_.next_in = const_cast(reinterpret_cast(data)); + data_length -= strm_.avail_in; + data += strm_.avail_in; - std::array buff{}; - while (strm_.avail_in > 0) { - strm_.avail_out = buff.size(); - strm_.next_out = reinterpret_cast(buff.data()); + std::array buff{}; + while (strm_.avail_in > 0) { + strm_.avail_out = static_cast(buff.size()); + strm_.next_out = reinterpret_cast(buff.data()); - ret = inflate(&strm_, Z_NO_FLUSH); - assert(ret != Z_STREAM_ERROR); - switch (ret) { - case Z_NEED_DICT: - case Z_DATA_ERROR: - case Z_MEM_ERROR: inflateEnd(&strm_); return false; - } + auto prev_avail_in = strm_.avail_in; - if (!callback(buff.data(), buff.size() - strm_.avail_out)) { - return false; - } - } + ret = inflate(&strm_, Z_NO_FLUSH); - return ret == Z_OK || ret == Z_STREAM_END; - } + if (prev_avail_in - strm_.avail_in == 0) { return false; } -private: - bool is_valid_ = false; - z_stream strm_; -}; -#endif + assert(ret != Z_STREAM_ERROR); + switch (ret) { + case Z_NEED_DICT: + case Z_DATA_ERROR: + case Z_MEM_ERROR: inflateEnd(&strm_); return false; + } -#ifdef CPPHTTPLIB_BROTLI_SUPPORT -class brotli_compressor : public compressor { -public: - brotli_compressor() { - state_ = BrotliEncoderCreateInstance(nullptr, nullptr, nullptr); - } + if (!callback(buff.data(), buff.size() - strm_.avail_out)) { + return false; + } + } - ~brotli_compressor() { BrotliEncoderDestroyInstance(state_); } + if (ret != Z_OK && ret != Z_STREAM_END) return false; - bool compress(const char *data, size_t data_length, bool last, - Callback callback) override { - std::array buff{}; + } while (data_length > 0); - auto operation = last ? BROTLI_OPERATION_FINISH : BROTLI_OPERATION_PROCESS; - auto available_in = data_length; - auto next_in = reinterpret_cast(data); + return true; +} +#endif - for (;;) { - if (last) { - if (BrotliEncoderIsFinished(state_)) { break; } - } else { - if (!available_in) { break; } - } +#ifdef CPPHTTPLIB_BROTLI_SUPPORT +inline brotli_compressor::brotli_compressor() { + state_ = BrotliEncoderCreateInstance(nullptr, nullptr, nullptr); +} - auto available_out = buff.size(); - auto next_out = buff.data(); +inline brotli_compressor::~brotli_compressor() { + BrotliEncoderDestroyInstance(state_); +} - if (!BrotliEncoderCompressStream(state_, operation, &available_in, - &next_in, &available_out, &next_out, - nullptr)) { - return false; - } +inline bool brotli_compressor::compress(const char *data, size_t data_length, + bool last, Callback callback) { + std::array buff{}; - auto output_bytes = buff.size() - available_out; - if (output_bytes) { - callback(reinterpret_cast(buff.data()), output_bytes); - } - } + auto operation = last ? BROTLI_OPERATION_FINISH : BROTLI_OPERATION_PROCESS; + auto available_in = data_length; + auto next_in = reinterpret_cast(data); - return true; - } + for (;;) { + if (last) { + if (BrotliEncoderIsFinished(state_)) { break; } + } else { + if (!available_in) { break; } + } -private: - BrotliEncoderState *state_ = nullptr; -}; + auto available_out = buff.size(); + auto next_out = buff.data(); -class brotli_decompressor : public decompressor { -public: - brotli_decompressor() { - decoder_s = BrotliDecoderCreateInstance(0, 0, 0); - decoder_r = decoder_s ? BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT - : BROTLI_DECODER_RESULT_ERROR; - } + if (!BrotliEncoderCompressStream(state_, operation, &available_in, &next_in, + &available_out, &next_out, nullptr)) { + return false; + } - ~brotli_decompressor() { - if (decoder_s) { BrotliDecoderDestroyInstance(decoder_s); } - } + auto output_bytes = buff.size() - available_out; + if (output_bytes) { + callback(reinterpret_cast(buff.data()), output_bytes); + } + } - bool is_valid() const override { return decoder_s; } + return true; +} - bool decompress(const char *data, size_t data_length, - Callback callback) override { - if (decoder_r == BROTLI_DECODER_RESULT_SUCCESS || - decoder_r == BROTLI_DECODER_RESULT_ERROR) { - return 0; - } +inline brotli_decompressor::brotli_decompressor() { + decoder_s = BrotliDecoderCreateInstance(0, 0, 0); + decoder_r = decoder_s ? BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT + : BROTLI_DECODER_RESULT_ERROR; +} - const uint8_t *next_in = (const uint8_t *)data; - size_t avail_in = data_length; - size_t total_out; +inline brotli_decompressor::~brotli_decompressor() { + if (decoder_s) { BrotliDecoderDestroyInstance(decoder_s); } +} - decoder_r = BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT; +inline bool brotli_decompressor::is_valid() const { return decoder_s; } - std::array buff{}; - while (decoder_r == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) { - char *next_out = buff.data(); - size_t avail_out = buff.size(); +inline bool brotli_decompressor::decompress(const char *data, + size_t data_length, + Callback callback) { + if (decoder_r == BROTLI_DECODER_RESULT_SUCCESS || + decoder_r == BROTLI_DECODER_RESULT_ERROR) { + return 0; + } - decoder_r = BrotliDecoderDecompressStream( - decoder_s, &avail_in, &next_in, &avail_out, - reinterpret_cast(&next_out), &total_out); + const uint8_t *next_in = (const uint8_t *)data; + size_t avail_in = data_length; + size_t total_out; - if (decoder_r == BROTLI_DECODER_RESULT_ERROR) { return false; } + decoder_r = BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT; - if (!callback(buff.data(), buff.size() - avail_out)) { return false; } - } + std::array buff{}; + while (decoder_r == BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT) { + char *next_out = buff.data(); + size_t avail_out = buff.size(); - return decoder_r == BROTLI_DECODER_RESULT_SUCCESS || - decoder_r == BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT; - } + decoder_r = BrotliDecoderDecompressStream( + decoder_s, &avail_in, &next_in, &avail_out, + reinterpret_cast(&next_out), &total_out); -private: - BrotliDecoderResult decoder_r; - BrotliDecoderState *decoder_s = nullptr; -}; + if (decoder_r == BROTLI_DECODER_RESULT_ERROR) { return false; } + + if (!callback(buff.data(), buff.size() - avail_out)) { return false; } + } + + return decoder_r == BROTLI_DECODER_RESULT_SUCCESS || + decoder_r == BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT; +} #endif inline bool has_header(const Headers &headers, const char *key) { - return headers.find(key) != headers.end(); + return headers.find(key) != headers.end(); } inline const char *get_header_value(const Headers &headers, const char *key, - size_t id = 0, const char *def = nullptr) { - auto rng = headers.equal_range(key); - auto it = rng.first; - std::advance(it, static_cast(id)); - if (it != rng.second) { return it->second.c_str(); } - return def; -} - -template -inline T get_header_value(const Headers & /*headers*/, const char * /*key*/, - size_t /*id*/ = 0, uint64_t /*def*/ = 0) {} - -template <> -inline uint64_t get_header_value(const Headers &headers, - const char *key, size_t id, - uint64_t def) { - auto rng = headers.equal_range(key); - auto it = rng.first; - std::advance(it, static_cast(id)); - if (it != rng.second) { - return std::strtoull(it->second.data(), nullptr, 10); - } - return def; + size_t id, const char *def) { + auto rng = headers.equal_range(key); + auto it = rng.first; + std::advance(it, static_cast(id)); + if (it != rng.second) { return it->second.c_str(); } + return def; } template inline bool parse_header(const char *beg, const char *end, T fn) { - // Skip trailing spaces and tabs. - while (beg < end && is_space_or_tab(end[-1])) { - end--; - } + // Skip trailing spaces and tabs. + while (beg < end && is_space_or_tab(end[-1])) { + end--; + } - auto p = beg; - while (p < end && *p != ':') { - p++; - } + auto p = beg; + while (p < end && *p != ':') { + p++; + } - if (p == end) { return false; } + if (p == end) { return false; } - auto key_end = p; + auto key_end = p; - if (*p++ != ':') { return false; } + if (*p++ != ':') { return false; } - while (p < end && is_space_or_tab(*p)) { - p++; - } + while (p < end && is_space_or_tab(*p)) { + p++; + } - if (p < end) { - fn(std::string(beg, key_end), decode_url(std::string(p, end), false)); - return true; - } + if (p < end) { + fn(std::string(beg, key_end), decode_url(std::string(p, end), false)); + return true; + } - return false; + return false; } inline bool read_headers(Stream &strm, Headers &headers) { - const auto bufsiz = 2048; - char buf[bufsiz]; - stream_line_reader line_reader(strm, buf, bufsiz); + const auto bufsiz = 2048; + char buf[bufsiz]; + stream_line_reader line_reader(strm, buf, bufsiz); - for (;;) { - if (!line_reader.getline()) { return false; } + for (;;) { + if (!line_reader.getline()) { return false; } + + // Check if the line ends with CRLF. + auto line_terminator_len = 2; + if (line_reader.end_with_crlf()) { + // Blank line indicates end of headers. + if (line_reader.size() == 2) { break; } +#ifdef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR + } else { + // Blank line indicates end of headers. + if (line_reader.size() == 1) { break; } + line_terminator_len = 1; + } +#else + } else { + continue; // Skip invalid line. + } +#endif - // Check if the line ends with CRLF. - if (line_reader.end_with_crlf()) { - // Blank line indicates end of headers. - if (line_reader.size() == 2) { break; } - } else { - continue; // Skip invalid line. - } + if (line_reader.size() > CPPHTTPLIB_HEADER_MAX_LENGTH) { return false; } - // Exclude CRLF - auto end = line_reader.ptr() + line_reader.size() - 2; + // Exclude line terminator + auto end = line_reader.ptr() + line_reader.size() - line_terminator_len; - parse_header(line_reader.ptr(), end, - [&](std::string &&key, std::string &&val) { - headers.emplace(std::move(key), std::move(val)); - }); - } + parse_header(line_reader.ptr(), end, + [&](std::string &&key, std::string &&val) { + headers.emplace(std::move(key), std::move(val)); + }); + } - return true; + return true; } inline bool read_content_with_length(Stream &strm, uint64_t len, Progress progress, ContentReceiverWithProgress out) { - char buf[CPPHTTPLIB_RECV_BUFSIZ]; + char buf[CPPHTTPLIB_RECV_BUFSIZ]; - uint64_t r = 0; - while (r < len) { - auto read_len = static_cast(len - r); - auto n = strm.read(buf, (std::min)(read_len, CPPHTTPLIB_RECV_BUFSIZ)); - if (n <= 0) { return false; } + uint64_t r = 0; + while (r < len) { + auto read_len = static_cast(len - r); + auto n = strm.read(buf, (std::min)(read_len, CPPHTTPLIB_RECV_BUFSIZ)); + if (n <= 0) { return false; } - if (!out(buf, static_cast(n), r, len)) { return false; } - r += static_cast(n); + if (!out(buf, static_cast(n), r, len)) { return false; } + r += static_cast(n); - if (progress) { - if (!progress(r, len)) { return false; } - } - } + if (progress) { + if (!progress(r, len)) { return false; } + } + } - return true; + return true; } inline void skip_content_with_length(Stream &strm, uint64_t len) { - char buf[CPPHTTPLIB_RECV_BUFSIZ]; - uint64_t r = 0; - while (r < len) { - auto read_len = static_cast(len - r); - auto n = strm.read(buf, (std::min)(read_len, CPPHTTPLIB_RECV_BUFSIZ)); - if (n <= 0) { return; } - r += static_cast(n); - } + char buf[CPPHTTPLIB_RECV_BUFSIZ]; + uint64_t r = 0; + while (r < len) { + auto read_len = static_cast(len - r); + auto n = strm.read(buf, (std::min)(read_len, CPPHTTPLIB_RECV_BUFSIZ)); + if (n <= 0) { return; } + r += static_cast(n); + } } inline bool read_content_without_length(Stream &strm, ContentReceiverWithProgress out) { - char buf[CPPHTTPLIB_RECV_BUFSIZ]; - uint64_t r = 0; - for (;;) { - auto n = strm.read(buf, CPPHTTPLIB_RECV_BUFSIZ); - if (n < 0) { - return false; - } else if (n == 0) { - return true; - } + char buf[CPPHTTPLIB_RECV_BUFSIZ]; + uint64_t r = 0; + for (;;) { + auto n = strm.read(buf, CPPHTTPLIB_RECV_BUFSIZ); + if (n < 0) { + return false; + } else if (n == 0) { + return true; + } - if (!out(buf, static_cast(n), r, 0)) { return false; } - r += static_cast(n); - } + if (!out(buf, static_cast(n), r, 0)) { return false; } + r += static_cast(n); + } - return true; + return true; } inline bool read_content_chunked(Stream &strm, ContentReceiverWithProgress out) { - const auto bufsiz = 16; - char buf[bufsiz]; + const auto bufsiz = 16; + char buf[bufsiz]; - stream_line_reader line_reader(strm, buf, bufsiz); + stream_line_reader line_reader(strm, buf, bufsiz); - if (!line_reader.getline()) { return false; } + if (!line_reader.getline()) { return false; } - unsigned long chunk_len; - while (true) { - char *end_ptr; + unsigned long chunk_len; + while (true) { + char *end_ptr; - chunk_len = std::strtoul(line_reader.ptr(), &end_ptr, 16); + chunk_len = std::strtoul(line_reader.ptr(), &end_ptr, 16); - if (end_ptr == line_reader.ptr()) { return false; } - if (chunk_len == ULONG_MAX) { return false; } + if (end_ptr == line_reader.ptr()) { return false; } + if (chunk_len == ULONG_MAX) { return false; } - if (chunk_len == 0) { break; } + if (chunk_len == 0) { break; } - if (!read_content_with_length(strm, chunk_len, nullptr, out)) { - return false; - } + if (!read_content_with_length(strm, chunk_len, nullptr, out)) { + return false; + } - if (!line_reader.getline()) { return false; } + if (!line_reader.getline()) { return false; } - if (strcmp(line_reader.ptr(), "\r\n")) { break; } + if (strcmp(line_reader.ptr(), "\r\n")) { break; } - if (!line_reader.getline()) { return false; } - } + if (!line_reader.getline()) { return false; } + } - if (chunk_len == 0) { - // Reader terminator after chunks - if (!line_reader.getline() || strcmp(line_reader.ptr(), "\r\n")) - return false; - } + if (chunk_len == 0) { + // Reader terminator after chunks + if (!line_reader.getline() || strcmp(line_reader.ptr(), "\r\n")) + return false; + } - return true; + return true; } inline bool is_chunked_transfer_encoding(const Headers &headers) { - return !strcasecmp(get_header_value(headers, "Transfer-Encoding", 0, ""), - "chunked"); + return !strcasecmp(get_header_value(headers, "Transfer-Encoding", 0, ""), + "chunked"); } template bool prepare_content_receiver(T &x, int &status, ContentReceiverWithProgress receiver, bool decompress, U callback) { - if (decompress) { - std::string encoding = x.get_header_value("Content-Encoding"); - std::unique_ptr decompressor; + if (decompress) { + std::string encoding = x.get_header_value("Content-Encoding"); + std::unique_ptr decompressor; - if (encoding.find("gzip") != std::string::npos || - encoding.find("deflate") != std::string::npos) { + if (encoding == "gzip" || encoding == "deflate") { #ifdef CPPHTTPLIB_ZLIB_SUPPORT - decompressor = detail::make_unique(); + decompressor = detail::make_unique(); #else - status = 415; - return false; + status = 415; + return false; #endif - } else if (encoding.find("br") != std::string::npos) { + } else if (encoding.find("br") != std::string::npos) { #ifdef CPPHTTPLIB_BROTLI_SUPPORT - decompressor = detail::make_unique(); + decompressor = detail::make_unique(); #else - status = 415; - return false; + status = 415; + return false; #endif - } + } - if (decompressor) { - if (decompressor->is_valid()) { - ContentReceiverWithProgress out = [&](const char *buf, size_t n, - uint64_t off, uint64_t len) { - return decompressor->decompress(buf, n, - [&](const char *buf, size_t n) { - return receiver(buf, n, off, len); - }); - }; - return callback(std::move(out)); - } else { - status = 500; - return false; - } - } - } + if (decompressor) { + if (decompressor->is_valid()) { + ContentReceiverWithProgress out = [&](const char *buf, size_t n, + uint64_t off, uint64_t len) { + return decompressor->decompress(buf, n, + [&](const char *buf2, size_t n2) { + return receiver(buf2, n2, off, len); + }); + }; + return callback(std::move(out)); + } else { + status = 500; + return false; + } + } + } - ContentReceiverWithProgress out = [&](const char *buf, size_t n, uint64_t off, - uint64_t len) { - return receiver(buf, n, off, len); - }; - return callback(std::move(out)); + ContentReceiverWithProgress out = [&](const char *buf, size_t n, uint64_t off, + uint64_t len) { + return receiver(buf, n, off, len); + }; + return callback(std::move(out)); } template bool read_content(Stream &strm, T &x, size_t payload_max_length, int &status, Progress progress, ContentReceiverWithProgress receiver, bool decompress) { - return prepare_content_receiver( - x, status, std::move(receiver), decompress, - [&](const ContentReceiverWithProgress &out) { - auto ret = true; - auto exceed_payload_max_length = false; - - if (is_chunked_transfer_encoding(x.headers)) { - ret = read_content_chunked(strm, out); - } else if (!has_header(x.headers, "Content-Length")) { - ret = read_content_without_length(strm, out); - } else { - auto len = get_header_value(x.headers, "Content-Length"); - if (len > payload_max_length) { - exceed_payload_max_length = true; - skip_content_with_length(strm, len); - ret = false; - } else if (len > 0) { - ret = read_content_with_length(strm, len, std::move(progress), out); - } - } + return prepare_content_receiver( + x, status, std::move(receiver), decompress, + [&](const ContentReceiverWithProgress &out) { + auto ret = true; + auto exceed_payload_max_length = false; + + if (is_chunked_transfer_encoding(x.headers)) { + ret = read_content_chunked(strm, out); + } else if (!has_header(x.headers, "Content-Length")) { + ret = read_content_without_length(strm, out); + } else { + auto len = get_header_value(x.headers, "Content-Length"); + if (len > payload_max_length) { + exceed_payload_max_length = true; + skip_content_with_length(strm, len); + ret = false; + } else if (len > 0) { + ret = read_content_with_length(strm, len, std::move(progress), out); + } + } - if (!ret) { status = exceed_payload_max_length ? 413 : 400; } - return ret; - }); + if (!ret) { status = exceed_payload_max_length ? 413 : 400; } + return ret; + }); } -template -inline ssize_t write_headers(Stream &strm, const T &info, - const Headers &headers) { - ssize_t write_len = 0; - for (const auto &x : info.headers) { - if (x.first == "EXCEPTION_WHAT") { continue; } - auto len = - strm.write_format("%s: %s\r\n", x.first.c_str(), x.second.c_str()); - if (len < 0) { return len; } - write_len += len; - } - for (const auto &x : headers) { - auto len = - strm.write_format("%s: %s\r\n", x.first.c_str(), x.second.c_str()); - if (len < 0) { return len; } - write_len += len; - } - auto len = strm.write("\r\n"); - if (len < 0) { return len; } - write_len += len; - return write_len; +inline ssize_t write_headers(Stream &strm, const Headers &headers) { + ssize_t write_len = 0; + for (const auto &x : headers) { + auto len = + strm.write_format("%s: %s\r\n", x.first.c_str(), x.second.c_str()); + if (len < 0) { return len; } + write_len += len; + } + auto len = strm.write("\r\n"); + if (len < 0) { return len; } + write_len += len; + return write_len; } inline bool write_data(Stream &strm, const char *d, size_t l) { - size_t offset = 0; - while (offset < l) { - auto length = strm.write(d + offset, l - offset); - if (length < 0) { return false; } - offset += static_cast(length); - } - return true; + size_t offset = 0; + while (offset < l) { + auto length = strm.write(d + offset, l - offset); + if (length < 0) { return false; } + offset += static_cast(length); + } + return true; } template inline bool write_content(Stream &strm, const ContentProvider &content_provider, size_t offset, size_t length, T is_shutting_down, Error &error) { - size_t end_offset = offset + length; - auto ok = true; - DataSink data_sink; - - data_sink.write = [&](const char *d, size_t l) { - if (ok) { - if (write_data(strm, d, l)) { - offset += l; - } else { - ok = false; - } - } - }; + size_t end_offset = offset + length; + auto ok = true; + DataSink data_sink; + + data_sink.write = [&](const char *d, size_t l) -> bool { + if (ok) { + if (write_data(strm, d, l)) { + offset += l; + } else { + ok = false; + } + } + return ok; + }; - data_sink.is_writable = [&](void) { return ok && strm.is_writable(); }; + data_sink.is_writable = [&](void) { return ok && strm.is_writable(); }; - while (offset < end_offset && !is_shutting_down()) { - if (!content_provider(offset, end_offset - offset, data_sink)) { - error = Error::Canceled; - return false; - } - if (!ok) { - error = Error::Write; - return false; - } - } + while (offset < end_offset && !is_shutting_down()) { + if (!content_provider(offset, end_offset - offset, data_sink)) { + error = Error::Canceled; + return false; + } + if (!ok) { + error = Error::Write; + return false; + } + } - error = Error::Success; - return true; + error = Error::Success; + return true; } template inline bool write_content(Stream &strm, const ContentProvider &content_provider, size_t offset, size_t length, const T &is_shutting_down) { - auto error = Error::Success; - return write_content(strm, content_provider, offset, length, is_shutting_down, - error); + auto error = Error::Success; + return write_content(strm, content_provider, offset, length, is_shutting_down, + error); } template @@ -108215,483 +117028,518 @@ inline bool write_content_without_length(Stream &strm, const ContentProvider &content_provider, const T &is_shutting_down) { - size_t offset = 0; - auto data_available = true; - auto ok = true; - DataSink data_sink; - - data_sink.write = [&](const char *d, size_t l) { - if (ok) { - offset += l; - if (!write_data(strm, d, l)) { ok = false; } - } - }; + size_t offset = 0; + auto data_available = true; + auto ok = true; + DataSink data_sink; + + data_sink.write = [&](const char *d, size_t l) -> bool { + if (ok) { + offset += l; + if (!write_data(strm, d, l)) { ok = false; } + } + return ok; + }; - data_sink.done = [&](void) { data_available = false; }; + data_sink.done = [&](void) { data_available = false; }; - data_sink.is_writable = [&](void) { return ok && strm.is_writable(); }; + data_sink.is_writable = [&](void) { return ok && strm.is_writable(); }; - while (data_available && !is_shutting_down()) { - if (!content_provider(offset, 0, data_sink)) { return false; } - if (!ok) { return false; } - } - return true; + while (data_available && !is_shutting_down()) { + if (!content_provider(offset, 0, data_sink)) { return false; } + if (!ok) { return false; } + } + return true; } template inline bool write_content_chunked(Stream &strm, const ContentProvider &content_provider, const T &is_shutting_down, U &compressor, Error &error) { - size_t offset = 0; - auto data_available = true; - auto ok = true; - DataSink data_sink; - - data_sink.write = [&](const char *d, size_t l) { - if (!ok) { return; } - - data_available = l > 0; - offset += l; - - std::string payload; - if (!compressor.compress(d, l, false, - [&](const char *data, size_t data_len) { - payload.append(data, data_len); - return true; - })) { - ok = false; - return; - } - - if (!payload.empty()) { - // Emit chunked response header and footer for each chunk - auto chunk = from_i_to_hex(payload.size()) + "\r\n" + payload + "\r\n"; - if (!write_data(strm, chunk.data(), chunk.size())) { - ok = false; - return; - } - } - }; + size_t offset = 0; + auto data_available = true; + auto ok = true; + DataSink data_sink; + + data_sink.write = [&](const char *d, size_t l) -> bool { + if (ok) { + data_available = l > 0; + offset += l; + + std::string payload; + if (compressor.compress(d, l, false, + [&](const char *data, size_t data_len) { + payload.append(data, data_len); + return true; + })) { + if (!payload.empty()) { + // Emit chunked response header and footer for each chunk + auto chunk = + from_i_to_hex(payload.size()) + "\r\n" + payload + "\r\n"; + if (!write_data(strm, chunk.data(), chunk.size())) { ok = false; } + } + } else { + ok = false; + } + } + return ok; + }; - data_sink.done = [&](void) { - if (!ok) { return; } + data_sink.done = [&](void) { + if (!ok) { return; } - data_available = false; + data_available = false; - std::string payload; - if (!compressor.compress(nullptr, 0, true, - [&](const char *data, size_t data_len) { - payload.append(data, data_len); - return true; - })) { - ok = false; - return; - } + std::string payload; + if (!compressor.compress(nullptr, 0, true, + [&](const char *data, size_t data_len) { + payload.append(data, data_len); + return true; + })) { + ok = false; + return; + } - if (!payload.empty()) { - // Emit chunked response header and footer for each chunk - auto chunk = from_i_to_hex(payload.size()) + "\r\n" + payload + "\r\n"; - if (!write_data(strm, chunk.data(), chunk.size())) { - ok = false; - return; - } - } + if (!payload.empty()) { + // Emit chunked response header and footer for each chunk + auto chunk = from_i_to_hex(payload.size()) + "\r\n" + payload + "\r\n"; + if (!write_data(strm, chunk.data(), chunk.size())) { + ok = false; + return; + } + } - static const std::string done_marker("0\r\n\r\n"); - if (!write_data(strm, done_marker.data(), done_marker.size())) { - ok = false; - } - }; + static const std::string done_marker("0\r\n\r\n"); + if (!write_data(strm, done_marker.data(), done_marker.size())) { + ok = false; + } + }; - data_sink.is_writable = [&](void) { return ok && strm.is_writable(); }; + data_sink.is_writable = [&](void) { return ok && strm.is_writable(); }; - while (data_available && !is_shutting_down()) { - if (!content_provider(offset, 0, data_sink)) { - error = Error::Canceled; - return false; - } - if (!ok) { - error = Error::Write; - return false; - } - } + while (data_available && !is_shutting_down()) { + if (!content_provider(offset, 0, data_sink)) { + error = Error::Canceled; + return false; + } + if (!ok) { + error = Error::Write; + return false; + } + } - error = Error::Success; - return true; + error = Error::Success; + return true; } template inline bool write_content_chunked(Stream &strm, const ContentProvider &content_provider, const T &is_shutting_down, U &compressor) { - auto error = Error::Success; - return write_content_chunked(strm, content_provider, is_shutting_down, - compressor, error); + auto error = Error::Success; + return write_content_chunked(strm, content_provider, is_shutting_down, + compressor, error); } template -inline bool redirect(T &cli, const Request &req, Response &res, +inline bool redirect(T &cli, Request &req, Response &res, const std::string &path, const std::string &location, Error &error) { - Request new_req = req; - new_req.path = path; - new_req.redirect_count_ -= 1; - - if (res.status == 303 && (req.method != "GET" && req.method != "HEAD")) { - new_req.method = "GET"; - new_req.body.clear(); - new_req.headers.clear(); - } + Request new_req = req; + new_req.path = path; + new_req.redirect_count_ -= 1; - Response new_res; + if (res.status == 303 && (req.method != "GET" && req.method != "HEAD")) { + new_req.method = "GET"; + new_req.body.clear(); + new_req.headers.clear(); + } - auto ret = cli.send(new_req, new_res, error); - if (ret) { - new_res.location = location; - res = new_res; - } - return ret; + Response new_res; + + auto ret = cli.send(new_req, new_res, error); + if (ret) { + req = new_req; + res = new_res; + res.location = location; + } + return ret; } inline std::string params_to_query_str(const Params ¶ms) { - std::string query; + std::string query; - for (auto it = params.begin(); it != params.end(); ++it) { - if (it != params.begin()) { query += "&"; } - query += it->first; - query += "="; - query += encode_query_param(it->second); - } - return query; + for (auto it = params.begin(); it != params.end(); ++it) { + if (it != params.begin()) { query += "&"; } + query += it->first; + query += "="; + query += encode_query_param(it->second); + } + return query; +} + +inline void parse_query_text(const std::string &s, Params ¶ms) { + std::set cache; + split(s.data(), s.data() + s.size(), '&', [&](const char *b, const char *e) { + std::string kv(b, e); + if (cache.find(kv) != cache.end()) { return; } + cache.insert(kv); + + std::string key; + std::string val; + split(b, e, '=', [&](const char *b2, const char *e2) { + if (key.empty()) { + key.assign(b2, e2); + } else { + val.assign(b2, e2); + } + }); + + if (!key.empty()) { + params.emplace(decode_url(key, true), decode_url(val, true)); + } + }); +} + +inline bool parse_multipart_boundary(const std::string &content_type, + std::string &boundary) { + auto pos = content_type.find("boundary="); + if (pos == std::string::npos) { return false; } + boundary = content_type.substr(pos + 9); + if (boundary.length() >= 2 && boundary.front() == '"' && + boundary.back() == '"') { + boundary = boundary.substr(1, boundary.size() - 2); + } + return !boundary.empty(); +} + +#ifdef CPPHTTPLIB_NO_EXCEPTIONS +inline bool parse_range_header(const std::string &s, Ranges &ranges) { +#else +inline bool parse_range_header(const std::string &s, Ranges &ranges) try { +#endif + static Regex re_first_range(R"(bytes=(\d*-\d*(?:,\s*\d*-\d*)*))"); + Match m; + if (duckdb_re2::RegexMatch(s, m, re_first_range)) { + auto pos = static_cast(m.position(1)); + auto len = static_cast(m.length(1)); + bool all_valid_ranges = true; + split(&s[pos], &s[pos + len], ',', [&](const char *b, const char *e) { + if (!all_valid_ranges) return; + static Regex re_another_range(R"(\s*(\d*)-(\d*))"); + Match cm; + if (duckdb_re2::RegexMatch(b, e, cm, re_another_range)) { + ssize_t first = -1; + if (!cm.str(1).empty()) { + first = static_cast(std::stoll(cm.str(1))); + } + + ssize_t last = -1; + if (!cm.str(2).empty()) { + last = static_cast(std::stoll(cm.str(2))); + } + + if (first != -1 && last != -1 && first > last) { + all_valid_ranges = false; + return; + } + ranges.emplace_back(std::make_pair(first, last)); + } + }); + return all_valid_ranges; + } + return false; +#ifdef CPPHTTPLIB_NO_EXCEPTIONS } +#else +} catch (...) { return false; } +#endif + +class MultipartFormDataParser { +public: + MultipartFormDataParser() = default; + + void set_boundary(std::string &&boundary) { boundary_ = boundary; } + + bool is_valid() const { return is_valid_; } + + bool parse(const char *buf, size_t n, const ContentReceiver &content_callback, + const MultipartContentHeader &header_callback) { + + static const Regex re_content_disposition( + "^Content-Disposition:\\s*form-data;\\s*name=\"(.*?)\"(?:;\\s*filename=" + "\"(.*?)\")?\\s*$", + duckdb_re2::RegexOptions::CASE_INSENSITIVE); + static const std::string dash_ = "--"; + static const std::string crlf_ = "\r\n"; + + buf_append(buf, n); + + while (buf_size() > 0) { + switch (state_) { + case 0: { // Initial boundary + auto pattern = dash_ + boundary_ + crlf_; + if (pattern.size() > buf_size()) { return true; } + if (!buf_start_with(pattern)) { return false; } + buf_erase(pattern.size()); + state_ = 1; + break; + } + case 1: { // New entry + clear_file_info(); + state_ = 2; + break; + } + case 2: { // Headers + auto pos = buf_find(crlf_); + if (pos > CPPHTTPLIB_HEADER_MAX_LENGTH) { return false; } + while (pos < buf_size()) { + // Empty line + if (pos == 0) { + if (!header_callback(file_)) { + is_valid_ = false; + return false; + } + buf_erase(crlf_.size()); + state_ = 3; + break; + } + + static const std::string header_name = "content-type:"; + const auto header = buf_head(pos); + if (start_with_case_ignore(header, header_name)) { + file_.content_type = trim_copy(header.substr(header_name.size())); + } else { + Match m; + if (duckdb_re2::RegexMatch(header, m, re_content_disposition)) { + file_.name = m[1]; + file_.filename = m[2]; + } + } + + buf_erase(pos + crlf_.size()); + pos = buf_find(crlf_); + } + if (state_ != 3) { return true; } + break; + } + case 3: { // Body + { + auto pattern = crlf_ + dash_; + if (pattern.size() > buf_size()) { return true; } -inline std::string append_query_params(const char *path, const Params ¶ms) { - std::string path_with_query = path; - const static std::regex re("[^?]+\\?.*"); - auto delm = std::regex_match(path, re) ? '&' : '?'; - path_with_query += delm + params_to_query_str(params); - return path_with_query; -} + auto pos = buf_find(pattern); -inline void parse_query_text(const std::string &s, Params ¶ms) { - split(s.data(), s.data() + s.size(), '&', [&](const char *b, const char *e) { - std::string key; - std::string val; - split(b, e, '=', [&](const char *b2, const char *e2) { - if (key.empty()) { - key.assign(b2, e2); - } else { - val.assign(b2, e2); - } - }); + if (!content_callback(buf_data(), pos)) { + is_valid_ = false; + return false; + } - if (!key.empty()) { - params.emplace(decode_url(key, true), decode_url(val, true)); - } - }); -} + buf_erase(pos); + } + { + auto pattern = crlf_ + dash_ + boundary_; + if (pattern.size() > buf_size()) { return true; } -inline bool parse_multipart_boundary(const std::string &content_type, - std::string &boundary) { - auto pos = content_type.find("boundary="); - if (pos == std::string::npos) { return false; } - boundary = content_type.substr(pos + 9); - if (boundary.length() >= 2 && boundary.front() == '"' && - boundary.back() == '"') { - boundary = boundary.substr(1, boundary.size() - 2); - } - return !boundary.empty(); -} + auto pos = buf_find(pattern); + if (pos < buf_size()) { + if (!content_callback(buf_data(), pos)) { + is_valid_ = false; + return false; + } -inline bool parse_range_header(const std::string &s, Ranges &ranges) try { - static auto re_first_range = std::regex(R"(bytes=(\d*-\d*(?:,\s*\d*-\d*)*))"); - std::smatch m; - if (std::regex_match(s, m, re_first_range)) { - auto pos = static_cast(m.position(1)); - auto len = static_cast(m.length(1)); - bool all_valid_ranges = true; - split(&s[pos], &s[pos + len], ',', [&](const char *b, const char *e) { - if (!all_valid_ranges) return; - static auto re_another_range = std::regex(R"(\s*(\d*)-(\d*))"); - std::cmatch cm; - if (std::regex_match(b, e, cm, re_another_range)) { - ssize_t first = -1; - if (!cm.str(1).empty()) { - first = static_cast(std::stoll(cm.str(1))); - } + buf_erase(pos + pattern.size()); + state_ = 4; + } else { + if (!content_callback(buf_data(), pattern.size())) { + is_valid_ = false; + return false; + } - ssize_t last = -1; - if (!cm.str(2).empty()) { - last = static_cast(std::stoll(cm.str(2))); - } + buf_erase(pattern.size()); + } + } + break; + } + case 4: { // Boundary + if (crlf_.size() > buf_size()) { return true; } + if (buf_start_with(crlf_)) { + buf_erase(crlf_.size()); + state_ = 1; + } else { + auto pattern = dash_ + crlf_; + if (pattern.size() > buf_size()) { return true; } + if (buf_start_with(pattern)) { + buf_erase(pattern.size()); + is_valid_ = true; + state_ = 5; + } else { + return true; + } + } + break; + } + case 5: { // Done + is_valid_ = false; + return false; + } + } + } - if (first != -1 && last != -1 && first > last) { - all_valid_ranges = false; - return; - } - ranges.emplace_back(std::make_pair(first, last)); - } - }); - return all_valid_ranges; - } - return false; -} catch (...) { return false; } + return true; + } -class MultipartFormDataParser { -public: - MultipartFormDataParser() = default; - - void set_boundary(std::string &&boundary) { boundary_ = boundary; } - - bool is_valid() const { return is_valid_; } - - bool parse(const char *buf, size_t n, const ContentReceiver &content_callback, - const MultipartContentHeader &header_callback) { - - static const std::regex re_content_disposition( - "^Content-Disposition:\\s*form-data;\\s*name=\"(.*?)\"(?:;\\s*filename=" - "\"(.*?)\")?\\s*$", - std::regex_constants::icase); - static const std::string dash_ = "--"; - static const std::string crlf_ = "\r\n"; - - buf_.append(buf, n); // TODO: performance improvement - - while (!buf_.empty()) { - switch (state_) { - case 0: { // Initial boundary - auto pattern = dash_ + boundary_ + crlf_; - if (pattern.size() > buf_.size()) { return true; } - auto pos = buf_.find(pattern); - if (pos != 0) { return false; } - buf_.erase(0, pattern.size()); - off_ += pattern.size(); - state_ = 1; - break; - } - case 1: { // New entry - clear_file_info(); - state_ = 2; - break; - } - case 2: { // Headers - auto pos = buf_.find(crlf_); - while (pos != std::string::npos) { - // Empty line - if (pos == 0) { - if (!header_callback(file_)) { - is_valid_ = false; - return false; - } - buf_.erase(0, crlf_.size()); - off_ += crlf_.size(); - state_ = 3; - break; - } +private: + void clear_file_info() { + file_.name.clear(); + file_.filename.clear(); + file_.content_type.clear(); + } - static const std::string header_name = "content-type:"; - const auto header = buf_.substr(0, pos); - if (start_with_case_ignore(header, header_name)) { - file_.content_type = trim_copy(header.substr(header_name.size())); - } else { - std::smatch m; - if (std::regex_match(header, m, re_content_disposition)) { - file_.name = m[1]; - file_.filename = m[2]; - } - } + bool start_with_case_ignore(const std::string &a, + const std::string &b) const { + if (a.size() < b.size()) { return false; } + for (size_t i = 0; i < b.size(); i++) { + if (::tolower(a[i]) != ::tolower(b[i])) { return false; } + } + return true; + } - buf_.erase(0, pos + crlf_.size()); - off_ += pos + crlf_.size(); - pos = buf_.find(crlf_); - } - if (state_ != 3) { return true; } - break; - } - case 3: { // Body - { - auto pattern = crlf_ + dash_; - if (pattern.size() > buf_.size()) { return true; } + std::string boundary_; - auto pos = find_string(buf_, pattern); + size_t state_ = 0; + bool is_valid_ = false; + MultipartFormData file_; - if (!content_callback(buf_.data(), pos)) { - is_valid_ = false; - return false; - } + // Buffer + bool start_with(const std::string &a, size_t spos, size_t epos, + const std::string &b) const { + if (epos - spos < b.size()) { return false; } + for (size_t i = 0; i < b.size(); i++) { + if (a[i + spos] != b[i]) { return false; } + } + return true; + } - off_ += pos; - buf_.erase(0, pos); - } - { - auto pattern = crlf_ + dash_ + boundary_; - if (pattern.size() > buf_.size()) { return true; } - - auto pos = buf_.find(pattern); - if (pos != std::string::npos) { - if (!content_callback(buf_.data(), pos)) { - is_valid_ = false; - return false; - } + size_t buf_size() const { return buf_epos_ - buf_spos_; } - off_ += pos + pattern.size(); - buf_.erase(0, pos + pattern.size()); - state_ = 4; - } else { - if (!content_callback(buf_.data(), pattern.size())) { - is_valid_ = false; - return false; - } + const char *buf_data() const { return &buf_[buf_spos_]; } - off_ += pattern.size(); - buf_.erase(0, pattern.size()); - } - } - break; - } - case 4: { // Boundary - if (crlf_.size() > buf_.size()) { return true; } - if (buf_.compare(0, crlf_.size(), crlf_) == 0) { - buf_.erase(0, crlf_.size()); - off_ += crlf_.size(); - state_ = 1; - } else { - auto pattern = dash_ + crlf_; - if (pattern.size() > buf_.size()) { return true; } - if (buf_.compare(0, pattern.size(), pattern) == 0) { - buf_.erase(0, pattern.size()); - off_ += pattern.size(); - is_valid_ = true; - state_ = 5; - } else { - return true; - } - } - break; - } - case 5: { // Done - is_valid_ = false; - return false; - } - } - } + std::string buf_head(size_t l) const { return buf_.substr(buf_spos_, l); } - return true; - } + bool buf_start_with(const std::string &s) const { + return start_with(buf_, buf_spos_, buf_epos_, s); + } -private: - void clear_file_info() { - file_.name.clear(); - file_.filename.clear(); - file_.content_type.clear(); - } + size_t buf_find(const std::string &s) const { + auto c = s.front(); - bool start_with_case_ignore(const std::string &a, - const std::string &b) const { - if (a.size() < b.size()) { return false; } - for (size_t i = 0; i < b.size(); i++) { - if (::tolower(a[i]) != ::tolower(b[i])) { return false; } - } - return true; - } + size_t off = buf_spos_; + while (off < buf_epos_) { + auto pos = off; + while (true) { + if (pos == buf_epos_) { return buf_size(); } + if (buf_[pos] == c) { break; } + pos++; + } - bool start_with(const std::string &a, size_t off, - const std::string &b) const { - if (a.size() - off < b.size()) { return false; } - for (size_t i = 0; i < b.size(); i++) { - if (a[i + off] != b[i]) { return false; } - } - return true; - } + auto remaining_size = buf_epos_ - pos; + if (s.size() > remaining_size) { return buf_size(); } - size_t find_string(const std::string &s, const std::string &pattern) const { - auto c = pattern.front(); + if (start_with(buf_, pos, buf_epos_, s)) { return pos - buf_spos_; } - size_t off = 0; - while (off < s.size()) { - auto pos = s.find(c, off); - if (pos == std::string::npos) { return s.size(); } + off = pos + 1; + } - auto rem = s.size() - pos; - if (pattern.size() > rem) { return pos; } + return buf_size(); + } - if (start_with(s, pos, pattern)) { return pos; } + void buf_append(const char *data, size_t n) { + auto remaining_size = buf_size(); + if (remaining_size > 0 && buf_spos_ > 0) { + for (size_t i = 0; i < remaining_size; i++) { + buf_[i] = buf_[buf_spos_ + i]; + } + } + buf_spos_ = 0; + buf_epos_ = remaining_size; - off = pos + 1; - } + if (remaining_size + n > buf_.size()) { buf_.resize(remaining_size + n); } - return s.size(); - } + for (size_t i = 0; i < n; i++) { + buf_[buf_epos_ + i] = data[i]; + } + buf_epos_ += n; + } - std::string boundary_; + void buf_erase(size_t size) { buf_spos_ += size; } - std::string buf_; - size_t state_ = 0; - bool is_valid_ = false; - size_t off_ = 0; - MultipartFormData file_; + std::string buf_; + size_t buf_spos_ = 0; + size_t buf_epos_ = 0; }; inline std::string to_lower(const char *beg, const char *end) { - std::string out; - auto it = beg; - while (it != end) { - out += static_cast(::tolower(*it)); - it++; - } - return out; + std::string out; + auto it = beg; + while (it != end) { + out += static_cast(::tolower(*it)); + it++; + } + return out; } inline std::string make_multipart_data_boundary() { - static const char data[] = - "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; + static const char data[] = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; - // std::random_device might actually be deterministic on some - // platforms, but due to lack of support in the c++ standard library, - // doing better requires either some ugly hacks or breaking portability. - std::random_device seed_gen; - // Request 128 bits of entropy for initialization - std::seed_seq seed_sequence{seed_gen(), seed_gen(), seed_gen(), seed_gen()}; - std::mt19937 engine(seed_sequence); + // std::random_device might actually be deterministic on some + // platforms, but due to lack of support in the c++ standard library, + // doing better requires either some ugly hacks or breaking portability. + std::random_device seed_gen; - std::string result = "--cpp-httplib-multipart-data-"; + // Request 128 bits of entropy for initialization + std::seed_seq seed_sequence{seed_gen(), seed_gen(), seed_gen(), seed_gen()}; + std::mt19937 engine(seed_sequence); - for (auto i = 0; i < 16; i++) { - result += data[engine() % (sizeof(data) - 1)]; - } + std::string result = "--cpp-httplib-multipart-data-"; - return result; + for (auto i = 0; i < 16; i++) { + result += data[engine() % (sizeof(data) - 1)]; + } + + return result; } inline std::pair get_range_offset_and_length(const Request &req, size_t content_length, size_t index) { - auto r = req.ranges[index]; + auto r = req.ranges[index]; - if (r.first == -1 && r.second == -1) { - return std::make_pair(0, content_length); - } + if (r.first == -1 && r.second == -1) { + return std::make_pair(0, content_length); + } - auto slen = static_cast(content_length); + auto slen = static_cast(content_length); - if (r.first == -1) { - r.first = (std::max)(static_cast(0), slen - r.second); - r.second = slen - 1; - } + if (r.first == -1) { + r.first = (std::max)(static_cast(0), slen - r.second); + r.second = slen - 1; + } - if (r.second == -1) { r.second = slen - 1; } - return std::make_pair(r.first, static_cast(r.second - r.first) + 1); + if (r.second == -1) { r.second = slen - 1; } + return std::make_pair(r.first, static_cast(r.second - r.first) + 1); } inline std::string make_content_range_header_field(size_t offset, size_t length, size_t content_length) { - std::string field = "bytes "; - field += std::to_string(offset); - field += "-"; - field += std::to_string(offset + length - 1); - field += "/"; - field += std::to_string(content_length); - return field; + std::string field = "bytes "; + field += std::to_string(offset); + field += "-"; + field += std::to_string(offset + length - 1); + field += "/"; + field += std::to_string(content_length); + return field; } template @@ -108700,68 +117548,68 @@ bool process_multipart_ranges_data(const Request &req, Response &res, const std::string &content_type, SToken stoken, CToken ctoken, Content content) { - for (size_t i = 0; i < req.ranges.size(); i++) { - ctoken("--"); - stoken(boundary); - ctoken("\r\n"); - if (!content_type.empty()) { - ctoken("Content-Type: "); - stoken(content_type); - ctoken("\r\n"); - } + for (size_t i = 0; i < req.ranges.size(); i++) { + ctoken("--"); + stoken(boundary); + ctoken("\r\n"); + if (!content_type.empty()) { + ctoken("Content-Type: "); + stoken(content_type); + ctoken("\r\n"); + } - auto offsets = get_range_offset_and_length(req, res.body.size(), i); - auto offset = offsets.first; - auto length = offsets.second; + auto offsets = get_range_offset_and_length(req, res.body.size(), i); + auto offset = offsets.first; + auto length = offsets.second; - ctoken("Content-Range: "); - stoken(make_content_range_header_field(offset, length, res.body.size())); - ctoken("\r\n"); - ctoken("\r\n"); - if (!content(offset, length)) { return false; } - ctoken("\r\n"); - } + ctoken("Content-Range: "); + stoken(make_content_range_header_field(offset, length, res.body.size())); + ctoken("\r\n"); + ctoken("\r\n"); + if (!content(offset, length)) { return false; } + ctoken("\r\n"); + } - ctoken("--"); - stoken(boundary); - ctoken("--\r\n"); + ctoken("--"); + stoken(boundary); + ctoken("--\r\n"); - return true; + return true; } inline bool make_multipart_ranges_data(const Request &req, Response &res, const std::string &boundary, const std::string &content_type, std::string &data) { - return process_multipart_ranges_data( - req, res, boundary, content_type, - [&](const std::string &token) { data += token; }, - [&](const char *token) { data += token; }, - [&](size_t offset, size_t length) { - if (offset < res.body.size()) { - data += res.body.substr(offset, length); - return true; - } - return false; - }); + return process_multipart_ranges_data( + req, res, boundary, content_type, + [&](const std::string &token) { data += token; }, + [&](const char *token) { data += token; }, + [&](size_t offset, size_t length) { + if (offset < res.body.size()) { + data += res.body.substr(offset, length); + return true; + } + return false; + }); } inline size_t get_multipart_ranges_data_length(const Request &req, Response &res, const std::string &boundary, const std::string &content_type) { - size_t data_length = 0; - - process_multipart_ranges_data( - req, res, boundary, content_type, - [&](const std::string &token) { data_length += token.size(); }, - [&](const char *token) { data_length += strlen(token); }, - [&](size_t /*offset*/, size_t length) { - data_length += length; - return true; - }); + size_t data_length = 0; + + process_multipart_ranges_data( + req, res, boundary, content_type, + [&](const std::string &token) { data_length += token.size(); }, + [&](const char *token) { data_length += strlen(token); }, + [&](size_t /*offset*/, size_t length) { + data_length += length; + return true; + }); - return data_length; + return data_length; } template @@ -108770,44 +117618,44 @@ inline bool write_multipart_ranges_data(Stream &strm, const Request &req, const std::string &boundary, const std::string &content_type, const T &is_shutting_down) { - return process_multipart_ranges_data( - req, res, boundary, content_type, - [&](const std::string &token) { strm.write(token); }, - [&](const char *token) { strm.write(token); }, - [&](size_t offset, size_t length) { - return write_content(strm, res.content_provider_, offset, length, - is_shutting_down); - }); + return process_multipart_ranges_data( + req, res, boundary, content_type, + [&](const std::string &token) { strm.write(token); }, + [&](const char *token) { strm.write(token); }, + [&](size_t offset, size_t length) { + return write_content(strm, res.content_provider_, offset, length, + is_shutting_down); + }); } inline std::pair get_range_offset_and_length(const Request &req, const Response &res, size_t index) { - auto r = req.ranges[index]; + auto r = req.ranges[index]; - if (r.second == -1) { - r.second = static_cast(res.content_length_) - 1; - } + if (r.second == -1) { + r.second = static_cast(res.content_length_) - 1; + } - return std::make_pair(r.first, r.second - r.first + 1); + return std::make_pair(r.first, r.second - r.first + 1); } inline bool expect_content(const Request &req) { - if (req.method == "POST" || req.method == "PUT" || req.method == "PATCH" || - req.method == "PRI" || req.method == "DELETE") { - return true; - } - // TODO: check if Content-Length is set - return false; + if (req.method == "POST" || req.method == "PUT" || req.method == "PATCH" || + req.method == "PRI" || req.method == "DELETE") { + return true; + } + // TODO: check if Content-Length is set + return false; } inline bool has_crlf(const char *s) { - auto p = s; - while (*p) { - if (*p == '\r' || *p == '\n') { return true; } - p++; - } - return false; + auto p = s; + while (*p) { + if (*p == '\r' || *p == '\n') { return true; } + p++; + } + return false; } #ifdef CPPHTTPLIB_OPENSSL_SUPPORT @@ -108815,34 +117663,32 @@ template inline std::string message_digest(const std::string &s, Init init, Update update, Final final, size_t digest_length) { - using namespace std; + std::vector md(digest_length, 0); + CTX ctx; + init(&ctx); + update(&ctx, s.data(), s.size()); + final(md.data(), &ctx); - std::vector md(digest_length, 0); - CTX ctx; - init(&ctx); - update(&ctx, s.data(), s.size()); - final(md.data(), &ctx); - - stringstream ss; - for (auto c : md) { - ss << setfill('0') << setw(2) << hex << (unsigned int)c; - } - return ss.str(); + std::stringstream ss; + for (auto c : md) { + ss << std::setfill('0') << std::setw(2) << std::hex << (unsigned int)c; + } + return ss.str(); } inline std::string MD5(const std::string &s) { - return message_digest(s, MD5_Init, MD5_Update, MD5_Final, - MD5_DIGEST_LENGTH); + return message_digest(s, MD5_Init, MD5_Update, MD5_Final, + MD5_DIGEST_LENGTH); } inline std::string SHA_256(const std::string &s) { - return message_digest(s, SHA256_Init, SHA256_Update, SHA256_Final, - SHA256_DIGEST_LENGTH); + return message_digest(s, SHA256_Init, SHA256_Update, SHA256_Final, + SHA256_DIGEST_LENGTH); } inline std::string SHA_512(const std::string &s) { - return message_digest(s, SHA512_Init, SHA512_Update, SHA512_Final, - SHA512_DIGEST_LENGTH); + return message_digest(s, SHA512_Init, SHA512_Update, SHA512_Final, + SHA512_DIGEST_LENGTH); } #endif @@ -108851,38 +117697,38 @@ inline std::string SHA_512(const std::string &s) { // NOTE: This code came up with the following stackoverflow post: // https://stackoverflow.com/questions/9507184/can-openssl-on-windows-use-the-system-certificate-store inline bool load_system_certs_on_windows(X509_STORE *store) { - auto hStore = CertOpenSystemStoreW((HCRYPTPROV_LEGACY)NULL, L"ROOT"); + auto hStore = CertOpenSystemStoreW((HCRYPTPROV_LEGACY)NULL, L"ROOT"); - if (!hStore) { return false; } + if (!hStore) { return false; } - PCCERT_CONTEXT pContext = NULL; - while ((pContext = CertEnumCertificatesInStore(hStore, pContext)) != - nullptr) { - auto encoded_cert = - static_cast(pContext->pbCertEncoded); + PCCERT_CONTEXT pContext = NULL; + while ((pContext = CertEnumCertificatesInStore(hStore, pContext)) != + nullptr) { + auto encoded_cert = + static_cast(pContext->pbCertEncoded); - auto x509 = d2i_X509(NULL, &encoded_cert, pContext->cbCertEncoded); - if (x509) { - X509_STORE_add_cert(store, x509); - X509_free(x509); - } - } + auto x509 = d2i_X509(NULL, &encoded_cert, pContext->cbCertEncoded); + if (x509) { + X509_STORE_add_cert(store, x509); + X509_free(x509); + } + } - CertFreeCertificateContext(pContext); - CertCloseStore(hStore, 0); + CertFreeCertificateContext(pContext); + CertCloseStore(hStore, 0); - return true; + return true; } #endif class WSInit { public: - WSInit() { - WSADATA wsaData; - WSAStartup(0x0002, &wsaData); - } + WSInit() { + WSADATA wsaData; + WSAStartup(0x0002, &wsaData); + } - ~WSInit() { WSACleanup(); } + ~WSInit() { WSACleanup(); } }; static WSInit wsinit_; @@ -108893,343 +117739,365 @@ inline std::pair make_digest_authentication_header( const Request &req, const std::map &auth, size_t cnonce_count, const std::string &cnonce, const std::string &username, const std::string &password, bool is_proxy = false) { - using namespace std; - - string nc; - { - stringstream ss; - ss << setfill('0') << setw(8) << hex << cnonce_count; - nc = ss.str(); - } + std::string nc; + { + std::stringstream ss; + ss << std::setfill('0') << std::setw(8) << std::hex << cnonce_count; + nc = ss.str(); + } + + std::string qop; + if (auth.find("qop") != auth.end()) { + qop = auth.at("qop"); + if (qop.find("auth-int") != std::string::npos) { + qop = "auth-int"; + } else if (qop.find("auth") != std::string::npos) { + qop = "auth"; + } else { + qop.clear(); + } + } - auto qop = auth.at("qop"); - if (qop.find("auth-int") != std::string::npos) { - qop = "auth-int"; - } else { - qop = "auth"; - } + std::string algo = "MD5"; + if (auth.find("algorithm") != auth.end()) { algo = auth.at("algorithm"); } - std::string algo = "MD5"; - if (auth.find("algorithm") != auth.end()) { algo = auth.at("algorithm"); } + std::string response; + { + auto H = algo == "SHA-256" ? detail::SHA_256 + : algo == "SHA-512" ? detail::SHA_512 + : detail::MD5; - string response; - { - auto H = algo == "SHA-256" - ? detail::SHA_256 - : algo == "SHA-512" ? detail::SHA_512 : detail::MD5; + auto A1 = username + ":" + auth.at("realm") + ":" + password; - auto A1 = username + ":" + auth.at("realm") + ":" + password; + auto A2 = req.method + ":" + req.path; + if (qop == "auth-int") { A2 += ":" + H(req.body); } - auto A2 = req.method + ":" + req.path; - if (qop == "auth-int") { A2 += ":" + H(req.body); } + if (qop.empty()) { + response = H(H(A1) + ":" + auth.at("nonce") + ":" + H(A2)); + } else { + response = H(H(A1) + ":" + auth.at("nonce") + ":" + nc + ":" + cnonce + + ":" + qop + ":" + H(A2)); + } + } - response = H(H(A1) + ":" + auth.at("nonce") + ":" + nc + ":" + cnonce + - ":" + qop + ":" + H(A2)); - } + auto opaque = (auth.find("opaque") != auth.end()) ? auth.at("opaque") : ""; - auto field = "Digest username=\"" + username + "\", realm=\"" + - auth.at("realm") + "\", nonce=\"" + auth.at("nonce") + - "\", uri=\"" + req.path + "\", algorithm=" + algo + - ", qop=" + qop + ", nc=\"" + nc + "\", cnonce=\"" + cnonce + - "\", response=\"" + response + "\""; + auto field = "Digest username=\"" + username + "\", realm=\"" + + auth.at("realm") + "\", nonce=\"" + auth.at("nonce") + + "\", uri=\"" + req.path + "\", algorithm=" + algo + + (qop.empty() ? ", response=\"" + : ", qop=" + qop + ", nc=" + nc + ", cnonce=\"" + + cnonce + "\", response=\"") + + response + "\"" + + (opaque.empty() ? "" : ", opaque=\"" + opaque + "\""); - auto key = is_proxy ? "Proxy-Authorization" : "Authorization"; - return std::make_pair(key, field); + auto key = is_proxy ? "Proxy-Authorization" : "Authorization"; + return std::make_pair(key, field); } #endif inline bool parse_www_authenticate(const Response &res, std::map &auth, bool is_proxy) { - auto auth_key = is_proxy ? "Proxy-Authenticate" : "WWW-Authenticate"; - if (res.has_header(auth_key)) { - static auto re = std::regex(R"~((?:(?:,\s*)?(.+?)=(?:"(.*?)"|([^,]*))))~"); - auto s = res.get_header_value(auth_key); - auto pos = s.find(' '); - if (pos != std::string::npos) { - auto type = s.substr(0, pos); - if (type == "Basic") { - return false; - } else if (type == "Digest") { - s = s.substr(pos + 1); - auto beg = std::sregex_iterator(s.begin(), s.end(), re); - for (auto i = beg; i != std::sregex_iterator(); ++i) { - auto m = *i; - auto key = s.substr(static_cast(m.position(1)), - static_cast(m.length(1))); - auto val = m.length(2) > 0 - ? s.substr(static_cast(m.position(2)), - static_cast(m.length(2))) - : s.substr(static_cast(m.position(3)), - static_cast(m.length(3))); - auth[key] = val; - } - return true; - } - } - } - return false; + auto auth_key = is_proxy ? "Proxy-Authenticate" : "WWW-Authenticate"; + if (res.has_header(auth_key)) { + static Regex re(R"~((?:(?:,\s*)?(.+?)=(?:"(.*?)"|([^,]*))))~"); + auto s = res.get_header_value(auth_key); + auto pos = s.find(' '); + if (pos != std::string::npos) { + auto type = s.substr(0, pos); + if (type == "Basic") { + return false; + } else if (type == "Digest") { + s = s.substr(pos + 1); + auto matches = duckdb_re2::RegexFindAll(s, re); + for (auto &m : matches) { + auto key = s.substr(static_cast(m.position(1)), + static_cast(m.length(1))); + auto val = m.length(2) > 0 + ? s.substr(static_cast(m.position(2)), + static_cast(m.length(2))) + : s.substr(static_cast(m.position(3)), + static_cast(m.length(3))); + auth[key] = val; + } + return true; + } + } + } + return false; } // https://stackoverflow.com/questions/440133/how-do-i-create-a-random-alpha-numeric-string-in-c/440240#answer-440240 inline std::string random_string(size_t length) { - auto randchar = []() -> char { - const char charset[] = "0123456789" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz"; - const size_t max_index = (sizeof(charset) - 1); - return charset[static_cast(rand()) % max_index]; - }; - std::string str(length, 0); - std::generate_n(str.begin(), length, randchar); - return str; + auto randchar = []() -> char { + const char charset[] = "0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz"; + const size_t max_index = (sizeof(charset) - 1); + return charset[static_cast(std::rand()) % max_index]; + }; + std::string str(length, 0); + std::generate_n(str.begin(), length, randchar); + return str; } class ContentProviderAdapter { public: - explicit ContentProviderAdapter( - ContentProviderWithoutLength &&content_provider) - : content_provider_(content_provider) {} + explicit ContentProviderAdapter( + ContentProviderWithoutLength &&content_provider) + : content_provider_(content_provider) {} - bool operator()(size_t offset, size_t, DataSink &sink) { - return content_provider_(offset, sink); - } + bool operator()(size_t offset, size_t, DataSink &sink) { + return content_provider_(offset, sink); + } private: - ContentProviderWithoutLength content_provider_; + ContentProviderWithoutLength content_provider_; }; } // namespace detail +inline std::string hosted_at(const char *hostname) { + std::vector addrs; + hosted_at(hostname, addrs); + if (addrs.empty()) { return std::string(); } + return addrs[0]; +} + +inline void hosted_at(const char *hostname, std::vector &addrs) { + struct addrinfo hints; + struct addrinfo *result; + + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = 0; + + if (getaddrinfo(hostname, nullptr, &hints, &result)) { +#if defined __linux__ && !defined __ANDROID__ + res_init(); +#endif + return; + } + + for (auto rp = result; rp; rp = rp->ai_next) { + const auto &addr = + *reinterpret_cast(rp->ai_addr); + std::string ip; + int dummy = -1; + if (detail::get_remote_ip_and_port(addr, sizeof(struct sockaddr_storage), + ip, dummy)) { + addrs.push_back(ip); + } + } +} + +inline std::string append_query_params(const char *path, const Params ¶ms) { + std::string path_with_query = path; + const static Regex re("[^?]+\\?.*"); + auto delm = duckdb_re2::RegexMatch(path, re) ? '&' : '?'; + path_with_query += delm + detail::params_to_query_str(params); + return path_with_query; +} + // Header utilities inline std::pair make_range_header(Ranges ranges) { - std::string field = "bytes="; - auto i = 0; - for (auto r : ranges) { - if (i != 0) { field += ", "; } - if (r.first != -1) { field += std::to_string(r.first); } - field += '-'; - if (r.second != -1) { field += std::to_string(r.second); } - i++; - } - return std::make_pair("Range", std::move(field)); + std::string field = "bytes="; + auto i = 0; + for (auto r : ranges) { + if (i != 0) { field += ", "; } + if (r.first != -1) { field += std::to_string(r.first); } + field += '-'; + if (r.second != -1) { field += std::to_string(r.second); } + i++; + } + return std::make_pair("Range", std::move(field)); } inline std::pair make_basic_authentication_header(const std::string &username, - const std::string &password, - bool is_proxy = false) { - auto field = "Basic " + detail::base64_encode(username + ":" + password); - auto key = is_proxy ? "Proxy-Authorization" : "Authorization"; - return std::make_pair(key, std::move(field)); + const std::string &password, bool is_proxy) { + auto field = "Basic " + detail::base64_encode(username + ":" + password); + auto key = is_proxy ? "Proxy-Authorization" : "Authorization"; + return std::make_pair(key, std::move(field)); } inline std::pair make_bearer_token_authentication_header(const std::string &token, bool is_proxy = false) { - auto field = "Bearer " + token; - auto key = is_proxy ? "Proxy-Authorization" : "Authorization"; - return std::make_pair(key, std::move(field)); + auto field = "Bearer " + token; + auto key = is_proxy ? "Proxy-Authorization" : "Authorization"; + return std::make_pair(key, std::move(field)); } // Request implementation inline bool Request::has_header(const char *key) const { - return detail::has_header(headers, key); + return detail::has_header(headers, key); } inline std::string Request::get_header_value(const char *key, size_t id) const { - return detail::get_header_value(headers, key, id, ""); -} - -template -inline T Request::get_header_value(const char *key, size_t id) const { - return detail::get_header_value(headers, key, id, 0); + return detail::get_header_value(headers, key, id, ""); } inline size_t Request::get_header_value_count(const char *key) const { - auto r = headers.equal_range(key); - return static_cast(std::distance(r.first, r.second)); + auto r = headers.equal_range(key); + return static_cast(std::distance(r.first, r.second)); } inline void Request::set_header(const char *key, const char *val) { - if (!detail::has_crlf(key) && !detail::has_crlf(val)) { - headers.emplace(key, val); - } + if (!detail::has_crlf(key) && !detail::has_crlf(val)) { + headers.emplace(key, val); + } } inline void Request::set_header(const char *key, const std::string &val) { - if (!detail::has_crlf(key) && !detail::has_crlf(val.c_str())) { - headers.emplace(key, val); - } + if (!detail::has_crlf(key) && !detail::has_crlf(val.c_str())) { + headers.emplace(key, val); + } } inline bool Request::has_param(const char *key) const { - return params.find(key) != params.end(); + return params.find(key) != params.end(); } inline std::string Request::get_param_value(const char *key, size_t id) const { - auto rng = params.equal_range(key); - auto it = rng.first; - std::advance(it, static_cast(id)); - if (it != rng.second) { return it->second; } - return std::string(); + auto rng = params.equal_range(key); + auto it = rng.first; + std::advance(it, static_cast(id)); + if (it != rng.second) { return it->second; } + return std::string(); } inline size_t Request::get_param_value_count(const char *key) const { - auto r = params.equal_range(key); - return static_cast(std::distance(r.first, r.second)); + auto r = params.equal_range(key); + return static_cast(std::distance(r.first, r.second)); } inline bool Request::is_multipart_form_data() const { - const auto &content_type = get_header_value("Content-Type"); - return !content_type.find("multipart/form-data"); + const auto &content_type = get_header_value("Content-Type"); + return !content_type.rfind("multipart/form-data", 0); } inline bool Request::has_file(const char *key) const { - return files.find(key) != files.end(); + return files.find(key) != files.end(); } inline MultipartFormData Request::get_file_value(const char *key) const { - auto it = files.find(key); - if (it != files.end()) { return it->second; } - return MultipartFormData(); + auto it = files.find(key); + if (it != files.end()) { return it->second; } + return MultipartFormData(); } // Response implementation inline bool Response::has_header(const char *key) const { - return headers.find(key) != headers.end(); + return headers.find(key) != headers.end(); } inline std::string Response::get_header_value(const char *key, size_t id) const { - return detail::get_header_value(headers, key, id, ""); -} - -template -inline T Response::get_header_value(const char *key, size_t id) const { - return detail::get_header_value(headers, key, id, 0); + return detail::get_header_value(headers, key, id, ""); } inline size_t Response::get_header_value_count(const char *key) const { - auto r = headers.equal_range(key); - return static_cast(std::distance(r.first, r.second)); + auto r = headers.equal_range(key); + return static_cast(std::distance(r.first, r.second)); } inline void Response::set_header(const char *key, const char *val) { - if (!detail::has_crlf(key) && !detail::has_crlf(val)) { - headers.emplace(key, val); - } + if (!detail::has_crlf(key) && !detail::has_crlf(val)) { + headers.emplace(key, val); + } } inline void Response::set_header(const char *key, const std::string &val) { - if (!detail::has_crlf(key) && !detail::has_crlf(val.c_str())) { - headers.emplace(key, val); - } + if (!detail::has_crlf(key) && !detail::has_crlf(val.c_str())) { + headers.emplace(key, val); + } } inline void Response::set_redirect(const char *url, int stat) { - if (!detail::has_crlf(url)) { - set_header("Location", url); - if (300 <= stat && stat < 400) { - this->status = stat; - } else { - this->status = 302; - } - } + if (!detail::has_crlf(url)) { + set_header("Location", url); + if (300 <= stat && stat < 400) { + this->status = stat; + } else { + this->status = 302; + } + } } inline void Response::set_redirect(const std::string &url, int stat) { - set_redirect(url.c_str(), stat); + set_redirect(url.c_str(), stat); } inline void Response::set_content(const char *s, size_t n, const char *content_type) { - body.assign(s, n); + body.assign(s, n); - auto rng = headers.equal_range("Content-Type"); - headers.erase(rng.first, rng.second); - set_header("Content-Type", content_type); + auto rng = headers.equal_range("Content-Type"); + headers.erase(rng.first, rng.second); + set_header("Content-Type", content_type); } inline void Response::set_content(const std::string &s, const char *content_type) { - set_content(s.data(), s.size(), content_type); + set_content(s.data(), s.size(), content_type); } -inline void -Response::set_content_provider(size_t in_length, const char *content_type, - ContentProvider provider, - const std::function &resource_releaser) { - assert(in_length > 0); - set_header("Content-Type", content_type); - content_length_ = in_length; - content_provider_ = std::move(provider); - content_provider_resource_releaser_ = resource_releaser; - is_chunked_content_provider_ = false; +inline void Response::set_content_provider( + size_t in_length, const char *content_type, ContentProvider provider, + ContentProviderResourceReleaser resource_releaser) { + assert(in_length > 0); + set_header("Content-Type", content_type); + content_length_ = in_length; + content_provider_ = std::move(provider); + content_provider_resource_releaser_ = resource_releaser; + is_chunked_content_provider_ = false; } -inline void -Response::set_content_provider(const char *content_type, - ContentProviderWithoutLength provider, - const std::function &resource_releaser) { - set_header("Content-Type", content_type); - content_length_ = 0; - content_provider_ = detail::ContentProviderAdapter(std::move(provider)); - content_provider_resource_releaser_ = resource_releaser; - is_chunked_content_provider_ = false; +inline void Response::set_content_provider( + const char *content_type, ContentProviderWithoutLength provider, + ContentProviderResourceReleaser resource_releaser) { + set_header("Content-Type", content_type); + content_length_ = 0; + content_provider_ = detail::ContentProviderAdapter(std::move(provider)); + content_provider_resource_releaser_ = resource_releaser; + is_chunked_content_provider_ = false; } inline void Response::set_chunked_content_provider( const char *content_type, ContentProviderWithoutLength provider, - const std::function &resource_releaser) { - set_header("Content-Type", content_type); - content_length_ = 0; - content_provider_ = detail::ContentProviderAdapter(std::move(provider)); - content_provider_resource_releaser_ = resource_releaser; - is_chunked_content_provider_ = true; + ContentProviderResourceReleaser resource_releaser) { + set_header("Content-Type", content_type); + content_length_ = 0; + content_provider_ = detail::ContentProviderAdapter(std::move(provider)); + content_provider_resource_releaser_ = resource_releaser; + is_chunked_content_provider_ = true; } -// Rstream implementation -inline ssize_t Stream::write(const char *ptr) { - return write(ptr, strlen(ptr)); +// Result implementation +inline bool Result::has_request_header(const char *key) const { + return request_headers_.find(key) != request_headers_.end(); } -inline ssize_t Stream::write(const std::string &s) { - return write(s.data(), s.size()); +inline std::string Result::get_request_header_value(const char *key, + size_t id) const { + return detail::get_header_value(request_headers_, key, id, ""); } -template -inline ssize_t Stream::write_format(const char *fmt, const Args &... args) { - const auto bufsiz = 2048; - std::array buf; - -#if defined(_MSC_VER) && _MSC_VER < 1900 - auto sn = _snprintf_s(buf.data(), bufsiz - 1, buf.size() - 1, fmt, args...); -#else - auto sn = snprintf(buf.data(), buf.size() - 1, fmt, args...); -#endif - if (sn <= 0) { return sn; } - - auto n = static_cast(sn); +inline size_t Result::get_request_header_value_count(const char *key) const { + auto r = request_headers_.equal_range(key); + return static_cast(std::distance(r.first, r.second)); +} - if (n >= buf.size() - 1) { - std::vector glowable_buf(buf.size()); +// Stream implementation +inline ssize_t Stream::write(const char *ptr) { + return write(ptr, strlen(ptr)); +} - while (n >= glowable_buf.size() - 1) { - glowable_buf.resize(glowable_buf.size() * 2); -#if defined(_MSC_VER) && _MSC_VER < 1900 - n = static_cast(_snprintf_s(&glowable_buf[0], glowable_buf.size(), - glowable_buf.size() - 1, fmt, - args...)); -#else - n = static_cast( - snprintf(&glowable_buf[0], glowable_buf.size() - 1, fmt, args...)); -#endif - } - return write(&glowable_buf[0], n); - } else { - return write(buf.data(), n); - } +inline ssize_t Stream::write(const std::string &s) { + return write(s.data(), s.size()); } namespace detail { @@ -109242,49 +118110,78 @@ inline SocketStream::SocketStream(socket_t sock, time_t read_timeout_sec, : sock_(sock), read_timeout_sec_(read_timeout_sec), read_timeout_usec_(read_timeout_usec), write_timeout_sec_(write_timeout_sec), - write_timeout_usec_(write_timeout_usec) {} + write_timeout_usec_(write_timeout_usec), read_buff_(read_buff_size_, 0) {} inline SocketStream::~SocketStream() {} inline bool SocketStream::is_readable() const { - return select_read(sock_, read_timeout_sec_, read_timeout_usec_) > 0; + return select_read(sock_, read_timeout_sec_, read_timeout_usec_) > 0; } inline bool SocketStream::is_writable() const { - return select_write(sock_, write_timeout_sec_, write_timeout_usec_) > 0; + return select_write(sock_, write_timeout_sec_, write_timeout_usec_) > 0; } inline ssize_t SocketStream::read(char *ptr, size_t size) { - if (!is_readable()) { return -1; } - #ifdef _WIN32 - if (size > static_cast((std::numeric_limits::max)())) { - return -1; - } - return recv(sock_, ptr, static_cast(size), CPPHTTPLIB_RECV_FLAGS); + size = + (std::min)(size, static_cast((std::numeric_limits::max)())); #else - return handle_EINTR( - [&]() { return recv(sock_, ptr, size, CPPHTTPLIB_RECV_FLAGS); }); + size = (std::min)(size, + static_cast((std::numeric_limits::max)())); #endif + + if (read_buff_off_ < read_buff_content_size_) { + auto remaining_size = read_buff_content_size_ - read_buff_off_; + if (size <= remaining_size) { + memcpy(ptr, read_buff_.data() + read_buff_off_, size); + read_buff_off_ += size; + return static_cast(size); + } else { + memcpy(ptr, read_buff_.data() + read_buff_off_, remaining_size); + read_buff_off_ += remaining_size; + return static_cast(remaining_size); + } + } + + if (!is_readable()) { return -1; } + + read_buff_off_ = 0; + read_buff_content_size_ = 0; + + if (size < read_buff_size_) { + auto n = read_socket(sock_, read_buff_.data(), read_buff_size_, + CPPHTTPLIB_RECV_FLAGS); + if (n <= 0) { + return n; + } else if (n <= static_cast(size)) { + memcpy(ptr, read_buff_.data(), static_cast(n)); + return n; + } else { + memcpy(ptr, read_buff_.data(), size); + read_buff_off_ = size; + read_buff_content_size_ = static_cast(n); + return static_cast(size); + } + } else { + return read_socket(sock_, ptr, size, CPPHTTPLIB_RECV_FLAGS); + } } inline ssize_t SocketStream::write(const char *ptr, size_t size) { - if (!is_writable()) { return -1; } + if (!is_writable()) { return -1; } #ifdef _WIN32 - if (size > static_cast((std::numeric_limits::max)())) { - return -1; - } - return send(sock_, ptr, static_cast(size), CPPHTTPLIB_SEND_FLAGS); -#else - return handle_EINTR( - [&]() { return send(sock_, ptr, size, CPPHTTPLIB_SEND_FLAGS); }); + size = + (std::min)(size, static_cast((std::numeric_limits::max)())); #endif + + return send_socket(sock_, ptr, size, CPPHTTPLIB_SEND_FLAGS); } inline void SocketStream::get_remote_ip_and_port(std::string &ip, int &port) const { - return detail::get_remote_ip_and_port(sock_, ip, port); + return detail::get_remote_ip_and_port(sock_, ip, port); } inline socket_t SocketStream::socket() const { return sock_; } @@ -109296,17 +118193,17 @@ inline bool BufferStream::is_writable() const { return true; } inline ssize_t BufferStream::read(char *ptr, size_t size) { #if defined(_MSC_VER) && _MSC_VER <= 1900 - auto len_read = buffer._Copy_s(ptr, size, size, position); + auto len_read = buffer._Copy_s(ptr, size, size, position); #else - auto len_read = buffer.copy(ptr, size, position); + auto len_read = buffer.copy(ptr, size, position); #endif - position += static_cast(len_read); - return static_cast(len_read); + position += static_cast(len_read); + return static_cast(len_read); } inline ssize_t BufferStream::write(const char *ptr, size_t size) { - buffer.append(ptr, size); - return static_cast(size); + buffer.append(ptr, size); + return static_cast(size); } inline void BufferStream::get_remote_ip_and_port(std::string & /*ip*/, @@ -109324,998 +118221,1025 @@ inline Server::Server() [] { return new ThreadPool(CPPHTTPLIB_THREAD_POOL_COUNT); }), svr_sock_(INVALID_SOCKET), is_running_(false) { #ifndef _WIN32 - signal(SIGPIPE, SIG_IGN); + signal(SIGPIPE, SIG_IGN); #endif } inline Server::~Server() {} -inline Server &Server::Get(const char *pattern, Handler handler) { - return Get(pattern, strlen(pattern), handler); -} - -inline Server &Server::Get(const char *pattern, size_t pattern_len, - Handler handler) { - get_handlers_.push_back( - std::make_pair(std::regex(pattern, pattern_len), std::move(handler))); - return *this; -} - -inline Server &Server::Post(const char *pattern, Handler handler) { - return Post(pattern, strlen(pattern), handler); -} - -inline Server &Server::Post(const char *pattern, size_t pattern_len, - Handler handler) { - post_handlers_.push_back( - std::make_pair(std::regex(pattern, pattern_len), std::move(handler))); - return *this; +inline Server &Server::Get(const std::string &pattern, Handler handler) { + get_handlers_.push_back( + std::make_pair(Regex(pattern), std::move(handler))); + return *this; } -inline Server &Server::Post(const char *pattern, - HandlerWithContentReader handler) { - return Post(pattern, strlen(pattern), handler); +inline Server &Server::Post(const std::string &pattern, Handler handler) { + post_handlers_.push_back( + std::make_pair(Regex(pattern), std::move(handler))); + return *this; } -inline Server &Server::Post(const char *pattern, size_t pattern_len, +inline Server &Server::Post(const std::string &pattern, HandlerWithContentReader handler) { - post_handlers_for_content_reader_.push_back( - std::make_pair(std::regex(pattern, pattern_len), std::move(handler))); - return *this; -} - -inline Server &Server::Put(const char *pattern, Handler handler) { - return Put(pattern, strlen(pattern), handler); -} - -inline Server &Server::Put(const char *pattern, size_t pattern_len, - Handler handler) { - put_handlers_.push_back( - std::make_pair(std::regex(pattern, pattern_len), std::move(handler))); - return *this; + post_handlers_for_content_reader_.push_back( + std::make_pair(Regex(pattern), std::move(handler))); + return *this; } -inline Server &Server::Put(const char *pattern, - HandlerWithContentReader handler) { - return Put(pattern, strlen(pattern), handler); +inline Server &Server::Put(const std::string &pattern, Handler handler) { + put_handlers_.push_back( + std::make_pair(Regex(pattern), std::move(handler))); + return *this; } -inline Server &Server::Put(const char *pattern, size_t pattern_len, +inline Server &Server::Put(const std::string &pattern, HandlerWithContentReader handler) { - put_handlers_for_content_reader_.push_back( - std::make_pair(std::regex(pattern, pattern_len), std::move(handler))); - return *this; -} - -inline Server &Server::Patch(const char *pattern, Handler handler) { - return Patch(pattern, strlen(pattern), handler); -} - -inline Server &Server::Patch(const char *pattern, size_t pattern_len, - Handler handler) { - patch_handlers_.push_back( - std::make_pair(std::regex(pattern, pattern_len), std::move(handler))); - return *this; + put_handlers_for_content_reader_.push_back( + std::make_pair(Regex(pattern), std::move(handler))); + return *this; } -inline Server &Server::Patch(const char *pattern, - HandlerWithContentReader handler) { - return Patch(pattern, strlen(pattern), handler); +inline Server &Server::Patch(const std::string &pattern, Handler handler) { + patch_handlers_.push_back( + std::make_pair(Regex(pattern), std::move(handler))); + return *this; } -inline Server &Server::Patch(const char *pattern, size_t pattern_len, +inline Server &Server::Patch(const std::string &pattern, HandlerWithContentReader handler) { - patch_handlers_for_content_reader_.push_back( - std::make_pair(std::regex(pattern, pattern_len), std::move(handler))); - return *this; -} - -inline Server &Server::Delete(const char *pattern, Handler handler) { - return Delete(pattern, strlen(pattern), handler); -} - -inline Server &Server::Delete(const char *pattern, size_t pattern_len, - Handler handler) { - delete_handlers_.push_back( - std::make_pair(std::regex(pattern, pattern_len), std::move(handler))); - return *this; + patch_handlers_for_content_reader_.push_back( + std::make_pair(Regex(pattern), std::move(handler))); + return *this; } -inline Server &Server::Delete(const char *pattern, - HandlerWithContentReader handler) { - return Delete(pattern, strlen(pattern), handler); +inline Server &Server::Delete(const std::string &pattern, Handler handler) { + delete_handlers_.push_back( + std::make_pair(Regex(pattern), std::move(handler))); + return *this; } -inline Server &Server::Delete(const char *pattern, size_t pattern_len, +inline Server &Server::Delete(const std::string &pattern, HandlerWithContentReader handler) { - delete_handlers_for_content_reader_.push_back( - std::make_pair(std::regex(pattern, pattern_len), std::move(handler))); - return *this; -} - -inline Server &Server::Options(const char *pattern, Handler handler) { - return Options(pattern, strlen(pattern), handler); + delete_handlers_for_content_reader_.push_back( + std::make_pair(Regex(pattern), std::move(handler))); + return *this; } -inline Server &Server::Options(const char *pattern, size_t pattern_len, - Handler handler) { - options_handlers_.push_back( - std::make_pair(std::regex(pattern, pattern_len), std::move(handler))); - return *this; +inline Server &Server::Options(const std::string &pattern, Handler handler) { + options_handlers_.push_back( + std::make_pair(Regex(pattern), std::move(handler))); + return *this; } -inline bool Server::set_base_dir(const char *dir, const char *mount_point) { - return set_mount_point(mount_point, dir); +inline bool Server::set_base_dir(const std::string &dir, + const std::string &mount_point) { + return set_mount_point(mount_point, dir); } -inline bool Server::set_mount_point(const char *mount_point, const char *dir, - Headers headers) { - if (detail::is_dir(dir)) { - std::string mnt = mount_point ? mount_point : "/"; - if (!mnt.empty() && mnt[0] == '/') { - base_dirs_.push_back({mnt, dir, std::move(headers)}); - return true; - } - } - return false; +inline bool Server::set_mount_point(const std::string &mount_point, + const std::string &dir, Headers headers) { + if (detail::is_dir(dir)) { + std::string mnt = !mount_point.empty() ? mount_point : "/"; + if (!mnt.empty() && mnt[0] == '/') { + base_dirs_.push_back({mnt, dir, std::move(headers)}); + return true; + } + } + return false; } -inline bool Server::remove_mount_point(const char *mount_point) { - for (auto it = base_dirs_.begin(); it != base_dirs_.end(); ++it) { - if (it->mount_point == mount_point) { - base_dirs_.erase(it); - return true; - } - } - return false; +inline bool Server::remove_mount_point(const std::string &mount_point) { + for (auto it = base_dirs_.begin(); it != base_dirs_.end(); ++it) { + if (it->mount_point == mount_point) { + base_dirs_.erase(it); + return true; + } + } + return false; } inline Server & Server::set_file_extension_and_mimetype_mapping(const char *ext, const char *mime) { - file_extension_and_mimetype_map_[ext] = mime; - - return *this; + file_extension_and_mimetype_map_[ext] = mime; + return *this; } inline Server &Server::set_file_request_handler(Handler handler) { - file_request_handler_ = std::move(handler); - - return *this; + file_request_handler_ = std::move(handler); + return *this; } inline Server &Server::set_error_handler(HandlerWithResponse handler) { - error_handler_ = std::move(handler); - return *this; + error_handler_ = std::move(handler); + return *this; } inline Server &Server::set_error_handler(Handler handler) { - error_handler_ = [handler](const Request &req, Response &res) { - handler(req, res); - return HandlerResponse::Handled; - }; - return *this; + error_handler_ = [handler](const Request &req, Response &res) { + handler(req, res); + return HandlerResponse::Handled; + }; + return *this; } inline Server &Server::set_exception_handler(ExceptionHandler handler) { - exception_handler_ = std::move(handler); - return *this; + exception_handler_ = std::move(handler); + return *this; } inline Server &Server::set_pre_routing_handler(HandlerWithResponse handler) { - pre_routing_handler_ = std::move(handler); - return *this; + pre_routing_handler_ = std::move(handler); + return *this; } inline Server &Server::set_post_routing_handler(Handler handler) { - post_routing_handler_ = std::move(handler); - return *this; + post_routing_handler_ = std::move(handler); + return *this; } inline Server &Server::set_logger(Logger logger) { - logger_ = std::move(logger); - - return *this; + logger_ = std::move(logger); + return *this; } inline Server & Server::set_expect_100_continue_handler(Expect100ContinueHandler handler) { - expect_100_continue_handler_ = std::move(handler); + expect_100_continue_handler_ = std::move(handler); - return *this; + return *this; } -inline Server &Server::set_tcp_nodelay(bool on) { - tcp_nodelay_ = on; +inline Server &Server::set_address_family(int family) { + address_family_ = family; + return *this; +} - return *this; +inline Server &Server::set_tcp_nodelay(bool on) { + tcp_nodelay_ = on; + return *this; } inline Server &Server::set_socket_options(SocketOptions socket_options) { - socket_options_ = std::move(socket_options); + socket_options_ = std::move(socket_options); + return *this; +} - return *this; +inline Server &Server::set_default_headers(Headers headers) { + default_headers_ = std::move(headers); + return *this; } inline Server &Server::set_keep_alive_max_count(size_t count) { - keep_alive_max_count_ = count; - - return *this; + keep_alive_max_count_ = count; + return *this; } inline Server &Server::set_keep_alive_timeout(time_t sec) { - keep_alive_timeout_sec_ = sec; - - return *this; + keep_alive_timeout_sec_ = sec; + return *this; } inline Server &Server::set_read_timeout(time_t sec, time_t usec) { - read_timeout_sec_ = sec; - read_timeout_usec_ = usec; - - return *this; + read_timeout_sec_ = sec; + read_timeout_usec_ = usec; + return *this; } inline Server &Server::set_write_timeout(time_t sec, time_t usec) { - write_timeout_sec_ = sec; - write_timeout_usec_ = usec; - - return *this; + write_timeout_sec_ = sec; + write_timeout_usec_ = usec; + return *this; } inline Server &Server::set_idle_interval(time_t sec, time_t usec) { - idle_interval_sec_ = sec; - idle_interval_usec_ = usec; - - return *this; + idle_interval_sec_ = sec; + idle_interval_usec_ = usec; + return *this; } inline Server &Server::set_payload_max_length(size_t length) { - payload_max_length_ = length; - - return *this; + payload_max_length_ = length; + return *this; } inline bool Server::bind_to_port(const char *host, int port, int socket_flags) { - if (bind_internal(host, port, socket_flags) < 0) return false; - return true; + if (bind_internal(host, port, socket_flags) < 0) return false; + return true; } inline int Server::bind_to_any_port(const char *host, int socket_flags) { - return bind_internal(host, 0, socket_flags); + return bind_internal(host, 0, socket_flags); } inline bool Server::listen_after_bind() { return listen_internal(); } inline bool Server::listen(const char *host, int port, int socket_flags) { - return bind_to_port(host, port, socket_flags) && listen_internal(); + return bind_to_port(host, port, socket_flags) && listen_internal(); } inline bool Server::is_running() const { return is_running_; } inline void Server::stop() { - if (is_running_) { - assert(svr_sock_ != INVALID_SOCKET); - std::atomic sock(svr_sock_.exchange(INVALID_SOCKET)); - detail::shutdown_socket(sock); - detail::close_socket(sock); - } + if (is_running_) { + assert(svr_sock_ != INVALID_SOCKET); + std::atomic sock(svr_sock_.exchange(INVALID_SOCKET)); + detail::shutdown_socket(sock); + detail::close_socket(sock); + } } inline bool Server::parse_request_line(const char *s, Request &req) { - const static std::regex re( - "(GET|HEAD|POST|PUT|DELETE|CONNECT|OPTIONS|TRACE|PATCH|PRI) " - "(([^? ]+)(?:\\?([^ ]*?))?) (HTTP/1\\.[01])\r\n"); + auto len = strlen(s); + if (len < 2 || s[len - 2] != '\r' || s[len - 1] != '\n') { return false; } + len -= 2; + + { + size_t count = 0; + + detail::split(s, s + len, ' ', [&](const char *b, const char *e) { + switch (count) { + case 0: req.method = std::string(b, e); break; + case 1: req.target = std::string(b, e); break; + case 2: req.version = std::string(b, e); break; + default: break; + } + count++; + }); - std::cmatch m; - if (std::regex_match(s, m, re)) { - req.version = std::string(m[5]); - req.method = std::string(m[1]); - req.target = std::string(m[2]); - req.path = detail::decode_url(m[3], false); + if (count != 3) { return false; } + } - // Parse query text - auto len = std::distance(m[4].first, m[4].second); - if (len > 0) { detail::parse_query_text(m[4], req.params); } + static const std::set methods{ + "GET", "HEAD", "POST", "PUT", "DELETE", + "CONNECT", "OPTIONS", "TRACE", "PATCH", "PRI"}; - return true; - } + if (methods.find(req.method) == methods.end()) { return false; } - return false; + if (req.version != "HTTP/1.1" && req.version != "HTTP/1.0") { return false; } + + { + size_t count = 0; + + detail::split(req.target.data(), req.target.data() + req.target.size(), '?', + [&](const char *b, const char *e) { + switch (count) { + case 0: + req.path = detail::decode_url(std::string(b, e), false); + break; + case 1: { + if (e - b > 0) { + detail::parse_query_text(std::string(b, e), req.params); + } + break; + } + default: break; + } + count++; + }); + + if (count > 2) { return false; } + } + + return true; } inline bool Server::write_response(Stream &strm, bool close_connection, const Request &req, Response &res) { - return write_response_core(strm, close_connection, req, res, false); + return write_response_core(strm, close_connection, req, res, false); } inline bool Server::write_response_with_content(Stream &strm, bool close_connection, const Request &req, Response &res) { - return write_response_core(strm, close_connection, req, res, true); + return write_response_core(strm, close_connection, req, res, true); } inline bool Server::write_response_core(Stream &strm, bool close_connection, const Request &req, Response &res, bool need_apply_ranges) { - assert(res.status != -1); + assert(res.status != -1); - if (400 <= res.status && error_handler_ && - error_handler_(req, res) == HandlerResponse::Handled) { - need_apply_ranges = true; - } + if (400 <= res.status && error_handler_ && + error_handler_(req, res) == HandlerResponse::Handled) { + need_apply_ranges = true; + } - std::string content_type; - std::string boundary; - if (need_apply_ranges) { apply_ranges(req, res, content_type, boundary); } + std::string content_type; + std::string boundary; + if (need_apply_ranges) { apply_ranges(req, res, content_type, boundary); } - // Prepare additional headers - if (close_connection || req.get_header_value("Connection") == "close") { - res.set_header("Connection", "close"); - } else { - std::stringstream ss; - ss << "timeout=" << keep_alive_timeout_sec_ - << ", max=" << keep_alive_max_count_; - res.set_header("Keep-Alive", ss.str()); - } + // Prepare additional headers + if (close_connection || req.get_header_value("Connection") == "close") { + res.set_header("Connection", "close"); + } else { + std::stringstream ss; + ss << "timeout=" << keep_alive_timeout_sec_ + << ", max=" << keep_alive_max_count_; + res.set_header("Keep-Alive", ss.str()); + } - if (!res.has_header("Content-Type") && - (!res.body.empty() || res.content_length_ > 0 || res.content_provider_)) { - res.set_header("Content-Type", "text/plain"); - } + if (!res.has_header("Content-Type") && + (!res.body.empty() || res.content_length_ > 0 || res.content_provider_)) { + res.set_header("Content-Type", "text/plain"); + } - if (!res.has_header("Content-Length") && res.body.empty() && - !res.content_length_ && !res.content_provider_) { - res.set_header("Content-Length", "0"); - } + if (!res.has_header("Content-Length") && res.body.empty() && + !res.content_length_ && !res.content_provider_) { + res.set_header("Content-Length", "0"); + } - if (!res.has_header("Accept-Ranges") && req.method == "HEAD") { - res.set_header("Accept-Ranges", "bytes"); - } + if (!res.has_header("Accept-Ranges") && req.method == "HEAD") { + res.set_header("Accept-Ranges", "bytes"); + } - if (post_routing_handler_) { post_routing_handler_(req, res); } + if (post_routing_handler_) { post_routing_handler_(req, res); } - // Response line and headers - { - detail::BufferStream bstrm; + // Response line and headers + { + detail::BufferStream bstrm; - if (!bstrm.write_format("HTTP/1.1 %d %s\r\n", res.status, - detail::status_message(res.status))) { - return false; - } + if (!bstrm.write_format("HTTP/1.1 %d %s\r\n", res.status, + detail::status_message(res.status))) { + return false; + } - if (!detail::write_headers(bstrm, res, Headers())) { return false; } + if (!detail::write_headers(bstrm, res.headers)) { return false; } - // Flush buffer - auto &data = bstrm.get_buffer(); - strm.write(data.data(), data.size()); - } + // Flush buffer + auto &data = bstrm.get_buffer(); + strm.write(data.data(), data.size()); + } - // Body - auto ret = true; - if (req.method != "HEAD") { - if (!res.body.empty()) { - if (!strm.write(res.body)) { ret = false; } - } else if (res.content_provider_) { - if (!write_content_with_provider(strm, req, res, boundary, - content_type)) { - ret = false; - } - } - } + // Body + auto ret = true; + if (req.method != "HEAD") { + if (!res.body.empty()) { + if (!strm.write(res.body)) { ret = false; } + } else if (res.content_provider_) { + if (write_content_with_provider(strm, req, res, boundary, content_type)) { + res.content_provider_success_ = true; + } else { + res.content_provider_success_ = false; + ret = false; + } + } + } - // Log - if (logger_) { logger_(req, res); } + // Log + if (logger_) { logger_(req, res); } - return ret; + return ret; } inline bool Server::write_content_with_provider(Stream &strm, const Request &req, Response &res, const std::string &boundary, const std::string &content_type) { - auto is_shutting_down = [this]() { - return this->svr_sock_ == INVALID_SOCKET; - }; + auto is_shutting_down = [this]() { + return this->svr_sock_ == INVALID_SOCKET; + }; - if (res.content_length_ > 0) { - if (req.ranges.empty()) { - return detail::write_content(strm, res.content_provider_, 0, - res.content_length_, is_shutting_down); - } else if (req.ranges.size() == 1) { - auto offsets = - detail::get_range_offset_and_length(req, res.content_length_, 0); - auto offset = offsets.first; - auto length = offsets.second; - return detail::write_content(strm, res.content_provider_, offset, length, - is_shutting_down); - } else { - return detail::write_multipart_ranges_data( - strm, req, res, boundary, content_type, is_shutting_down); - } - } else { - if (res.is_chunked_content_provider_) { - auto type = detail::encoding_type(req, res); + if (res.content_length_ > 0) { + if (req.ranges.empty()) { + return detail::write_content(strm, res.content_provider_, 0, + res.content_length_, is_shutting_down); + } else if (req.ranges.size() == 1) { + auto offsets = + detail::get_range_offset_and_length(req, res.content_length_, 0); + auto offset = offsets.first; + auto length = offsets.second; + return detail::write_content(strm, res.content_provider_, offset, length, + is_shutting_down); + } else { + return detail::write_multipart_ranges_data( + strm, req, res, boundary, content_type, is_shutting_down); + } + } else { + if (res.is_chunked_content_provider_) { + auto type = detail::encoding_type(req, res); - std::unique_ptr compressor; - if (type == detail::EncodingType::Gzip) { + std::unique_ptr compressor; + if (type == detail::EncodingType::Gzip) { #ifdef CPPHTTPLIB_ZLIB_SUPPORT - compressor = detail::make_unique(); + compressor = detail::make_unique(); #endif - } else if (type == detail::EncodingType::Brotli) { + } else if (type == detail::EncodingType::Brotli) { #ifdef CPPHTTPLIB_BROTLI_SUPPORT - compressor = detail::make_unique(); + compressor = detail::make_unique(); #endif - } else { - compressor = detail::make_unique(); - } - assert(compressor != nullptr); + } else { + compressor = detail::make_unique(); + } + assert(compressor != nullptr); - return detail::write_content_chunked(strm, res.content_provider_, - is_shutting_down, *compressor); - } else { - return detail::write_content_without_length(strm, res.content_provider_, - is_shutting_down); - } - } + return detail::write_content_chunked(strm, res.content_provider_, + is_shutting_down, *compressor); + } else { + return detail::write_content_without_length(strm, res.content_provider_, + is_shutting_down); + } + } } inline bool Server::read_content(Stream &strm, Request &req, Response &res) { - MultipartFormDataMap::iterator cur; - if (read_content_core( - strm, req, res, - // Regular - [&](const char *buf, size_t n) { - if (req.body.size() + n > req.body.max_size()) { return false; } - req.body.append(buf, n); - return true; - }, - // Multipart - [&](const MultipartFormData &file) { - cur = req.files.emplace(file.name, file); - return true; - }, - [&](const char *buf, size_t n) { - auto &content = cur->second.content; - if (content.size() + n > content.max_size()) { return false; } - content.append(buf, n); - return true; - })) { - const auto &content_type = req.get_header_value("Content-Type"); - if (!content_type.find("application/x-www-form-urlencoded")) { - detail::parse_query_text(req.body, req.params); - } - return true; - } - return false; + MultipartFormDataMap::iterator cur; + if (read_content_core( + strm, req, res, + // Regular + [&](const char *buf, size_t n) { + if (req.body.size() + n > req.body.max_size()) { return false; } + req.body.append(buf, n); + return true; + }, + // Multipart + [&](const MultipartFormData &file) { + cur = req.files.emplace(file.name, file); + return true; + }, + [&](const char *buf, size_t n) { + auto &content = cur->second.content; + if (content.size() + n > content.max_size()) { return false; } + content.append(buf, n); + return true; + })) { + const auto &content_type = req.get_header_value("Content-Type"); + if (!content_type.find("application/x-www-form-urlencoded")) { + if (req.body.size() > CPPHTTPLIB_REQUEST_URI_MAX_LENGTH) { + res.status = 413; // NOTE: should be 414? + return false; + } + detail::parse_query_text(req.body, req.params); + } + return true; + } + return false; } inline bool Server::read_content_with_content_receiver( Stream &strm, Request &req, Response &res, ContentReceiver receiver, MultipartContentHeader multipart_header, ContentReceiver multipart_receiver) { - return read_content_core(strm, req, res, std::move(receiver), - std::move(multipart_header), - std::move(multipart_receiver)); + return read_content_core(strm, req, res, std::move(receiver), + std::move(multipart_header), + std::move(multipart_receiver)); } inline bool Server::read_content_core(Stream &strm, Request &req, Response &res, ContentReceiver receiver, MultipartContentHeader mulitpart_header, ContentReceiver multipart_receiver) { - detail::MultipartFormDataParser multipart_form_data_parser; - ContentReceiverWithProgress out; - - if (req.is_multipart_form_data()) { - const auto &content_type = req.get_header_value("Content-Type"); - std::string boundary; - if (!detail::parse_multipart_boundary(content_type, boundary)) { - res.status = 400; - return false; - } + detail::MultipartFormDataParser multipart_form_data_parser; + ContentReceiverWithProgress out; + + if (req.is_multipart_form_data()) { + const auto &content_type = req.get_header_value("Content-Type"); + std::string boundary; + if (!detail::parse_multipart_boundary(content_type, boundary)) { + res.status = 400; + return false; + } - multipart_form_data_parser.set_boundary(std::move(boundary)); - out = [&](const char *buf, size_t n, uint64_t /*off*/, uint64_t /*len*/) { - /* For debug - size_t pos = 0; - while (pos < n) { - auto read_size = std::min(1, n - pos); - auto ret = multipart_form_data_parser.parse( - buf + pos, read_size, multipart_receiver, mulitpart_header); - if (!ret) { return false; } - pos += read_size; - } - return true; - */ - return multipart_form_data_parser.parse(buf, n, multipart_receiver, - mulitpart_header); - }; - } else { - out = [receiver](const char *buf, size_t n, uint64_t /*off*/, - uint64_t /*len*/) { return receiver(buf, n); }; - } + multipart_form_data_parser.set_boundary(std::move(boundary)); + out = [&](const char *buf, size_t n, uint64_t /*off*/, uint64_t /*len*/) { + /* For debug + size_t pos = 0; + while (pos < n) { + auto read_size = (std::min)(1, n - pos); + auto ret = multipart_form_data_parser.parse( + buf + pos, read_size, multipart_receiver, mulitpart_header); + if (!ret) { return false; } + pos += read_size; + } + return true; + */ + return multipart_form_data_parser.parse(buf, n, multipart_receiver, + mulitpart_header); + }; + } else { + out = [receiver](const char *buf, size_t n, uint64_t /*off*/, + uint64_t /*len*/) { return receiver(buf, n); }; + } - if (req.method == "DELETE" && !req.has_header("Content-Length")) { - return true; - } + if (req.method == "DELETE" && !req.has_header("Content-Length")) { + return true; + } - if (!detail::read_content(strm, req, payload_max_length_, res.status, nullptr, - out, true)) { - return false; - } + if (!detail::read_content(strm, req, payload_max_length_, res.status, nullptr, + out, true)) { + return false; + } - if (req.is_multipart_form_data()) { - if (!multipart_form_data_parser.is_valid()) { - res.status = 400; - return false; - } - } + if (req.is_multipart_form_data()) { + if (!multipart_form_data_parser.is_valid()) { + res.status = 400; + return false; + } + } - return true; + return true; } inline bool Server::handle_file_request(const Request &req, Response &res, bool head) { - for (const auto &entry : base_dirs_) { - // Prefix match - if (!req.path.compare(0, entry.mount_point.size(), entry.mount_point)) { - std::string sub_path = "/" + req.path.substr(entry.mount_point.size()); - if (detail::is_valid_path(sub_path)) { - auto path = entry.base_dir + sub_path; - if (path.back() == '/') { path += "index.html"; } - - if (detail::is_file(path)) { - detail::read_file(path, res.body); - auto type = - detail::find_content_type(path, file_extension_and_mimetype_map_); - if (type) { res.set_header("Content-Type", type); } - for (const auto &kv : entry.headers) { - res.set_header(kv.first.c_str(), kv.second); - } - res.status = req.has_header("Range") ? 206 : 200; - if (!head && file_request_handler_) { - file_request_handler_(req, res); - } - return true; - } - } - } - } - return false; + for (const auto &entry : base_dirs_) { + // Prefix match + if (!req.path.compare(0, entry.mount_point.size(), entry.mount_point)) { + std::string sub_path = "/" + req.path.substr(entry.mount_point.size()); + if (detail::is_valid_path(sub_path)) { + auto path = entry.base_dir + sub_path; + if (path.back() == '/') { path += "index.html"; } + + if (detail::is_file(path)) { + detail::read_file(path, res.body); + auto type = + detail::find_content_type(path, file_extension_and_mimetype_map_); + if (type) { res.set_header("Content-Type", type); } + for (const auto &kv : entry.headers) { + res.set_header(kv.first.c_str(), kv.second); + } + res.status = req.has_header("Range") ? 206 : 200; + if (!head && file_request_handler_) { + file_request_handler_(req, res); + } + return true; + } + } + } + } + return false; } inline socket_t Server::create_server_socket(const char *host, int port, int socket_flags, SocketOptions socket_options) const { - return detail::create_socket( - host, port, socket_flags, tcp_nodelay_, std::move(socket_options), - [](socket_t sock, struct addrinfo &ai) -> bool { - if (::bind(sock, ai.ai_addr, static_cast(ai.ai_addrlen))) { - return false; - } - if (::listen(sock, 5)) { // Listen through 5 channels - return false; - } - return true; - }); + return detail::create_socket( + host, "", port, address_family_, socket_flags, tcp_nodelay_, + std::move(socket_options), + [](socket_t sock, struct addrinfo &ai) -> bool { + if (::bind(sock, ai.ai_addr, static_cast(ai.ai_addrlen))) { + return false; + } + if (::listen(sock, CPPHTTPLIB_LISTEN_BACKLOG)) { return false; } + return true; + }); } inline int Server::bind_internal(const char *host, int port, int socket_flags) { - if (!is_valid()) { return -1; } + if (!is_valid()) { return -1; } - svr_sock_ = create_server_socket(host, port, socket_flags, socket_options_); - if (svr_sock_ == INVALID_SOCKET) { return -1; } + svr_sock_ = create_server_socket(host, port, socket_flags, socket_options_); + if (svr_sock_ == INVALID_SOCKET) { return -1; } - if (port == 0) { - struct sockaddr_storage addr; - socklen_t addr_len = sizeof(addr); - if (getsockname(svr_sock_, reinterpret_cast(&addr), - &addr_len) == -1) { - return -1; - } - if (addr.ss_family == AF_INET) { - return ntohs(reinterpret_cast(&addr)->sin_port); - } else if (addr.ss_family == AF_INET6) { - return ntohs(reinterpret_cast(&addr)->sin6_port); - } else { - return -1; - } - } else { - return port; - } + if (port == 0) { + struct sockaddr_storage addr; + socklen_t addr_len = sizeof(addr); + if (getsockname(svr_sock_, reinterpret_cast(&addr), + &addr_len) == -1) { + return -1; + } + if (addr.ss_family == AF_INET) { + return ntohs(reinterpret_cast(&addr)->sin_port); + } else if (addr.ss_family == AF_INET6) { + return ntohs(reinterpret_cast(&addr)->sin6_port); + } else { + return -1; + } + } else { + return port; + } } inline bool Server::listen_internal() { - auto ret = true; - is_running_ = true; + auto ret = true; + is_running_ = true; - { - std::unique_ptr task_queue(new_task_queue()); + { + std::unique_ptr task_queue(new_task_queue()); - while (svr_sock_ != INVALID_SOCKET) { + while (svr_sock_ != INVALID_SOCKET) { #ifndef _WIN32 - if (idle_interval_sec_ > 0 || idle_interval_usec_ > 0) { + if (idle_interval_sec_ > 0 || idle_interval_usec_ > 0) { #endif - auto val = detail::select_read(svr_sock_, idle_interval_sec_, - idle_interval_usec_); - if (val == 0) { // Timeout - task_queue->on_idle(); - continue; - } + auto val = detail::select_read(svr_sock_, idle_interval_sec_, + idle_interval_usec_); + if (val == 0) { // Timeout + task_queue->on_idle(); + continue; + } #ifndef _WIN32 - } + } #endif - socket_t sock = accept(svr_sock_, nullptr, nullptr); + socket_t sock = accept(svr_sock_, nullptr, nullptr); - if (sock == INVALID_SOCKET) { - if (errno == EMFILE) { - // The per-process limit of open file descriptors has been reached. - // Try to accept new connections after a short sleep. - std::this_thread::sleep_for(std::chrono::milliseconds(1)); - continue; - } - if (svr_sock_ != INVALID_SOCKET) { - detail::close_socket(svr_sock_); - ret = false; - } else { - ; // The server socket was closed by user. - } - break; - } + if (sock == INVALID_SOCKET) { + if (errno == EMFILE) { + // The per-process limit of open file descriptors has been reached. + // Try to accept new connections after a short sleep. + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + continue; + } + if (svr_sock_ != INVALID_SOCKET) { + detail::close_socket(svr_sock_); + ret = false; + } else { + ; // The server socket was closed by user. + } + break; + } + + { +#ifdef _WIN32 + auto timeout = static_cast(read_timeout_sec_ * 1000 + + read_timeout_usec_ / 1000); + setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&timeout, + sizeof(timeout)); +#else + timeval tv; + tv.tv_sec = static_cast(read_timeout_sec_); + tv.tv_usec = static_cast(read_timeout_usec_); + setsockopt(sock, SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(tv)); +#endif + } + { + +#ifdef _WIN32 + auto timeout = static_cast(write_timeout_sec_ * 1000 + + write_timeout_usec_ / 1000); + setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&timeout, + sizeof(timeout)); +#else + timeval tv; + tv.tv_sec = static_cast(write_timeout_sec_); + tv.tv_usec = static_cast(write_timeout_usec_); + setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(tv)); +#endif + } #if __cplusplus > 201703L - task_queue->enqueue([=, this]() { process_and_close_socket(sock); }); + task_queue->enqueue([=, this]() { process_and_close_socket(sock); }); #else - task_queue->enqueue([=]() { process_and_close_socket(sock); }); + task_queue->enqueue([=]() { process_and_close_socket(sock); }); #endif - } + } - task_queue->shutdown(); - } + task_queue->shutdown(); + } - is_running_ = false; - return ret; + is_running_ = false; + return ret; } inline bool Server::routing(Request &req, Response &res, Stream &strm) { - if (pre_routing_handler_ && - pre_routing_handler_(req, res) == HandlerResponse::Handled) { - return true; - } + if (pre_routing_handler_ && + pre_routing_handler_(req, res) == HandlerResponse::Handled) { + return true; + } - // File handler - bool is_head_request = req.method == "HEAD"; - if ((req.method == "GET" || is_head_request) && - handle_file_request(req, res, is_head_request)) { - return true; - } + // File handler + bool is_head_request = req.method == "HEAD"; + if ((req.method == "GET" || is_head_request) && + handle_file_request(req, res, is_head_request)) { + return true; + } - if (detail::expect_content(req)) { - // Content reader handler - { - ContentReader reader( - [&](ContentReceiver receiver) { - return read_content_with_content_receiver( - strm, req, res, std::move(receiver), nullptr, nullptr); - }, - [&](MultipartContentHeader header, ContentReceiver receiver) { - return read_content_with_content_receiver(strm, req, res, nullptr, - std::move(header), - std::move(receiver)); - }); - - if (req.method == "POST") { - if (dispatch_request_for_content_reader( - req, res, std::move(reader), - post_handlers_for_content_reader_)) { - return true; - } - } else if (req.method == "PUT") { - if (dispatch_request_for_content_reader( - req, res, std::move(reader), - put_handlers_for_content_reader_)) { - return true; - } - } else if (req.method == "PATCH") { - if (dispatch_request_for_content_reader( - req, res, std::move(reader), - patch_handlers_for_content_reader_)) { - return true; - } - } else if (req.method == "DELETE") { - if (dispatch_request_for_content_reader( - req, res, std::move(reader), - delete_handlers_for_content_reader_)) { - return true; - } - } - } + if (detail::expect_content(req)) { + // Content reader handler + { + ContentReader reader( + [&](ContentReceiver receiver) { + return read_content_with_content_receiver( + strm, req, res, std::move(receiver), nullptr, nullptr); + }, + [&](MultipartContentHeader header, ContentReceiver receiver) { + return read_content_with_content_receiver(strm, req, res, nullptr, + std::move(header), + std::move(receiver)); + }); + + if (req.method == "POST") { + if (dispatch_request_for_content_reader( + req, res, std::move(reader), + post_handlers_for_content_reader_)) { + return true; + } + } else if (req.method == "PUT") { + if (dispatch_request_for_content_reader( + req, res, std::move(reader), + put_handlers_for_content_reader_)) { + return true; + } + } else if (req.method == "PATCH") { + if (dispatch_request_for_content_reader( + req, res, std::move(reader), + patch_handlers_for_content_reader_)) { + return true; + } + } else if (req.method == "DELETE") { + if (dispatch_request_for_content_reader( + req, res, std::move(reader), + delete_handlers_for_content_reader_)) { + return true; + } + } + } - // Read content into `req.body` - if (!read_content(strm, req, res)) { return false; } - } + // Read content into `req.body` + if (!read_content(strm, req, res)) { return false; } + } - // Regular handler - if (req.method == "GET" || req.method == "HEAD") { - return dispatch_request(req, res, get_handlers_); - } else if (req.method == "POST") { - return dispatch_request(req, res, post_handlers_); - } else if (req.method == "PUT") { - return dispatch_request(req, res, put_handlers_); - } else if (req.method == "DELETE") { - return dispatch_request(req, res, delete_handlers_); - } else if (req.method == "OPTIONS") { - return dispatch_request(req, res, options_handlers_); - } else if (req.method == "PATCH") { - return dispatch_request(req, res, patch_handlers_); - } + // Regular handler + if (req.method == "GET" || req.method == "HEAD") { + return dispatch_request(req, res, get_handlers_); + } else if (req.method == "POST") { + return dispatch_request(req, res, post_handlers_); + } else if (req.method == "PUT") { + return dispatch_request(req, res, put_handlers_); + } else if (req.method == "DELETE") { + return dispatch_request(req, res, delete_handlers_); + } else if (req.method == "OPTIONS") { + return dispatch_request(req, res, options_handlers_); + } else if (req.method == "PATCH") { + return dispatch_request(req, res, patch_handlers_); + } - res.status = 400; - return false; + res.status = 400; + return false; } inline bool Server::dispatch_request(Request &req, Response &res, const Handlers &handlers) { - for (const auto &x : handlers) { - const auto &pattern = x.first; - const auto &handler = x.second; + for (const auto &x : handlers) { + const auto &pattern = x.first; + const auto &handler = x.second; - if (std::regex_match(req.path, req.matches, pattern)) { - handler(req, res); - return true; - } - } - return false; + if (duckdb_re2::RegexMatch(req.path, req.matches, pattern)) { + handler(req, res); + return true; + } + } + return false; } inline void Server::apply_ranges(const Request &req, Response &res, std::string &content_type, std::string &boundary) { - if (req.ranges.size() > 1) { - boundary = detail::make_multipart_data_boundary(); - - auto it = res.headers.find("Content-Type"); - if (it != res.headers.end()) { - content_type = it->second; - res.headers.erase(it); - } - - res.headers.emplace("Content-Type", - "multipart/byteranges; boundary=" + boundary); - } - - auto type = detail::encoding_type(req, res); - - if (res.body.empty()) { - if (res.content_length_ > 0) { - size_t length = 0; - if (req.ranges.empty()) { - length = res.content_length_; - } else if (req.ranges.size() == 1) { - auto offsets = - detail::get_range_offset_and_length(req, res.content_length_, 0); - auto offset = offsets.first; - length = offsets.second; - auto content_range = detail::make_content_range_header_field( - offset, length, res.content_length_); - res.set_header("Content-Range", content_range); - } else { - length = detail::get_multipart_ranges_data_length(req, res, boundary, - content_type); - } - res.set_header("Content-Length", std::to_string(length)); - } else { - if (res.content_provider_) { - if (res.is_chunked_content_provider_) { - res.set_header("Transfer-Encoding", "chunked"); - if (type == detail::EncodingType::Gzip) { - res.set_header("Content-Encoding", "gzip"); - } else if (type == detail::EncodingType::Brotli) { - res.set_header("Content-Encoding", "br"); - } - } - } - } - } else { - if (req.ranges.empty()) { - ; - } else if (req.ranges.size() == 1) { - auto offsets = - detail::get_range_offset_and_length(req, res.body.size(), 0); - auto offset = offsets.first; - auto length = offsets.second; - auto content_range = detail::make_content_range_header_field( - offset, length, res.body.size()); - res.set_header("Content-Range", content_range); - if (offset < res.body.size()) { - res.body = res.body.substr(offset, length); - } else { - res.body.clear(); - res.status = 416; - } - } else { - std::string data; - if (detail::make_multipart_ranges_data(req, res, boundary, content_type, - data)) { - res.body.swap(data); - } else { - res.body.clear(); - res.status = 416; - } - } + if (req.ranges.size() > 1) { + boundary = detail::make_multipart_data_boundary(); + + auto it = res.headers.find("Content-Type"); + if (it != res.headers.end()) { + content_type = it->second; + res.headers.erase(it); + } + + res.headers.emplace("Content-Type", + "multipart/byteranges; boundary=" + boundary); + } + + auto type = detail::encoding_type(req, res); + + if (res.body.empty()) { + if (res.content_length_ > 0) { + size_t length = 0; + if (req.ranges.empty()) { + length = res.content_length_; + } else if (req.ranges.size() == 1) { + auto offsets = + detail::get_range_offset_and_length(req, res.content_length_, 0); + auto offset = offsets.first; + length = offsets.second; + auto content_range = detail::make_content_range_header_field( + offset, length, res.content_length_); + res.set_header("Content-Range", content_range); + } else { + length = detail::get_multipart_ranges_data_length(req, res, boundary, + content_type); + } + res.set_header("Content-Length", std::to_string(length)); + } else { + if (res.content_provider_) { + if (res.is_chunked_content_provider_) { + res.set_header("Transfer-Encoding", "chunked"); + if (type == detail::EncodingType::Gzip) { + res.set_header("Content-Encoding", "gzip"); + } else if (type == detail::EncodingType::Brotli) { + res.set_header("Content-Encoding", "br"); + } + } + } + } + } else { + if (req.ranges.empty()) { + ; + } else if (req.ranges.size() == 1) { + auto offsets = + detail::get_range_offset_and_length(req, res.body.size(), 0); + auto offset = offsets.first; + auto length = offsets.second; + auto content_range = detail::make_content_range_header_field( + offset, length, res.body.size()); + res.set_header("Content-Range", content_range); + if (offset < res.body.size()) { + res.body = res.body.substr(offset, length); + } else { + res.body.clear(); + res.status = 416; + } + } else { + std::string data; + if (detail::make_multipart_ranges_data(req, res, boundary, content_type, + data)) { + res.body.swap(data); + } else { + res.body.clear(); + res.status = 416; + } + } - if (type != detail::EncodingType::None) { - std::unique_ptr compressor; - std::string content_encoding; + if (type != detail::EncodingType::None) { + std::unique_ptr compressor; + std::string content_encoding; - if (type == detail::EncodingType::Gzip) { + if (type == detail::EncodingType::Gzip) { #ifdef CPPHTTPLIB_ZLIB_SUPPORT - compressor = detail::make_unique(); - content_encoding = "gzip"; + compressor = detail::make_unique(); + content_encoding = "gzip"; #endif - } else if (type == detail::EncodingType::Brotli) { + } else if (type == detail::EncodingType::Brotli) { #ifdef CPPHTTPLIB_BROTLI_SUPPORT - compressor = detail::make_unique(); - content_encoding = "br"; + compressor = detail::make_unique(); + content_encoding = "br"; #endif - } + } - if (compressor) { - std::string compressed; - if (compressor->compress(res.body.data(), res.body.size(), true, - [&](const char *data, size_t data_len) { - compressed.append(data, data_len); - return true; - })) { - res.body.swap(compressed); - res.set_header("Content-Encoding", content_encoding); - } - } - } + if (compressor) { + std::string compressed; + if (compressor->compress(res.body.data(), res.body.size(), true, + [&](const char *data, size_t data_len) { + compressed.append(data, data_len); + return true; + })) { + res.body.swap(compressed); + res.set_header("Content-Encoding", content_encoding); + } + } + } - auto length = std::to_string(res.body.size()); - res.set_header("Content-Length", length); - } + auto length = std::to_string(res.body.size()); + res.set_header("Content-Length", length); + } } inline bool Server::dispatch_request_for_content_reader( Request &req, Response &res, ContentReader content_reader, const HandlersForContentReader &handlers) { - for (const auto &x : handlers) { - const auto &pattern = x.first; - const auto &handler = x.second; + for (const auto &x : handlers) { + const auto &pattern = x.first; + const auto &handler = x.second; - if (std::regex_match(req.path, req.matches, pattern)) { - handler(req, res, content_reader); - return true; - } - } - return false; + if (duckdb_re2::RegexMatch(req.path, req.matches, pattern)) { + handler(req, res, content_reader); + return true; + } + } + return false; } inline bool Server::process_request(Stream &strm, bool close_connection, bool &connection_closed, const std::function &setup_request) { - std::array buf{}; + std::array buf{}; + + detail::stream_line_reader line_reader(strm, buf.data(), buf.size()); - detail::stream_line_reader line_reader(strm, buf.data(), buf.size()); + // Connection has been closed on client + if (!line_reader.getline()) { return false; } - // Connection has been closed on client - if (!line_reader.getline()) { return false; } + Request req; + Response res; - Request req; - Response res; + res.version = "HTTP/1.1"; - res.version = "HTTP/1.1"; + for (const auto &header : default_headers_) { + if (res.headers.find(header.first) == res.headers.end()) { + res.headers.insert(header); + } + } #ifdef _WIN32 - // TODO: Increase FD_SETSIZE statically (libzmq), dynamically (MySQL). + // TODO: Increase FD_SETSIZE statically (libzmq), dynamically (MySQL). #else #ifndef CPPHTTPLIB_USE_POLL - // Socket file descriptor exceeded FD_SETSIZE... - if (strm.socket() >= FD_SETSIZE) { - Headers dummy; - detail::read_headers(strm, dummy); - res.status = 500; - return write_response(strm, close_connection, req, res); - } + // Socket file descriptor exceeded FD_SETSIZE... + if (strm.socket() >= FD_SETSIZE) { + Headers dummy; + detail::read_headers(strm, dummy); + res.status = 500; + return write_response(strm, close_connection, req, res); + } #endif #endif - // Check if the request URI doesn't exceed the limit - if (line_reader.size() > CPPHTTPLIB_REQUEST_URI_MAX_LENGTH) { - Headers dummy; - detail::read_headers(strm, dummy); - res.status = 414; - return write_response(strm, close_connection, req, res); - } + // Check if the request URI doesn't exceed the limit + if (line_reader.size() > CPPHTTPLIB_REQUEST_URI_MAX_LENGTH) { + Headers dummy; + detail::read_headers(strm, dummy); + res.status = 414; + return write_response(strm, close_connection, req, res); + } - // Request line and headers - if (!parse_request_line(line_reader.ptr(), req) || - !detail::read_headers(strm, req.headers)) { - res.status = 400; - return write_response(strm, close_connection, req, res); - } + // Request line and headers + if (!parse_request_line(line_reader.ptr(), req) || + !detail::read_headers(strm, req.headers)) { + res.status = 400; + return write_response(strm, close_connection, req, res); + } - if (req.get_header_value("Connection") == "close") { - connection_closed = true; - } + if (req.get_header_value("Connection") == "close") { + connection_closed = true; + } - if (req.version == "HTTP/1.0" && - req.get_header_value("Connection") != "Keep-Alive") { - connection_closed = true; - } + if (req.version == "HTTP/1.0" && + req.get_header_value("Connection") != "Keep-Alive") { + connection_closed = true; + } - strm.get_remote_ip_and_port(req.remote_addr, req.remote_port); - req.set_header("REMOTE_ADDR", req.remote_addr); - req.set_header("REMOTE_PORT", std::to_string(req.remote_port)); + strm.get_remote_ip_and_port(req.remote_addr, req.remote_port); + req.set_header("REMOTE_ADDR", req.remote_addr); + req.set_header("REMOTE_PORT", std::to_string(req.remote_port)); - if (req.has_header("Range")) { - const auto &range_header_value = req.get_header_value("Range"); - if (!detail::parse_range_header(range_header_value, req.ranges)) { - res.status = 416; - return write_response(strm, close_connection, req, res); - } - } + if (req.has_header("Range")) { + const auto &range_header_value = req.get_header_value("Range"); + if (!detail::parse_range_header(range_header_value, req.ranges)) { + res.status = 416; + return write_response(strm, close_connection, req, res); + } + } - if (setup_request) { setup_request(req); } + if (setup_request) { setup_request(req); } - if (req.get_header_value("Expect") == "100-continue") { - auto status = 100; - if (expect_100_continue_handler_) { - status = expect_100_continue_handler_(req, res); - } - switch (status) { - case 100: - case 417: - strm.write_format("HTTP/1.1 %d %s\r\n\r\n", status, - detail::status_message(status)); - break; - default: return write_response(strm, close_connection, req, res); - } - } + if (req.get_header_value("Expect") == "100-continue") { + auto status = 100; + if (expect_100_continue_handler_) { + status = expect_100_continue_handler_(req, res); + } + switch (status) { + case 100: + case 417: + strm.write_format("HTTP/1.1 %d %s\r\n\r\n", status, + detail::status_message(status)); + break; + default: return write_response(strm, close_connection, req, res); + } + } - // Rounting - bool routed = false; - try { - routed = routing(req, res, strm); - } catch (std::exception & e) { - if (exception_handler_) { - exception_handler_(req, res, e); - routed = true; - } else { - res.status = 500; - res.set_header("EXCEPTION_WHAT", e.what()); - } - } catch (...) { - res.status = 500; - res.set_header("EXCEPTION_WHAT", "UNKNOWN"); - } + // Rounting + bool routed = false; +#ifdef CPPHTTPLIB_NO_EXCEPTIONS + routed = routing(req, res, strm); +#else + try { + routed = routing(req, res, strm); + } catch (std::exception &e) { + if (exception_handler_) { + exception_handler_(req, res, e); + routed = true; + } else { + res.status = 500; + res.set_header("EXCEPTION_WHAT", e.what()); + } + } catch (...) { + res.status = 500; + res.set_header("EXCEPTION_WHAT", "UNKNOWN"); + } +#endif - if (routed) { - if (res.status == -1) { res.status = req.ranges.empty() ? 200 : 206; } - return write_response_with_content(strm, close_connection, req, res); - } else { - if (res.status == -1) { res.status = 404; } - return write_response(strm, close_connection, req, res); - } + if (routed) { + if (res.status == -1) { res.status = req.ranges.empty() ? 200 : 206; } + return write_response_with_content(strm, close_connection, req, res); + } else { + if (res.status == -1) { res.status = 404; } + return write_response(strm, close_connection, req, res); + } } inline bool Server::is_valid() const { return true; } inline bool Server::process_and_close_socket(socket_t sock) { - auto ret = detail::process_server_socket( - sock, keep_alive_max_count_, keep_alive_timeout_sec_, read_timeout_sec_, - read_timeout_usec_, write_timeout_sec_, write_timeout_usec_, - [this](Stream &strm, bool close_connection, bool &connection_closed) { - return process_request(strm, close_connection, connection_closed, - nullptr); - }); - - detail::shutdown_socket(sock); - detail::close_socket(sock); - return ret; + auto ret = detail::process_server_socket( + svr_sock_, sock, keep_alive_max_count_, keep_alive_timeout_sec_, + read_timeout_sec_, read_timeout_usec_, write_timeout_sec_, + write_timeout_usec_, + [this](Stream &strm, bool close_connection, bool &connection_closed) { + return process_request(strm, close_connection, connection_closed, + nullptr); + }); + + detail::shutdown_socket(sock); + detail::close_socket(sock); + return ret; } // HTTP client implementation @@ -110328,549 +119252,596 @@ inline ClientImpl::ClientImpl(const std::string &host, int port) inline ClientImpl::ClientImpl(const std::string &host, int port, const std::string &client_cert_path, const std::string &client_key_path) - // : (Error::Success), host_(host), port_(port), : host_(host), port_(port), - host_and_port_(host_ + ":" + std::to_string(port_)), + host_and_port_(adjust_host_string(host) + ":" + std::to_string(port)), client_cert_path_(client_cert_path), client_key_path_(client_key_path) {} -inline ClientImpl::~ClientImpl() { lock_socket_and_shutdown_and_close(); } +inline ClientImpl::~ClientImpl() { + std::lock_guard guard(socket_mutex_); + shutdown_socket(socket_); + close_socket(socket_); +} inline bool ClientImpl::is_valid() const { return true; } inline void ClientImpl::copy_settings(const ClientImpl &rhs) { - client_cert_path_ = rhs.client_cert_path_; - client_key_path_ = rhs.client_key_path_; - connection_timeout_sec_ = rhs.connection_timeout_sec_; - read_timeout_sec_ = rhs.read_timeout_sec_; - read_timeout_usec_ = rhs.read_timeout_usec_; - write_timeout_sec_ = rhs.write_timeout_sec_; - write_timeout_usec_ = rhs.write_timeout_usec_; - basic_auth_username_ = rhs.basic_auth_username_; - basic_auth_password_ = rhs.basic_auth_password_; - bearer_token_auth_token_ = rhs.bearer_token_auth_token_; + client_cert_path_ = rhs.client_cert_path_; + client_key_path_ = rhs.client_key_path_; + connection_timeout_sec_ = rhs.connection_timeout_sec_; + read_timeout_sec_ = rhs.read_timeout_sec_; + read_timeout_usec_ = rhs.read_timeout_usec_; + write_timeout_sec_ = rhs.write_timeout_sec_; + write_timeout_usec_ = rhs.write_timeout_usec_; + basic_auth_username_ = rhs.basic_auth_username_; + basic_auth_password_ = rhs.basic_auth_password_; + bearer_token_auth_token_ = rhs.bearer_token_auth_token_; +#ifdef CPPHTTPLIB_OPENSSL_SUPPORT + digest_auth_username_ = rhs.digest_auth_username_; + digest_auth_password_ = rhs.digest_auth_password_; +#endif + keep_alive_ = rhs.keep_alive_; + follow_location_ = rhs.follow_location_; + url_encode_ = rhs.url_encode_; + address_family_ = rhs.address_family_; + tcp_nodelay_ = rhs.tcp_nodelay_; + socket_options_ = rhs.socket_options_; + compress_ = rhs.compress_; + decompress_ = rhs.decompress_; + interface_ = rhs.interface_; + proxy_host_ = rhs.proxy_host_; + proxy_port_ = rhs.proxy_port_; + proxy_basic_auth_username_ = rhs.proxy_basic_auth_username_; + proxy_basic_auth_password_ = rhs.proxy_basic_auth_password_; + proxy_bearer_token_auth_token_ = rhs.proxy_bearer_token_auth_token_; #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - digest_auth_username_ = rhs.digest_auth_username_; - digest_auth_password_ = rhs.digest_auth_password_; + proxy_digest_auth_username_ = rhs.proxy_digest_auth_username_; + proxy_digest_auth_password_ = rhs.proxy_digest_auth_password_; #endif - keep_alive_ = rhs.keep_alive_; - follow_location_ = rhs.follow_location_; - tcp_nodelay_ = rhs.tcp_nodelay_; - socket_options_ = rhs.socket_options_; - compress_ = rhs.compress_; - decompress_ = rhs.decompress_; - interface_ = rhs.interface_; - proxy_host_ = rhs.proxy_host_; - proxy_port_ = rhs.proxy_port_; - proxy_basic_auth_username_ = rhs.proxy_basic_auth_username_; - proxy_basic_auth_password_ = rhs.proxy_basic_auth_password_; - proxy_bearer_token_auth_token_ = rhs.proxy_bearer_token_auth_token_; #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - proxy_digest_auth_username_ = rhs.proxy_digest_auth_username_; - proxy_digest_auth_password_ = rhs.proxy_digest_auth_password_; + ca_cert_file_path_ = rhs.ca_cert_file_path_; + ca_cert_dir_path_ = rhs.ca_cert_dir_path_; + ca_cert_store_ = rhs.ca_cert_store_; #endif #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - server_certificate_verification_ = rhs.server_certificate_verification_; + server_certificate_verification_ = rhs.server_certificate_verification_; #endif - logger_ = rhs.logger_; + logger_ = rhs.logger_; } inline socket_t ClientImpl::create_client_socket(Error &error) const { - if (!proxy_host_.empty() && proxy_port_ != -1) { - return detail::create_client_socket( - proxy_host_.c_str(), proxy_port_, tcp_nodelay_, socket_options_, - connection_timeout_sec_, connection_timeout_usec_, interface_, error); - } - return detail::create_client_socket( - host_.c_str(), port_, tcp_nodelay_, socket_options_, - connection_timeout_sec_, connection_timeout_usec_, interface_, error); + if (!proxy_host_.empty() && proxy_port_ != -1) { + return detail::create_client_socket( + proxy_host_.c_str(), "", proxy_port_, address_family_, tcp_nodelay_, + socket_options_, connection_timeout_sec_, connection_timeout_usec_, + read_timeout_sec_, read_timeout_usec_, write_timeout_sec_, + write_timeout_usec_, interface_, error); + } + + // Check is custom IP specified for host_ + std::string ip; + auto it = addr_map_.find(host_); + if (it != addr_map_.end()) ip = it->second; + + return detail::create_client_socket( + host_.c_str(), ip.c_str(), port_, address_family_, tcp_nodelay_, + socket_options_, connection_timeout_sec_, connection_timeout_usec_, + read_timeout_sec_, read_timeout_usec_, write_timeout_sec_, + write_timeout_usec_, interface_, error); } inline bool ClientImpl::create_and_connect_socket(Socket &socket, Error &error) { - auto sock = create_client_socket(error); - if (sock == INVALID_SOCKET) { return false; } - socket.sock = sock; - return true; + auto sock = create_client_socket(error); + if (sock == INVALID_SOCKET) { return false; } + socket.sock = sock; + return true; } inline void ClientImpl::shutdown_ssl(Socket & /*socket*/, bool /*shutdown_gracefully*/) { - // If there are any requests in flight from threads other than us, then it's - // a thread-unsafe race because individual ssl* objects are not thread-safe. - assert(socket_requests_in_flight_ == 0 || - socket_requests_are_from_thread_ == std::this_thread::get_id()); + // If there are any requests in flight from threads other than us, then it's + // a thread-unsafe race because individual ssl* objects are not thread-safe. + assert(socket_requests_in_flight_ == 0 || + socket_requests_are_from_thread_ == std::this_thread::get_id()); } inline void ClientImpl::shutdown_socket(Socket &socket) { - if (socket.sock == INVALID_SOCKET) { return; } - detail::shutdown_socket(socket.sock); + if (socket.sock == INVALID_SOCKET) { return; } + detail::shutdown_socket(socket.sock); } inline void ClientImpl::close_socket(Socket &socket) { - // If there are requests in flight in another thread, usually closing - // the socket will be fine and they will simply receive an error when - // using the closed socket, but it is still a bug since rarely the OS - // may reassign the socket id to be used for a new socket, and then - // suddenly they will be operating on a live socket that is different - // than the one they intended! - assert(socket_requests_in_flight_ == 0 || - socket_requests_are_from_thread_ == std::this_thread::get_id()); - - // It is also a bug if this happens while SSL is still active + // If there are requests in flight in another thread, usually closing + // the socket will be fine and they will simply receive an error when + // using the closed socket, but it is still a bug since rarely the OS + // may reassign the socket id to be used for a new socket, and then + // suddenly they will be operating on a live socket that is different + // than the one they intended! + assert(socket_requests_in_flight_ == 0 || + socket_requests_are_from_thread_ == std::this_thread::get_id()); + + // It is also a bug if this happens while SSL is still active #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - assert(socket.ssl == nullptr); + assert(socket.ssl == nullptr); #endif - if (socket.sock == INVALID_SOCKET) { return; } - detail::close_socket(socket.sock); - socket.sock = INVALID_SOCKET; -} - -inline void ClientImpl::lock_socket_and_shutdown_and_close() { - std::lock_guard guard(socket_mutex_); - shutdown_ssl(socket_, true); - shutdown_socket(socket_); - close_socket(socket_); + if (socket.sock == INVALID_SOCKET) { return; } + detail::close_socket(socket.sock); + socket.sock = INVALID_SOCKET; } inline bool ClientImpl::read_response_line(Stream &strm, const Request &req, Response &res) { - std::array buf; + std::array buf{}; - detail::stream_line_reader line_reader(strm, buf.data(), buf.size()); + detail::stream_line_reader line_reader(strm, buf.data(), buf.size()); - if (!line_reader.getline()) { return false; } + if (!line_reader.getline()) { return false; } - const static std::regex re("(HTTP/1\\.[01]) (\\d{3}) (.*?)\r\n"); +#ifdef CPPHTTPLIB_ALLOW_LF_AS_LINE_TERMINATOR + const static Regex re("(HTTP/1\\.[01]) (\\d{3})(?: (.*?))?\r\n"); +#else + const static Regex re("(HTTP/1\\.[01]) (\\d{3})(?: (.*?))?\r?\n"); +#endif - std::cmatch m; - if (!std::regex_match(line_reader.ptr(), m, re)) { - return req.method == "CONNECT"; - } - res.version = std::string(m[1]); - res.status = std::stoi(std::string(m[2])); - res.reason = std::string(m[3]); - - // Ignore '100 Continue' - while (res.status == 100) { - if (!line_reader.getline()) { return false; } // CRLF - if (!line_reader.getline()) { return false; } // next response line - - if (!std::regex_match(line_reader.ptr(), m, re)) { return false; } - res.version = std::string(m[1]); - res.status = std::stoi(std::string(m[2])); - res.reason = std::string(m[3]); - } + Match m; + if (!duckdb_re2::RegexMatch(line_reader.ptr(), m, re)) { + return req.method == "CONNECT"; + } + res.version = std::string(m[1]); + res.status = std::stoi(std::string(m[2])); + res.reason = std::string(m[3]); - return true; + // Ignore '100 Continue' + while (res.status == 100) { + if (!line_reader.getline()) { return false; } // CRLF + if (!line_reader.getline()) { return false; } // next response line + + if (!duckdb_re2::RegexMatch(line_reader.ptr(), m, re)) { return false; } + res.version = std::string(m[1]); + res.status = std::stoi(std::string(m[2])); + res.reason = std::string(m[3]); + } + + return true; } -inline bool ClientImpl::send(const Request &req, Response &res, Error &error) { - std::lock_guard request_mutex_guard(request_mutex_); +inline bool ClientImpl::send(Request &req, Response &res, Error &error) { + std::lock_guard request_mutex_guard(request_mutex_); - { - std::lock_guard guard(socket_mutex_); - // Set this to false immediately - if it ever gets set to true by the end of - // the request, we know another thread instructed us to close the socket. - socket_should_be_closed_when_request_is_done_ = false; - - auto is_alive = false; - if (socket_.is_open()) { - is_alive = detail::select_write(socket_.sock, 0, 0) > 0; - if (!is_alive) { - // Attempt to avoid sigpipe by shutting down nongracefully if it seems - // like the other side has already closed the connection Also, there - // cannot be any requests in flight from other threads since we locked - // request_mutex_, so safe to close everything immediately - const bool shutdown_gracefully = false; - shutdown_ssl(socket_, shutdown_gracefully); - shutdown_socket(socket_); - close_socket(socket_); - } - } + { + std::lock_guard guard(socket_mutex_); + + // Set this to false immediately - if it ever gets set to true by the end of + // the request, we know another thread instructed us to close the socket. + socket_should_be_closed_when_request_is_done_ = false; + + auto is_alive = false; + if (socket_.is_open()) { + is_alive = detail::is_socket_alive(socket_.sock); + if (!is_alive) { + // Attempt to avoid sigpipe by shutting down nongracefully if it seems + // like the other side has already closed the connection Also, there + // cannot be any requests in flight from other threads since we locked + // request_mutex_, so safe to close everything immediately + const bool shutdown_gracefully = false; + shutdown_ssl(socket_, shutdown_gracefully); + shutdown_socket(socket_); + close_socket(socket_); + } + } - if (!is_alive) { - if (!create_and_connect_socket(socket_, error)) { return false; } + if (!is_alive) { + if (!create_and_connect_socket(socket_, error)) { return false; } #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - // TODO: refactoring - if (is_ssl()) { - auto &scli = static_cast(*this); - if (!proxy_host_.empty() && proxy_port_ != -1) { - bool success = false; - if (!scli.connect_with_proxy(socket_, res, success, error)) { - return success; - } - } + // TODO: refactoring + if (is_ssl()) { + auto &scli = static_cast(*this); + if (!proxy_host_.empty() && proxy_port_ != -1) { + bool success = false; + if (!scli.connect_with_proxy(socket_, res, success, error)) { + return success; + } + } - if (!scli.initialize_ssl(socket_, error)) { return false; } - } + if (!scli.initialize_ssl(socket_, error)) { return false; } + } #endif - } + } - // Mark the current socket as being in use so that it cannot be closed by - // anyone else while this request is ongoing, even though we will be - // releasing the mutex. - if (socket_requests_in_flight_ > 1) { - assert(socket_requests_are_from_thread_ == std::this_thread::get_id()); - } - socket_requests_in_flight_ += 1; - socket_requests_are_from_thread_ = std::this_thread::get_id(); - } + // Mark the current socket as being in use so that it cannot be closed by + // anyone else while this request is ongoing, even though we will be + // releasing the mutex. + if (socket_requests_in_flight_ > 1) { + assert(socket_requests_are_from_thread_ == std::this_thread::get_id()); + } + socket_requests_in_flight_ += 1; + socket_requests_are_from_thread_ = std::this_thread::get_id(); + } - auto close_connection = !keep_alive_; - auto ret = process_socket(socket_, [&](Stream &strm) { - return handle_request(strm, req, res, close_connection, error); - }); + for (const auto &header : default_headers_) { + if (req.headers.find(header.first) == req.headers.end()) { + req.headers.insert(header); + } + } - // Briefly lock mutex in order to mark that a request is no longer ongoing - { - std::lock_guard guard(socket_mutex_); - socket_requests_in_flight_ -= 1; - if (socket_requests_in_flight_ <= 0) { - assert(socket_requests_in_flight_ == 0); - socket_requests_are_from_thread_ = std::thread::id(); - } + auto close_connection = !keep_alive_; + auto ret = process_socket(socket_, [&](Stream &strm) { + return handle_request(strm, req, res, close_connection, error); + }); - if (socket_should_be_closed_when_request_is_done_ || close_connection || - !ret) { - shutdown_ssl(socket_, true); - shutdown_socket(socket_); - close_socket(socket_); - } - } + // Briefly lock mutex in order to mark that a request is no longer ongoing + { + std::lock_guard guard(socket_mutex_); + socket_requests_in_flight_ -= 1; + if (socket_requests_in_flight_ <= 0) { + assert(socket_requests_in_flight_ == 0); + socket_requests_are_from_thread_ = std::thread::id(); + } - if (!ret) { - if (error == Error::Success) { error = Error::Unknown; } - } + if (socket_should_be_closed_when_request_is_done_ || close_connection || + !ret) { + shutdown_ssl(socket_, true); + shutdown_socket(socket_); + close_socket(socket_); + } + } - return ret; + if (!ret) { + if (error == Error::Success) { error = Error::Unknown; } + } + + return ret; } inline Result ClientImpl::send(const Request &req) { - auto res = detail::make_unique(); - auto error = Error::Success; - auto ret = send(req, *res, error); - return Result{ret ? std::move(res) : nullptr, error}; + auto req2 = req; + return send_(std::move(req2)); } -inline bool ClientImpl::handle_request(Stream &strm, const Request &req, +inline Result ClientImpl::send_(Request &&req) { + auto res = detail::make_unique(); + auto error = Error::Success; + auto ret = send(req, *res, error); + return Result{ret ? std::move(res) : nullptr, error, std::move(req.headers)}; +} + +inline bool ClientImpl::handle_request(Stream &strm, Request &req, Response &res, bool close_connection, Error &error) { - if (req.path.empty()) { - error = Error::Connection; - return false; - } + if (req.path.empty()) { + error = Error::Connection; + return false; + } - bool ret; + auto req_save = req; - if (!is_ssl() && !proxy_host_.empty() && proxy_port_ != -1) { - auto req2 = req; - req2.path = "http://" + host_and_port_ + req.path; - ret = process_request(strm, req2, res, close_connection, error); - } else { - ret = process_request(strm, req, res, close_connection, error); - } + bool ret; - if (!ret) { return false; } + if (!is_ssl() && !proxy_host_.empty() && proxy_port_ != -1) { + auto req2 = req; + req2.path = "http://" + host_and_port_ + req.path; + ret = process_request(strm, req2, res, close_connection, error); + req = req2; + req.path = req_save.path; + } else { + ret = process_request(strm, req, res, close_connection, error); + } - if (300 < res.status && res.status < 400 && follow_location_) { - ret = redirect(req, res, error); - } + if (!ret) { return false; } + + if (300 < res.status && res.status < 400 && follow_location_) { + req = req_save; + ret = redirect(req, res, error); + } #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - if ((res.status == 401 || res.status == 407) && - req.authorization_count_ < 5) { - auto is_proxy = res.status == 407; - const auto &username = - is_proxy ? proxy_digest_auth_username_ : digest_auth_username_; - const auto &password = - is_proxy ? proxy_digest_auth_password_ : digest_auth_password_; - - if (!username.empty() && !password.empty()) { - std::map auth; - if (detail::parse_www_authenticate(res, auth, is_proxy)) { - Request new_req = req; - new_req.authorization_count_ += 1; - auto key = is_proxy ? "Proxy-Authorization" : "Authorization"; - new_req.headers.erase(key); - new_req.headers.insert(detail::make_digest_authentication_header( - req, auth, new_req.authorization_count_, detail::random_string(10), - username, password, is_proxy)); - - Response new_res; - - ret = send(new_req, new_res, error); - if (ret) { res = new_res; } - } - } - } + if ((res.status == 401 || res.status == 407) && + req.authorization_count_ < 5) { + auto is_proxy = res.status == 407; + const auto &username = + is_proxy ? proxy_digest_auth_username_ : digest_auth_username_; + const auto &password = + is_proxy ? proxy_digest_auth_password_ : digest_auth_password_; + + if (!username.empty() && !password.empty()) { + std::map auth; + if (detail::parse_www_authenticate(res, auth, is_proxy)) { + Request new_req = req; + new_req.authorization_count_ += 1; + new_req.headers.erase(is_proxy ? "Proxy-Authorization" + : "Authorization"); + new_req.headers.insert(detail::make_digest_authentication_header( + req, auth, new_req.authorization_count_, detail::random_string(10), + username, password, is_proxy)); + + Response new_res; + + ret = send(new_req, new_res, error); + if (ret) { res = new_res; } + } + } + } #endif - return ret; + return ret; } -inline bool ClientImpl::redirect(const Request &req, Response &res, - Error &error) { - if (req.redirect_count_ == 0) { - error = Error::ExceedRedirectCount; - return false; - } +inline bool ClientImpl::redirect(Request &req, Response &res, Error &error) { + if (req.redirect_count_ == 0) { + error = Error::ExceedRedirectCount; + return false; + } - auto location = detail::decode_url(res.get_header_value("location"), true); - if (location.empty()) { return false; } + auto location = detail::decode_url(res.get_header_value("location"), true); + if (location.empty()) { return false; } - const static std::regex re( - R"(^(?:(https?):)?(?://([^:/?#]*)(?::(\d+))?)?([^?#]*(?:\?[^#]*)?)(?:#.*)?)"); + const static Regex re( + R"((?:(https?):)?(?://(?:\[([\d:]+)\]|([^:/?#]+))(?::(\d+))?)?([^?#]*(?:\?[^#]*)?)(?:#.*)?)"); - std::smatch m; - if (!std::regex_match(location, m, re)) { return false; } + Match m; + if (!duckdb_re2::RegexMatch(location, m, re)) { return false; } - auto scheme = is_ssl() ? "https" : "http"; + auto scheme = is_ssl() ? "https" : "http"; - auto next_scheme = m[1].str(); - auto next_host = m[2].str(); - auto port_str = m[3].str(); - auto next_path = m[4].str(); + auto next_scheme = m[1].str(); + auto next_host = m[2].str(); + if (next_host.empty()) { next_host = m[3].str(); } + auto port_str = m[4].str(); + auto next_path = m[5].str(); - auto next_port = port_; - if (!port_str.empty()) { - next_port = std::stoi(port_str); - } else if (!next_scheme.empty()) { - next_port = next_scheme == "https" ? 443 : 80; - } + auto next_port = port_; + if (!port_str.empty()) { + next_port = std::stoi(port_str); + } else if (!next_scheme.empty()) { + next_port = next_scheme == "https" ? 443 : 80; + } - if (next_scheme.empty()) { next_scheme = scheme; } - if (next_host.empty()) { next_host = host_; } - if (next_path.empty()) { next_path = "/"; } + if (next_scheme.empty()) { next_scheme = scheme; } + if (next_host.empty()) { next_host = host_; } + if (next_path.empty()) { next_path = "/"; } - if (next_scheme == scheme && next_host == host_ && next_port == port_) { - return detail::redirect(*this, req, res, next_path, location, error); - } else { - if (next_scheme == "https") { + if (next_scheme == scheme && next_host == host_ && next_port == port_) { + return detail::redirect(*this, req, res, next_path, location, error); + } else { + if (next_scheme == "https") { #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - SSLClient cli(next_host.c_str(), next_port); - cli.copy_settings(*this); - return detail::redirect(cli, req, res, next_path, location, error); + SSLClient cli(next_host.c_str(), next_port); + cli.copy_settings(*this); + if (ca_cert_store_) { cli.set_ca_cert_store(ca_cert_store_); } + return detail::redirect(cli, req, res, next_path, location, error); #else - return false; + return false; #endif - } else { - ClientImpl cli(next_host.c_str(), next_port); - cli.copy_settings(*this); - return detail::redirect(cli, req, res, next_path, location, error); - } - } + } else { + ClientImpl cli(next_host.c_str(), next_port); + cli.copy_settings(*this); + return detail::redirect(cli, req, res, next_path, location, error); + } + } } inline bool ClientImpl::write_content_with_provider(Stream &strm, const Request &req, Error &error) { - auto is_shutting_down = []() { return false; }; + auto is_shutting_down = []() { return false; }; - if (req.is_chunked_content_provider_) { - // TODO: Brotli suport - std::unique_ptr compressor; + if (req.is_chunked_content_provider_) { + // TODO: Brotli suport + std::unique_ptr compressor; #ifdef CPPHTTPLIB_ZLIB_SUPPORT - if (compress_) { - compressor = detail::make_unique(); - } else + if (compress_) { + compressor = detail::make_unique(); + } else #endif - { - compressor = detail::make_unique(); - } + { + compressor = detail::make_unique(); + } - return detail::write_content_chunked(strm, req.content_provider_, - is_shutting_down, *compressor, error); - } else { - return detail::write_content(strm, req.content_provider_, 0, - req.content_length_, is_shutting_down, error); - } + return detail::write_content_chunked(strm, req.content_provider_, + is_shutting_down, *compressor, error); + } else { + return detail::write_content(strm, req.content_provider_, 0, + req.content_length_, is_shutting_down, error); + } } // namespace CPPHTTPLIB_NAMESPACE -inline bool ClientImpl::write_request(Stream &strm, const Request &req, +inline bool ClientImpl::write_request(Stream &strm, Request &req, bool close_connection, Error &error) { - // Prepare additional headers - Headers headers; - if (close_connection) { headers.emplace("Connection", "close"); } - - if (!req.has_header("Host")) { - if (is_ssl()) { - if (port_ == 443) { - headers.emplace("Host", host_); - } else { - headers.emplace("Host", host_and_port_); - } - } else { - if (port_ == 80) { - headers.emplace("Host", host_); - } else { - headers.emplace("Host", host_and_port_); - } - } - } + // Prepare additional headers + if (close_connection) { + if (!req.has_header("Connection")) { + req.headers.emplace("Connection", "close"); + } + } - if (!req.has_header("Accept")) { headers.emplace("Accept", "*/*"); } + if (!req.has_header("Host")) { + if (is_ssl()) { + if (port_ == 443) { + req.headers.emplace("Host", host_); + } else { + req.headers.emplace("Host", host_and_port_); + } + } else { + if (port_ == 80) { + req.headers.emplace("Host", host_); + } else { + req.headers.emplace("Host", host_and_port_); + } + } + } - if (!req.has_header("User-Agent")) { - headers.emplace("User-Agent", "cpp-httplib/0.7"); - } + if (!req.has_header("Accept")) { req.headers.emplace("Accept", "*/*"); } - if (req.body.empty()) { - if (req.content_provider_) { - if (!req.is_chunked_content_provider_) { - auto length = std::to_string(req.content_length_); - headers.emplace("Content-Length", length); - } - } else { - if (req.method == "POST" || req.method == "PUT" || - req.method == "PATCH") { - headers.emplace("Content-Length", "0"); - } - } - } else { - if (!req.has_header("Content-Type")) { - headers.emplace("Content-Type", "text/plain"); - } + if (!req.has_header("User-Agent")) { + req.headers.emplace("User-Agent", "cpp-httplib/0.10.1"); + } - if (!req.has_header("Content-Length")) { - auto length = std::to_string(req.body.size()); - headers.emplace("Content-Length", length); - } - } + if (req.body.empty()) { + if (req.content_provider_) { + if (!req.is_chunked_content_provider_) { + if (!req.has_header("Content-Length")) { + auto length = std::to_string(req.content_length_); + req.headers.emplace("Content-Length", length); + } + } + } else { + if (req.method == "POST" || req.method == "PUT" || + req.method == "PATCH") { + req.headers.emplace("Content-Length", "0"); + } + } + } else { + if (!req.has_header("Content-Type")) { + req.headers.emplace("Content-Type", "text/plain"); + } - if (!basic_auth_password_.empty()) { - headers.insert(make_basic_authentication_header( - basic_auth_username_, basic_auth_password_, false)); - } + if (!req.has_header("Content-Length")) { + auto length = std::to_string(req.body.size()); + req.headers.emplace("Content-Length", length); + } + } - if (!proxy_basic_auth_username_.empty() && - !proxy_basic_auth_password_.empty()) { - headers.insert(make_basic_authentication_header( - proxy_basic_auth_username_, proxy_basic_auth_password_, true)); - } + if (!basic_auth_password_.empty() || !basic_auth_username_.empty()) { + if (!req.has_header("Authorization")) { + req.headers.insert(make_basic_authentication_header( + basic_auth_username_, basic_auth_password_, false)); + } + } - if (!bearer_token_auth_token_.empty()) { - headers.insert(make_bearer_token_authentication_header( - bearer_token_auth_token_, false)); - } + if (!proxy_basic_auth_username_.empty() && + !proxy_basic_auth_password_.empty()) { + if (!req.has_header("Proxy-Authorization")) { + req.headers.insert(make_basic_authentication_header( + proxy_basic_auth_username_, proxy_basic_auth_password_, true)); + } + } - if (!proxy_bearer_token_auth_token_.empty()) { - headers.insert(make_bearer_token_authentication_header( - proxy_bearer_token_auth_token_, true)); - } + if (!bearer_token_auth_token_.empty()) { + if (!req.has_header("Authorization")) { + req.headers.insert(make_bearer_token_authentication_header( + bearer_token_auth_token_, false)); + } + } - // Request line and headers - { - detail::BufferStream bstrm; + if (!proxy_bearer_token_auth_token_.empty()) { + if (!req.has_header("Proxy-Authorization")) { + req.headers.insert(make_bearer_token_authentication_header( + proxy_bearer_token_auth_token_, true)); + } + } - const auto &path = detail::encode_url(req.path); - bstrm.write_format("%s %s HTTP/1.1\r\n", req.method.c_str(), path.c_str()); + // Request line and headers + { + detail::BufferStream bstrm; - detail::write_headers(bstrm, req, headers); + const auto &path = url_encode_ ? detail::encode_url(req.path) : req.path; + bstrm.write_format("%s %s HTTP/1.1\r\n", req.method.c_str(), path.c_str()); - // Flush buffer - auto &data = bstrm.get_buffer(); - if (!detail::write_data(strm, data.data(), data.size())) { - error = Error::Write; - return false; - } - } + detail::write_headers(bstrm, req.headers); - // Body - if (req.body.empty()) { - return write_content_with_provider(strm, req, error); - } else { - return detail::write_data(strm, req.body.data(), req.body.size()); - } + // Flush buffer + auto &data = bstrm.get_buffer(); + if (!detail::write_data(strm, data.data(), data.size())) { + error = Error::Write; + return false; + } + } - return true; + // Body + if (req.body.empty()) { + return write_content_with_provider(strm, req, error); + } + + if (!detail::write_data(strm, req.body.data(), req.body.size())) { + error = Error::Write; + return false; + } + + return true; } inline std::unique_ptr ClientImpl::send_with_content_provider( - const char *method, const char *path, const Headers &headers, + Request &req, + // const char *method, const char *path, const Headers &headers, const char *body, size_t content_length, ContentProvider content_provider, ContentProviderWithoutLength content_provider_without_length, const char *content_type, Error &error) { - Request req; - req.method = method; - req.headers = default_headers_; - req.headers.insert(headers.begin(), headers.end()); - req.path = path; - - if (content_type) { req.headers.emplace("Content-Type", content_type); } + if (content_type) { req.headers.emplace("Content-Type", content_type); } #ifdef CPPHTTPLIB_ZLIB_SUPPORT - if (compress_) { req.headers.emplace("Content-Encoding", "gzip"); } + if (compress_) { req.headers.emplace("Content-Encoding", "gzip"); } #endif #ifdef CPPHTTPLIB_ZLIB_SUPPORT - if (compress_ && !content_provider_without_length) { - // TODO: Brotli support - detail::gzip_compressor compressor; - - if (content_provider) { - auto ok = true; - size_t offset = 0; - DataSink data_sink; - - data_sink.write = [&](const char *data, size_t data_len) { - if (ok) { - auto last = offset + data_len == content_length; - - auto ret = compressor.compress( - data, data_len, last, [&](const char *data, size_t data_len) { - req.body.append(data, data_len); - return true; - }); - - if (ret) { - offset += data_len; - } else { - ok = false; - } - } - }; + if (compress_ && !content_provider_without_length) { + // TODO: Brotli support + detail::gzip_compressor compressor; + + if (content_provider) { + auto ok = true; + size_t offset = 0; + DataSink data_sink; + + data_sink.write = [&](const char *data, size_t data_len) -> bool { + if (ok) { + auto last = offset + data_len == content_length; + + auto ret = compressor.compress( + data, data_len, last, [&](const char *data, size_t data_len) { + req.body.append(data, data_len); + return true; + }); + + if (ret) { + offset += data_len; + } else { + ok = false; + } + } + return ok; + }; - data_sink.is_writable = [&](void) { return ok && true; }; + data_sink.is_writable = [&](void) { return ok && true; }; - while (ok && offset < content_length) { - if (!content_provider(offset, content_length - offset, data_sink)) { - error = Error::Canceled; - return nullptr; - } - } - } else { - if (!compressor.compress(body, content_length, true, - [&](const char *data, size_t data_len) { - req.body.append(data, data_len); - return true; - })) { - error = Error::Compression; - return nullptr; - } - } - } else + while (ok && offset < content_length) { + if (!content_provider(offset, content_length - offset, data_sink)) { + error = Error::Canceled; + return nullptr; + } + } + } else { + if (!compressor.compress(body, content_length, true, + [&](const char *data, size_t data_len) { + req.body.append(data, data_len); + return true; + })) { + error = Error::Compression; + return nullptr; + } + } + } else #endif - { - if (content_provider) { - req.content_length_ = content_length; - req.content_provider_ = std::move(content_provider); - req.is_chunked_content_provider_ = false; - } else if (content_provider_without_length) { - req.content_length_ = 0; - req.content_provider_ = detail::ContentProviderAdapter( - std::move(content_provider_without_length)); - req.is_chunked_content_provider_ = true; - req.headers.emplace("Transfer-Encoding", "chunked"); - } else { - req.body.assign(body, content_length); - ; - } - } + { + if (content_provider) { + req.content_length_ = content_length; + req.content_provider_ = std::move(content_provider); + req.is_chunked_content_provider_ = false; + } else if (content_provider_without_length) { + req.content_length_ = 0; + req.content_provider_ = detail::ContentProviderAdapter( + std::move(content_provider_without_length)); + req.is_chunked_content_provider_ = true; + req.headers.emplace("Transfer-Encoding", "chunked"); + } else { + req.body.assign(body, content_length); + ; + } + } - auto res = detail::make_unique(); - return send(req, *res, error) ? std::move(res) : nullptr; + auto res = detail::make_unique(); + return send(req, *res, error) ? std::move(res) : nullptr; } inline Result ClientImpl::send_with_content_provider( @@ -110878,203 +119849,222 @@ inline Result ClientImpl::send_with_content_provider( const char *body, size_t content_length, ContentProvider content_provider, ContentProviderWithoutLength content_provider_without_length, const char *content_type) { - auto error = Error::Success; - auto res = send_with_content_provider( - method, path, headers, body, content_length, std::move(content_provider), - std::move(content_provider_without_length), content_type, error); - return Result{std::move(res), error}; + Request req; + req.method = method; + req.headers = headers; + req.path = path; + + auto error = Error::Success; + + auto res = send_with_content_provider( + req, + // method, path, headers, + body, content_length, std::move(content_provider), + std::move(content_provider_without_length), content_type, error); + + return Result{std::move(res), error, std::move(req.headers)}; +} + +inline std::string +ClientImpl::adjust_host_string(const std::string &host) const { + if (host.find(':') != std::string::npos) { return "[" + host + "]"; } + return host; } -inline bool ClientImpl::process_request(Stream &strm, const Request &req, +inline bool ClientImpl::process_request(Stream &strm, Request &req, Response &res, bool close_connection, Error &error) { - // Send request - if (!write_request(strm, req, close_connection, error)) { return false; } + // Send request + if (!write_request(strm, req, close_connection, error)) { return false; } - // Receive response and headers - if (!read_response_line(strm, req, res) || - !detail::read_headers(strm, res.headers)) { - error = Error::Read; - return false; - } + // Receive response and headers + if (!read_response_line(strm, req, res) || + !detail::read_headers(strm, res.headers)) { + error = Error::Read; + return false; + } - if (req.response_handler_) { - if (!req.response_handler_(res)) { - error = Error::Canceled; - return false; - } - } + // Body + if ((res.status != 204) && req.method != "HEAD" && req.method != "CONNECT") { + auto redirect = 300 < res.status && res.status < 400 && follow_location_; - // Body - if ((res.status != 204) && req.method != "HEAD" && req.method != "CONNECT") { - auto out = - req.content_receiver_ - ? static_cast( - [&](const char *buf, size_t n, uint64_t off, uint64_t len) { - auto ret = req.content_receiver_(buf, n, off, len); - if (!ret) { error = Error::Canceled; } - return ret; - }) - : static_cast( - [&](const char *buf, size_t n, uint64_t /*off*/, - uint64_t /*len*/) { - if (res.body.size() + n > res.body.max_size()) { - return false; - } - res.body.append(buf, n); - return true; - }); - - auto progress = [&](uint64_t current, uint64_t total) { - if (!req.progress_) { return true; } - auto ret = req.progress_(current, total); - if (!ret) { error = Error::Canceled; } - return ret; - }; + if (req.response_handler && !redirect) { + if (!req.response_handler(res)) { + error = Error::Canceled; + return false; + } + } - int dummy_status; - if (!detail::read_content(strm, res, (std::numeric_limits::max)(), - dummy_status, std::move(progress), std::move(out), - decompress_)) { - if (error != Error::Canceled) { error = Error::Read; } - return false; - } - } + auto out = + req.content_receiver + ? static_cast( + [&](const char *buf, size_t n, uint64_t off, uint64_t len) { + if (redirect) { return true; } + auto ret = req.content_receiver(buf, n, off, len); + if (!ret) { error = Error::Canceled; } + return ret; + }) + : static_cast( + [&](const char *buf, size_t n, uint64_t /*off*/, + uint64_t /*len*/) { + if (res.body.size() + n > res.body.max_size()) { + return false; + } + res.body.append(buf, n); + return true; + }); + + auto progress = [&](uint64_t current, uint64_t total) { + if (!req.progress || redirect) { return true; } + auto ret = req.progress(current, total); + if (!ret) { error = Error::Canceled; } + return ret; + }; - if (res.get_header_value("Connection") == "close" || - (res.version == "HTTP/1.0" && res.reason != "Connection established")) { - // TODO this requires a not-entirely-obvious chain of calls to be correct - // for this to be safe. Maybe a code refactor (such as moving this out to - // the send function and getting rid of the recursiveness of the mutex) - // could make this more obvious. - - // This is safe to call because process_request is only called by - // handle_request which is only called by send, which locks the request - // mutex during the process. It would be a bug to call it from a different - // thread since it's a thread-safety issue to do these things to the socket - // if another thread is using the socket. - lock_socket_and_shutdown_and_close(); - } + int dummy_status; + if (!detail::read_content(strm, res, (std::numeric_limits::max)(), + dummy_status, std::move(progress), std::move(out), + decompress_)) { + if (error != Error::Canceled) { error = Error::Read; } + return false; + } + } - // Log - if (logger_) { logger_(req, res); } + if (res.get_header_value("Connection") == "close" || + (res.version == "HTTP/1.0" && res.reason != "Connection established")) { + // TODO this requires a not-entirely-obvious chain of calls to be correct + // for this to be safe. Maybe a code refactor (such as moving this out to + // the send function and getting rid of the recursiveness of the mutex) + // could make this more obvious. - return true; + // This is safe to call because process_request is only called by + // handle_request which is only called by send, which locks the request + // mutex during the process. It would be a bug to call it from a different + // thread since it's a thread-safety issue to do these things to the socket + // if another thread is using the socket. + std::lock_guard guard(socket_mutex_); + shutdown_ssl(socket_, true); + shutdown_socket(socket_); + close_socket(socket_); + } + + // Log + if (logger_) { logger_(req, res); } + + return true; } inline bool ClientImpl::process_socket(const Socket &socket, std::function callback) { - return detail::process_client_socket( - socket.sock, read_timeout_sec_, read_timeout_usec_, write_timeout_sec_, - write_timeout_usec_, std::move(callback)); + return detail::process_client_socket( + socket.sock, read_timeout_sec_, read_timeout_usec_, write_timeout_sec_, + write_timeout_usec_, std::move(callback)); } inline bool ClientImpl::is_ssl() const { return false; } inline Result ClientImpl::Get(const char *path) { - return Get(path, Headers(), Progress()); + return Get(path, Headers(), Progress()); } inline Result ClientImpl::Get(const char *path, Progress progress) { - return Get(path, Headers(), std::move(progress)); + return Get(path, Headers(), std::move(progress)); } inline Result ClientImpl::Get(const char *path, const Headers &headers) { - return Get(path, headers, Progress()); + return Get(path, headers, Progress()); } inline Result ClientImpl::Get(const char *path, const Headers &headers, Progress progress) { - Request req; - req.method = "GET"; - req.path = path; - req.headers = default_headers_; - req.headers.insert(headers.begin(), headers.end()); - req.progress_ = std::move(progress); + Request req; + req.method = "GET"; + req.path = path; + req.headers = headers; + req.progress = std::move(progress); - return send(req); + return send_(std::move(req)); } inline Result ClientImpl::Get(const char *path, ContentReceiver content_receiver) { - return Get(path, Headers(), nullptr, std::move(content_receiver), nullptr); + return Get(path, Headers(), nullptr, std::move(content_receiver), nullptr); } inline Result ClientImpl::Get(const char *path, ContentReceiver content_receiver, Progress progress) { - return Get(path, Headers(), nullptr, std::move(content_receiver), - std::move(progress)); + return Get(path, Headers(), nullptr, std::move(content_receiver), + std::move(progress)); } inline Result ClientImpl::Get(const char *path, const Headers &headers, ContentReceiver content_receiver) { - return Get(path, headers, nullptr, std::move(content_receiver), nullptr); + return Get(path, headers, nullptr, std::move(content_receiver), nullptr); } inline Result ClientImpl::Get(const char *path, const Headers &headers, ContentReceiver content_receiver, Progress progress) { - return Get(path, headers, nullptr, std::move(content_receiver), - std::move(progress)); + return Get(path, headers, nullptr, std::move(content_receiver), + std::move(progress)); } inline Result ClientImpl::Get(const char *path, ResponseHandler response_handler, ContentReceiver content_receiver) { - return Get(path, Headers(), std::move(response_handler), - std::move(content_receiver), nullptr); + return Get(path, Headers(), std::move(response_handler), + std::move(content_receiver), nullptr); } inline Result ClientImpl::Get(const char *path, const Headers &headers, ResponseHandler response_handler, ContentReceiver content_receiver) { - return Get(path, headers, std::move(response_handler), - std::move(content_receiver), nullptr); + return Get(path, headers, std::move(response_handler), + std::move(content_receiver), nullptr); } inline Result ClientImpl::Get(const char *path, ResponseHandler response_handler, ContentReceiver content_receiver, Progress progress) { - return Get(path, Headers(), std::move(response_handler), - std::move(content_receiver), std::move(progress)); + return Get(path, Headers(), std::move(response_handler), + std::move(content_receiver), std::move(progress)); } inline Result ClientImpl::Get(const char *path, const Headers &headers, ResponseHandler response_handler, ContentReceiver content_receiver, Progress progress) { - Request req; - req.method = "GET"; - req.path = path; - req.headers = default_headers_; - req.headers.insert(headers.begin(), headers.end()); - req.response_handler_ = std::move(response_handler); - req.content_receiver_ = - [content_receiver](const char *data, size_t data_length, - uint64_t /*offset*/, uint64_t /*total_length*/) { - return content_receiver(data, data_length); - }; - req.progress_ = std::move(progress); - - return send(req); + Request req; + req.method = "GET"; + req.path = path; + req.headers = headers; + req.response_handler = std::move(response_handler); + req.content_receiver = + [content_receiver](const char *data, size_t data_length, + uint64_t /*offset*/, uint64_t /*total_length*/) { + return content_receiver(data, data_length); + }; + req.progress = std::move(progress); + + return send_(std::move(req)); } inline Result ClientImpl::Get(const char *path, const Params ¶ms, const Headers &headers, Progress progress) { - if (params.empty()) { return Get(path, headers); } + if (params.empty()) { return Get(path, headers); } - std::string path_with_query = detail::append_query_params(path, params); - return Get(path_with_query.c_str(), headers, progress); + std::string path_with_query = append_query_params(path, params); + return Get(path_with_query.c_str(), headers, progress); } inline Result ClientImpl::Get(const char *path, const Params ¶ms, const Headers &headers, ContentReceiver content_receiver, Progress progress) { - return Get(path, params, headers, nullptr, content_receiver, progress); + return Get(path, params, headers, nullptr, content_receiver, progress); } inline Result ClientImpl::Get(const char *path, const Params ¶ms, @@ -111082,379 +120072,376 @@ inline Result ClientImpl::Get(const char *path, const Params ¶ms, ResponseHandler response_handler, ContentReceiver content_receiver, Progress progress) { - if (params.empty()) { - return Get(path, headers, response_handler, content_receiver, progress); - } + if (params.empty()) { + return Get(path, headers, response_handler, content_receiver, progress); + } - std::string path_with_query = detail::append_query_params(path, params); - return Get(path_with_query.c_str(), params, headers, response_handler, - content_receiver, progress); + std::string path_with_query = append_query_params(path, params); + return Get(path_with_query.c_str(), headers, response_handler, + content_receiver, progress); } inline Result ClientImpl::Head(const char *path) { - return Head(path, Headers()); + return Head(path, Headers()); } inline Result ClientImpl::Head(const char *path, const Headers &headers) { - Request req; - req.method = "HEAD"; - req.headers = default_headers_; - req.headers.insert(headers.begin(), headers.end()); - req.path = path; + Request req; + req.method = "HEAD"; + req.headers = headers; + req.path = path; - return send(req); + return send_(std::move(req)); } inline Result ClientImpl::Post(const char *path) { - return Post(path, std::string(), nullptr); + return Post(path, std::string(), nullptr); } inline Result ClientImpl::Post(const char *path, const char *body, size_t content_length, const char *content_type) { - return Post(path, Headers(), body, content_length, content_type); + return Post(path, Headers(), body, content_length, content_type); } inline Result ClientImpl::Post(const char *path, const Headers &headers, const char *body, size_t content_length, const char *content_type) { - return send_with_content_provider("POST", path, headers, body, content_length, - nullptr, nullptr, content_type); + return send_with_content_provider("POST", path, headers, body, content_length, + nullptr, nullptr, content_type); } inline Result ClientImpl::Post(const char *path, const std::string &body, const char *content_type) { - return Post(path, Headers(), body, content_type); + return Post(path, Headers(), body, content_type); } inline Result ClientImpl::Post(const char *path, const Headers &headers, const std::string &body, const char *content_type) { - return send_with_content_provider("POST", path, headers, body.data(), - body.size(), nullptr, nullptr, - content_type); + return send_with_content_provider("POST", path, headers, body.data(), + body.size(), nullptr, nullptr, + content_type); } inline Result ClientImpl::Post(const char *path, const Params ¶ms) { - return Post(path, Headers(), params); + return Post(path, Headers(), params); } inline Result ClientImpl::Post(const char *path, size_t content_length, ContentProvider content_provider, const char *content_type) { - return Post(path, Headers(), content_length, std::move(content_provider), - content_type); + return Post(path, Headers(), content_length, std::move(content_provider), + content_type); } inline Result ClientImpl::Post(const char *path, ContentProviderWithoutLength content_provider, const char *content_type) { - return Post(path, Headers(), std::move(content_provider), content_type); + return Post(path, Headers(), std::move(content_provider), content_type); } inline Result ClientImpl::Post(const char *path, const Headers &headers, size_t content_length, ContentProvider content_provider, const char *content_type) { - return send_with_content_provider("POST", path, headers, nullptr, - content_length, std::move(content_provider), - nullptr, content_type); + return send_with_content_provider("POST", path, headers, nullptr, + content_length, std::move(content_provider), + nullptr, content_type); } inline Result ClientImpl::Post(const char *path, const Headers &headers, ContentProviderWithoutLength content_provider, const char *content_type) { - return send_with_content_provider("POST", path, headers, nullptr, 0, nullptr, - std::move(content_provider), content_type); + return send_with_content_provider("POST", path, headers, nullptr, 0, nullptr, + std::move(content_provider), content_type); } inline Result ClientImpl::Post(const char *path, const Headers &headers, const Params ¶ms) { - auto query = detail::params_to_query_str(params); - return Post(path, headers, query, "application/x-www-form-urlencoded"); + auto query = detail::params_to_query_str(params); + return Post(path, headers, query, "application/x-www-form-urlencoded"); } inline Result ClientImpl::Post(const char *path, const MultipartFormDataItems &items) { - return Post(path, Headers(), items); + return Post(path, Headers(), items); } inline Result ClientImpl::Post(const char *path, const Headers &headers, const MultipartFormDataItems &items) { - return Post(path, headers, items, detail::make_multipart_data_boundary()); + return Post(path, headers, items, detail::make_multipart_data_boundary()); } inline Result ClientImpl::Post(const char *path, const Headers &headers, const MultipartFormDataItems &items, const std::string &boundary) { - for (size_t i = 0; i < boundary.size(); i++) { - char c = boundary[i]; - if (!std::isalnum(c) && c != '-' && c != '_') { - return Result{nullptr, Error::UnsupportedMultipartBoundaryChars}; - } - } + for (size_t i = 0; i < boundary.size(); i++) { + char c = boundary[i]; + if (!std::isalnum(c) && c != '-' && c != '_') { + return Result{nullptr, Error::UnsupportedMultipartBoundaryChars}; + } + } - std::string body; + std::string body; - for (const auto &item : items) { - body += "--" + boundary + "\r\n"; - body += "Content-Disposition: form-data; name=\"" + item.name + "\""; - if (!item.filename.empty()) { - body += "; filename=\"" + item.filename + "\""; - } - body += "\r\n"; - if (!item.content_type.empty()) { - body += "Content-Type: " + item.content_type + "\r\n"; - } - body += "\r\n"; - body += item.content + "\r\n"; - } + for (const auto &item : items) { + body += "--" + boundary + "\r\n"; + body += "Content-Disposition: form-data; name=\"" + item.name + "\""; + if (!item.filename.empty()) { + body += "; filename=\"" + item.filename + "\""; + } + body += "\r\n"; + if (!item.content_type.empty()) { + body += "Content-Type: " + item.content_type + "\r\n"; + } + body += "\r\n"; + body += item.content + "\r\n"; + } - body += "--" + boundary + "--\r\n"; + body += "--" + boundary + "--\r\n"; - std::string content_type = "multipart/form-data; boundary=" + boundary; - return Post(path, headers, body, content_type.c_str()); + std::string content_type = "multipart/form-data; boundary=" + boundary; + return Post(path, headers, body, content_type.c_str()); } inline Result ClientImpl::Put(const char *path) { - return Put(path, std::string(), nullptr); + return Put(path, std::string(), nullptr); } inline Result ClientImpl::Put(const char *path, const char *body, size_t content_length, const char *content_type) { - return Put(path, Headers(), body, content_length, content_type); + return Put(path, Headers(), body, content_length, content_type); } inline Result ClientImpl::Put(const char *path, const Headers &headers, const char *body, size_t content_length, const char *content_type) { - return send_with_content_provider("PUT", path, headers, body, content_length, - nullptr, nullptr, content_type); + return send_with_content_provider("PUT", path, headers, body, content_length, + nullptr, nullptr, content_type); } inline Result ClientImpl::Put(const char *path, const std::string &body, const char *content_type) { - return Put(path, Headers(), body, content_type); + return Put(path, Headers(), body, content_type); } inline Result ClientImpl::Put(const char *path, const Headers &headers, const std::string &body, const char *content_type) { - return send_with_content_provider("PUT", path, headers, body.data(), - body.size(), nullptr, nullptr, - content_type); + return send_with_content_provider("PUT", path, headers, body.data(), + body.size(), nullptr, nullptr, + content_type); } inline Result ClientImpl::Put(const char *path, size_t content_length, ContentProvider content_provider, const char *content_type) { - return Put(path, Headers(), content_length, std::move(content_provider), - content_type); + return Put(path, Headers(), content_length, std::move(content_provider), + content_type); } inline Result ClientImpl::Put(const char *path, ContentProviderWithoutLength content_provider, const char *content_type) { - return Put(path, Headers(), std::move(content_provider), content_type); + return Put(path, Headers(), std::move(content_provider), content_type); } inline Result ClientImpl::Put(const char *path, const Headers &headers, size_t content_length, ContentProvider content_provider, const char *content_type) { - return send_with_content_provider("PUT", path, headers, nullptr, - content_length, std::move(content_provider), - nullptr, content_type); + return send_with_content_provider("PUT", path, headers, nullptr, + content_length, std::move(content_provider), + nullptr, content_type); } inline Result ClientImpl::Put(const char *path, const Headers &headers, ContentProviderWithoutLength content_provider, const char *content_type) { - return send_with_content_provider("PUT", path, headers, nullptr, 0, nullptr, - std::move(content_provider), content_type); + return send_with_content_provider("PUT", path, headers, nullptr, 0, nullptr, + std::move(content_provider), content_type); } inline Result ClientImpl::Put(const char *path, const Params ¶ms) { - return Put(path, Headers(), params); + return Put(path, Headers(), params); } inline Result ClientImpl::Put(const char *path, const Headers &headers, const Params ¶ms) { - auto query = detail::params_to_query_str(params); - return Put(path, headers, query, "application/x-www-form-urlencoded"); + auto query = detail::params_to_query_str(params); + return Put(path, headers, query, "application/x-www-form-urlencoded"); } inline Result ClientImpl::Patch(const char *path) { - return Patch(path, std::string(), nullptr); + return Patch(path, std::string(), nullptr); } inline Result ClientImpl::Patch(const char *path, const char *body, size_t content_length, const char *content_type) { - return Patch(path, Headers(), body, content_length, content_type); + return Patch(path, Headers(), body, content_length, content_type); } inline Result ClientImpl::Patch(const char *path, const Headers &headers, const char *body, size_t content_length, const char *content_type) { - return send_with_content_provider("PATCH", path, headers, body, - content_length, nullptr, nullptr, - content_type); + return send_with_content_provider("PATCH", path, headers, body, + content_length, nullptr, nullptr, + content_type); } inline Result ClientImpl::Patch(const char *path, const std::string &body, const char *content_type) { - return Patch(path, Headers(), body, content_type); + return Patch(path, Headers(), body, content_type); } inline Result ClientImpl::Patch(const char *path, const Headers &headers, const std::string &body, const char *content_type) { - return send_with_content_provider("PATCH", path, headers, body.data(), - body.size(), nullptr, nullptr, - content_type); + return send_with_content_provider("PATCH", path, headers, body.data(), + body.size(), nullptr, nullptr, + content_type); } inline Result ClientImpl::Patch(const char *path, size_t content_length, ContentProvider content_provider, const char *content_type) { - return Patch(path, Headers(), content_length, std::move(content_provider), - content_type); + return Patch(path, Headers(), content_length, std::move(content_provider), + content_type); } inline Result ClientImpl::Patch(const char *path, ContentProviderWithoutLength content_provider, const char *content_type) { - return Patch(path, Headers(), std::move(content_provider), content_type); + return Patch(path, Headers(), std::move(content_provider), content_type); } inline Result ClientImpl::Patch(const char *path, const Headers &headers, size_t content_length, ContentProvider content_provider, const char *content_type) { - return send_with_content_provider("PATCH", path, headers, nullptr, - content_length, std::move(content_provider), - nullptr, content_type); + return send_with_content_provider("PATCH", path, headers, nullptr, + content_length, std::move(content_provider), + nullptr, content_type); } inline Result ClientImpl::Patch(const char *path, const Headers &headers, ContentProviderWithoutLength content_provider, const char *content_type) { - return send_with_content_provider("PATCH", path, headers, nullptr, 0, nullptr, - std::move(content_provider), content_type); + return send_with_content_provider("PATCH", path, headers, nullptr, 0, nullptr, + std::move(content_provider), content_type); } inline Result ClientImpl::Delete(const char *path) { - return Delete(path, Headers(), std::string(), nullptr); + return Delete(path, Headers(), std::string(), nullptr); } inline Result ClientImpl::Delete(const char *path, const Headers &headers) { - return Delete(path, headers, std::string(), nullptr); + return Delete(path, headers, std::string(), nullptr); } inline Result ClientImpl::Delete(const char *path, const char *body, size_t content_length, const char *content_type) { - return Delete(path, Headers(), body, content_length, content_type); + return Delete(path, Headers(), body, content_length, content_type); } inline Result ClientImpl::Delete(const char *path, const Headers &headers, const char *body, size_t content_length, const char *content_type) { - Request req; - req.method = "DELETE"; - req.headers = default_headers_; - req.headers.insert(headers.begin(), headers.end()); - req.path = path; + Request req; + req.method = "DELETE"; + req.headers = headers; + req.path = path; - if (content_type) { req.headers.emplace("Content-Type", content_type); } - req.body.assign(body, content_length); + if (content_type) { req.headers.emplace("Content-Type", content_type); } + req.body.assign(body, content_length); - return send(req); + return send_(std::move(req)); } inline Result ClientImpl::Delete(const char *path, const std::string &body, const char *content_type) { - return Delete(path, Headers(), body.data(), body.size(), content_type); + return Delete(path, Headers(), body.data(), body.size(), content_type); } inline Result ClientImpl::Delete(const char *path, const Headers &headers, const std::string &body, const char *content_type) { - return Delete(path, headers, body.data(), body.size(), content_type); + return Delete(path, headers, body.data(), body.size(), content_type); } inline Result ClientImpl::Options(const char *path) { - return Options(path, Headers()); + return Options(path, Headers()); } inline Result ClientImpl::Options(const char *path, const Headers &headers) { - Request req; - req.method = "OPTIONS"; - req.headers = default_headers_; - req.headers.insert(headers.begin(), headers.end()); - req.path = path; + Request req; + req.method = "OPTIONS"; + req.headers = headers; + req.path = path; - return send(req); + return send_(std::move(req)); } inline size_t ClientImpl::is_socket_open() const { - std::lock_guard guard(socket_mutex_); - return socket_.is_open(); + std::lock_guard guard(socket_mutex_); + return socket_.is_open(); } inline void ClientImpl::stop() { - std::lock_guard guard(socket_mutex_); - - // If there is anything ongoing right now, the ONLY thread-safe thing we can - // do is to shutdown_socket, so that threads using this socket suddenly - // discover they can't read/write any more and error out. Everything else - // (closing the socket, shutting ssl down) is unsafe because these actions are - // not thread-safe. - if (socket_requests_in_flight_ > 0) { - shutdown_socket(socket_); - - // Aside from that, we set a flag for the socket to be closed when we're - // done. - socket_should_be_closed_when_request_is_done_ = true; - return; - } + std::lock_guard guard(socket_mutex_); + + // If there is anything ongoing right now, the ONLY thread-safe thing we can + // do is to shutdown_socket, so that threads using this socket suddenly + // discover they can't read/write any more and error out. Everything else + // (closing the socket, shutting ssl down) is unsafe because these actions are + // not thread-safe. + if (socket_requests_in_flight_ > 0) { + shutdown_socket(socket_); + + // Aside from that, we set a flag for the socket to be closed when we're + // done. + socket_should_be_closed_when_request_is_done_ = true; + return; + } - // Otherwise, sitll holding the mutex, we can shut everything down ourselves - shutdown_ssl(socket_, true); - shutdown_socket(socket_); - close_socket(socket_); + // Otherwise, sitll holding the mutex, we can shut everything down ourselves + shutdown_ssl(socket_, true); + shutdown_socket(socket_); + close_socket(socket_); } inline void ClientImpl::set_connection_timeout(time_t sec, time_t usec) { - connection_timeout_sec_ = sec; - connection_timeout_usec_ = usec; + connection_timeout_sec_ = sec; + connection_timeout_usec_ = usec; } inline void ClientImpl::set_read_timeout(time_t sec, time_t usec) { - read_timeout_sec_ = sec; - read_timeout_usec_ = usec; + read_timeout_sec_ = sec; + read_timeout_usec_ = usec; } inline void ClientImpl::set_write_timeout(time_t sec, time_t usec) { - write_timeout_sec_ = sec; - write_timeout_usec_ = usec; + write_timeout_sec_ = sec; + write_timeout_usec_ = usec; } inline void ClientImpl::set_basic_auth(const char *username, const char *password) { - basic_auth_username_ = username; - basic_auth_password_ = password; + basic_auth_username_ = username; + basic_auth_password_ = password; } inline void ClientImpl::set_bearer_token_auth(const char *token) { - bearer_token_auth_token_ = token; + bearer_token_auth_token_ = token; } #ifdef CPPHTTPLIB_OPENSSL_SUPPORT inline void ClientImpl::set_digest_auth(const char *username, const char *password) { - digest_auth_username_ = username; - digest_auth_password_ = password; + digest_auth_username_ = username; + digest_auth_password_ = password; } #endif @@ -111462,14 +120449,25 @@ inline void ClientImpl::set_keep_alive(bool on) { keep_alive_ = on; } inline void ClientImpl::set_follow_location(bool on) { follow_location_ = on; } +inline void ClientImpl::set_url_encode(bool on) { url_encode_ = on; } + +inline void ClientImpl::set_hostname_addr_map( + const std::map addr_map) { + addr_map_ = std::move(addr_map); +} + inline void ClientImpl::set_default_headers(Headers headers) { - default_headers_ = std::move(headers); + default_headers_ = std::move(headers); +} + +inline void ClientImpl::set_address_family(int family) { + address_family_ = family; } inline void ClientImpl::set_tcp_nodelay(bool on) { tcp_nodelay_ = on; } inline void ClientImpl::set_socket_options(SocketOptions socket_options) { - socket_options_ = std::move(socket_options); + socket_options_ = std::move(socket_options); } inline void ClientImpl::set_compress(bool on) { compress_ = on; } @@ -111479,36 +120477,50 @@ inline void ClientImpl::set_decompress(bool on) { decompress_ = on; } inline void ClientImpl::set_interface(const char *intf) { interface_ = intf; } inline void ClientImpl::set_proxy(const char *host, int port) { - proxy_host_ = host; - proxy_port_ = port; + proxy_host_ = host; + proxy_port_ = port; } inline void ClientImpl::set_proxy_basic_auth(const char *username, const char *password) { - proxy_basic_auth_username_ = username; - proxy_basic_auth_password_ = password; + proxy_basic_auth_username_ = username; + proxy_basic_auth_password_ = password; } inline void ClientImpl::set_proxy_bearer_token_auth(const char *token) { - proxy_bearer_token_auth_token_ = token; + proxy_bearer_token_auth_token_ = token; } #ifdef CPPHTTPLIB_OPENSSL_SUPPORT inline void ClientImpl::set_proxy_digest_auth(const char *username, const char *password) { - proxy_digest_auth_username_ = username; - proxy_digest_auth_password_ = password; + proxy_digest_auth_username_ = username; + proxy_digest_auth_password_ = password; +} +#endif + +#ifdef CPPHTTPLIB_OPENSSL_SUPPORT +inline void ClientImpl::set_ca_cert_path(const char *ca_cert_file_path, + const char *ca_cert_dir_path) { + if (ca_cert_file_path) { ca_cert_file_path_ = ca_cert_file_path; } + if (ca_cert_dir_path) { ca_cert_dir_path_ = ca_cert_dir_path; } +} + +inline void ClientImpl::set_ca_cert_store(X509_STORE *ca_cert_store) { + if (ca_cert_store && ca_cert_store != ca_cert_store_) { + ca_cert_store_ = ca_cert_store; + } } #endif #ifdef CPPHTTPLIB_OPENSSL_SUPPORT inline void ClientImpl::enable_server_certificate_verification(bool enabled) { - server_certificate_verification_ = enabled; + server_certificate_verification_ = enabled; } #endif inline void ClientImpl::set_logger(Logger logger) { - logger_ = std::move(logger); + logger_ = std::move(logger); } /* @@ -111520,44 +120532,44 @@ namespace detail { template inline SSL *ssl_new(socket_t sock, SSL_CTX *ctx, std::mutex &ctx_mutex, U SSL_connect_or_accept, V setup) { - SSL *ssl = nullptr; - { - std::lock_guard guard(ctx_mutex); - ssl = SSL_new(ctx); - } + SSL *ssl = nullptr; + { + std::lock_guard guard(ctx_mutex); + ssl = SSL_new(ctx); + } - if (ssl) { - set_nonblocking(sock, true); - auto bio = BIO_new_socket(static_cast(sock), BIO_NOCLOSE); - BIO_set_nbio(bio, 1); - SSL_set_bio(ssl, bio, bio); + if (ssl) { + set_nonblocking(sock, true); + auto bio = BIO_new_socket(static_cast(sock), BIO_NOCLOSE); + BIO_set_nbio(bio, 1); + SSL_set_bio(ssl, bio, bio); - if (!setup(ssl) || SSL_connect_or_accept(ssl) != 1) { - SSL_shutdown(ssl); - { - std::lock_guard guard(ctx_mutex); - SSL_free(ssl); - } - set_nonblocking(sock, false); - return nullptr; - } - BIO_set_nbio(bio, 0); - set_nonblocking(sock, false); - } + if (!setup(ssl) || SSL_connect_or_accept(ssl) != 1) { + SSL_shutdown(ssl); + { + std::lock_guard guard(ctx_mutex); + SSL_free(ssl); + } + set_nonblocking(sock, false); + return nullptr; + } + BIO_set_nbio(bio, 0); + set_nonblocking(sock, false); + } - return ssl; + return ssl; } inline void ssl_delete(std::mutex &ctx_mutex, SSL *ssl, bool shutdown_gracefully) { - // sometimes we may want to skip this to try to avoid SIGPIPE if we know - // the remote has closed the network connection - // Note that it is not always possible to avoid SIGPIPE, this is merely a - // best-efforts. - if (shutdown_gracefully) { SSL_shutdown(ssl); } + // sometimes we may want to skip this to try to avoid SIGPIPE if we know + // the remote has closed the network connection + // Note that it is not always possible to avoid SIGPIPE, this is merely a + // best-efforts. + if (shutdown_gracefully) { SSL_shutdown(ssl); } - std::lock_guard guard(ctx_mutex); - SSL_free(ssl); + std::lock_guard guard(ctx_mutex); + SSL_free(ssl); } template @@ -111565,37 +120577,36 @@ bool ssl_connect_or_accept_nonblocking(socket_t sock, SSL *ssl, U ssl_connect_or_accept, time_t timeout_sec, time_t timeout_usec) { - int res = 0; - while ((res = ssl_connect_or_accept(ssl)) != 1) { - auto err = SSL_get_error(ssl, res); - switch (err) { - case SSL_ERROR_WANT_READ: - if (select_read(sock, timeout_sec, timeout_usec) > 0) { continue; } - break; - case SSL_ERROR_WANT_WRITE: - if (select_write(sock, timeout_sec, timeout_usec) > 0) { continue; } - break; - default: break; - } - return false; - } - return true; + int res = 0; + while ((res = ssl_connect_or_accept(ssl)) != 1) { + auto err = SSL_get_error(ssl, res); + switch (err) { + case SSL_ERROR_WANT_READ: + if (select_read(sock, timeout_sec, timeout_usec) > 0) { continue; } + break; + case SSL_ERROR_WANT_WRITE: + if (select_write(sock, timeout_sec, timeout_usec) > 0) { continue; } + break; + default: break; + } + return false; + } + return true; } template -inline bool -process_server_socket_ssl(SSL *ssl, socket_t sock, size_t keep_alive_max_count, - time_t keep_alive_timeout_sec, - time_t read_timeout_sec, time_t read_timeout_usec, - time_t write_timeout_sec, time_t write_timeout_usec, - T callback) { - return process_server_socket_core( - sock, keep_alive_max_count, keep_alive_timeout_sec, - [&](bool close_connection, bool &connection_closed) { - SSLSocketStream strm(sock, ssl, read_timeout_sec, read_timeout_usec, - write_timeout_sec, write_timeout_usec); - return callback(strm, close_connection, connection_closed); - }); +inline bool process_server_socket_ssl( + const std::atomic &svr_sock, SSL *ssl, socket_t sock, + size_t keep_alive_max_count, time_t keep_alive_timeout_sec, + time_t read_timeout_sec, time_t read_timeout_usec, time_t write_timeout_sec, + time_t write_timeout_usec, T callback) { + return process_server_socket_core( + svr_sock, sock, keep_alive_max_count, keep_alive_timeout_sec, + [&](bool close_connection, bool &connection_closed) { + SSLSocketStream strm(sock, ssl, read_timeout_sec, read_timeout_usec, + write_timeout_sec, write_timeout_usec); + return callback(strm, close_connection, connection_closed); + }); } template @@ -111603,9 +120614,9 @@ inline bool process_client_socket_ssl(SSL *ssl, socket_t sock, time_t read_timeout_sec, time_t read_timeout_usec, time_t write_timeout_sec, time_t write_timeout_usec, T callback) { - SSLSocketStream strm(sock, ssl, read_timeout_sec, read_timeout_usec, - write_timeout_sec, write_timeout_usec); - return callback(strm); + SSLSocketStream strm(sock, ssl, read_timeout_sec, read_timeout_usec, + write_timeout_sec, write_timeout_usec); + return callback(strm); } #if OPENSSL_VERSION_NUMBER < 0x10100000L @@ -111613,49 +120624,49 @@ static std::shared_ptr> openSSL_locks_; class SSLThreadLocks { public: - SSLThreadLocks() { - openSSL_locks_ = - std::make_shared>(CRYPTO_num_locks()); - CRYPTO_set_locking_callback(locking_callback); - } + SSLThreadLocks() { + openSSL_locks_ = + std::make_shared>(CRYPTO_num_locks()); + CRYPTO_set_locking_callback(locking_callback); + } - ~SSLThreadLocks() { CRYPTO_set_locking_callback(nullptr); } + ~SSLThreadLocks() { CRYPTO_set_locking_callback(nullptr); } private: - static void locking_callback(int mode, int type, const char * /*file*/, - int /*line*/) { - auto &lk = (*openSSL_locks_)[static_cast(type)]; - if (mode & CRYPTO_LOCK) { - lk.lock(); - } else { - lk.unlock(); - } - } + static void locking_callback(int mode, int type, const char * /*file*/, + int /*line*/) { + auto &lk = (*openSSL_locks_)[static_cast(type)]; + if (mode & CRYPTO_LOCK) { + lk.lock(); + } else { + lk.unlock(); + } + } }; #endif class SSLInit { public: - SSLInit() { + SSLInit() { #if OPENSSL_VERSION_NUMBER < 0x1010001fL - SSL_load_error_strings(); - SSL_library_init(); + SSL_load_error_strings(); + SSL_library_init(); #else - OPENSSL_init_ssl( - OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); + OPENSSL_init_ssl( + OPENSSL_INIT_LOAD_SSL_STRINGS | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); #endif - } + } - ~SSLInit() { + ~SSLInit() { #if OPENSSL_VERSION_NUMBER < 0x1010001fL - ERR_free_strings(); + ERR_free_strings(); #endif - } + } private: #if OPENSSL_VERSION_NUMBER < 0x10100000L - SSLThreadLocks thread_init_; + SSLThreadLocks thread_init_; #endif }; @@ -111669,52 +120680,83 @@ inline SSLSocketStream::SSLSocketStream(socket_t sock, SSL *ssl, read_timeout_usec_(read_timeout_usec), write_timeout_sec_(write_timeout_sec), write_timeout_usec_(write_timeout_usec) { - SSL_clear_mode(ssl, SSL_MODE_AUTO_RETRY); + SSL_clear_mode(ssl, SSL_MODE_AUTO_RETRY); } inline SSLSocketStream::~SSLSocketStream() {} inline bool SSLSocketStream::is_readable() const { - return detail::select_read(sock_, read_timeout_sec_, read_timeout_usec_) > 0; + return detail::select_read(sock_, read_timeout_sec_, read_timeout_usec_) > 0; } inline bool SSLSocketStream::is_writable() const { - return detail::select_write(sock_, write_timeout_sec_, write_timeout_usec_) > - 0; + return detail::select_write(sock_, write_timeout_sec_, write_timeout_usec_) > + 0; } inline ssize_t SSLSocketStream::read(char *ptr, size_t size) { - if (SSL_pending(ssl_) > 0) { - return SSL_read(ssl_, ptr, static_cast(size)); - } else if (is_readable()) { - auto ret = SSL_read(ssl_, ptr, static_cast(size)); - if (ret < 0) { - auto err = SSL_get_error(ssl_, ret); - while (err == SSL_ERROR_WANT_READ) { - if (SSL_pending(ssl_) > 0) { - return SSL_read(ssl_, ptr, static_cast(size)); - } else if (is_readable()) { - ret = SSL_read(ssl_, ptr, static_cast(size)); - if (ret >= 0) { return ret; } - err = SSL_get_error(ssl_, ret); - } else { - return -1; - } - } - } - return ret; - } - return -1; + if (SSL_pending(ssl_) > 0) { + return SSL_read(ssl_, ptr, static_cast(size)); + } else if (is_readable()) { + auto ret = SSL_read(ssl_, ptr, static_cast(size)); + if (ret < 0) { + auto err = SSL_get_error(ssl_, ret); + int n = 1000; +#ifdef _WIN32 + while (--n >= 0 && (err == SSL_ERROR_WANT_READ || + (err == SSL_ERROR_SYSCALL && + WSAGetLastError() == WSAETIMEDOUT))) { +#else + while (--n >= 0 && err == SSL_ERROR_WANT_READ) { +#endif + if (SSL_pending(ssl_) > 0) { + return SSL_read(ssl_, ptr, static_cast(size)); + } else if (is_readable()) { + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + ret = SSL_read(ssl_, ptr, static_cast(size)); + if (ret >= 0) { return ret; } + err = SSL_get_error(ssl_, ret); + } else { + return -1; + } + } + } + return ret; + } + return -1; } inline ssize_t SSLSocketStream::write(const char *ptr, size_t size) { - if (is_writable()) { return SSL_write(ssl_, ptr, static_cast(size)); } - return -1; + if (is_writable()) { + auto ret = SSL_write(ssl_, ptr, static_cast(size)); + if (ret < 0) { + auto err = SSL_get_error(ssl_, ret); + int n = 1000; +#ifdef _WIN32 + while (--n >= 0 && (err == SSL_ERROR_WANT_WRITE || + (err == SSL_ERROR_SYSCALL && + WSAGetLastError() == WSAETIMEDOUT))) { +#else + while (--n >= 0 && err == SSL_ERROR_WANT_WRITE) { +#endif + if (is_writable()) { + std::this_thread::sleep_for(std::chrono::milliseconds(1)); + ret = SSL_write(ssl_, ptr, static_cast(size)); + if (ret >= 0) { return ret; } + err = SSL_get_error(ssl_, ret); + } else { + return -1; + } + } + } + return ret; + } + return -1; } inline void SSLSocketStream::get_remote_ip_and_port(std::string &ip, int &port) const { - detail::get_remote_ip_and_port(sock_, ip, port); + detail::get_remote_ip_and_port(sock_, ip, port); } inline socket_t SSLSocketStream::socket() const { return sock_; } @@ -111727,104 +120769,103 @@ static SSLInit sslinit_; inline SSLServer::SSLServer(const char *cert_path, const char *private_key_path, const char *client_ca_cert_file_path, const char *client_ca_cert_dir_path) { - ctx_ = SSL_CTX_new(SSLv23_server_method()); - - if (ctx_) { - SSL_CTX_set_options(ctx_, - SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | - SSL_OP_NO_COMPRESSION | - SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); - - // auto ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); - // SSL_CTX_set_tmp_ecdh(ctx_, ecdh); - // EC_KEY_free(ecdh); - - if (SSL_CTX_use_certificate_chain_file(ctx_, cert_path) != 1 || - SSL_CTX_use_PrivateKey_file(ctx_, private_key_path, SSL_FILETYPE_PEM) != - 1) { - SSL_CTX_free(ctx_); - ctx_ = nullptr; - } else if (client_ca_cert_file_path || client_ca_cert_dir_path) { - // if (client_ca_cert_file_path) { - // auto list = SSL_load_client_CA_file(client_ca_cert_file_path); - // SSL_CTX_set_client_CA_list(ctx_, list); - // } - - SSL_CTX_load_verify_locations(ctx_, client_ca_cert_file_path, - client_ca_cert_dir_path); - - SSL_CTX_set_verify( - ctx_, - SSL_VERIFY_PEER | - SSL_VERIFY_FAIL_IF_NO_PEER_CERT, // SSL_VERIFY_CLIENT_ONCE, - nullptr); - } - } + ctx_ = SSL_CTX_new(TLS_server_method()); + + if (ctx_) { + SSL_CTX_set_options(ctx_, + SSL_OP_NO_COMPRESSION | + SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); + + SSL_CTX_set_min_proto_version(ctx_, TLS1_1_VERSION); + + if (SSL_CTX_use_certificate_chain_file(ctx_, cert_path) != 1 || + SSL_CTX_use_PrivateKey_file(ctx_, private_key_path, SSL_FILETYPE_PEM) != + 1) { + SSL_CTX_free(ctx_); + ctx_ = nullptr; + } else if (client_ca_cert_file_path || client_ca_cert_dir_path) { + SSL_CTX_load_verify_locations(ctx_, client_ca_cert_file_path, + client_ca_cert_dir_path); + + SSL_CTX_set_verify( + ctx_, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, nullptr); + } + } } inline SSLServer::SSLServer(X509 *cert, EVP_PKEY *private_key, X509_STORE *client_ca_cert_store) { - ctx_ = SSL_CTX_new(SSLv23_server_method()); - - if (ctx_) { - SSL_CTX_set_options(ctx_, - SSL_OP_ALL | SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | - SSL_OP_NO_COMPRESSION | - SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); - - if (SSL_CTX_use_certificate(ctx_, cert) != 1 || - SSL_CTX_use_PrivateKey(ctx_, private_key) != 1) { - SSL_CTX_free(ctx_); - ctx_ = nullptr; - } else if (client_ca_cert_store) { - - SSL_CTX_set_cert_store(ctx_, client_ca_cert_store); - - SSL_CTX_set_verify( - ctx_, - SSL_VERIFY_PEER | - SSL_VERIFY_FAIL_IF_NO_PEER_CERT, // SSL_VERIFY_CLIENT_ONCE, - nullptr); - } - } + ctx_ = SSL_CTX_new(TLS_server_method()); + + if (ctx_) { + SSL_CTX_set_options(ctx_, + SSL_OP_NO_COMPRESSION | + SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION); + + SSL_CTX_set_min_proto_version(ctx_, TLS1_1_VERSION); + + if (SSL_CTX_use_certificate(ctx_, cert) != 1 || + SSL_CTX_use_PrivateKey(ctx_, private_key) != 1) { + SSL_CTX_free(ctx_); + ctx_ = nullptr; + } else if (client_ca_cert_store) { + SSL_CTX_set_cert_store(ctx_, client_ca_cert_store); + + SSL_CTX_set_verify( + ctx_, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, nullptr); + } + } +} + +inline SSLServer::SSLServer( + const std::function &setup_ssl_ctx_callback) { + ctx_ = SSL_CTX_new(TLS_method()); + if (ctx_) { + if (!setup_ssl_ctx_callback(*ctx_)) { + SSL_CTX_free(ctx_); + ctx_ = nullptr; + } + } } inline SSLServer::~SSLServer() { - if (ctx_) { SSL_CTX_free(ctx_); } + if (ctx_) { SSL_CTX_free(ctx_); } } inline bool SSLServer::is_valid() const { return ctx_; } +inline SSL_CTX *SSLServer::ssl_context() const { return ctx_; } + inline bool SSLServer::process_and_close_socket(socket_t sock) { - auto ssl = detail::ssl_new( - sock, ctx_, ctx_mutex_, - [&](SSL *ssl) { - return detail::ssl_connect_or_accept_nonblocking( - sock, ssl, SSL_accept, read_timeout_sec_, read_timeout_usec_); - }, - [](SSL * /*ssl*/) { return true; }); - - bool ret = false; - if (ssl) { - ret = detail::process_server_socket_ssl( - ssl, sock, keep_alive_max_count_, keep_alive_timeout_sec_, - read_timeout_sec_, read_timeout_usec_, write_timeout_sec_, - write_timeout_usec_, - [this, ssl](Stream &strm, bool close_connection, - bool &connection_closed) { - return process_request(strm, close_connection, connection_closed, - [&](Request &req) { req.ssl = ssl; }); - }); - - // Shutdown gracefully if the result seemed successful, non-gracefully if - // the connection appeared to be closed. - const bool shutdown_gracefully = ret; - detail::ssl_delete(ctx_mutex_, ssl, shutdown_gracefully); - } + auto ssl = detail::ssl_new( + sock, ctx_, ctx_mutex_, + [&](SSL *ssl) { + return detail::ssl_connect_or_accept_nonblocking( + sock, ssl, SSL_accept, read_timeout_sec_, read_timeout_usec_); + }, + [](SSL * /*ssl*/) { return true; }); + + bool ret = false; + if (ssl) { + ret = detail::process_server_socket_ssl( + svr_sock_, ssl, sock, keep_alive_max_count_, keep_alive_timeout_sec_, + read_timeout_sec_, read_timeout_usec_, write_timeout_sec_, + write_timeout_usec_, + [this, ssl](Stream &strm, bool close_connection, + bool &connection_closed) { + return process_request(strm, close_connection, connection_closed, + [&](Request &req) { req.ssl = ssl; }); + }); - detail::shutdown_socket(sock); - detail::close_socket(sock); - return ret; + // Shutdown gracefully if the result seemed successful, non-gracefully if + // the connection appeared to be closed. + const bool shutdown_gracefully = ret; + detail::ssl_delete(ctx_mutex_, ssl, shutdown_gracefully); + } + + detail::shutdown_socket(sock); + detail::close_socket(sock); + return ret; } // SSL HTTP client implementation @@ -111838,417 +120879,422 @@ inline SSLClient::SSLClient(const std::string &host, int port, const std::string &client_cert_path, const std::string &client_key_path) : ClientImpl(host, port, client_cert_path, client_key_path) { - ctx_ = SSL_CTX_new(SSLv23_client_method()); - - detail::split(&host_[0], &host_[host_.size()], '.', - [&](const char *b, const char *e) { - host_components_.emplace_back(std::string(b, e)); - }); - if (!client_cert_path.empty() && !client_key_path.empty()) { - if (SSL_CTX_use_certificate_file(ctx_, client_cert_path.c_str(), - SSL_FILETYPE_PEM) != 1 || - SSL_CTX_use_PrivateKey_file(ctx_, client_key_path.c_str(), - SSL_FILETYPE_PEM) != 1) { - SSL_CTX_free(ctx_); - ctx_ = nullptr; - } - } + ctx_ = SSL_CTX_new(TLS_client_method()); + + detail::split(&host_[0], &host_[host_.size()], '.', + [&](const char *b, const char *e) { + host_components_.emplace_back(std::string(b, e)); + }); + + if (!client_cert_path.empty() && !client_key_path.empty()) { + if (SSL_CTX_use_certificate_file(ctx_, client_cert_path.c_str(), + SSL_FILETYPE_PEM) != 1 || + SSL_CTX_use_PrivateKey_file(ctx_, client_key_path.c_str(), + SSL_FILETYPE_PEM) != 1) { + SSL_CTX_free(ctx_); + ctx_ = nullptr; + } + } } inline SSLClient::SSLClient(const std::string &host, int port, X509 *client_cert, EVP_PKEY *client_key) : ClientImpl(host, port) { - ctx_ = SSL_CTX_new(SSLv23_client_method()); - - detail::split(&host_[0], &host_[host_.size()], '.', - [&](const char *b, const char *e) { - host_components_.emplace_back(std::string(b, e)); - }); - if (client_cert != nullptr && client_key != nullptr) { - if (SSL_CTX_use_certificate(ctx_, client_cert) != 1 || - SSL_CTX_use_PrivateKey(ctx_, client_key) != 1) { - SSL_CTX_free(ctx_); - ctx_ = nullptr; - } - } + ctx_ = SSL_CTX_new(TLS_client_method()); + + detail::split(&host_[0], &host_[host_.size()], '.', + [&](const char *b, const char *e) { + host_components_.emplace_back(std::string(b, e)); + }); + + if (client_cert != nullptr && client_key != nullptr) { + if (SSL_CTX_use_certificate(ctx_, client_cert) != 1 || + SSL_CTX_use_PrivateKey(ctx_, client_key) != 1) { + SSL_CTX_free(ctx_); + ctx_ = nullptr; + } + } } inline SSLClient::~SSLClient() { - if (ctx_) { SSL_CTX_free(ctx_); } - // Make sure to shut down SSL since shutdown_ssl will resolve to the - // base function rather than the derived function once we get to the - // base class destructor, and won't free the SSL (causing a leak). - SSLClient::shutdown_ssl(socket_, true); + if (ctx_) { SSL_CTX_free(ctx_); } + // Make sure to shut down SSL since shutdown_ssl will resolve to the + // base function rather than the derived function once we get to the + // base class destructor, and won't free the SSL (causing a leak). + shutdown_ssl_impl(socket_, true); } inline bool SSLClient::is_valid() const { return ctx_; } -inline void SSLClient::set_ca_cert_path(const char *ca_cert_file_path, - const char *ca_cert_dir_path) { - if (ca_cert_file_path) { ca_cert_file_path_ = ca_cert_file_path; } - if (ca_cert_dir_path) { ca_cert_dir_path_ = ca_cert_dir_path; } -} - inline void SSLClient::set_ca_cert_store(X509_STORE *ca_cert_store) { - if (ca_cert_store) { - if (ctx_) { - if (SSL_CTX_get_cert_store(ctx_) != ca_cert_store) { - // Free memory allocated for old cert and use new store `ca_cert_store` - SSL_CTX_set_cert_store(ctx_, ca_cert_store); - } - } else { - X509_STORE_free(ca_cert_store); - } - } + if (ca_cert_store) { + if (ctx_) { + if (SSL_CTX_get_cert_store(ctx_) != ca_cert_store) { + // Free memory allocated for old cert and use new store `ca_cert_store` + SSL_CTX_set_cert_store(ctx_, ca_cert_store); + } + } else { + X509_STORE_free(ca_cert_store); + } + } } inline long SSLClient::get_openssl_verify_result() const { - return verify_result_; + return verify_result_; } inline SSL_CTX *SSLClient::ssl_context() const { return ctx_; } inline bool SSLClient::create_and_connect_socket(Socket &socket, Error &error) { - return is_valid() && ClientImpl::create_and_connect_socket(socket, error); + return is_valid() && ClientImpl::create_and_connect_socket(socket, error); } // Assumes that socket_mutex_ is locked and that there are no requests in flight inline bool SSLClient::connect_with_proxy(Socket &socket, Response &res, bool &success, Error &error) { - success = true; - Response res2; - if (!detail::process_client_socket( - socket.sock, read_timeout_sec_, read_timeout_usec_, - write_timeout_sec_, write_timeout_usec_, [&](Stream &strm) { - Request req2; - req2.method = "CONNECT"; - req2.path = host_and_port_; - return process_request(strm, req2, res2, false, error); - })) { - // Thread-safe to close everything because we are assuming there are no - // requests in flight - shutdown_ssl(socket, true); - shutdown_socket(socket); - close_socket(socket); - success = false; - return false; - } + success = true; + Response res2; + if (!detail::process_client_socket( + socket.sock, read_timeout_sec_, read_timeout_usec_, + write_timeout_sec_, write_timeout_usec_, [&](Stream &strm) { + Request req2; + req2.method = "CONNECT"; + req2.path = host_and_port_; + return process_request(strm, req2, res2, false, error); + })) { + // Thread-safe to close everything because we are assuming there are no + // requests in flight + shutdown_ssl(socket, true); + shutdown_socket(socket); + close_socket(socket); + success = false; + return false; + } - if (res2.status == 407) { - if (!proxy_digest_auth_username_.empty() && - !proxy_digest_auth_password_.empty()) { - std::map auth; - if (detail::parse_www_authenticate(res2, auth, true)) { - Response res3; - if (!detail::process_client_socket( - socket.sock, read_timeout_sec_, read_timeout_usec_, - write_timeout_sec_, write_timeout_usec_, [&](Stream &strm) { - Request req3; - req3.method = "CONNECT"; - req3.path = host_and_port_; - req3.headers.insert(detail::make_digest_authentication_header( - req3, auth, 1, detail::random_string(10), - proxy_digest_auth_username_, proxy_digest_auth_password_, - true)); - return process_request(strm, req3, res3, false, error); - })) { - // Thread-safe to close everything because we are assuming there are - // no requests in flight - shutdown_ssl(socket, true); - shutdown_socket(socket); - close_socket(socket); - success = false; - return false; - } - } - } else { - res = res2; - return false; - } - } + if (res2.status == 407) { + if (!proxy_digest_auth_username_.empty() && + !proxy_digest_auth_password_.empty()) { + std::map auth; + if (detail::parse_www_authenticate(res2, auth, true)) { + Response res3; + if (!detail::process_client_socket( + socket.sock, read_timeout_sec_, read_timeout_usec_, + write_timeout_sec_, write_timeout_usec_, [&](Stream &strm) { + Request req3; + req3.method = "CONNECT"; + req3.path = host_and_port_; + req3.headers.insert(detail::make_digest_authentication_header( + req3, auth, 1, detail::random_string(10), + proxy_digest_auth_username_, proxy_digest_auth_password_, + true)); + return process_request(strm, req3, res3, false, error); + })) { + // Thread-safe to close everything because we are assuming there are + // no requests in flight + shutdown_ssl(socket, true); + shutdown_socket(socket); + close_socket(socket); + success = false; + return false; + } + } + } else { + res = res2; + return false; + } + } - return true; + return true; } inline bool SSLClient::load_certs() { - bool ret = true; - - std::call_once(initialize_cert_, [&]() { - std::lock_guard guard(ctx_mutex_); - if (!ca_cert_file_path_.empty()) { - if (!SSL_CTX_load_verify_locations(ctx_, ca_cert_file_path_.c_str(), - nullptr)) { - ret = false; - } - } else if (!ca_cert_dir_path_.empty()) { - if (!SSL_CTX_load_verify_locations(ctx_, nullptr, - ca_cert_dir_path_.c_str())) { - ret = false; - } - } else { + bool ret = true; + + std::call_once(initialize_cert_, [&]() { + std::lock_guard guard(ctx_mutex_); + if (!ca_cert_file_path_.empty()) { + if (!SSL_CTX_load_verify_locations(ctx_, ca_cert_file_path_.c_str(), + nullptr)) { + ret = false; + } + } else if (!ca_cert_dir_path_.empty()) { + if (!SSL_CTX_load_verify_locations(ctx_, nullptr, + ca_cert_dir_path_.c_str())) { + ret = false; + } + } else { #ifdef _WIN32 - detail::load_system_certs_on_windows(SSL_CTX_get_cert_store(ctx_)); + detail::load_system_certs_on_windows(SSL_CTX_get_cert_store(ctx_)); #else - SSL_CTX_set_default_verify_paths(ctx_); + SSL_CTX_set_default_verify_paths(ctx_); #endif - } - }); + } + }); - return ret; + return ret; } inline bool SSLClient::initialize_ssl(Socket &socket, Error &error) { - auto ssl = detail::ssl_new( - socket.sock, ctx_, ctx_mutex_, - [&](SSL *ssl) { - if (server_certificate_verification_) { - if (!load_certs()) { - error = Error::SSLLoadingCerts; - return false; - } - SSL_set_verify(ssl, SSL_VERIFY_NONE, nullptr); - } + auto ssl = detail::ssl_new( + socket.sock, ctx_, ctx_mutex_, + [&](SSL *ssl) { + if (server_certificate_verification_) { + if (!load_certs()) { + error = Error::SSLLoadingCerts; + return false; + } + SSL_set_verify(ssl, SSL_VERIFY_NONE, nullptr); + } - if (!detail::ssl_connect_or_accept_nonblocking( - socket.sock, ssl, SSL_connect, connection_timeout_sec_, - connection_timeout_usec_)) { - error = Error::SSLConnection; - return false; - } + if (!detail::ssl_connect_or_accept_nonblocking( + socket.sock, ssl, SSL_connect, connection_timeout_sec_, + connection_timeout_usec_)) { + error = Error::SSLConnection; + return false; + } - if (server_certificate_verification_) { - verify_result_ = SSL_get_verify_result(ssl); + if (server_certificate_verification_) { + verify_result_ = SSL_get_verify_result(ssl); - if (verify_result_ != X509_V_OK) { - error = Error::SSLServerVerification; - return false; - } + if (verify_result_ != X509_V_OK) { + error = Error::SSLServerVerification; + return false; + } - auto server_cert = SSL_get_peer_certificate(ssl); + auto server_cert = SSL_get_peer_certificate(ssl); - if (server_cert == nullptr) { - error = Error::SSLServerVerification; - return false; - } + if (server_cert == nullptr) { + error = Error::SSLServerVerification; + return false; + } - if (!verify_host(server_cert)) { - X509_free(server_cert); - error = Error::SSLServerVerification; - return false; - } - X509_free(server_cert); - } + if (!verify_host(server_cert)) { + X509_free(server_cert); + error = Error::SSLServerVerification; + return false; + } + X509_free(server_cert); + } - return true; - }, - [&](SSL *ssl) { - SSL_set_tlsext_host_name(ssl, host_.c_str()); - return true; - }); + return true; + }, + [&](SSL *ssl) { + SSL_set_tlsext_host_name(ssl, host_.c_str()); + return true; + }); - if (ssl) { - socket.ssl = ssl; - return true; - } + if (ssl) { + socket.ssl = ssl; + return true; + } - shutdown_socket(socket); - close_socket(socket); - return false; + shutdown_socket(socket); + close_socket(socket); + return false; } inline void SSLClient::shutdown_ssl(Socket &socket, bool shutdown_gracefully) { - if (socket.sock == INVALID_SOCKET) { - assert(socket.ssl == nullptr); - return; - } - if (socket.ssl) { - detail::ssl_delete(ctx_mutex_, socket.ssl, shutdown_gracefully); - socket.ssl = nullptr; - } - assert(socket.ssl == nullptr); + shutdown_ssl_impl(socket, shutdown_gracefully); +} + +inline void SSLClient::shutdown_ssl_impl(Socket &socket, + bool shutdown_gracefully) { + if (socket.sock == INVALID_SOCKET) { + assert(socket.ssl == nullptr); + return; + } + if (socket.ssl) { + detail::ssl_delete(ctx_mutex_, socket.ssl, shutdown_gracefully); + socket.ssl = nullptr; + } + assert(socket.ssl == nullptr); } inline bool SSLClient::process_socket(const Socket &socket, std::function callback) { - assert(socket.ssl); - return detail::process_client_socket_ssl( - socket.ssl, socket.sock, read_timeout_sec_, read_timeout_usec_, - write_timeout_sec_, write_timeout_usec_, std::move(callback)); + assert(socket.ssl); + return detail::process_client_socket_ssl( + socket.ssl, socket.sock, read_timeout_sec_, read_timeout_usec_, + write_timeout_sec_, write_timeout_usec_, std::move(callback)); } inline bool SSLClient::is_ssl() const { return true; } inline bool SSLClient::verify_host(X509 *server_cert) const { - /* Quote from RFC2818 section 3.1 "Server Identity" - - If a subjectAltName extension of type dNSName is present, that MUST - be used as the identity. Otherwise, the (most specific) Common Name - field in the Subject field of the certificate MUST be used. Although - the use of the Common Name is existing practice, it is deprecated and - Certification Authorities are encouraged to use the dNSName instead. - - Matching is performed using the matching rules specified by - [RFC2459]. If more than one identity of a given type is present in - the certificate (e.g., more than one dNSName name, a match in any one - of the set is considered acceptable.) Names may contain the wildcard - character * which is considered to match any single domain name - component or component fragment. E.g., *.a.com matches foo.a.com but - not bar.foo.a.com. f*.com matches foo.com but not bar.com. - - In some cases, the URI is specified as an IP address rather than a - hostname. In this case, the iPAddress subjectAltName must be present - in the certificate and must exactly match the IP in the URI. + /* Quote from RFC2818 section 3.1 "Server Identity" - */ - return verify_host_with_subject_alt_name(server_cert) || - verify_host_with_common_name(server_cert); + If a subjectAltName extension of type dNSName is present, that MUST + be used as the identity. Otherwise, the (most specific) Common Name + field in the Subject field of the certificate MUST be used. Although + the use of the Common Name is existing practice, it is deprecated and + Certification Authorities are encouraged to use the dNSName instead. + + Matching is performed using the matching rules specified by + [RFC2459]. If more than one identity of a given type is present in + the certificate (e.g., more than one dNSName name, a match in any one + of the set is considered acceptable.) Names may contain the wildcard + character * which is considered to match any single domain name + component or component fragment. E.g., *.a.com matches foo.a.com but + not bar.foo.a.com. f*.com matches foo.com but not bar.com. + + In some cases, the URI is specified as an IP address rather than a + hostname. In this case, the iPAddress subjectAltName must be present + in the certificate and must exactly match the IP in the URI. + + */ + return verify_host_with_subject_alt_name(server_cert) || + verify_host_with_common_name(server_cert); } inline bool SSLClient::verify_host_with_subject_alt_name(X509 *server_cert) const { - auto ret = false; + auto ret = false; - auto type = GEN_DNS; + auto type = GEN_DNS; - struct in6_addr addr6; - struct in_addr addr; - size_t addr_len = 0; + struct in6_addr addr6; + struct in_addr addr; + size_t addr_len = 0; #ifndef __MINGW32__ - if (inet_pton(AF_INET6, host_.c_str(), &addr6)) { - type = GEN_IPADD; - addr_len = sizeof(struct in6_addr); - } else if (inet_pton(AF_INET, host_.c_str(), &addr)) { - type = GEN_IPADD; - addr_len = sizeof(struct in_addr); - } + if (inet_pton(AF_INET6, host_.c_str(), &addr6)) { + type = GEN_IPADD; + addr_len = sizeof(struct in6_addr); + } else if (inet_pton(AF_INET, host_.c_str(), &addr)) { + type = GEN_IPADD; + addr_len = sizeof(struct in_addr); + } #endif - auto alt_names = static_cast( - X509_get_ext_d2i(server_cert, NID_subject_alt_name, nullptr, nullptr)); + auto alt_names = static_cast( + X509_get_ext_d2i(server_cert, NID_subject_alt_name, nullptr, nullptr)); - if (alt_names) { - auto dsn_matched = false; - auto ip_mached = false; + if (alt_names) { + auto dsn_matched = false; + auto ip_mached = false; - auto count = sk_GENERAL_NAME_num(alt_names); + auto count = sk_GENERAL_NAME_num(alt_names); - for (decltype(count) i = 0; i < count && !dsn_matched; i++) { - auto val = sk_GENERAL_NAME_value(alt_names, i); - if (val->type == type) { - auto name = (const char *)ASN1_STRING_get0_data(val->d.ia5); - auto name_len = (size_t)ASN1_STRING_length(val->d.ia5); + for (decltype(count) i = 0; i < count && !dsn_matched; i++) { + auto val = sk_GENERAL_NAME_value(alt_names, i); + if (val->type == type) { + auto name = (const char *)ASN1_STRING_get0_data(val->d.ia5); + auto name_len = (size_t)ASN1_STRING_length(val->d.ia5); - switch (type) { - case GEN_DNS: dsn_matched = check_host_name(name, name_len); break; + switch (type) { + case GEN_DNS: dsn_matched = check_host_name(name, name_len); break; - case GEN_IPADD: - if (!memcmp(&addr6, name, addr_len) || - !memcmp(&addr, name, addr_len)) { - ip_mached = true; - } - break; - } - } - } + case GEN_IPADD: + if (!memcmp(&addr6, name, addr_len) || + !memcmp(&addr, name, addr_len)) { + ip_mached = true; + } + break; + } + } + } - if (dsn_matched || ip_mached) { ret = true; } - } + if (dsn_matched || ip_mached) { ret = true; } + } - GENERAL_NAMES_free((STACK_OF(GENERAL_NAME) *)alt_names); - return ret; + GENERAL_NAMES_free((STACK_OF(GENERAL_NAME) *)alt_names); + return ret; } inline bool SSLClient::verify_host_with_common_name(X509 *server_cert) const { - const auto subject_name = X509_get_subject_name(server_cert); + const auto subject_name = X509_get_subject_name(server_cert); - if (subject_name != nullptr) { - char name[BUFSIZ]; - auto name_len = X509_NAME_get_text_by_NID(subject_name, NID_commonName, - name, sizeof(name)); + if (subject_name != nullptr) { + char name[BUFSIZ]; + auto name_len = X509_NAME_get_text_by_NID(subject_name, NID_commonName, + name, sizeof(name)); - if (name_len != -1) { - return check_host_name(name, static_cast(name_len)); - } - } + if (name_len != -1) { + return check_host_name(name, static_cast(name_len)); + } + } - return false; + return false; } inline bool SSLClient::check_host_name(const char *pattern, size_t pattern_len) const { - if (host_.size() == pattern_len && host_ == pattern) { return true; } - - // Wildcard match - // https://bugs.launchpad.net/ubuntu/+source/firefox-3.0/+bug/376484 - std::vector pattern_components; - detail::split(&pattern[0], &pattern[pattern_len], '.', - [&](const char *b, const char *e) { - pattern_components.emplace_back(std::string(b, e)); - }); - - if (host_components_.size() != pattern_components.size()) { return false; } - - auto itr = pattern_components.begin(); - for (const auto &h : host_components_) { - auto &p = *itr; - if (p != h && p != "*") { - auto partial_match = (p.size() > 0 && p[p.size() - 1] == '*' && - !p.compare(0, p.size() - 1, h)); - if (!partial_match) { return false; } - } - ++itr; - } + if (host_.size() == pattern_len && host_ == pattern) { return true; } - return true; + // Wildcard match + // https://bugs.launchpad.net/ubuntu/+source/firefox-3.0/+bug/376484 + std::vector pattern_components; + detail::split(&pattern[0], &pattern[pattern_len], '.', + [&](const char *b, const char *e) { + pattern_components.emplace_back(std::string(b, e)); + }); + + if (host_components_.size() != pattern_components.size()) { return false; } + + auto itr = pattern_components.begin(); + for (const auto &h : host_components_) { + auto &p = *itr; + if (p != h && p != "*") { + auto partial_match = (p.size() > 0 && p[p.size() - 1] == '*' && + !p.compare(0, p.size() - 1, h)); + if (!partial_match) { return false; } + } + ++itr; + } + + return true; } #endif // Universal client implementation -inline Client::Client(const char *scheme_host_port) +inline Client::Client(const std::string &scheme_host_port) : Client(scheme_host_port, std::string(), std::string()) {} -inline Client::Client(const char *scheme_host_port, +inline Client::Client(const std::string &scheme_host_port, const std::string &client_cert_path, const std::string &client_key_path) { - const static std::regex re(R"(^(?:([a-z]+)://)?([^:/?#]+)(?::(\d+))?)"); + const static Regex re( + R"((?:([a-z]+):\/\/)?(?:\[([\d:]+)\]|([^:/?#]+))(?::(\d+))?)"); - std::cmatch m; - if (std::regex_match(scheme_host_port, m, re)) { - auto scheme = m[1].str(); + Match m; + if (duckdb_re2::RegexMatch(scheme_host_port, m, re)) { + auto scheme = m[1].str(); #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - if (!scheme.empty() && (scheme != "http" && scheme != "https")) { + if (!scheme.empty() && (scheme != "http" && scheme != "https")) { #else - if (!scheme.empty() && scheme != "http") { + if (!scheme.empty() && scheme != "http") { #endif - std::string msg = "'" + scheme + "' scheme is not supported."; - throw std::invalid_argument(msg); - return; - } +#ifndef CPPHTTPLIB_NO_EXCEPTIONS + std::string msg = "'" + scheme + "' scheme is not supported."; + throw std::invalid_argument(msg); +#endif + return; + } - auto is_ssl = scheme == "https"; + auto is_ssl = scheme == "https"; - auto host = m[2].str(); + auto host = m[2].str(); + if (host.empty()) { host = m[3].str(); } - auto port_str = m[3].str(); - auto port = !port_str.empty() ? std::stoi(port_str) : (is_ssl ? 443 : 80); + auto port_str = m[4].str(); + auto port = !port_str.empty() ? std::stoi(port_str) : (is_ssl ? 443 : 80); - if (is_ssl) { + if (is_ssl) { #ifdef CPPHTTPLIB_OPENSSL_SUPPORT - cli_ = detail::make_unique(host.c_str(), port, - client_cert_path, client_key_path); - is_ssl_ = is_ssl; + cli_ = detail::make_unique(host.c_str(), port, + client_cert_path, client_key_path); + is_ssl_ = is_ssl; #endif - } else { - cli_ = detail::make_unique(host.c_str(), port, - client_cert_path, client_key_path); - } - } else { - cli_ = detail::make_unique(scheme_host_port, 80, - client_cert_path, client_key_path); - } + } else { + cli_ = detail::make_unique(host.c_str(), port, + client_cert_path, client_key_path); + } + } else { + cli_ = detail::make_unique(scheme_host_port, 80, + client_cert_path, client_key_path); + } } inline Client::Client(const std::string &host, int port) @@ -112263,259 +121309,259 @@ inline Client::Client(const std::string &host, int port, inline Client::~Client() {} inline bool Client::is_valid() const { - return cli_ != nullptr && cli_->is_valid(); + return cli_ != nullptr && cli_->is_valid(); } inline Result Client::Get(const char *path) { return cli_->Get(path); } inline Result Client::Get(const char *path, const Headers &headers) { - return cli_->Get(path, headers); + return cli_->Get(path, headers); } inline Result Client::Get(const char *path, Progress progress) { - return cli_->Get(path, std::move(progress)); + return cli_->Get(path, std::move(progress)); } inline Result Client::Get(const char *path, const Headers &headers, Progress progress) { - return cli_->Get(path, headers, std::move(progress)); + return cli_->Get(path, headers, std::move(progress)); } inline Result Client::Get(const char *path, ContentReceiver content_receiver) { - return cli_->Get(path, std::move(content_receiver)); + return cli_->Get(path, std::move(content_receiver)); } inline Result Client::Get(const char *path, const Headers &headers, ContentReceiver content_receiver) { - return cli_->Get(path, headers, std::move(content_receiver)); + return cli_->Get(path, headers, std::move(content_receiver)); } inline Result Client::Get(const char *path, ContentReceiver content_receiver, Progress progress) { - return cli_->Get(path, std::move(content_receiver), std::move(progress)); + return cli_->Get(path, std::move(content_receiver), std::move(progress)); } inline Result Client::Get(const char *path, const Headers &headers, ContentReceiver content_receiver, Progress progress) { - return cli_->Get(path, headers, std::move(content_receiver), - std::move(progress)); + return cli_->Get(path, headers, std::move(content_receiver), + std::move(progress)); } inline Result Client::Get(const char *path, ResponseHandler response_handler, ContentReceiver content_receiver) { - return cli_->Get(path, std::move(response_handler), - std::move(content_receiver)); + return cli_->Get(path, std::move(response_handler), + std::move(content_receiver)); } inline Result Client::Get(const char *path, const Headers &headers, ResponseHandler response_handler, ContentReceiver content_receiver) { - return cli_->Get(path, headers, std::move(response_handler), - std::move(content_receiver)); + return cli_->Get(path, headers, std::move(response_handler), + std::move(content_receiver)); } inline Result Client::Get(const char *path, ResponseHandler response_handler, ContentReceiver content_receiver, Progress progress) { - return cli_->Get(path, std::move(response_handler), - std::move(content_receiver), std::move(progress)); + return cli_->Get(path, std::move(response_handler), + std::move(content_receiver), std::move(progress)); } inline Result Client::Get(const char *path, const Headers &headers, ResponseHandler response_handler, ContentReceiver content_receiver, Progress progress) { - return cli_->Get(path, headers, std::move(response_handler), - std::move(content_receiver), std::move(progress)); + return cli_->Get(path, headers, std::move(response_handler), + std::move(content_receiver), std::move(progress)); } inline Result Client::Get(const char *path, const Params ¶ms, const Headers &headers, Progress progress) { - return cli_->Get(path, params, headers, progress); + return cli_->Get(path, params, headers, progress); } inline Result Client::Get(const char *path, const Params ¶ms, const Headers &headers, ContentReceiver content_receiver, Progress progress) { - return cli_->Get(path, params, headers, content_receiver, progress); + return cli_->Get(path, params, headers, content_receiver, progress); } inline Result Client::Get(const char *path, const Params ¶ms, const Headers &headers, ResponseHandler response_handler, ContentReceiver content_receiver, Progress progress) { - return cli_->Get(path, params, headers, response_handler, content_receiver, - progress); + return cli_->Get(path, params, headers, response_handler, content_receiver, + progress); } inline Result Client::Head(const char *path) { return cli_->Head(path); } inline Result Client::Head(const char *path, const Headers &headers) { - return cli_->Head(path, headers); + return cli_->Head(path, headers); } inline Result Client::Post(const char *path) { return cli_->Post(path); } inline Result Client::Post(const char *path, const char *body, size_t content_length, const char *content_type) { - return cli_->Post(path, body, content_length, content_type); + return cli_->Post(path, body, content_length, content_type); } inline Result Client::Post(const char *path, const Headers &headers, const char *body, size_t content_length, const char *content_type) { - return cli_->Post(path, headers, body, content_length, content_type); + return cli_->Post(path, headers, body, content_length, content_type); } inline Result Client::Post(const char *path, const std::string &body, const char *content_type) { - return cli_->Post(path, body, content_type); + return cli_->Post(path, body, content_type); } inline Result Client::Post(const char *path, const Headers &headers, const std::string &body, const char *content_type) { - return cli_->Post(path, headers, body, content_type); + return cli_->Post(path, headers, body, content_type); } inline Result Client::Post(const char *path, size_t content_length, ContentProvider content_provider, const char *content_type) { - return cli_->Post(path, content_length, std::move(content_provider), - content_type); + return cli_->Post(path, content_length, std::move(content_provider), + content_type); } inline Result Client::Post(const char *path, ContentProviderWithoutLength content_provider, const char *content_type) { - return cli_->Post(path, std::move(content_provider), content_type); + return cli_->Post(path, std::move(content_provider), content_type); } inline Result Client::Post(const char *path, const Headers &headers, size_t content_length, ContentProvider content_provider, const char *content_type) { - return cli_->Post(path, headers, content_length, std::move(content_provider), - content_type); + return cli_->Post(path, headers, content_length, std::move(content_provider), + content_type); } inline Result Client::Post(const char *path, const Headers &headers, ContentProviderWithoutLength content_provider, const char *content_type) { - return cli_->Post(path, headers, std::move(content_provider), content_type); + return cli_->Post(path, headers, std::move(content_provider), content_type); } inline Result Client::Post(const char *path, const Params ¶ms) { - return cli_->Post(path, params); + return cli_->Post(path, params); } inline Result Client::Post(const char *path, const Headers &headers, const Params ¶ms) { - return cli_->Post(path, headers, params); + return cli_->Post(path, headers, params); } inline Result Client::Post(const char *path, const MultipartFormDataItems &items) { - return cli_->Post(path, items); + return cli_->Post(path, items); } inline Result Client::Post(const char *path, const Headers &headers, const MultipartFormDataItems &items) { - return cli_->Post(path, headers, items); + return cli_->Post(path, headers, items); } inline Result Client::Post(const char *path, const Headers &headers, const MultipartFormDataItems &items, const std::string &boundary) { - return cli_->Post(path, headers, items, boundary); + return cli_->Post(path, headers, items, boundary); } inline Result Client::Put(const char *path) { return cli_->Put(path); } inline Result Client::Put(const char *path, const char *body, size_t content_length, const char *content_type) { - return cli_->Put(path, body, content_length, content_type); + return cli_->Put(path, body, content_length, content_type); } inline Result Client::Put(const char *path, const Headers &headers, const char *body, size_t content_length, const char *content_type) { - return cli_->Put(path, headers, body, content_length, content_type); + return cli_->Put(path, headers, body, content_length, content_type); } inline Result Client::Put(const char *path, const std::string &body, const char *content_type) { - return cli_->Put(path, body, content_type); + return cli_->Put(path, body, content_type); } inline Result Client::Put(const char *path, const Headers &headers, const std::string &body, const char *content_type) { - return cli_->Put(path, headers, body, content_type); + return cli_->Put(path, headers, body, content_type); } inline Result Client::Put(const char *path, size_t content_length, ContentProvider content_provider, const char *content_type) { - return cli_->Put(path, content_length, std::move(content_provider), - content_type); + return cli_->Put(path, content_length, std::move(content_provider), + content_type); } inline Result Client::Put(const char *path, ContentProviderWithoutLength content_provider, const char *content_type) { - return cli_->Put(path, std::move(content_provider), content_type); + return cli_->Put(path, std::move(content_provider), content_type); } inline Result Client::Put(const char *path, const Headers &headers, size_t content_length, ContentProvider content_provider, const char *content_type) { - return cli_->Put(path, headers, content_length, std::move(content_provider), - content_type); + return cli_->Put(path, headers, content_length, std::move(content_provider), + content_type); } inline Result Client::Put(const char *path, const Headers &headers, ContentProviderWithoutLength content_provider, const char *content_type) { - return cli_->Put(path, headers, std::move(content_provider), content_type); + return cli_->Put(path, headers, std::move(content_provider), content_type); } inline Result Client::Put(const char *path, const Params ¶ms) { - return cli_->Put(path, params); + return cli_->Put(path, params); } inline Result Client::Put(const char *path, const Headers &headers, const Params ¶ms) { - return cli_->Put(path, headers, params); + return cli_->Put(path, headers, params); } inline Result Client::Patch(const char *path) { return cli_->Patch(path); } inline Result Client::Patch(const char *path, const char *body, size_t content_length, const char *content_type) { - return cli_->Patch(path, body, content_length, content_type); + return cli_->Patch(path, body, content_length, content_type); } inline Result Client::Patch(const char *path, const Headers &headers, const char *body, size_t content_length, const char *content_type) { - return cli_->Patch(path, headers, body, content_length, content_type); + return cli_->Patch(path, headers, body, content_length, content_type); } inline Result Client::Patch(const char *path, const std::string &body, const char *content_type) { - return cli_->Patch(path, body, content_type); + return cli_->Patch(path, body, content_type); } inline Result Client::Patch(const char *path, const Headers &headers, const std::string &body, const char *content_type) { - return cli_->Patch(path, headers, body, content_type); + return cli_->Patch(path, headers, body, content_type); } inline Result Client::Patch(const char *path, size_t content_length, ContentProvider content_provider, const char *content_type) { - return cli_->Patch(path, content_length, std::move(content_provider), - content_type); + return cli_->Patch(path, content_length, std::move(content_provider), + content_type); } inline Result Client::Patch(const char *path, ContentProviderWithoutLength content_provider, const char *content_type) { - return cli_->Patch(path, std::move(content_provider), content_type); + return cli_->Patch(path, std::move(content_provider), content_type); } inline Result Client::Patch(const char *path, const Headers &headers, size_t content_length, ContentProvider content_provider, const char *content_type) { - return cli_->Patch(path, headers, content_length, std::move(content_provider), - content_type); + return cli_->Patch(path, headers, content_length, std::move(content_provider), + content_type); } inline Result Client::Patch(const char *path, const Headers &headers, ContentProviderWithoutLength content_provider, const char *content_type) { - return cli_->Patch(path, headers, std::move(content_provider), content_type); + return cli_->Patch(path, headers, std::move(content_provider), content_type); } inline Result Client::Delete(const char *path) { return cli_->Delete(path); } inline Result Client::Delete(const char *path, const Headers &headers) { - return cli_->Delete(path, headers); + return cli_->Delete(path, headers); } inline Result Client::Delete(const char *path, const char *body, size_t content_length, const char *content_type) { - return cli_->Delete(path, body, content_length, content_type); + return cli_->Delete(path, body, content_length, content_type); } inline Result Client::Delete(const char *path, const Headers &headers, const char *body, size_t content_length, const char *content_type) { - return cli_->Delete(path, headers, body, content_length, content_type); + return cli_->Delete(path, headers, body, content_length, content_type); } inline Result Client::Delete(const char *path, const std::string &body, const char *content_type) { - return cli_->Delete(path, body, content_type); + return cli_->Delete(path, body, content_type); } inline Result Client::Delete(const char *path, const Headers &headers, const std::string &body, const char *content_type) { - return cli_->Delete(path, headers, body, content_type); + return cli_->Delete(path, headers, body, content_type); } inline Result Client::Options(const char *path) { return cli_->Options(path); } inline Result Client::Options(const char *path, const Headers &headers) { - return cli_->Options(path, headers); + return cli_->Options(path, headers); } -inline bool Client::send(const Request &req, Response &res, Error &error) { - return cli_->send(req, res, error); +inline bool Client::send(Request &req, Response &res, Error &error) { + return cli_->send(req, res, error); } inline Result Client::send(const Request &req) { return cli_->send(req); } @@ -112524,71 +121570,85 @@ inline size_t Client::is_socket_open() const { return cli_->is_socket_open(); } inline void Client::stop() { cli_->stop(); } +inline void Client::set_hostname_addr_map( + const std::map addr_map) { + cli_->set_hostname_addr_map(std::move(addr_map)); +} + inline void Client::set_default_headers(Headers headers) { - cli_->set_default_headers(std::move(headers)); + cli_->set_default_headers(std::move(headers)); +} + +inline void Client::set_address_family(int family) { + cli_->set_address_family(family); } inline void Client::set_tcp_nodelay(bool on) { cli_->set_tcp_nodelay(on); } + inline void Client::set_socket_options(SocketOptions socket_options) { - cli_->set_socket_options(std::move(socket_options)); + cli_->set_socket_options(std::move(socket_options)); } inline void Client::set_connection_timeout(time_t sec, time_t usec) { - cli_->set_connection_timeout(sec, usec); + cli_->set_connection_timeout(sec, usec); } + inline void Client::set_read_timeout(time_t sec, time_t usec) { - cli_->set_read_timeout(sec, usec); + cli_->set_read_timeout(sec, usec); } + inline void Client::set_write_timeout(time_t sec, time_t usec) { - cli_->set_write_timeout(sec, usec); + cli_->set_write_timeout(sec, usec); } inline void Client::set_basic_auth(const char *username, const char *password) { - cli_->set_basic_auth(username, password); + cli_->set_basic_auth(username, password); } inline void Client::set_bearer_token_auth(const char *token) { - cli_->set_bearer_token_auth(token); + cli_->set_bearer_token_auth(token); } #ifdef CPPHTTPLIB_OPENSSL_SUPPORT inline void Client::set_digest_auth(const char *username, const char *password) { - cli_->set_digest_auth(username, password); + cli_->set_digest_auth(username, password); } #endif inline void Client::set_keep_alive(bool on) { cli_->set_keep_alive(on); } inline void Client::set_follow_location(bool on) { - cli_->set_follow_location(on); + cli_->set_follow_location(on); } +inline void Client::set_url_encode(bool on) { cli_->set_url_encode(on); } + inline void Client::set_compress(bool on) { cli_->set_compress(on); } inline void Client::set_decompress(bool on) { cli_->set_decompress(on); } inline void Client::set_interface(const char *intf) { - cli_->set_interface(intf); + cli_->set_interface(intf); } inline void Client::set_proxy(const char *host, int port) { - cli_->set_proxy(host, port); + cli_->set_proxy(host, port); } inline void Client::set_proxy_basic_auth(const char *username, const char *password) { - cli_->set_proxy_basic_auth(username, password); + cli_->set_proxy_basic_auth(username, password); } inline void Client::set_proxy_bearer_token_auth(const char *token) { - cli_->set_proxy_bearer_token_auth(token); + cli_->set_proxy_bearer_token_auth(token); } #ifdef CPPHTTPLIB_OPENSSL_SUPPORT inline void Client::set_proxy_digest_auth(const char *username, const char *password) { - cli_->set_proxy_digest_auth(username, password); + cli_->set_proxy_digest_auth(username, password); } #endif #ifdef CPPHTTPLIB_OPENSSL_SUPPORT inline void Client::enable_server_certificate_verification(bool enabled) { - cli_->enable_server_certificate_verification(enabled); + cli_->enable_server_certificate_verification(enabled); } #endif @@ -112597,28 +121657,27 @@ inline void Client::set_logger(Logger logger) { cli_->set_logger(logger); } #ifdef CPPHTTPLIB_OPENSSL_SUPPORT inline void Client::set_ca_cert_path(const char *ca_cert_file_path, const char *ca_cert_dir_path) { - if (is_ssl_) { - static_cast(*cli_).set_ca_cert_path(ca_cert_file_path, - ca_cert_dir_path); - } + cli_->set_ca_cert_path(ca_cert_file_path, ca_cert_dir_path); } inline void Client::set_ca_cert_store(X509_STORE *ca_cert_store) { - if (is_ssl_) { - static_cast(*cli_).set_ca_cert_store(ca_cert_store); - } + if (is_ssl_) { + static_cast(*cli_).set_ca_cert_store(ca_cert_store); + } else { + cli_->set_ca_cert_store(ca_cert_store); + } } inline long Client::get_openssl_verify_result() const { - if (is_ssl_) { - return static_cast(*cli_).get_openssl_verify_result(); - } - return -1; // NOTE: -1 doesn't match any of X509_V_ERR_??? + if (is_ssl_) { + return static_cast(*cli_).get_openssl_verify_result(); + } + return -1; // NOTE: -1 doesn't match any of X509_V_ERR_??? } inline SSL_CTX *Client::ssl_context() const { - if (is_ssl_) { return static_cast(*cli_).ssl_context(); } - return nullptr; + if (is_ssl_) { return static_cast(*cli_).ssl_context(); } + return nullptr; } #endif @@ -112632,7 +121691,6 @@ inline SSL_CTX *Client::ssl_context() const { #endif // CPPHTTPLIB_HTTPLIB_H - // LICENSE_CHANGE_END #endif @@ -112751,6 +121809,7 @@ void ExtensionHelper::InstallExtension(DatabaseInstance &db, const string &exten + #ifndef _WIN32 #include #else @@ -112771,6 +121830,17 @@ void *dlsym(void *handle, const char *name) { D_ASSERT(handle); return (void *)GetProcAddress((HINSTANCE)handle, name); } + +std::string GetDLError(void) { + return LocalFileSystem::GetLastErrorAsString(); +} + +#else + +std::string GetDLError(void) { + return dlerror(); +} + #endif } // namespace duckdb @@ -112788,7 +121858,7 @@ template static T LoadFunctionFromDLL(void *dll, const string &function_name, const string &filename) { auto function = dlsym(dll, function_name.c_str()); if (!function) { - throw IOException("File \"%s\" did not contain function \"%s\"", filename, function_name); + throw IOException("File \"%s\" did not contain function \"%s\": %s", filename, function_name, GetDLError()); } return (T)function; } @@ -112816,7 +121886,7 @@ void ExtensionHelper::LoadExternalExtension(DatabaseInstance &db, const string & } auto lib_hdl = dlopen(filename.c_str(), RTLD_LAZY | RTLD_LOCAL); if (!lib_hdl) { - throw IOException("File \"%s\" could not be loaded", filename); + throw IOException("File \"%s\" could not be loaded: %s", filename, GetDLError()); } auto basename = fs.ExtractBaseName(filename); @@ -113119,7 +122189,6 @@ using std::ofstream; - #include #include @@ -113190,6 +122259,7 @@ bool QueryProfiler::OperatorRequiresProfiling(PhysicalOperatorType op_type) { case PhysicalOperatorType::HASH_JOIN: case PhysicalOperatorType::CROSS_PRODUCT: case PhysicalOperatorType::PIECEWISE_MERGE_JOIN: + case PhysicalOperatorType::IE_JOIN: case PhysicalOperatorType::DELIM_JOIN: case PhysicalOperatorType::UNION: case PhysicalOperatorType::RECURSIVE_CTE: @@ -113345,7 +122415,7 @@ void OperatorProfiler::AddTiming(const PhysicalOperator *op, double time, idx_t if (!enabled) { return; } - if (!Value::DoubleIsValid(time)) { + if (!Value::DoubleIsFinite(time)) { return; } auto entry = timings.find(op); @@ -113873,6 +122943,9 @@ bool QueryResult::Equals(QueryResult &other) { // LCOV_EXCL_START for (idx_t row = 0; row < rchunk->size(); row++) { auto lvalue = lchunk->GetValue(col, row); auto rvalue = rchunk->GetValue(col, row); + if (lvalue.IsNull() && rvalue.IsNull()) { + continue; + } if (lvalue != rvalue) { return false; } @@ -113991,6 +123064,7 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co child.format = "g"; break; case LogicalTypeId::UUID: + case LogicalTypeId::JSON: case LogicalTypeId::VARCHAR: child.format = "u"; break; @@ -114112,20 +123186,21 @@ void SetArrowFormat(DuckDBArrowSchemaHolder &root_holder, ArrowSchema &child, co } } -void QueryResult::ToArrowSchema(ArrowSchema *out_schema) { +void QueryResult::ToArrowSchema(ArrowSchema *out_schema, vector &types, vector &names) { D_ASSERT(out_schema); - + D_ASSERT(types.size() == names.size()); + idx_t column_count = types.size(); // Allocate as unique_ptr first to cleanup properly on error auto root_holder = make_unique(); // Allocate the children - root_holder->children.resize(ColumnCount()); - root_holder->children_ptrs.resize(ColumnCount(), nullptr); - for (size_t i = 0; i < ColumnCount(); ++i) { + root_holder->children.resize(column_count); + root_holder->children_ptrs.resize(column_count, nullptr); + for (size_t i = 0; i < column_count; ++i) { root_holder->children_ptrs[i] = &root_holder->children[i]; } out_schema->children = root_holder->children_ptrs.data(); - out_schema->n_children = ColumnCount(); + out_schema->n_children = column_count; // Store the schema out_schema->format = "+s"; // struct apparently @@ -114135,7 +123210,7 @@ void QueryResult::ToArrowSchema(ArrowSchema *out_schema) { out_schema->dictionary = nullptr; // Configure all child schemas - for (idx_t col_idx = 0; col_idx < ColumnCount(); col_idx++) { + for (idx_t col_idx = 0; col_idx < column_count; col_idx++) { auto &child = root_holder->children[col_idx]; InitializeChild(child, names[col_idx]); @@ -114165,9 +123240,9 @@ namespace duckdb { class AggregateRelation : public Relation { public: - AggregateRelation(shared_ptr child, vector> expressions); - AggregateRelation(shared_ptr child, vector> expressions, - vector> groups); + DUCKDB_API AggregateRelation(shared_ptr child, vector> expressions); + DUCKDB_API AggregateRelation(shared_ptr child, vector> expressions, + vector> groups); vector> expressions; vector> groups; @@ -114230,7 +123305,7 @@ AggregateRelation::AggregateRelation(shared_ptr child_p, : Relation(child_p->context, RelationType::AGGREGATE_RELATION), expressions(move(parsed_expressions)), child(move(child_p)) { // bind the expressions - context.TryBindRelation(*this, this->columns); + context.GetContext()->TryBindRelation(*this, this->columns); } AggregateRelation::AggregateRelation(shared_ptr child_p, @@ -114239,7 +123314,7 @@ AggregateRelation::AggregateRelation(shared_ptr child_p, : Relation(child_p->context, RelationType::AGGREGATE_RELATION), expressions(move(parsed_expressions)), groups(move(groups_p)), child(move(child_p)) { // bind the expressions - context.TryBindRelation(*this, this->columns); + context.GetContext()->TryBindRelation(*this, this->columns); } unique_ptr AggregateRelation::GetQueryNode() { @@ -114369,13 +123444,12 @@ class CreateStatement : public SQLStatement { - namespace duckdb { CreateTableRelation::CreateTableRelation(shared_ptr child_p, string schema_name, string table_name) : Relation(child_p->context, RelationType::CREATE_TABLE_RELATION), child(move(child_p)), schema_name(move(schema_name)), table_name(move(table_name)) { - context.TryBindRelation(*this, this->columns); + context.GetContext()->TryBindRelation(*this, this->columns); } BoundStatement CreateTableRelation::Bind(Binder &binder) { @@ -114441,14 +123515,13 @@ class CreateViewRelation : public Relation { - namespace duckdb { CreateViewRelation::CreateViewRelation(shared_ptr child_p, string view_name_p, bool replace_p, bool temporary_p) : Relation(child_p->context, RelationType::CREATE_VIEW_RELATION), child(move(child_p)), view_name(move(view_name_p)), replace(replace_p), temporary(temporary_p) { - context.TryBindRelation(*this, this->columns); + context.GetContext()->TryBindRelation(*this, this->columns); } BoundStatement CreateViewRelation::Bind(Binder &binder) { @@ -114492,7 +123565,7 @@ namespace duckdb { class CrossProductRelation : public Relation { public: - CrossProductRelation(shared_ptr left, shared_ptr right); + DUCKDB_API CrossProductRelation(shared_ptr left, shared_ptr right); shared_ptr left; shared_ptr right; @@ -114553,10 +123626,10 @@ namespace duckdb { CrossProductRelation::CrossProductRelation(shared_ptr left_p, shared_ptr right_p) : Relation(left_p->context, RelationType::CROSS_PRODUCT_RELATION), left(move(left_p)), right(move(right_p)) { - if (&left->context != &right->context) { + if (left->context.GetContext() != right->context.GetContext()) { throw Exception("Cannot combine LEFT and RIGHT relations of different connections!"); } - context.TryBindRelation(*this, this->columns); + context.GetContext()->TryBindRelation(*this, this->columns); } unique_ptr CrossProductRelation::GetQueryNode() { @@ -114601,7 +123674,7 @@ namespace duckdb { class DeleteRelation : public Relation { public: - DeleteRelation(ClientContext &context, unique_ptr condition, string schema_name, + DeleteRelation(ClientContextWrapper &context, unique_ptr condition, string schema_name, string table_name); vector columns; @@ -114643,6 +123716,7 @@ class DeleteStatement : public SQLStatement { unique_ptr condition; unique_ptr table; vector> using_clauses; + vector> returning_list; protected: DeleteStatement(const DeleteStatement &other); @@ -114659,11 +123733,11 @@ class DeleteStatement : public SQLStatement { namespace duckdb { -DeleteRelation::DeleteRelation(ClientContext &context, unique_ptr condition_p, string schema_name_p, - string table_name_p) +DeleteRelation::DeleteRelation(ClientContextWrapper &context, unique_ptr condition_p, + string schema_name_p, string table_name_p) : Relation(context, RelationType::DELETE_RELATION), condition(move(condition_p)), schema_name(move(schema_name_p)), table_name(move(table_name_p)) { - context.TryBindRelation(*this, this->columns); + context.GetContext()->TryBindRelation(*this, this->columns); } BoundStatement DeleteRelation::Bind(Binder &binder) { @@ -114736,7 +123810,7 @@ namespace duckdb { DistinctRelation::DistinctRelation(shared_ptr child_p) : Relation(child_p->context, RelationType::DISTINCT_RELATION), child(move(child_p)) { vector dummy_columns; - context.TryBindRelation(*this, dummy_columns); + context.GetContext()->TryBindRelation(*this, dummy_columns); } unique_ptr DistinctRelation::GetQueryNode() { @@ -114802,7 +123876,7 @@ namespace duckdb { ExplainRelation::ExplainRelation(shared_ptr child_p) : Relation(child_p->context, RelationType::EXPLAIN_RELATION), child(move(child_p)) { - context.TryBindRelation(*this, this->columns); + context.GetContext()->TryBindRelation(*this, this->columns); } BoundStatement ExplainRelation::Bind(Binder &binder) { @@ -114839,7 +123913,7 @@ namespace duckdb { class FilterRelation : public Relation { public: - FilterRelation(shared_ptr child, unique_ptr condition); + DUCKDB_API FilterRelation(shared_ptr child, unique_ptr condition); unique_ptr condition; shared_ptr child; @@ -114944,9 +124018,10 @@ namespace duckdb { //! Represents a conjunction (AND/OR) class ConjunctionExpression : public ParsedExpression { public: - explicit ConjunctionExpression(ExpressionType type); - ConjunctionExpression(ExpressionType type, vector> children); - ConjunctionExpression(ExpressionType type, unique_ptr left, unique_ptr right); + DUCKDB_API explicit ConjunctionExpression(ExpressionType type); + DUCKDB_API ConjunctionExpression(ExpressionType type, vector> children); + DUCKDB_API ConjunctionExpression(ExpressionType type, unique_ptr left, + unique_ptr right); vector> children; @@ -114961,6 +124036,16 @@ class ConjunctionExpression : public ParsedExpression { void Serialize(FieldWriter &writer) const override; static unique_ptr Deserialize(ExpressionType type, FieldReader &source); + +public: + template + static string ToString(const T &entry) { + string result = entry.children[0]->ToString(); + for (idx_t i = 1; i < entry.children.size(); i++) { + result += " " + ExpressionTypeToOperator(entry.type) + " " + entry.children[i]->ToString(); + } + return result; + } }; } // namespace duckdb @@ -114971,7 +124056,7 @@ namespace duckdb { FilterRelation::FilterRelation(shared_ptr child_p, unique_ptr condition_p) : Relation(child_p->context, RelationType::FILTER_RELATION), condition(move(condition_p)), child(move(child_p)) { vector dummy_columns; - context.TryBindRelation(*this, dummy_columns); + context.GetContext()->TryBindRelation(*this, dummy_columns); } unique_ptr FilterRelation::GetQueryNode() { @@ -115077,6 +124162,9 @@ class InsertStatement : public SQLStatement { //! Schema name to insert to string schema; + //! keep track of optional returningList if statement contains a RETURNING keyword + vector> returning_list; + protected: InsertStatement(const InsertStatement &other); @@ -115096,7 +124184,7 @@ namespace duckdb { InsertRelation::InsertRelation(shared_ptr child_p, string schema_name, string table_name) : Relation(child_p->context, RelationType::INSERT_RELATION), child(move(child_p)), schema_name(move(schema_name)), table_name(move(table_name)) { - context.TryBindRelation(*this, this->columns); + context.GetContext()->TryBindRelation(*this, this->columns); } BoundStatement InsertRelation::Bind(Binder &binder) { @@ -115136,9 +124224,10 @@ namespace duckdb { class JoinRelation : public Relation { public: - JoinRelation(shared_ptr left, shared_ptr right, unique_ptr condition, - JoinType type); - JoinRelation(shared_ptr left, shared_ptr right, vector using_columns, JoinType type); + DUCKDB_API JoinRelation(shared_ptr left, shared_ptr right, + unique_ptr condition, JoinType type); + DUCKDB_API JoinRelation(shared_ptr left, shared_ptr right, vector using_columns, + JoinType type); shared_ptr left; shared_ptr right; @@ -115216,20 +124305,20 @@ JoinRelation::JoinRelation(shared_ptr left_p, shared_ptr rig unique_ptr condition_p, JoinType type) : Relation(left_p->context, RelationType::JOIN_RELATION), left(move(left_p)), right(move(right_p)), condition(move(condition_p)), join_type(type) { - if (&left->context != &right->context) { + if (left->context.GetContext() != right->context.GetContext()) { throw Exception("Cannot combine LEFT and RIGHT relations of different connections!"); } - context.TryBindRelation(*this, this->columns); + context.GetContext()->TryBindRelation(*this, this->columns); } JoinRelation::JoinRelation(shared_ptr left_p, shared_ptr right_p, vector using_columns_p, JoinType type) : Relation(left_p->context, RelationType::JOIN_RELATION), left(move(left_p)), right(move(right_p)), using_columns(move(using_columns_p)), join_type(type) { - if (&left->context != &right->context) { + if (left->context.GetContext() != right->context.GetContext()) { throw Exception("Cannot combine LEFT and RIGHT relations of different connections!"); } - context.TryBindRelation(*this, this->columns); + context.GetContext()->TryBindRelation(*this, this->columns); } unique_ptr JoinRelation::GetQueryNode() { @@ -115257,7 +124346,11 @@ const vector &JoinRelation::Columns() { string JoinRelation::ToString(idx_t depth) { string str = RenderWhitespace(depth); - str = "Join " + JoinTypeToString(join_type); + str += "Join " + JoinTypeToString(join_type); + if (condition) { + str += " " + condition->GetName(); + } + return str + "\n" + left->ToString(depth + 1) + "\n" + right->ToString(depth + 1); } @@ -115278,7 +124371,7 @@ namespace duckdb { class LimitRelation : public Relation { public: - LimitRelation(shared_ptr child, int64_t limit, int64_t offset); + DUCKDB_API LimitRelation(shared_ptr child, int64_t limit, int64_t offset); int64_t limit; int64_t offset; @@ -115364,10 +124457,11 @@ namespace duckdb { class OrderRelation : public Relation { public: - OrderRelation(shared_ptr child, vector orders); + DUCKDB_API OrderRelation(shared_ptr child, vector orders); vector orders; shared_ptr child; + vector columns; public: unique_ptr GetQueryNode() override; @@ -115390,23 +124484,26 @@ class OrderRelation : public Relation { + + namespace duckdb { OrderRelation::OrderRelation(shared_ptr child_p, vector orders) : Relation(child_p->context, RelationType::ORDER_RELATION), orders(move(orders)), child(move(child_p)) { // bind the expressions - vector dummy_columns; - context.TryBindRelation(*this, dummy_columns); + context.GetContext()->TryBindRelation(*this, this->columns); } unique_ptr OrderRelation::GetQueryNode() { - auto child_node = child->GetQueryNode(); + auto select = make_unique(); + select->from_table = child->GetTableRef(); + select->select_list.push_back(make_unique()); auto order_node = make_unique(); for (idx_t i = 0; i < orders.size(); i++) { order_node->orders.emplace_back(orders[i].type, orders[i].null_order, orders[i].expression->Copy()); } - child_node->modifiers.push_back(move(order_node)); - return child_node; + select->modifiers.push_back(move(order_node)); + return move(select); } string OrderRelation::GetAlias() { @@ -115414,7 +124511,7 @@ string OrderRelation::GetAlias() { } const vector &OrderRelation::Columns() { - return child->Columns(); + return columns; } string OrderRelation::ToString(idx_t depth) { @@ -115447,8 +124544,8 @@ namespace duckdb { class ProjectionRelation : public Relation { public: - ProjectionRelation(shared_ptr child, vector> expressions, - vector aliases); + DUCKDB_API ProjectionRelation(shared_ptr child, vector> expressions, + vector aliases); vector> expressions; vector columns; @@ -115483,7 +124580,7 @@ ProjectionRelation::ProjectionRelation(shared_ptr child_p, } } // bind the expressions - context.TryBindRelation(*this, this->columns); + context.GetContext()->TryBindRelation(*this, this->columns); } unique_ptr ProjectionRelation::GetQueryNode() { @@ -115525,7 +124622,7 @@ string ProjectionRelation::ToString(idx_t depth) { if (i != 0) { str += ", "; } - str += expressions[i]->ToString(); + str += expressions[i]->ToString() + " as " + expressions[i]->alias; } str += "]\n"; return str + child->ToString(depth + 1); @@ -115540,9 +124637,10 @@ string ProjectionRelation::ToString(idx_t depth) { namespace duckdb { -QueryRelation::QueryRelation(ClientContext &context, unique_ptr select_stmt_p, string alias_p) +QueryRelation::QueryRelation(const std::shared_ptr &context, unique_ptr select_stmt_p, + string alias_p) : Relation(context, RelationType::QUERY_RELATION), select_stmt(move(select_stmt_p)), alias(move(alias_p)) { - context.TryBindRelation(*this, this->columns); + context->TryBindRelation(*this, this->columns); } QueryRelation::~QueryRelation() { @@ -115601,8 +124699,8 @@ string QueryRelation::ToString(idx_t depth) { namespace duckdb { -ReadCSVRelation::ReadCSVRelation(ClientContext &context, string csv_file_p, vector columns_p, - bool auto_detect, string alias_p) +ReadCSVRelation::ReadCSVRelation(const std::shared_ptr &context, string csv_file_p, + vector columns_p, bool auto_detect, string alias_p) : Relation(context, RelationType::READ_CSV_RELATION), csv_file(move(csv_file_p)), auto_detect(auto_detect), alias(move(alias_p)), columns(move(columns_p)) { if (alias.empty()) { @@ -115695,11 +124793,11 @@ namespace duckdb { SetOpRelation::SetOpRelation(shared_ptr left_p, shared_ptr right_p, SetOperationType setop_type_p) : Relation(left_p->context, RelationType::SET_OPERATION_RELATION), left(move(left_p)), right(move(right_p)), setop_type(setop_type_p) { - if (&left->context != &right->context) { + if (left->context.GetContext() != right->context.GetContext()) { throw Exception("Cannot combine LEFT and RIGHT relations of different connections!"); } vector dummy_columns; - context.TryBindRelation(*this, dummy_columns); + context.GetContext()->TryBindRelation(*this, dummy_columns); } unique_ptr SetOpRelation::GetQueryNode() { @@ -115784,7 +124882,7 @@ namespace duckdb { SubqueryRelation::SubqueryRelation(shared_ptr child_p, string alias_p) : Relation(child_p->context, RelationType::SUBQUERY_RELATION), child(move(child_p)), alias(move(alias_p)) { vector dummy_columns; - context.TryBindRelation(*this, dummy_columns); + context.GetContext()->TryBindRelation(*this, dummy_columns); } unique_ptr SubqueryRelation::GetQueryNode() { @@ -115867,19 +124965,20 @@ class SubqueryExpression : public ParsedExpression { namespace duckdb { -TableFunctionRelation::TableFunctionRelation(ClientContext &context, string name_p, vector parameters_p, - named_parameter_map_t named_parameters, +TableFunctionRelation::TableFunctionRelation(const std::shared_ptr &context, string name_p, + vector parameters_p, named_parameter_map_t named_parameters, shared_ptr input_relation_p) : Relation(context, RelationType::TABLE_FUNCTION_RELATION), name(move(name_p)), parameters(move(parameters_p)), named_parameters(move(named_parameters)), input_relation(move(input_relation_p)) { - context.TryBindRelation(*this, this->columns); + context->TryBindRelation(*this, this->columns); } -TableFunctionRelation::TableFunctionRelation(ClientContext &context, string name_p, vector parameters_p, +TableFunctionRelation::TableFunctionRelation(const std::shared_ptr &context, string name_p, + vector parameters_p, shared_ptr input_relation_p) : Relation(context, RelationType::TABLE_FUNCTION_RELATION), name(move(name_p)), parameters(move(parameters_p)), input_relation(move(input_relation_p)) { - context.TryBindRelation(*this, this->columns); + context->TryBindRelation(*this, this->columns); } unique_ptr TableFunctionRelation::GetQueryNode() { @@ -115962,7 +125061,7 @@ namespace duckdb { class UpdateRelation : public Relation { public: - UpdateRelation(ClientContext &context, unique_ptr condition, string schema_name, + UpdateRelation(ClientContextWrapper &context, unique_ptr condition, string schema_name, string table_name, vector update_columns, vector> expressions); vector columns; @@ -115988,7 +125087,7 @@ class UpdateRelation : public Relation { namespace duckdb { -TableRelation::TableRelation(ClientContext &context, unique_ptr description) +TableRelation::TableRelation(const std::shared_ptr &context, unique_ptr description) : Relation(context, RelationType::TABLE_RELATION), description(move(description)) { } @@ -116033,15 +125132,15 @@ static unique_ptr ParseCondition(ClientContext &context, const void TableRelation::Update(const string &update_list, const string &condition) { vector update_columns; vector> expressions; - auto cond = ParseCondition(context, condition); - Parser::ParseUpdateList(update_list, update_columns, expressions, context.GetParserOptions()); + auto cond = ParseCondition(*context.GetContext(), condition); + Parser::ParseUpdateList(update_list, update_columns, expressions, context.GetContext()->GetParserOptions()); auto update = make_shared(context, move(cond), description->schema, description->table, move(update_columns), move(expressions)); update->Execute(); } void TableRelation::Delete(const string &condition) { - auto cond = ParseCondition(context, condition); + auto cond = ParseCondition(*context.GetContext(), condition); auto del = make_shared(context, move(cond), description->schema, description->table); del->Execute(); } @@ -116074,6 +125173,8 @@ class UpdateStatement : public SQLStatement { unique_ptr from_table; vector columns; vector> expressions; + //! keep track of optional returningList if statement contains a RETURNING keyword + vector> returning_list; protected: UpdateStatement(const UpdateStatement &other); @@ -116090,13 +125191,13 @@ class UpdateStatement : public SQLStatement { namespace duckdb { -UpdateRelation::UpdateRelation(ClientContext &context, unique_ptr condition_p, string schema_name_p, - string table_name_p, vector update_columns_p, +UpdateRelation::UpdateRelation(ClientContextWrapper &context, unique_ptr condition_p, + string schema_name_p, string table_name_p, vector update_columns_p, vector> expressions_p) : Relation(context, RelationType::UPDATE_RELATION), condition(move(condition_p)), schema_name(move(schema_name_p)), table_name(move(table_name_p)), update_columns(move(update_columns_p)), expressions(move(expressions_p)) { D_ASSERT(update_columns.size() == expressions.size()); - context.TryBindRelation(*this, this->columns); + context.GetContext()->TryBindRelation(*this, this->columns); } BoundStatement UpdateRelation::Bind(Binder &binder) { @@ -116180,8 +125281,8 @@ class ExpressionListRef : public TableRef { namespace duckdb { -ValueRelation::ValueRelation(ClientContext &context, const vector> &values, vector names_p, - string alias_p) +ValueRelation::ValueRelation(const std::shared_ptr &context, const vector> &values, + vector names_p, string alias_p) : Relation(context, RelationType::VALUE_LIST_RELATION), names(move(names_p)), alias(move(alias_p)) { // create constant expressions for the values for (idx_t row_idx = 0; row_idx < values.size(); row_idx++) { @@ -116192,13 +125293,14 @@ ValueRelation::ValueRelation(ClientContext &context, const vector> } this->expressions.push_back(move(expressions)); } - context.TryBindRelation(*this, this->columns); + context->TryBindRelation(*this, this->columns); } -ValueRelation::ValueRelation(ClientContext &context, const string &values_list, vector names_p, string alias_p) +ValueRelation::ValueRelation(const std::shared_ptr &context, const string &values_list, + vector names_p, string alias_p) : Relation(context, RelationType::VALUE_LIST_RELATION), names(move(names_p)), alias(move(alias_p)) { - this->expressions = Parser::ParseValuesList(values_list, context.GetParserOptions()); - context.TryBindRelation(*this, this->columns); + this->expressions = Parser::ParseValuesList(values_list, context->GetParserOptions()); + context->TryBindRelation(*this, this->columns); } unique_ptr ValueRelation::GetQueryNode() { @@ -116269,9 +125371,9 @@ string ValueRelation::ToString(idx_t depth) { namespace duckdb { -ViewRelation::ViewRelation(ClientContext &context, string schema_name_p, string view_name_p) +ViewRelation::ViewRelation(const std::shared_ptr &context, string schema_name_p, string view_name_p) : Relation(context, RelationType::VIEW_RELATION), schema_name(move(schema_name_p)), view_name(move(view_name_p)) { - context.TryBindRelation(*this, this->columns); + context->TryBindRelation(*this, this->columns); } unique_ptr ViewRelation::GetQueryNode() { @@ -116374,7 +125476,7 @@ namespace duckdb { WriteCSVRelation::WriteCSVRelation(shared_ptr child_p, string csv_file_p) : Relation(child_p->context, RelationType::WRITE_CSV_RELATION), child(move(child_p)), csv_file(move(csv_file_p)) { - context.TryBindRelation(*this, this->columns); + context.GetContext()->TryBindRelation(*this, this->columns); } BoundStatement WriteCSVRelation::Bind(Binder &binder) { @@ -116436,7 +125538,7 @@ shared_ptr Relation::Project(const string &expression, const string &a } shared_ptr Relation::Project(const string &select_list, const vector &aliases) { - auto expressions = Parser::ParseExpressionList(select_list, context.GetParserOptions()); + auto expressions = Parser::ParseExpressionList(select_list, context.GetContext()->GetParserOptions()); return make_shared(shared_from_this(), move(expressions), aliases); } @@ -116462,12 +125564,12 @@ static vector> StringListToExpressionList(ClientCon } shared_ptr Relation::Project(const vector &expressions, const vector &aliases) { - auto result_list = StringListToExpressionList(context, expressions); + auto result_list = StringListToExpressionList(*context.GetContext(), expressions); return make_shared(shared_from_this(), move(result_list), aliases); } shared_ptr Relation::Filter(const string &expression) { - auto expression_list = Parser::ParseExpressionList(expression, context.GetParserOptions()); + auto expression_list = Parser::ParseExpressionList(expression, context.GetContext()->GetParserOptions()); if (expression_list.size() != 1) { throw ParserException("Expected a single expression as filter condition"); } @@ -116476,7 +125578,7 @@ shared_ptr Relation::Filter(const string &expression) { shared_ptr Relation::Filter(const vector &expressions) { // if there are multiple expressions, we AND them together - auto expression_list = StringListToExpressionList(context, expressions); + auto expression_list = StringListToExpressionList(*context.GetContext(), expressions); D_ASSERT(!expression_list.empty()); auto expr = move(expression_list[0]); @@ -116492,7 +125594,7 @@ shared_ptr Relation::Limit(int64_t limit, int64_t offset) { } shared_ptr Relation::Order(const string &expression) { - auto order_list = Parser::ParseOrderList(expression, context.GetParserOptions()); + auto order_list = Parser::ParseOrderList(expression, context.GetContext()->GetParserOptions()); return make_shared(shared_from_this(), move(order_list)); } @@ -116502,7 +125604,7 @@ shared_ptr Relation::Order(const vector &expressions) { } vector order_list; for (auto &expression : expressions) { - auto inner_list = Parser::ParseOrderList(expression, context.GetParserOptions()); + auto inner_list = Parser::ParseOrderList(expression, context.GetContext()->GetParserOptions()); if (inner_list.size() != 1) { throw ParserException("Expected a single ORDER BY expression in the expression list"); } @@ -116512,7 +125614,7 @@ shared_ptr Relation::Order(const vector &expressions) { } shared_ptr Relation::Join(const shared_ptr &other, const string &condition, JoinType type) { - auto expression_list = Parser::ParseExpressionList(condition, context.GetParserOptions()); + auto expression_list = Parser::ParseExpressionList(condition, context.GetContext()->GetParserOptions()); D_ASSERT(!expression_list.empty()); if (expression_list.size() > 1 || expression_list[0]->type == ExpressionType::COLUMN_REF) { @@ -116560,24 +125662,24 @@ shared_ptr Relation::Alias(const string &alias) { } shared_ptr Relation::Aggregate(const string &aggregate_list) { - auto expression_list = Parser::ParseExpressionList(aggregate_list, context.GetParserOptions()); + auto expression_list = Parser::ParseExpressionList(aggregate_list, context.GetContext()->GetParserOptions()); return make_shared(shared_from_this(), move(expression_list)); } shared_ptr Relation::Aggregate(const string &aggregate_list, const string &group_list) { - auto expression_list = Parser::ParseExpressionList(aggregate_list, context.GetParserOptions()); - auto groups = Parser::ParseExpressionList(group_list, context.GetParserOptions()); + auto expression_list = Parser::ParseExpressionList(aggregate_list, context.GetContext()->GetParserOptions()); + auto groups = Parser::ParseExpressionList(group_list, context.GetContext()->GetParserOptions()); return make_shared(shared_from_this(), move(expression_list), move(groups)); } shared_ptr Relation::Aggregate(const vector &aggregates) { - auto aggregate_list = StringListToExpressionList(context, aggregates); + auto aggregate_list = StringListToExpressionList(*context.GetContext(), aggregates); return make_shared(shared_from_this(), move(aggregate_list)); } shared_ptr Relation::Aggregate(const vector &aggregates, const vector &groups) { - auto aggregate_list = StringListToExpressionList(context, aggregates); - auto group_list = StringListToExpressionList(context, groups); + auto aggregate_list = StringListToExpressionList(*context.GetContext(), aggregates); + auto group_list = StringListToExpressionList(*context.GetContext(), groups); return make_shared(shared_from_this(), move(aggregate_list), move(group_list)); } @@ -116592,7 +125694,7 @@ unique_ptr Relation::GetTableRef() { } unique_ptr Relation::Execute() { - return context.Execute(shared_from_this()); + return context.GetContext()->Execute(shared_from_this()); } BoundStatement Relation::Bind(Binder &binder) { @@ -116615,7 +125717,7 @@ void Relation::Insert(const string &schema_name, const string &table_name) { void Relation::Insert(const vector> &values) { vector column_names; - auto rel = make_shared(context, values, move(column_names), "values"); + auto rel = make_shared(context.GetContext(), values, move(column_names), "values"); rel->Insert(GetAlias()); } @@ -116649,7 +125751,7 @@ shared_ptr Relation::CreateView(const string &name, bool replace, bool } unique_ptr Relation::Query(const string &sql) { - return context.Query(sql, false); + return context.GetContext()->Query(sql, false); } unique_ptr Relation::Query(const string &name, const string &sql) { @@ -116672,11 +125774,12 @@ void Relation::Delete(const string &condition) { shared_ptr Relation::TableFunction(const std::string &fname, const vector &values, const named_parameter_map_t &named_parameters) { - return make_shared(context, fname, values, named_parameters, shared_from_this()); + return make_shared(context.GetContext(), fname, values, named_parameters, + shared_from_this()); } shared_ptr Relation::TableFunction(const std::string &fname, const vector &values) { - return make_shared(context, fname, values, shared_from_this()); + return make_shared(context.GetContext(), fname, values, shared_from_this()); } string Relation::ToString() { @@ -117930,7 +127033,6 @@ class DeliminatorPlanUpdater : LogicalOperatorVisitor { void VisitExpression(unique_ptr *expression) override; //! Whether the operator has one or more children of type DELIM_GET bool HasChildDelimGet(LogicalOperator &op); - expression_map_t expr_map; column_binding_map_t projection_map; unique_ptr temp_ptr; @@ -117939,12 +127041,12 @@ class DeliminatorPlanUpdater : LogicalOperatorVisitor { void DeliminatorPlanUpdater::VisitOperator(LogicalOperator &op) { VisitOperatorChildren(op); VisitOperatorExpressions(op); - // now check if this is a delim join that can be removed if (op.type == LogicalOperatorType::LOGICAL_DELIM_JOIN && !HasChildDelimGet(op)) { auto &delim_join = (LogicalDelimJoin &)op; auto decs = &delim_join.duplicate_eliminated_columns; for (auto &cond : delim_join.conditions) { - if (cond.comparison != ExpressionType::COMPARE_EQUAL) { + if (cond.comparison != ExpressionType::COMPARE_EQUAL && + cond.comparison != ExpressionType::COMPARE_NOT_DISTINCT_FROM) { continue; } auto &colref = (BoundColumnRefExpression &)*cond.right; @@ -117958,7 +127060,7 @@ void DeliminatorPlanUpdater::VisitOperator(LogicalOperator &op) { } } // whether we applied an IS NOT NULL filter - cond.null_values_are_equal = true; // projection_map[colref.binding]; + cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; } } // change type if there are no more duplicate-eliminated columns @@ -118055,6 +127157,7 @@ bool Deliminator::RemoveCandidate(unique_ptr *op_ptr, Deliminat if (join.join_type != JoinType::INNER && join.join_type != JoinType::SEMI) { return false; } + // get the index (left or right) of the DelimGet side of the join idx_t delim_idx = OperatorIsDelimGet(*join.children[0]) ? 0 : 1; D_ASSERT(OperatorIsDelimGet(*join.children[delim_idx])); @@ -118071,7 +127174,8 @@ bool Deliminator::RemoveCandidate(unique_ptr *op_ptr, Deliminat // check if joining with the DelimGet is redundant, and collect relevant column information vector nulls_are_not_equal_exprs; for (auto &cond : join.conditions) { - if (cond.comparison != ExpressionType::COMPARE_EQUAL) { + if (cond.comparison != ExpressionType::COMPARE_EQUAL && + cond.comparison != ExpressionType::COMPARE_NOT_DISTINCT_FROM) { // non-equality join condition return false; } @@ -118083,7 +127187,7 @@ bool Deliminator::RemoveCandidate(unique_ptr *op_ptr, Deliminat return false; } updater.expr_map[delim_side] = other_side; - if (!cond.null_values_are_equal) { + if (cond.comparison != ExpressionType::COMPARE_NOT_DISTINCT_FROM) { nulls_are_not_equal_exprs.push_back(other_side); } } @@ -120101,6 +129205,8 @@ class FilterPushdown { unique_ptr PushdownSetOperation(unique_ptr op); //! Push down a LogicalGet op unique_ptr PushdownGet(unique_ptr op); + //! Push down a LogicalLimit op + unique_ptr PushdownLimit(unique_ptr op); // Pushdown an inner join unique_ptr PushdownInnerJoin(unique_ptr op, unordered_set &left_bindings, unordered_set &right_bindings); @@ -120166,6 +129272,8 @@ unique_ptr FilterPushdown::Rewrite(unique_ptr } case LogicalOperatorType::LOGICAL_GET: return PushdownGet(move(op)); + case LogicalOperatorType::LOGICAL_LIMIT: + return PushdownLimit(move(op)); default: return FinishPushdown(move(op)); } @@ -121488,15 +130596,8 @@ JoinOrderOptimizer::GenerateJoins(vector> &extracted bool invert = !JoinRelationSet::IsSubset(left.first, f->left_set); cond.left = !invert ? move(comparison.left) : move(comparison.right); cond.right = !invert ? move(comparison.right) : move(comparison.left); - if (condition->type == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { - cond.comparison = ExpressionType::COMPARE_EQUAL; - cond.null_values_are_equal = true; - } else if (condition->type == ExpressionType::COMPARE_DISTINCT_FROM) { - cond.comparison = condition->type; - cond.null_values_are_equal = true; - } else { - cond.comparison = condition->type; - } + cond.comparison = condition->type; + if (invert) { // reverse comparison expression if we reverse the order of the children cond.comparison = FlipComparisionExpression(cond.comparison); @@ -123096,6 +132197,25 @@ unique_ptr FilterPushdown::PushdownLeftJoin(unique_ptr FilterPushdown::PushdownLimit(unique_ptr op) { + auto &limit = (LogicalLimit &)*op; + + if (!limit.limit && limit.limit_val == 0) { + return make_unique(move(op)); + } + + return FinishPushdown(move(op)); +} + +} // namespace duckdb + + + + namespace duckdb { using Filter = FilterPushdown::Filter; @@ -123148,7 +132268,8 @@ unique_ptr FilterPushdown::PushdownMarkJoin(unique_ptr StatisticsPropagator::PropagateExpression(BoundAggreg + namespace duckdb { unique_ptr CastHugeintToSmallestType(unique_ptr expr, NumericStatistics &num_stats) { @@ -124821,23 +133956,21 @@ unique_ptr TemplatedCastToSmallestType(unique_ptr expr, return expr; } - // Prevent signed integer overflow - we can't range map these - if (std::is_signed() && signed_min_val < -((T)1 << (sizeof(T) * 8 - 2)) && - signed_max_val > ((T)1 << (sizeof(T) * 8 - 2))) { + // Compute range, cast to unsigned to prevent comparing signed with unsigned + T signed_range; + if (!TrySubtractOperator::Operation(signed_min_val, signed_max_val, signed_range)) { + // overflow in subtraction: cannot do any simplification return expr; } - - // Compute range, cast to unsigned to prevent comparing signed with unsigned - auto signed_range = signed_max_val - signed_min_val; auto range = static_cast::type>(signed_range); // Check if this range fits in a smaller type LogicalType cast_type; - if (range < NumericLimits().Maximum()) { + if (range < NumericLimits::Maximum()) { cast_type = LogicalType::UTINYINT; - } else if (sizeof(T) > sizeof(uint16_t) && range < NumericLimits().Maximum()) { + } else if (sizeof(T) > sizeof(uint16_t) && range < NumericLimits::Maximum()) { cast_type = LogicalType::USMALLINT; - } else if (sizeof(T) > sizeof(uint32_t) && range < NumericLimits().Maximum()) { + } else if (sizeof(T) > sizeof(uint32_t) && range < NumericLimits::Maximum()) { cast_type = LogicalType::UINTEGER; } else { return expr; @@ -125798,7 +134931,9 @@ void StatisticsPropagator::PropagateStatistics(LogicalComparisonJoin &join, uniq auto stats_left = PropagateExpression(condition.left); auto stats_right = PropagateExpression(condition.right); if (stats_left && stats_right) { - if (condition.null_values_are_equal && stats_left->CanHaveNull() && stats_right->CanHaveNull()) { + if ((condition.comparison == ExpressionType::COMPARE_DISTINCT_FROM || + condition.comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM) && + stats_left->CanHaveNull() && stats_right->CanHaveNull()) { // null values are equal in this join, and both sides can have null values // nothing to do here continue; @@ -125886,7 +135021,8 @@ void StatisticsPropagator::PropagateStatistics(LogicalComparisonJoin &join, uniq // anti joins have inverse statistics propagation // (i.e. if we have an anti join on i: [0, 100] and j: [0, 25], the resulting stats are i:[25,100]) // for now we don't handle anti joins - if (condition.null_values_are_equal) { + if (condition.comparison == ExpressionType::COMPARE_DISTINCT_FROM || + condition.comparison == ExpressionType::COMPARE_NOT_DISTINCT_FROM) { // skip update when null values are equal (for now?) continue; } @@ -125948,11 +135084,17 @@ unique_ptr StatisticsPropagator::PropagateStatistics(LogicalJoin } auto join_type = join.join_type; + // depending on the join type, we might need to alter the statistics + // LEFT, FULL, RIGHT OUTER and SINGLE joins can introduce null values + // this requires us to alter the statistics after this point in the query plan + bool adds_null_on_left = IsRightOuterJoin(join_type); + bool adds_null_on_right = IsLeftOuterJoin(join_type) || join_type == JoinType::SINGLE; + vector left_bindings, right_bindings; - if (IsRightOuterJoin(join_type)) { + if (adds_null_on_left) { left_bindings = join.children[0]->GetColumnBindings(); } - if (IsLeftOuterJoin(join_type)) { + if (adds_null_on_right) { right_bindings = join.children[1]->GetColumnBindings(); } @@ -125968,10 +135110,7 @@ unique_ptr StatisticsPropagator::PropagateStatistics(LogicalJoin break; } - // now depending on the join type, we might need to alter the statistics - // LEFT, FULL and RIGHT OUTER joins can introduce null values - // this requires us to alter the statistics after this point in the query plan - if (IsLeftOuterJoin(join_type)) { + if (adds_null_on_right) { // left or full outer join: set IsNull() to true for all rhs statistics for (auto &binding : right_bindings) { auto stats = statistics_map.find(binding); @@ -125980,7 +135119,7 @@ unique_ptr StatisticsPropagator::PropagateStatistics(LogicalJoin } } } - if (IsRightOuterJoin(join_type)) { + if (adds_null_on_left) { // right or full outer join: set IsNull() to true for all lhs statistics for (auto &binding : left_bindings) { auto stats = statistics_map.find(binding); @@ -126365,6 +135504,7 @@ void Event::SetTasks(vector> tasks) { + //===----------------------------------------------------------------------===// // DuckDB // @@ -126982,6 +136122,7 @@ void Executor::AddChildPipeline(Pipeline *current) { void Executor::BuildPipelines(PhysicalOperator *op, Pipeline *current) { D_ASSERT(current); + op->op_state.reset(); if (op->IsSink()) { // operator is a sink, build a pipeline op->sink_state.reset(); @@ -127040,6 +136181,35 @@ void Executor::BuildPipelines(PhysicalOperator *op, Pipeline *current) { } BuildPipelines(op->children[0].get(), current); break; + case PhysicalOperatorType::IE_JOIN: { + D_ASSERT(op->children.size() == 2); + if (recursive_cte) { + throw NotImplementedException("IEJoins are not supported in recursive CTEs yet"); + } + + // Build the LHS + auto lhs_pipeline = make_shared(*this); + lhs_pipeline->sink = op; + D_ASSERT(op->children[0].get()); + BuildPipelines(op->children[0].get(), lhs_pipeline.get()); + + // Build the RHS + auto rhs_pipeline = make_shared(*this); + rhs_pipeline->sink = op; + D_ASSERT(op->children[1].get()); + BuildPipelines(op->children[1].get(), rhs_pipeline.get()); + + // RHS => LHS => current + current->AddDependency(rhs_pipeline); + rhs_pipeline->AddDependency(lhs_pipeline); + + pipelines.emplace_back(move(lhs_pipeline)); + pipelines.emplace_back(move(rhs_pipeline)); + + // Now build both and scan + current->source = op; + return; + } case PhysicalOperatorType::DELIM_JOIN: { // duplicate eliminated join // for delim joins, recurse into the actual join @@ -127366,12 +136536,33 @@ bool Pipeline::GetProgressInternal(ClientContext &context, PhysicalOperator *op, current_percentage = get.function.table_scan_progress(context, get.bind_data.get()); return true; } - //! If the table_scan_progress is not implemented it means we don't support this function yet in the progress - //! bar + // If the table_scan_progress is not implemented it means we don't support this function yet in the progress + // bar return false; } - default: - return false; + // If it is not a table scan we go down on all children until we reach the leaf operators + default: { + vector progress; + vector cardinality; + double total_cardinality = 0; + current_percentage = 0; + for (auto &op_child : op->children) { + double child_percentage = 0; + if (!GetProgressInternal(context, op_child.get(), child_percentage)) { + return false; + } + if (!Value::DoubleIsFinite(child_percentage)) { + return false; + } + progress.push_back(child_percentage); + cardinality.push_back(op_child->estimated_cardinality); + total_cardinality += op_child->estimated_cardinality; + } + for (size_t i = 0; i < progress.size(); i++) { + current_percentage += progress[i] * cardinality[i] / total_cardinality; + } + return true; + } } } // LCOV_EXCL_STOP @@ -127437,6 +136628,13 @@ void Pipeline::Reset() { if (sink && !sink->sink_state) { sink->sink_state = sink->GetGlobalSinkState(GetClientContext()); } + + for (auto &op : operators) { + if (op && !op->op_state) { + op->op_state = op->GetGlobalOperatorState(GetClientContext()); + } + } + ResetSource(); } @@ -127805,7 +137003,7 @@ OperatorResultType PipelineExecutor::Execute(DataChunk &input, DataChunk &result // if current_idx > source_idx, we pass the previous' operators output through the Execute of the current // operator StartOperator(current_operator); - auto result = current_operator->Execute(context, prev_chunk, current_chunk, + auto result = current_operator->Execute(context, prev_chunk, current_chunk, *current_operator->op_state, *intermediate_states[current_intermediate - 1]); EndOperator(current_operator, ¤t_chunk); if (result == OperatorResultType::HAVE_MORE_OUTPUT) { @@ -127898,7 +137096,7 @@ void PipelineFinishEvent::FinishEvent() { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #8 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 // See the end of this file for a list // Provides a C++11 implementation of a multi-producer, multi-consumer lock-free queue. @@ -131575,7 +140773,7 @@ inline void swap(typename ConcurrentQueue::ImplicitProducerKVP& a, ty // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #8 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 // See the end of this file for a list // Provides an efficient implementation of a semaphore (LightweightSemaphore). @@ -132237,6 +141435,9 @@ bool BaseExpression::Equals(const BaseExpression *other) const { return true; } +void BaseExpression::Verify() const { +} + } // namespace duckdb @@ -132313,6 +141514,9 @@ unique_ptr Constraint::Deserialize(Deserializer &source) { case ConstraintType::UNIQUE: result = UniqueConstraint::Deserialize(reader); break; + case ConstraintType::FOREIGN_KEY: + result = ForeignKeyConstraint::Deserialize(reader); + break; default: throw InternalException("Unrecognized constraint type for serialization"); } @@ -132357,6 +141561,82 @@ unique_ptr CheckConstraint::Deserialize(FieldReader &source) { + + +namespace duckdb { + +ForeignKeyConstraint::ForeignKeyConstraint(vector pk_columns, vector fk_columns, ForeignKeyInfo info) + : Constraint(ConstraintType::FOREIGN_KEY), pk_columns(move(pk_columns)), fk_columns(move(fk_columns)), + info(move(info)) { +} + +string ForeignKeyConstraint::ToString() const { + if (info.type == ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE) { + string base = "FOREIGN KEY ("; + + for (idx_t i = 0; i < fk_columns.size(); i++) { + if (i > 0) { + base += ", "; + } + base += KeywordHelper::WriteOptionallyQuoted(fk_columns[i]); + } + base += ") REFERENCES "; + if (!info.schema.empty()) { + base += info.schema; + base += "."; + } + base += info.table; + base += "("; + + for (idx_t i = 0; i < pk_columns.size(); i++) { + if (i > 0) { + base += ", "; + } + base += KeywordHelper::WriteOptionallyQuoted(pk_columns[i]); + } + base += ")"; + + return base; + } + + return ""; +} + +unique_ptr ForeignKeyConstraint::Copy() const { + return make_unique(pk_columns, fk_columns, info); +} + +void ForeignKeyConstraint::Serialize(FieldWriter &writer) const { + D_ASSERT(pk_columns.size() <= NumericLimits::Maximum()); + writer.WriteList(pk_columns); + D_ASSERT(fk_columns.size() <= NumericLimits::Maximum()); + writer.WriteList(fk_columns); + writer.WriteField(info.type); + writer.WriteString(info.schema); + writer.WriteString(info.table); + writer.WriteList(info.pk_keys); + writer.WriteList(info.fk_keys); +} + +unique_ptr ForeignKeyConstraint::Deserialize(FieldReader &source) { + ForeignKeyInfo read_info; + auto pk_columns = source.ReadRequiredList(); + auto fk_columns = source.ReadRequiredList(); + read_info.type = source.ReadRequired(); + read_info.schema = source.ReadRequired(); + read_info.table = source.ReadRequired(); + read_info.pk_keys = source.ReadRequiredList(); + read_info.fk_keys = source.ReadRequiredList(); + + // column list parsed constraint + return make_unique(pk_columns, fk_columns, move(read_info)); +} + +} // namespace duckdb + + + + namespace duckdb { NotNullConstraint::NotNullConstraint(column_t index) : Constraint(ConstraintType::NOT_NULL), index(index) { @@ -132476,6 +141756,12 @@ class BetweenExpression : public ParsedExpression { void Serialize(FieldWriter &writer) const override; static unique_ptr Deserialize(ExpressionType type, FieldReader &source); + +public: + template + static string ToString(const T &entry) { + return entry.input->ToString() + " BETWEEN " + entry.lower->ToString() + " AND " + entry.upper->ToString(); + } }; } // namespace duckdb @@ -132490,7 +141776,7 @@ BetweenExpression::BetweenExpression(unique_ptr input_p, uniqu } string BetweenExpression::ToString() const { - return input->ToString() + " BETWEEN " + lower->ToString() + " AND " + upper->ToString(); + return ToString(*this); } bool BetweenExpression::Equals(const BetweenExpression *a, const BetweenExpression *b) { @@ -132548,7 +141834,7 @@ struct CaseCheck { //! The CaseExpression represents a CASE expression in the query class CaseExpression : public ParsedExpression { public: - CaseExpression(); + DUCKDB_API CaseExpression(); vector case_checks; unique_ptr else_expr; @@ -132562,6 +141848,19 @@ class CaseExpression : public ParsedExpression { void Serialize(FieldWriter &writer) const override; static unique_ptr Deserialize(ExpressionType type, FieldReader &source); + +public: + template + static string ToString(const T &entry) { + string case_str = "CASE "; + for (auto &check : entry.case_checks) { + case_str += " WHEN (" + check.when_expr->ToString() + ")"; + case_str += " THEN (" + check.then_expr->ToString() + ")"; + } + case_str += " ELSE " + entry.else_expr->ToString(); + case_str += " END"; + return case_str; + } }; } // namespace duckdb @@ -132575,13 +141874,7 @@ CaseExpression::CaseExpression() : ParsedExpression(ExpressionType::CASE_EXPR, E } string CaseExpression::ToString() const { - string case_str = "CASE "; - for (auto &check : case_checks) { - case_str += " WHEN (" + check.when_expr->ToString() + ")"; - case_str += " THEN (" + check.then_expr->ToString() + ")"; - } - case_str += " ELSE " + else_expr->ToString(); - return case_str; + return ToString(*this); } bool CaseExpression::Equals(const CaseExpression *a, const CaseExpression *b) { @@ -132660,7 +141953,7 @@ namespace duckdb { //! CastExpression represents a type cast from one SQL type to another SQL type class CastExpression : public ParsedExpression { public: - CastExpression(LogicalType target, unique_ptr child, bool try_cast = false); + DUCKDB_API CastExpression(LogicalType target, unique_ptr child, bool try_cast = false); //! The child of the cast expression unique_ptr child; @@ -132678,6 +141971,13 @@ class CastExpression : public ParsedExpression { void Serialize(FieldWriter &writer) const override; static unique_ptr Deserialize(ExpressionType type, FieldReader &source); + +public: + template + static string ToString(const T &entry) { + return (entry.try_cast ? "TRY_CAST(" : "CAST(") + entry.child->ToString() + " AS " + + entry.cast_type.ToString() + ")"; + } }; } // namespace duckdb @@ -132695,7 +141995,7 @@ CastExpression::CastExpression(LogicalType target, unique_ptr } string CastExpression::ToString() const { - return (try_cast ? "TRY_CAST(" : "CAST(") + child->ToString() + " AS " + cast_type.ToString() + ")"; + return ToString(*this); } bool CastExpression::Equals(const CastExpression *a, const CastExpression *b) { @@ -132780,7 +142080,7 @@ CollateExpression::CollateExpression(string collation_p, unique_ptrToString() + ")"; + return child->ToString() + " COLLATE " + collation; } bool CollateExpression::Equals(const CollateExpression *a, const CollateExpression *b) { @@ -132817,6 +142117,7 @@ unique_ptr CollateExpression::Deserialize(ExpressionType type, + namespace duckdb { ColumnRefExpression::ColumnRefExpression(string column_name, string table_name) @@ -132860,7 +142161,7 @@ string ColumnRefExpression::ToString() const { if (i > 0) { result += "."; } - result += column_names[i]; + result += KeywordHelper::WriteOptionallyQuoted(column_names[i]); } return result; } @@ -132921,7 +142222,7 @@ ComparisonExpression::ComparisonExpression(ExpressionType type, unique_ptrToString() + ExpressionTypeToOperator(type) + right->ToString(); + return ToString(*this); } bool ComparisonExpression::Equals(const ComparisonExpression *a, const ComparisonExpression *b) { @@ -132955,41 +142256,6 @@ unique_ptr ComparisonExpression::Deserialize(ExpressionType ty -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/expression_util.hpp -// -// -//===----------------------------------------------------------------------===// - - - - - - -namespace duckdb { -class ParsedExpression; -class Expression; - -class ExpressionUtil { -public: - //! ListEquals: check if a list of two expressions is equal (order is important) - static bool ListEquals(const vector> &a, - const vector> &b); - static bool ListEquals(const vector> &a, const vector> &b); - //! SetEquals: check if two sets of expressions are equal (order is not important) - static bool SetEquals(const vector> &a, const vector> &b); - static bool SetEquals(const vector> &a, const vector> &b); - -private: - template - static bool ExpressionListEquals(const vector> &a, const vector> &b); - template - static bool ExpressionSetEquals(const vector> &a, const vector> &b); -}; - -} // namespace duckdb namespace duckdb { @@ -133025,11 +142291,7 @@ void ConjunctionExpression::AddExpression(unique_ptr expr) { } string ConjunctionExpression::ToString() const { - string result = children[0]->ToString(); - for (idx_t i = 1; i < children.size(); i++) { - result += " " + ExpressionTypeToOperator(type) + " " + children[i]->ToString(); - } - return result; + return ToString(*this); } bool ConjunctionExpression::Equals(const ConjunctionExpression *a, const ConjunctionExpression *b) { @@ -133071,7 +142333,7 @@ ConstantExpression::ConstantExpression(Value val) } string ConstantExpression::ToString() const { - return value.ToString(); + return value.ToSQLString(); } bool ConstantExpression::Equals(const ConstantExpression *a, const ConstantExpression *b) { @@ -133169,10 +142431,11 @@ namespace duckdb { FunctionExpression::FunctionExpression(string schema, const string &function_name, vector> children_p, unique_ptr filter, unique_ptr order_bys_p, - bool distinct, bool is_operator) + bool distinct, bool is_operator, bool export_state_p) : ParsedExpression(ExpressionType::FUNCTION, ExpressionClass::FUNCTION), schema(std::move(schema)), function_name(StringUtil::Lower(function_name)), is_operator(is_operator), children(move(children_p)), - distinct(distinct), filter(move(filter)), order_bys(move(order_bys_p)) { + distinct(distinct), filter(move(filter)), order_bys(move(order_bys_p)), export_state(export_state_p) { + D_ASSERT(!function_name.empty()); if (!order_bys) { order_bys = make_unique(); } @@ -133180,39 +142443,14 @@ FunctionExpression::FunctionExpression(string schema, const string &function_nam FunctionExpression::FunctionExpression(const string &function_name, vector> children_p, unique_ptr filter, unique_ptr order_bys, - bool distinct, bool is_operator) + bool distinct, bool is_operator, bool export_state_p) : FunctionExpression(INVALID_SCHEMA, function_name, move(children_p), move(filter), move(order_bys), distinct, - is_operator) { + is_operator, export_state_p) { } string FunctionExpression::ToString() const { - if (is_operator) { - // built-in operator - if (children.size() == 1) { - return function_name + children[0]->ToString(); - } else if (children.size() == 2) { - return children[0]->ToString() + " " + function_name + " " + children[1]->ToString(); - } - } - // standard function call - string result = function_name + "("; - result += StringUtil::Join(children, children.size(), ", ", - [](const unique_ptr &child) { return child->ToString(); }); - - // filtered aggregate - if (filter) { - result += " FILTER " + filter->ToString(); - } - - // ordered aggregate - if (!order_bys->orders.empty()) { - result += " ORDER BY"; - for (const auto &order : order_bys->orders) { - result += " " + order.ToString(); - } - } - - return result + ")"; + return ToString(*this, schema, function_name, is_operator, distinct, + filter.get(), order_bys.get(), export_state); } bool FunctionExpression::Equals(const FunctionExpression *a, const FunctionExpression *b) { @@ -133233,6 +142471,9 @@ bool FunctionExpression::Equals(const FunctionExpression *a, const FunctionExpre if (!a->order_bys->Equals(b->order_bys.get())) { return false; } + if (a->export_state != b->export_state) { + return false; + } return true; } @@ -133241,6 +142482,7 @@ hash_t FunctionExpression::Hash() const { result = CombineHash(result, duckdb::Hash(schema.c_str())); result = CombineHash(result, duckdb::Hash(function_name.c_str())); result = CombineHash(result, duckdb::Hash(distinct)); + result = CombineHash(result, duckdb::Hash(export_state)); return result; } @@ -133259,7 +142501,7 @@ unique_ptr FunctionExpression::Copy() const { } auto copy = make_unique(function_name, move(copy_children), move(filter_copy), move(order_copy), - distinct, is_operator); + distinct, is_operator, export_state); copy->schema = schema; copy->CopyProperties(*this); return move(copy); @@ -133273,6 +142515,7 @@ void FunctionExpression::Serialize(FieldWriter &writer) const { writer.WriteSerializable((ResultModifier &)*order_bys); writer.WriteField(distinct); writer.WriteField(is_operator); + writer.WriteField(export_state); } unique_ptr FunctionExpression::Deserialize(ExpressionType type, FieldReader &reader) { @@ -133283,13 +142526,19 @@ unique_ptr FunctionExpression::Deserialize(ExpressionType type auto order_bys = unique_ptr_cast(reader.ReadRequiredSerializable()); auto distinct = reader.ReadRequired(); auto is_operator = reader.ReadRequired(); + auto export_state = reader.ReadField(false); + unique_ptr function; function = make_unique(function_name, move(children), move(filter), move(order_bys), distinct, - is_operator); + is_operator, export_state); function->schema = schema; return move(function); } +void FunctionExpression::Verify() const { + D_ASSERT(!function_name.empty()); +} + } // namespace duckdb //===----------------------------------------------------------------------===// // DuckDB @@ -133306,14 +142555,16 @@ unique_ptr FunctionExpression::Deserialize(ExpressionType type namespace duckdb { -//! LambdaExpression represents a lambda operator that can be used for e.g. mapping an expression to a list +//! LambdaExpression represents either: +//! 1. A lambda operator that can be used for e.g. mapping an expression to a list +//! 2. An OperatorExpression with the "->" operator //! Lambda expressions are written in the form of "capture -> expr", e.g. "x -> x + 1" class LambdaExpression : public ParsedExpression { public: - LambdaExpression(vector parameters, unique_ptr expression); + LambdaExpression(unique_ptr lhs, unique_ptr rhs); - vector parameters; - unique_ptr expression; + unique_ptr lhs; + unique_ptr rhs; public: string ToString() const override; @@ -133334,59 +142585,38 @@ class LambdaExpression : public ParsedExpression { namespace duckdb { -LambdaExpression::LambdaExpression(vector parameters, unique_ptr expression) - : ParsedExpression(ExpressionType::LAMBDA, ExpressionClass::LAMBDA), parameters(move(parameters)), - expression(move(expression)) { +LambdaExpression::LambdaExpression(unique_ptr lhs, unique_ptr rhs) + : ParsedExpression(ExpressionType::LAMBDA, ExpressionClass::LAMBDA), lhs(move(lhs)), rhs(move(rhs)) { } string LambdaExpression::ToString() const { - string parameter_str; - if (parameters.size() == 1) { - parameter_str = parameters[0]; - } else { - for (auto ¶meter : parameters) { - if (!parameter_str.empty()) { - parameter_str += ", "; - } - parameter_str += parameter; - } - parameter_str = "(" + parameter_str + ")"; - } - return parameter_str + " -> " + expression->ToString(); + return lhs->ToString() + " -> " + rhs->ToString(); } bool LambdaExpression::Equals(const LambdaExpression *a, const LambdaExpression *b) { - if (a->parameters != b->parameters) { - return false; - } - if (!a->expression->Equals(b->expression.get())) { - return false; - } - return true; + return a->lhs->Equals(b->lhs.get()) && a->rhs->Equals(b->rhs.get()); } hash_t LambdaExpression::Hash() const { - hash_t result = ParsedExpression::Hash(); - for (auto ¶meter : parameters) { - result = CombineHash(result, duckdb::Hash(parameter.c_str())); - } - result = CombineHash(result, expression->Hash()); + hash_t result = lhs->Hash(); + ParsedExpression::Hash(); + result = CombineHash(result, rhs->Hash()); return result; } unique_ptr LambdaExpression::Copy() const { - return make_unique(parameters, expression->Copy()); + return make_unique(lhs->Copy(), rhs->Copy()); } void LambdaExpression::Serialize(FieldWriter &writer) const { - writer.WriteList(parameters); - writer.WriteSerializable(*expression); + writer.WriteSerializable(*lhs); + writer.WriteSerializable(*rhs); } unique_ptr LambdaExpression::Deserialize(ExpressionType type, FieldReader &reader) { - auto parameters = reader.ReadRequiredList(); - auto expression = reader.ReadRequiredSerializable(); - return make_unique(move(parameters), move(expression)); + auto lhs = reader.ReadRequiredSerializable(); + auto rhs = reader.ReadRequiredSerializable(); + return make_unique(move(lhs), move(rhs)); } } // namespace duckdb @@ -133403,13 +142633,15 @@ unique_ptr LambdaExpression::Deserialize(ExpressionType type, + + namespace duckdb { //! Represents a built-in operator expression class OperatorExpression : public ParsedExpression { public: - explicit OperatorExpression(ExpressionType type, unique_ptr left = nullptr, - unique_ptr right = nullptr); - OperatorExpression(ExpressionType type, vector> children); + DUCKDB_API explicit OperatorExpression(ExpressionType type, unique_ptr left = nullptr, + unique_ptr right = nullptr); + DUCKDB_API OperatorExpression(ExpressionType type, vector> children); vector> children; @@ -133422,9 +142654,72 @@ class OperatorExpression : public ParsedExpression { void Serialize(FieldWriter &writer) const override; static unique_ptr Deserialize(ExpressionType type, FieldReader &source); + +public: + template + static string ToString(const T &entry) { + auto op = ExpressionTypeToOperator(entry.type); + if (!op.empty()) { + // use the operator string to represent the operator + D_ASSERT(entry.children.size() == 2); + return entry.children[0]->ToString() + " " + op + " " + entry.children[1]->ToString(); + } + switch (entry.type) { + case ExpressionType::COMPARE_IN: + case ExpressionType::COMPARE_NOT_IN: { + string op_type = entry.type == ExpressionType::COMPARE_IN ? " IN " : " NOT IN "; + string in_child = entry.children[0]->ToString(); + string child_list = "("; + for (idx_t i = 1; i < entry.children.size(); i++) { + if (i > 1) { + child_list += ", "; + } + child_list += entry.children[i]->ToString(); + } + child_list += ")"; + return "(" + in_child + op_type + child_list + ")"; + } + case ExpressionType::OPERATOR_NOT: + case ExpressionType::GROUPING_FUNCTION: + case ExpressionType::OPERATOR_COALESCE: { + string result = ExpressionTypeToString(entry.type); + result += "("; + result += StringUtil::Join(entry.children, entry.children.size(), ", ", + [](const unique_ptr &child) { return child->ToString(); }); + result += ")"; + return result; + } + case ExpressionType::OPERATOR_IS_NULL: + return "(" + entry.children[0]->ToString() + " IS NULL)"; + case ExpressionType::OPERATOR_IS_NOT_NULL: + return "(" + entry.children[0]->ToString() + " IS NOT NULL)"; + case ExpressionType::ARRAY_EXTRACT: + return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + "]"; + case ExpressionType::ARRAY_SLICE: + return entry.children[0]->ToString() + "[" + entry.children[1]->ToString() + ":" + + entry.children[2]->ToString() + "]"; + case ExpressionType::STRUCT_EXTRACT: { + D_ASSERT(entry.children[1]->type == ExpressionType::VALUE_CONSTANT); + auto child_string = entry.children[1]->ToString(); + D_ASSERT(child_string.size() >= 3); + D_ASSERT(child_string[0] == '\'' && child_string[child_string.size() - 1] == '\''); + return "(" + entry.children[0]->ToString() + ")." + + KeywordHelper::WriteOptionallyQuoted(child_string.substr(1, child_string.size() - 2)); + } + case ExpressionType::ARRAY_CONSTRUCTOR: { + string result = "ARRAY["; + result += StringUtil::Join(entry.children, entry.children.size(), ", ", + [](const unique_ptr &child) { return child->ToString(); }); + result += "]"; + return result; + } + default: + throw InternalException("Unrecognized operator type"); + } + } }; -} // namespace duckdb +} // namespace duckdb @@ -133448,21 +142743,7 @@ OperatorExpression::OperatorExpression(ExpressionType type, vectorToString(); - } else if (children.size() == 2) { - return children[0]->ToString() + " " + op + " " + children[1]->ToString(); - } - } - // if there is no operator we render it as a function - auto result = ExpressionTypeToString(type) + "("; - result += StringUtil::Join(children, children.size(), ", ", - [](const unique_ptr &child) { return child->ToString(); }); - result += ")"; - return result; + return ToString(*this); } bool OperatorExpression::Equals(const OperatorExpression *a, const OperatorExpression *b) { @@ -133588,7 +142869,7 @@ unique_ptr ParameterExpression::Deserialize(ExpressionType typ namespace duckdb { class PositionalReferenceExpression : public ParsedExpression { public: - PositionalReferenceExpression(idx_t index); + DUCKDB_API PositionalReferenceExpression(idx_t index); idx_t index; @@ -133664,7 +142945,7 @@ StarExpression::StarExpression(string relation_name_p) string StarExpression::ToString() const { string result = relation_name.empty() ? "*" : relation_name + ".*"; if (!exclude_list.empty()) { - result += " EXCEPT ("; + result += " EXCLUDE ("; bool first_entry = true; for (auto &entry : exclude_list) { if (!first_entry) { @@ -133682,9 +142963,9 @@ string StarExpression::ToString() const { if (!first_entry) { result += ", "; } - result += entry.first; - result += " AS "; result += entry.second->ToString(); + result += " AS "; + result += entry.first; first_entry = false; } result += ")"; @@ -133851,125 +143132,8 @@ WindowExpression::WindowExpression(ExpressionType type, string schema, const str } } -string WindowExpression::GetName() const { - return !alias.empty() ? alias : function_name; -} - string WindowExpression::ToString() const { - // Start with function call - string result = function_name + "("; - result += StringUtil::Join(children, children.size(), ", ", - [](const unique_ptr &child) { return child->ToString(); }); - // Lead/Lag extra arguments - if (offset_expr.get()) { - result += ", "; - result += offset_expr->ToString(); - } - if (default_expr.get()) { - result += ", "; - result += default_expr->ToString(); - } - // IGNORE NULLS - if (ignore_nulls) { - result += " IGNORE NULLS"; - } - // Over clause - result += ") OVER("; - string sep; - - // Partitions - if (!partitions.empty()) { - result += "PARTITION BY "; - result += StringUtil::Join(partitions, partitions.size(), ", ", - [](const unique_ptr &partition) { return partition->ToString(); }); - sep = " "; - } - - // Orders - if (!orders.empty()) { - result += sep; - result += "ORDER BY "; - result += - StringUtil::Join(orders, orders.size(), ", ", [](const OrderByNode &order) { return order.ToString(); }); - sep = " "; - } - - // Rows/Range - string units = "ROWS"; - string from; - switch (start) { - case WindowBoundary::CURRENT_ROW_RANGE: - case WindowBoundary::CURRENT_ROW_ROWS: - from = "CURRENT ROW"; - units = (start == WindowBoundary::CURRENT_ROW_RANGE) ? "RANGE" : "ROWS"; - break; - case WindowBoundary::UNBOUNDED_PRECEDING: - if (end != WindowBoundary::CURRENT_ROW_RANGE) { - from = "UNBOUNDED PRECEDING"; - } - break; - case WindowBoundary::EXPR_PRECEDING_ROWS: - case WindowBoundary::EXPR_PRECEDING_RANGE: - from = start_expr->GetName() + " PRECEDING"; - units = (start == WindowBoundary::EXPR_PRECEDING_RANGE) ? "RANGE" : "ROWS"; - break; - case WindowBoundary::EXPR_FOLLOWING_ROWS: - case WindowBoundary::EXPR_FOLLOWING_RANGE: - from = start_expr->GetName() + " FOLLOWING"; - units = (start == WindowBoundary::EXPR_FOLLOWING_RANGE) ? "RANGE" : "ROWS"; - break; - default: - break; - } - - string to; - switch (end) { - case WindowBoundary::CURRENT_ROW_RANGE: - if (start != WindowBoundary::UNBOUNDED_PRECEDING) { - to = "CURRENT ROW"; - units = "RANGE"; - } - break; - case WindowBoundary::CURRENT_ROW_ROWS: - to = "CURRENT ROW"; - units = "ROWS"; - break; - case WindowBoundary::UNBOUNDED_PRECEDING: - to = "UNBOUNDED PRECEDING"; - break; - case WindowBoundary::EXPR_PRECEDING_ROWS: - case WindowBoundary::EXPR_PRECEDING_RANGE: - to = end_expr->GetName() + " PRECEDING"; - units = (start == WindowBoundary::EXPR_PRECEDING_RANGE) ? "RANGE" : "ROWS"; - break; - case WindowBoundary::EXPR_FOLLOWING_ROWS: - case WindowBoundary::EXPR_FOLLOWING_RANGE: - to = end_expr->GetName() + " FOLLOWING"; - units = (start == WindowBoundary::EXPR_FOLLOWING_RANGE) ? "RANGE" : "ROWS"; - break; - default: - break; - } - - if (!from.empty() || !to.empty()) { - result += sep + units; - } - if (!from.empty() && !to.empty()) { - result += " BETWEEN "; - result += from; - result += " AND "; - result += to; - } else if (!from.empty()) { - result += " "; - result += from; - } else if (!to.empty()) { - result += " "; - result += to; - } - - result += ")"; - - return result; + return ToString(*this, schema, function_name); } bool WindowExpression::Equals(const WindowExpression *a, const WindowExpression *b) { @@ -134297,6 +143461,8 @@ unique_ptr AlterTableInfo::Deserialize(FieldReader &reader) { return ChangeColumnTypeInfo::Deserialize(reader, schema, table); case AlterTableType::SET_DEFAULT: return SetDefaultInfo::Deserialize(reader, schema, table); + case AlterTableType::FOREIGN_KEY_CONSTRAINT: + return AlterForeignKeyInfo::Deserialize(reader, schema, table); default: throw SerializationException("Unknown alter table type for deserialization!"); } @@ -134453,6 +143619,44 @@ unique_ptr SetDefaultInfo::Deserialize(FieldReader &reader, string sc return make_unique(move(schema), move(table), move(column_name), move(new_default)); } +//===--------------------------------------------------------------------===// +// AlterForeignKeyInfo +//===--------------------------------------------------------------------===// +AlterForeignKeyInfo::AlterForeignKeyInfo(string schema_p, string table_p, string fk_table, vector pk_columns, + vector fk_columns, vector pk_keys, vector fk_keys, + AlterForeignKeyType type_p) + : AlterTableInfo(AlterTableType::FOREIGN_KEY_CONSTRAINT, move(schema_p), move(table_p)), fk_table(move(fk_table)), + pk_columns(move(pk_columns)), fk_columns(move(fk_columns)), pk_keys(move(pk_keys)), fk_keys(move(fk_keys)), + type(type_p) { +} +AlterForeignKeyInfo::~AlterForeignKeyInfo() { +} + +unique_ptr AlterForeignKeyInfo::Copy() const { + return make_unique_base(schema, name, fk_table, pk_columns, fk_columns, pk_keys, + fk_keys, type); +} + +void AlterForeignKeyInfo::SerializeAlterTable(FieldWriter &writer) const { + writer.WriteString(fk_table); + writer.WriteList(pk_columns); + writer.WriteList(fk_columns); + writer.WriteList(pk_keys); + writer.WriteList(fk_keys); + writer.WriteField(type); +} + +unique_ptr AlterForeignKeyInfo::Deserialize(FieldReader &reader, string schema, string table) { + auto fk_table = reader.ReadRequired(); + auto pk_columns = reader.ReadRequiredList(); + auto fk_columns = reader.ReadRequiredList(); + auto pk_keys = reader.ReadRequiredList(); + auto fk_keys = reader.ReadRequiredList(); + auto type = reader.ReadRequired(); + return make_unique(move(schema), move(table), move(fk_table), move(pk_columns), + move(fk_columns), move(pk_keys), move(fk_keys), type); +} + //===--------------------------------------------------------------------===// // Alter View //===--------------------------------------------------------------------===// @@ -134935,7 +144139,8 @@ void ParsedExpressionIterator::EnumerateChildren( } case ExpressionClass::LAMBDA: { auto &lambda_expr = (LambdaExpression &)expr; - callback(lambda_expr.expression); + callback(lambda_expr.lhs); + callback(lambda_expr.rhs); break; } case ExpressionClass::OPERATOR: { @@ -134992,6 +144197,52 @@ void ParsedExpressionIterator::EnumerateChildren( } } +void ParsedExpressionIterator::EnumerateQueryNodeModifiers( + QueryNode &node, const std::function &child)> &callback) { + + for (auto &modifier : node.modifiers) { + switch (modifier->type) { + case ResultModifierType::LIMIT_MODIFIER: { + auto &limit_modifier = (LimitModifier &)*modifier; + if (limit_modifier.limit) { + callback(limit_modifier.limit); + } + if (limit_modifier.offset) { + callback(limit_modifier.offset); + } + } break; + + case ResultModifierType::LIMIT_PERCENT_MODIFIER: { + auto &limit_modifier = (LimitPercentModifier &)*modifier; + if (limit_modifier.limit) { + callback(limit_modifier.limit); + } + if (limit_modifier.offset) { + callback(limit_modifier.offset); + } + } break; + + case ResultModifierType::ORDER_MODIFIER: { + auto &order_modifier = (OrderModifier &)*modifier; + for (auto &order : order_modifier.orders) { + callback(order.expression); + } + } break; + + case ResultModifierType::DISTINCT_MODIFIER: { + auto &distinct_modifier = (DistinctModifier &)*modifier; + for (auto &target : distinct_modifier.distinct_on_targets) { + callback(target); + } + } break; + + // do nothing + default: + break; + } + } +} + void ParsedExpressionIterator::EnumerateTableRefChildren( TableRef &ref, const std::function &child)> &callback) { switch (ref.type) { @@ -135075,6 +144326,11 @@ void ParsedExpressionIterator::EnumerateQueryNodeChildren( default: throw NotImplementedException("QueryNode type not implemented for traversal"); } + + if (!node.modifiers.empty()) { + EnumerateQueryNodeModifiers(node, callback); + } + for (auto &kv : node.cte_map) { EnumerateQueryNodeChildren(*kv.second->query->node, callback); } @@ -135105,7 +144361,7 @@ void ParsedExpressionIterator::EnumerateQueryNodeChildren( // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list // this is a bit of a mess from c.h, port.h and some others. Upside is it makes the parser compile with minimal @@ -135217,7 +144473,7 @@ typedef enum PGPostgresAttributIdentityTypes { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -135246,7 +144502,7 @@ typedef enum PGPostgresAttributIdentityTypes { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -135357,7 +144613,7 @@ uint32_t bms_hash_value(const PGBitmapset *a); // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -135410,7 +144666,7 @@ typedef enum PGLockWaitPolicy { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -135434,7 +144690,7 @@ typedef enum PGLockWaitPolicy { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -135507,7 +144763,7 @@ typedef int16_t PGAttrNumber; // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -135551,7 +144807,7 @@ typedef int16_t PGAttrNumber; // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -138008,7 +147264,7 @@ typedef struct PGOnConflictExpr { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -138336,6 +147592,7 @@ typedef struct PGFuncCall { PGList *args; /* the arguments (list of exprs) */ PGList *agg_order; /* ORDER BY (list of PGSortBy) */ PGNode *agg_filter; /* FILTER clause, if any */ + bool export_state; /* EXPORT_STATE clause, if any */ bool agg_within_group; /* ORDER BY appeared in WITHIN GROUP */ bool agg_star; /* argument was really '*' */ bool agg_distinct; /* arguments were labeled DISTINCT */ @@ -139321,6 +148578,7 @@ typedef enum PGObjectType { PG_OBJECT_FOREIGN_SERVER, PG_OBJECT_FOREIGN_TABLE, PG_OBJECT_FUNCTION, + PG_OBJECT_TABLE_MACRO, PG_OBJECT_INDEX, PG_OBJECT_LANGUAGE, PG_OBJECT_LARGEOBJECT, @@ -139722,6 +148980,8 @@ typedef struct PGCreateFunctionStmt { PGRangeVar *name; PGList *params; PGNode *function; + PGNode *query; + char relpersistence; } PGCreateFunctionStmt; /* ---------------------- @@ -140035,7 +149295,7 @@ typedef struct PGSampleOptions { } PGSampleOptions; /* ---------------------- - * Limit Percentage + * Limit Percentage * ---------------------- */ typedef struct PGLimitPercent { @@ -140044,13 +149304,13 @@ typedef struct PGLimitPercent { } PGLimitPercent; /* ---------------------- - * Lambda Function + * Lambda Function (or Arrow Operator) * ---------------------- */ typedef struct PGLambdaFunction { PGNodeTag type; - PGList *parameters; /* list of input parameters */ - PGNode *function; /* lambda expression */ + PGNode *lhs; /* list of input parameters */ + PGNode *rhs; /* lambda expression */ int location; /* token location, or -1 if unknown */ } PGLambdaFunction; @@ -140347,7 +149607,7 @@ class StackChecker { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list //===----------------------------------------------------------------------===// @@ -140366,7 +149626,7 @@ class StackChecker { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list @@ -140438,7 +149698,7 @@ class PostgresParser { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -141533,6 +150793,36 @@ unique_ptr DropStatement::Copy() const { } } // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/statement/execute_statement.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + + +namespace duckdb { + +class ExecuteStatement : public SQLStatement { +public: + ExecuteStatement(); + + string name; + vector> values; + +protected: + ExecuteStatement(const ExecuteStatement &other); + +public: + unique_ptr Copy() const override; +}; +} // namespace duckdb namespace duckdb { @@ -141690,6 +150980,35 @@ unique_ptr PragmaStatement::Copy() const { } } // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/statement/prepare_statement.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + +namespace duckdb { + +class PrepareStatement : public SQLStatement { +public: + PrepareStatement(); + + unique_ptr statement; + string name; + +protected: + PrepareStatement(const PrepareStatement &other); + +public: + unique_ptr Copy() const override; +}; +} // namespace duckdb namespace duckdb { @@ -142374,6 +151693,30 @@ unique_ptr Transformer::TransformConstraint(duckdb_libpgquery::PGLis } return make_unique(TransformExpression(constraint->raw_expr)); } + case duckdb_libpgquery::PG_CONSTR_FOREIGN: { + ForeignKeyInfo fk_info; + fk_info.type = ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE; + if (constraint->pktable->schemaname) { + fk_info.schema = constraint->pktable->schemaname; + } else { + fk_info.schema = ""; + } + fk_info.table = constraint->pktable->relname; + vector pk_columns, fk_columns; + for (auto kc = constraint->fk_attrs->head; kc; kc = kc->next) { + fk_columns.emplace_back(reinterpret_cast(kc->data.ptr_value)->val.str); + } + for (auto kc = constraint->pk_attrs->head; kc; kc = kc->next) { + pk_columns.emplace_back(reinterpret_cast(kc->data.ptr_value)->val.str); + } + if (pk_columns.size() != fk_columns.size()) { + throw ParserException("The number of referencing and referenced columns for foreign keys must be the same"); + } + if (fk_columns.empty()) { + throw ParserException("The set of referencing and referenced columns for foreign keys must be not empty"); + } + return make_unique(pk_columns, fk_columns, move(fk_info)); + } default: throw NotImplementedException("Constraint type not handled yet!"); } @@ -142744,9 +152087,6 @@ unique_ptr Transformer::TransformValue(duckdb_libpgquery::PG } // if there is a decimal or the value is too big to cast as either hugeint or bigint double dbl_value = Cast::Operation(str_val); - if (!Value::DoubleIsValid(dbl_value)) { - throw ParserException("Double value \"%s\" is out of range!", val.val.str); - } return make_unique(Value::DOUBLE(dbl_value)); } case duckdb_libpgquery::T_PGNull: @@ -142966,7 +152306,6 @@ unique_ptr Transformer::TransformFuncCall(duckdb_libpgquery::P function_name = reinterpret_cast(name->head->next->data.ptr_value)->val.str; } else { // unqualified name - // schema = DEFAULT_SCHEMA; schema = INVALID_SCHEMA; function_name = reinterpret_cast(name->head->data.ptr_value)->val.str; } @@ -142985,6 +152324,9 @@ unique_ptr Transformer::TransformFuncCall(duckdb_libpgquery::P if (root->agg_filter) { throw ParserException("FILTER is not implemented for window functions!"); } + if (root->export_state) { + throw ParserException("EXPORT_STATE is not supported for window functions!"); + } const auto win_fun_type = WindowToExpressionType(lowercase_name); if (win_fun_type == ExpressionType::INVALID) { @@ -143139,8 +152481,9 @@ unique_ptr Transformer::TransformFuncCall(duckdb_libpgquery::P } auto function = make_unique(schema, lowercase_name.c_str(), move(children), move(filter_expr), - move(order_bys), root->agg_distinct); + move(order_bys), root->agg_distinct, false, root->export_state); function->query_location = root->location; + return move(function); } @@ -143348,34 +152691,15 @@ unique_ptr Transformer::TransformNullTest(duckdb_libpgquery::P - namespace duckdb { -static string ExtractColumnFromLambda(ParsedExpression &expr) { - if (expr.type != ExpressionType::COLUMN_REF) { - throw ParserException("Lambda parameter must be a column name"); - } - auto &colref = (ColumnRefExpression &)expr; - if (colref.IsQualified()) { - throw ParserException("Lambda parameter must be an unqualified name (e.g. 'x', not 'a.x')"); - } - return colref.column_names[0]; -} - unique_ptr Transformer::TransformLambda(duckdb_libpgquery::PGLambdaFunction *node) { - if (!node->parameters) { + if (!node->lhs) { throw ParserException("Lambda function must have parameters"); } - vector> parameter_expressions; - TransformExpressionList(*node->parameters, parameter_expressions); - vector parameters; - parameters.reserve(parameter_expressions.size()); - for (auto &expr : parameter_expressions) { - parameters.push_back(ExtractColumnFromLambda(*expr)); - } - - auto lambda_function = TransformExpression(node->function); - return make_unique(move(parameters), move(lambda_function)); + auto lhs = TransformExpression(node->lhs); + auto rhs = TransformExpression(node->rhs); + return make_unique(move(lhs), move(rhs)); } } // namespace duckdb @@ -144929,7 +154253,7 @@ LogicalType Transformer::TransformTypeName(duckdb_libpgquery::PGTypeName *type_n auto name = (reinterpret_cast(type_name->names->tail->data.ptr_value)->val.str); // transform it to the SQL type - LogicalTypeId base_type = TransformStringToLogicalType(name); + LogicalTypeId base_type = TransformStringToLogicalTypeId(name); LogicalType result_type; if (base_type == LogicalTypeId::STRUCT) { @@ -145393,6 +154717,8 @@ unique_ptr Transformer::TransformCreateEnum(duckdb_libpgquery:: + + namespace duckdb { unique_ptr Transformer::TransformCreateFunction(duckdb_libpgquery::PGNode *node) { @@ -145401,17 +154727,39 @@ unique_ptr Transformer::TransformCreateFunction(duckdb_libpgque auto stmt = reinterpret_cast(node); D_ASSERT(stmt); + D_ASSERT(stmt->function || stmt->query); auto result = make_unique(); - auto info = make_unique(); - auto qname = TransformQualifiedName(stmt->name); + + unique_ptr macro_func; + ; + + // function can be null here + if (stmt->function) { + auto expression = TransformExpression(stmt->function); + macro_func = make_unique(move(expression)); + } else if (stmt->query) { + auto query_node = TransformSelect(stmt->query, true)->node->Copy(); + macro_func = make_unique(move(query_node)); + } + + auto info = + make_unique((stmt->function ? CatalogType::MACRO_ENTRY : CatalogType::TABLE_MACRO_ENTRY)); info->schema = qname.schema; info->name = qname.name; - auto function = TransformExpression(stmt->function); - D_ASSERT(function); - auto macro_func = make_unique(move(function)); + switch (stmt->relpersistence) { + case duckdb_libpgquery::PG_RELPERSISTENCE_TEMP: + info->temporary = true; + break; + case duckdb_libpgquery::PG_RELPERSISTENCE_UNLOGGED: + throw ParserException("Unlogged flag not supported for macros: '%s'", qname.name); + break; + case duckdb_libpgquery::RELPERSISTENCE_PERMANENT: + info->temporary = false; + break; + } if (stmt->params) { vector> parameters; @@ -145425,8 +154773,7 @@ unique_ptr Transformer::TransformCreateFunction(duckdb_libpgque if (macro_func->default_parameters.find(param->alias) != macro_func->default_parameters.end()) { throw ParserException("Duplicate default parameter: '%s'", param->alias); } - auto alias = param->alias; - macro_func->default_parameters[alias] = move(param); + macro_func->default_parameters[param->alias] = move(param); } else if (param->GetExpressionClass() == ExpressionClass::COLUMN_REF) { // positional parameters if (!macro_func->default_parameters.empty()) { @@ -145441,6 +154788,7 @@ unique_ptr Transformer::TransformCreateFunction(duckdb_libpgque info->function = move(macro_func); result->info = move(info); + return result; } @@ -145868,6 +155216,10 @@ unique_ptr Transformer::TransformDelete(duckdb_libpgquery::PGNo result->using_clauses.push_back(move(using_entry)); } } + + if (stmt->returningList) { + Transformer::TransformExpressionList(*(stmt->returningList), result->returning_list); + } return result; } @@ -145904,6 +155256,9 @@ unique_ptr Transformer::TransformDrop(duckdb_libpgquery::PGNode *n case duckdb_libpgquery::PG_OBJECT_FUNCTION: info.type = CatalogType::MACRO_ENTRY; break; + case duckdb_libpgquery::PG_OBJECT_TABLE_MACRO: + info.type = CatalogType::TABLE_MACRO_ENTRY; + break; case duckdb_libpgquery::PG_OBJECT_TYPE: info.type = CatalogType::TYPE_ENTRY; break; @@ -146034,6 +155389,11 @@ unique_ptr Transformer::TransformInsert(duckdb_libpgquery::PGNo result->columns.emplace_back(target->name); } } + + // Grab and transform the returning columns from the parser. + if (stmt->returningList) { + Transformer::TransformExpressionList(*(stmt->returningList), result->returning_list); + } result->select_statement = TransformSelect(stmt->selectStmt, false); auto qname = TransformQualifiedName(stmt->relation); @@ -146079,6 +155439,7 @@ unique_ptr Transformer::TransformLoad(duckdb_libpgquery::PGNode * + namespace duckdb { unique_ptr Transformer::TransformPragma(duckdb_libpgquery::PGNode *node) { @@ -146096,7 +155457,15 @@ unique_ptr Transformer::TransformPragma(duckdb_libpgquery::PGNode if (expr->type == ExpressionType::COMPARE_EQUAL) { auto &comp = (ComparisonExpression &)*expr; - info.named_parameters[comp.left->ToString()] = Value(comp.right->ToString()); + if (comp.right->type != ExpressionType::VALUE_CONSTANT) { + throw ParserException("Named parameter requires a constant on the RHS"); + } + if (comp.left->type != ExpressionType::COLUMN_REF) { + throw ParserException("Named parameter requires a column reference on the LHS"); + } + auto &columnref = (ColumnRefExpression &)*comp.left; + auto &constant = (ConstantExpression &)*comp.right; + info.named_parameters[columnref.GetName()] = constant.value; } else if (node->type == duckdb_libpgquery::T_PGAConst) { auto constant = TransformConstant((duckdb_libpgquery::PGAConst *)node); info.parameters.push_back(((ConstantExpression &)*constant).value); @@ -146533,9 +155902,12 @@ unique_ptr Transformer::TransformShow(duckdb_libpgquery::PGNode *n auto result = make_unique(); auto &info = *result->info; - if (string(stmt->name) == "tables") { + string name = stmt->name; + if (name == "tables") { // show all tables info.name = "show_tables"; + } else if (name == "__show_tables_expanded") { + info.name = "show_tables_expanded"; } else { // show one specific table info.name = "show"; @@ -146612,6 +155984,11 @@ unique_ptr Transformer::TransformUpdate(duckdb_libpgquery::PGNo result->expressions.push_back(TransformExpression(target->val)); } + // Grab and transform the returning columns from the parser. + if (stmt->returningList) { + Transformer::TransformExpressionList(*(stmt->returningList), result->returning_list); + } + result->condition = TransformExpression(stmt->whereClause); return result; } @@ -147044,6 +156421,8 @@ unique_ptr Transformer::TransformStatementInternal(duckdb_libpgque + + #include namespace duckdb { @@ -147257,10 +156636,16 @@ BindResult BindContext::BindColumn(ColumnRefExpression &colref, idx_t depth) { } string BindContext::BindColumn(PositionalReferenceExpression &ref, string &table_name, string &column_name) { - idx_t current_position = ref.index - 1; idx_t total_columns = 0; + idx_t current_position = ref.index - 1; for (auto &entry : bindings_list) { idx_t entry_column_count = entry.second->names.size(); + if (ref.index == 0) { + // this is a row id + table_name = entry.first; + column_name = "rowid"; + return string(); + } if (current_position < entry_column_count) { table_name = entry.first; column_name = entry.second->names[current_position]; @@ -147427,6 +156812,11 @@ void BindContext::AddSubquery(idx_t index, const string &alias, SubqueryRef &ref AddGenericBinding(index, alias, names, subquery.types); } +void BindContext::AddSubquery(idx_t index, const string &alias, TableFunctionRef &ref, BoundQueryNode &subquery) { + auto names = AliasColumnNames(alias, subquery.names, ref.column_name_alias); + AddGenericBinding(index, alias, names, subquery.types); +} + void BindContext::AddGenericBinding(idx_t index, const string &alias, const vector &names, const vector &types) { AddBinding(alias, make_unique(alias, types, names, index)); @@ -147474,7 +156864,6 @@ void BindContext::AddContext(BindContext other) { - //===----------------------------------------------------------------------===// // DuckDB // @@ -147695,6 +157084,7 @@ class BoundSelectNode : public BoundQueryNode { + namespace duckdb { static void InvertPercentileFractions(unique_ptr &fractions) { @@ -147854,8 +157244,9 @@ BindResult SelectBinder::BindAggregate(FunctionExpression &aggr, AggregateFuncti auto aggregate = AggregateFunction::BindAggregateFunction(context, bound_function, move(children), move(bound_filter), aggr.distinct, move(order_bys)); - - auto return_type = aggregate->return_type; + if (aggr.export_state) { + aggregate = ExportAggregateFunction::Bind(move(aggregate)); + } // check for all the aggregates if this aggregate already exists idx_t aggr_index; @@ -147871,9 +157262,9 @@ BindResult SelectBinder::BindAggregate(FunctionExpression &aggr, AggregateFuncti } // now create a column reference referring to the aggregate - auto colref = - make_unique(aggr.alias.empty() ? node.aggregates[aggr_index]->ToString() : aggr.alias, - return_type, ColumnBinding(node.aggregate_index, aggr_index), depth); + auto colref = make_unique( + aggr.alias.empty() ? node.aggregates[aggr_index]->ToString() : aggr.alias, + node.aggregates[aggr_index]->return_type, ColumnBinding(node.aggregate_index, aggr_index), depth); // move the aggregate expression into the set of bound aggregates return BindResult(move(colref)); } @@ -148170,7 +157561,7 @@ unique_ptr ExpressionBinder::CreateStructExtract(unique_ptr> children; children.push_back(move(base)); children.push_back(make_unique_base(Value(move(field_name)))); - auto extract_fun = make_unique("struct_extract", move(children)); + auto extract_fun = make_unique(ExpressionType::STRUCT_EXTRACT, move(children)); return move(extract_fun); } @@ -148501,7 +157892,7 @@ BindResult ExpressionBinder::BindExpression(FunctionExpression &function, idx_t return BindFunction(function, (ScalarFunctionCatalogEntry *)func, depth); case CatalogType::MACRO_ENTRY: // macro function - return BindMacro(function, (MacroCatalogEntry *)func, depth, expr_ptr); + return BindMacro(function, (ScalarMacroCatalogEntry *)func, depth, expr_ptr); default: // aggregate function return BindAggregate(function, (AggregateFunctionCatalogEntry *)func, depth); @@ -148526,12 +157917,13 @@ BindResult ExpressionBinder::BindFunction(FunctionExpression &function, ScalarFu vector> children; for (idx_t i = 0; i < function.children.size(); i++) { auto &child = (BoundExpression &)*function.children[i]; + D_ASSERT(child.expr); children.push_back(move(child.expr)); } unique_ptr result = ScalarFunction::BindScalarFunction(context, *func, move(children), error, function.is_operator); if (!result) { - return BindResult(binder.FormatError(function, error)); + throw BinderException(binder.FormatError(function, error)); } return BindResult(move(result)); } @@ -148557,11 +157949,25 @@ string ExpressionBinder::UnsupportedUnnestMessage() { + namespace duckdb { +// static string ExtractColumnFromLambda(ParsedExpression &expr) { +// if (expr.type != ExpressionType::COLUMN_REF) { +// throw ParserException("Lambda parameter must be a column name"); +// } +// auto &colref = (ColumnRefExpression &)expr; +// if (colref.IsQualified()) { +// throw ParserException("Lambda parameter must be an unqualified name (e.g. 'x', not 'a.x')"); +// } +// return colref.column_names[0]; +// } + BindResult ExpressionBinder::BindExpression(LambdaExpression &expr, idx_t depth) { string error; + // FIXME: decide from the context whether this is actually a LambdaExpression + // If it is, bind it as a lambda here // // set up the lambda capture // FIXME: need to get the type from the list for binding // lambda_capture = expr.capture_name; @@ -148573,7 +157979,8 @@ BindResult ExpressionBinder::BindExpression(LambdaExpression &expr, idx_t depth) // return BindResult(error); // } // expr.Print(); - return BindResult("FIXME: bind lambda function"); + OperatorExpression arrow_expr(ExpressionType::ARROW, move(expr.lhs), move(expr.rhs)); + return ExpressionBinder::BindExpression(arrow_expr, depth); } } // namespace duckdb @@ -148584,6 +157991,8 @@ BindResult ExpressionBinder::BindExpression(LambdaExpression &expr, idx_t depth) + + namespace duckdb { void ExpressionBinder::ReplaceMacroParametersRecursive(unique_ptr &expr) { @@ -148618,13 +158027,18 @@ void ExpressionBinder::ReplaceMacroParametersRecursive(unique_ptr &child) { ReplaceMacroParametersRecursive(child); }); } -BindResult ExpressionBinder::BindMacro(FunctionExpression &function, MacroCatalogEntry *macro_func, idx_t depth, +BindResult ExpressionBinder::BindMacro(FunctionExpression &function, ScalarMacroCatalogEntry *macro_func, idx_t depth, unique_ptr *expr) { - auto ¯o_def = *macro_func->function; + + // recast function so we can access the scalar member function->expression + auto ¯o_def = (ScalarMacroFunction &)*macro_func->function; + // validate the arguments and separate positional and default arguments vector> positionals; unordered_map> defaults; - string error = MacroFunction::ValidateArguments(*macro_func, function, positionals, defaults); + + string error = + MacroFunction::ValidateArguments(*macro_func->function, macro_func->name, function, positionals, defaults); if (!error.empty()) { return BindResult(binder.FormatError(*expr->get(), error)); } @@ -148650,7 +158064,7 @@ BindResult ExpressionBinder::BindMacro(FunctionExpression &function, MacroCatalo macro_binding = new_macro_binding.get(); // replace current expression with stored macro expression, and replace params - *expr = macro_func->function->expression->Copy(); + *expr = macro_def.expression->Copy(); ReplaceMacroParametersRecursive(*expr); // bind the unfolded macro @@ -148746,12 +158160,27 @@ BindResult ExpressionBinder::BindExpression(OperatorExpression &op, idx_t depth) case ExpressionType::ARRAY_SLICE: function_name = "array_slice"; break; - case ExpressionType::STRUCT_EXTRACT: + case ExpressionType::STRUCT_EXTRACT: { + D_ASSERT(op.children.size() == 2); + D_ASSERT(op.children[0]->expression_class == ExpressionClass::BOUND_EXPRESSION); + D_ASSERT(op.children[1]->expression_class == ExpressionClass::BOUND_EXPRESSION); + auto &extract_exp = (BoundExpression &)*op.children[0]; + auto &name_exp = (BoundExpression &)*op.children[1]; + if (extract_exp.expr->return_type.id() != LogicalTypeId::STRUCT && + extract_exp.expr->return_type.id() != LogicalTypeId::SQLNULL) { + return BindResult( + StringUtil::Format("Cannot extract field %s from expression \"%s\" because it is not a struct", + name_exp.ToString(), extract_exp.ToString())); + } function_name = "struct_extract"; break; + } case ExpressionType::ARRAY_CONSTRUCTOR: function_name = "list_value"; break; + case ExpressionType::ARROW: + function_name = "json_extract"; + break; default: break; } @@ -148793,6 +158222,9 @@ namespace duckdb { BindResult ExpressionBinder::BindExpression(ParameterExpression &expr, idx_t depth) { auto bound_parameter = make_unique(expr.parameter_nr); + if (!binder.parameters) { + throw std::runtime_error("Unexpected prepared parameter. This type of statement can't be prepared!"); + } binder.parameters->push_back(bound_parameter.get()); return BindResult(move(bound_parameter)); } @@ -148940,13 +158372,19 @@ BindResult SelectBinder::BindUnnest(FunctionExpression &function, idx_t depth) { } auto &child = (BoundExpression &)*function.children[0]; auto &child_type = child.expr->return_type; - if (child_type.id() != LogicalTypeId::LIST) { - return BindResult(binder.FormatError(function, "Unnest() can only be applied to lists")); + + if (child_type.id() != LogicalTypeId::LIST && child_type.id() != LogicalTypeId::SQLNULL) { + return BindResult(binder.FormatError(function, "Unnest() can only be applied to lists and NULL")); } + if (depth > 0) { throw BinderException(binder.FormatError(function, "Unnest() for correlated expressions is not supported yet")); } - auto &return_type = ListType::GetChildType(child_type); + + auto return_type = LogicalType(LogicalTypeId::SQLNULL); + if (child_type.id() == LogicalTypeId::LIST) { + return_type = ListType::GetChildType(child_type); + } auto result = make_unique(return_type); result->child = move(child.expr); @@ -148960,6 +158398,7 @@ BindResult SelectBinder::BindUnnest(FunctionExpression &function, idx_t depth) { auto colref = make_unique( function.alias.empty() ? node.unnests[unnest_index]->ToString() : function.alias, return_type, ColumnBinding(node.unnest_index, unnest_index), depth); + return BindResult(move(colref)); } @@ -149084,6 +158523,8 @@ static LogicalType BindRangeExpression(ClientContext &context, const string &nam } BindResult SelectBinder::BindWindow(WindowExpression &window, idx_t depth) { + auto name = window.GetName(); + QueryErrorContext error_context(binder.root_statement, window.query_location); if (inside_window) { throw BinderException(error_context.FormatError("window function calls cannot be nested")); @@ -149251,7 +158692,7 @@ BindResult SelectBinder::BindWindow(WindowExpression &window, idx_t depth) { result->end = window.end; // create a BoundColumnRef that references this entry - auto colref = make_unique(window.GetName(), result->return_type, + auto colref = make_unique(move(name), result->return_type, ColumnBinding(node.window_index, node.windows.size()), depth); // move the WINDOW expression into the set of bound windows node.windows.push_back(move(result)); @@ -149587,6 +159028,8 @@ class OrderBinder { return max_count; } + unique_ptr CreateExtraReference(unique_ptr expr); + private: unique_ptr CreateProjectionReference(ParsedExpression &expr, idx_t index); @@ -149620,9 +159063,13 @@ unique_ptr Binder::BindOrderExpression(OrderBinder &order_binder, un return bound_expr; } -unique_ptr Binder::BindDelimiter(ClientContext &context, unique_ptr delimiter, - const LogicalType &type, Value &delimiter_value) { +unique_ptr Binder::BindDelimiter(ClientContext &context, OrderBinder &order_binder, + unique_ptr delimiter, const LogicalType &type, + Value &delimiter_value) { auto new_binder = Binder::CreateBinder(context, this, true); + if (delimiter->HasSubquery()) { + return order_binder.CreateExtraReference(move(delimiter)); + } ExpressionBinder expr_binder(*new_binder, context); expr_binder.target_type = type; auto expr = expr_binder.Bind(delimiter); @@ -149634,30 +159081,36 @@ unique_ptr Binder::BindDelimiter(ClientContext &context, unique_ptr< return expr; } -unique_ptr Binder::BindLimit(LimitModifier &limit_mod) { +unique_ptr Binder::BindLimit(OrderBinder &order_binder, LimitModifier &limit_mod) { auto result = make_unique(); if (limit_mod.limit) { Value val; - result->limit = BindDelimiter(context, move(limit_mod.limit), LogicalType::BIGINT, val); + result->limit = BindDelimiter(context, order_binder, move(limit_mod.limit), LogicalType::BIGINT, val); if (!result->limit) { result->limit_val = val.GetValue(); + if (result->limit_val < 0) { + throw BinderException("LIMIT cannot be negative"); + } } } if (limit_mod.offset) { Value val; - result->offset = BindDelimiter(context, move(limit_mod.offset), LogicalType::BIGINT, val); + result->offset = BindDelimiter(context, order_binder, move(limit_mod.offset), LogicalType::BIGINT, val); if (!result->offset) { result->offset_val = val.GetValue(); + if (result->offset_val < 0) { + throw BinderException("OFFSET cannot be negative"); + } } } return move(result); } -unique_ptr Binder::BindLimitPercent(LimitPercentModifier &limit_mod) { +unique_ptr Binder::BindLimitPercent(OrderBinder &order_binder, LimitPercentModifier &limit_mod) { auto result = make_unique(); if (limit_mod.limit) { Value val; - result->limit = BindDelimiter(context, move(limit_mod.limit), LogicalType::DOUBLE, val); + result->limit = BindDelimiter(context, order_binder, move(limit_mod.limit), LogicalType::DOUBLE, val); if (!result->limit) { result->limit_percent = val.GetValue(); if (result->limit_percent < 0.0) { @@ -149667,7 +159120,7 @@ unique_ptr Binder::BindLimitPercent(LimitPercentModifier &l } if (limit_mod.offset) { Value val; - result->offset = BindDelimiter(context, move(limit_mod.offset), LogicalType::BIGINT, val); + result->offset = BindDelimiter(context, order_binder, move(limit_mod.offset), LogicalType::BIGINT, val); if (!result->offset) { result->offset_val = val.GetValue(); } @@ -149732,10 +159185,10 @@ void Binder::BindModifiers(OrderBinder &order_binder, QueryNode &statement, Boun break; } case ResultModifierType::LIMIT_MODIFIER: - bound_modifier = BindLimit((LimitModifier &)*mod); + bound_modifier = BindLimit(order_binder, (LimitModifier &)*mod); break; case ResultModifierType::LIMIT_PERCENT_MODIFIER: - bound_modifier = BindLimitPercent((LimitPercentModifier &)*mod); + bound_modifier = BindLimitPercent(order_binder, (LimitPercentModifier &)*mod); break; default: throw Exception("Unsupported result modifier"); @@ -149746,6 +159199,18 @@ void Binder::BindModifiers(OrderBinder &order_binder, QueryNode &statement, Boun } } +static void AssignReturnType(unique_ptr &expr, const vector &sql_types, + idx_t projection_index) { + if (!expr) { + return; + } + if (expr->type != ExpressionType::BOUND_COLUMN_REF) { + return; + } + auto &bound_colref = (BoundColumnRefExpression &)*expr; + bound_colref.return_type = sql_types[bound_colref.binding.column_index]; +} + void Binder::BindModifierTypes(BoundQueryNode &result, const vector &sql_types, idx_t projection_index) { for (auto &bound_mod : result.modifiers) { switch (bound_mod->type) { @@ -149779,6 +159244,18 @@ void Binder::BindModifierTypes(BoundQueryNode &result, const vector } break; } + case ResultModifierType::LIMIT_MODIFIER: { + auto &limit = (BoundLimitModifier &)*bound_mod; + AssignReturnType(limit.limit, sql_types, projection_index); + AssignReturnType(limit.offset, sql_types, projection_index); + break; + } + case ResultModifierType::LIMIT_PERCENT_MODIFIER: { + auto &limit = (BoundLimitPercentModifier &)*bound_mod; + AssignReturnType(limit.limit, sql_types, projection_index); + AssignReturnType(limit.offset, sql_types, projection_index); + break; + } case ResultModifierType::ORDER_MODIFIER: { auto &order = (BoundOrderModifier &)*bound_mod; for (auto &order_node : order.orders) { @@ -150149,6 +159626,75 @@ unique_ptr Binder::BindNode(SetOperationNode &statement) { + + + + + + + + + +namespace duckdb { + +unique_ptr Binder::BindTableMacro(FunctionExpression &function, TableMacroCatalogEntry *macro_func, + idx_t depth) { + + auto ¯o_def = (TableMacroFunction &)*macro_func->function; + auto node = macro_def.query_node->Copy(); + + // auto ¯o_def = *macro_func->function; + + // validate the arguments and separate positional and default arguments + vector> positionals; + unordered_map> defaults; + string error = + MacroFunction::ValidateArguments(*macro_func->function, macro_func->name, function, positionals, defaults); + if (!error.empty()) { + // cannot use error below as binder rnot in scope + // return BindResult(binder. FormatError(*expr->get(), error)); + throw BinderException(FormatError(function, error)); + } + + // create a MacroBinding to bind this macro's parameters to its arguments + vector types; + vector names; + // positional parameters + for (idx_t i = 0; i < macro_def.parameters.size(); i++) { + types.emplace_back(LogicalType::SQLNULL); + auto ¶m = (ColumnRefExpression &)*macro_def.parameters[i]; + names.push_back(param.GetColumnName()); + } + // default parameters + for (auto it = macro_def.default_parameters.begin(); it != macro_def.default_parameters.end(); it++) { + types.emplace_back(LogicalType::SQLNULL); + names.push_back(it->first); + // now push the defaults into the positionals + positionals.push_back(move(defaults[it->first])); + } + auto new_macro_binding = make_unique(types, names, macro_func->name); + new_macro_binding->arguments = move(positionals); + + // We need an EXpressionBinder So that we can call ExpressionBinder::ReplaceMacroParametersRecursive() + auto eb = ExpressionBinder(*this, this->context); + + eb.macro_binding = new_macro_binding.get(); + + /* Does it all goes throu every expression in a selectstmt */ + ParsedExpressionIterator::EnumerateQueryNodeChildren( + *node, [&](unique_ptr &child) { eb.ReplaceMacroParametersRecursive(child); }); + + return node; +} + +} // namespace duckdb + + + + + + + namespace duckdb { unique_ptr Binder::VisitQueryNode(BoundQueryNode &node, unique_ptr root) { @@ -150338,36 +159884,6 @@ unique_ptr Binder::CreatePlan(BoundSelectNode &statement) { PlanSubqueries(&expr, &root); } - for (size_t i = 0; i < statement.modifiers.size(); i++) { - auto &modifier = statement.modifiers[i]; - unique_ptr limit = nullptr; - if (modifier->type == ResultModifierType::LIMIT_MODIFIER) { - auto &limit_modifier = (BoundLimitModifier &)*modifier; - if (limit_modifier.limit || limit_modifier.offset) { - PlanSubqueries(&limit_modifier.limit, &root); - PlanSubqueries(&limit_modifier.offset, &root); - limit = make_unique(limit_modifier.limit_val, limit_modifier.offset_val, - move(limit_modifier.limit), move(limit_modifier.offset)); - } - } else if (modifier->type == ResultModifierType::LIMIT_PERCENT_MODIFIER) { - auto &limit_modifier = (BoundLimitPercentModifier &)*modifier; - if (limit_modifier.limit || limit_modifier.offset) { - PlanSubqueries(&limit_modifier.limit, &root); - PlanSubqueries(&limit_modifier.offset, &root); - limit = make_unique(limit_modifier.limit_percent, limit_modifier.offset_val, - move(limit_modifier.limit), move(limit_modifier.offset)); - } - } - if (limit) { - limit->AddChild(move(root)); - root = move(limit); - // Delete from modifiers - std::swap(statement.modifiers[i], statement.modifiers.back()); - statement.modifiers.erase(statement.modifiers.end() - 1); - i--; - } - } - // create the projection auto proj = make_unique(statement.projection_index, move(statement.select_list)); auto &projection = *proj; @@ -150519,7 +160035,7 @@ namespace duckdb { //! The FlattenDependentJoins class is responsible for pushing the dependent join down into the plan to create a //! flattened subquery struct FlattenDependentJoins { - FlattenDependentJoins(Binder &binder, const vector &correlated); + FlattenDependentJoins(Binder &binder, const vector &correlated, bool any_join = false); //! Detects which Logical Operators have correlated expressions that they are dependent upon, filling the //! has_correlated_expressions map. @@ -150538,8 +160054,11 @@ struct FlattenDependentJoins { const vector &correlated_columns; vector delim_types; + bool any_join; + private: - unique_ptr PushDownDependentJoinInternal(unique_ptr plan); + unique_ptr PushDownDependentJoinInternal(unique_ptr plan, + bool &parent_propagate_null_values); }; } // namespace duckdb @@ -150685,8 +160204,7 @@ static void CreateDelimJoinConditions(LogicalDelimJoin &delim_join, vector(col.name, col.type, col.binding); cond.right = make_unique(col.name, col.type, bindings[base_offset + i]); - cond.comparison = ExpressionType::COMPARE_EQUAL; - cond.null_values_are_equal = true; + cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; delim_join.conditions.push_back(move(cond)); } } @@ -150777,7 +160295,7 @@ static unique_ptr PlanCorrelatedSubquery(Binder &binder, BoundSubque // LHS delim_join->AddChild(move(root)); // RHS - FlattenDependentJoins flatten(binder, correlated_columns); + FlattenDependentJoins flatten(binder, correlated_columns, true); flatten.DetectCorrelatedExpressions(plan.get()); auto dependent_join = flatten.PushDownDependentJoin(move(plan)); @@ -150947,6 +160465,8 @@ BoundStatement Binder::Bind(CallStatement &stmt) { + + #include namespace duckdb { @@ -150970,11 +160490,24 @@ BoundStatement Binder::BindCopyTo(CopyStatement &stmt) { if (!copy_function->function.copy_to_bind) { throw NotImplementedException("COPY TO is not supported for FORMAT \"%s\"", stmt.info->format); } - + bool use_tmp_file = true; + for (auto &option : stmt.info->options) { + auto loption = StringUtil::Lower(option.first); + if (loption == "use_tmp_file") { + use_tmp_file = option.second[0].CastAs(LogicalType::BOOLEAN).GetValue(); + stmt.info->options.erase(option.first); + break; + } + } auto function_data = copy_function->function.copy_to_bind(context, *stmt.info, select_node.names, select_node.types); // now create the copy information auto copy = make_unique(copy_function->function, move(function_data)); + copy->file_path = stmt.info->file_path; + copy->use_tmp_file = use_tmp_file; + LocalFileSystem fs; + copy->is_file_and_exists = fs.FileExists(copy->file_path); + copy->AddChild(move(select_node.plan)); result.plan = move(copy); @@ -151181,6 +160714,9 @@ class BoundBaseTableRef : public BoundTableRef { } // namespace duckdb + + + namespace duckdb { SchemaCatalogEntry *Binder::BindSchema(CreateInfo &info) { @@ -151227,8 +160763,9 @@ void Binder::BindCreateViewInfo(CreateViewInfo &base) { SchemaCatalogEntry *Binder::BindCreateFunctionInfo(CreateInfo &info) { auto &base = (CreateMacroInfo &)info; + auto &scalar_function = (ScalarMacroFunction &)*base.function; - if (base.function->expression->HasParameter()) { + if (scalar_function.expression->HasParameter()) { throw BinderException("Parameter expressions within macro's are not supported!"); } @@ -151252,10 +160789,10 @@ SchemaCatalogEntry *Binder::BindCreateFunctionInfo(CreateInfo &info) { } auto this_macro_binding = make_unique(dummy_types, dummy_names, base.name); macro_binding = this_macro_binding.get(); - ExpressionBinder::QualifyColumnNames(*this, base.function->expression); + ExpressionBinder::QualifyColumnNames(*this, scalar_function.expression); // create a copy of the expression because we do not want to alter the original - auto expression = base.function->expression->Copy(); + auto expression = scalar_function.expression->Copy(); // bind it to verify the function was defined correctly string error; @@ -151327,6 +160864,11 @@ BoundStatement Binder::Bind(CreateStatement &stmt) { result.plan = make_unique(LogicalOperatorType::LOGICAL_CREATE_SEQUENCE, move(stmt.info), schema); break; } + case CatalogType::TABLE_MACRO_ENTRY: { + auto schema = BindSchema(*stmt.info); + result.plan = make_unique(LogicalOperatorType::LOGICAL_CREATE_MACRO, move(stmt.info), schema); + break; + } case CatalogType::MACRO_ENTRY: { auto schema = BindCreateFunctionInfo(*stmt.info); result.plan = make_unique(LogicalOperatorType::LOGICAL_CREATE_MACRO, move(stmt.info), schema); @@ -151367,6 +160909,42 @@ BoundStatement Binder::Bind(CreateStatement &stmt) { break; } case CatalogType::TABLE_ENTRY: { + // If there is a foreign key constraint, resolve primary key column's index from primary key column's name + auto &create_info = (CreateTableInfo &)*stmt.info; + auto &catalog = Catalog::GetCatalog(context); + for (idx_t i = 0; i < create_info.constraints.size(); i++) { + auto &cond = create_info.constraints[i]; + if (cond->type != ConstraintType::FOREIGN_KEY) { + continue; + } + auto &fk = (ForeignKeyConstraint &)*cond; + if (fk.info.type != ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE) { + continue; + } + D_ASSERT(fk.info.pk_keys.empty() && !fk.pk_columns.empty()); + if (create_info.table == fk.info.table) { + fk.info.type = ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE; + } else { + // have to resolve referenced table + auto pk_table_entry_ptr = catalog.GetEntry(context, fk.info.schema, fk.info.table); + D_ASSERT(!fk.pk_columns.empty() && fk.info.pk_keys.empty()); + for (auto &keyname : fk.pk_columns) { + auto entry = pk_table_entry_ptr->name_map.find(keyname); + if (entry == pk_table_entry_ptr->name_map.end()) { + throw BinderException("column \"%s\" named in key does not exist", keyname); + } + fk.info.pk_keys.push_back(entry->second); + } + auto index = pk_table_entry_ptr->storage->info->indexes.FindForeignKeyIndex( + fk.info.pk_keys, ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE); + if (!index) { + auto fk_column_names = StringUtil::Join(fk.pk_columns, ","); + throw BinderException("Failed to create foreign key on %s(%s): no UNIQUE or PRIMARY KEY constraint " + "present on these columns", + pk_table_entry_ptr->name, fk_column_names); + } + } + } // We first check if there are any user types, if yes we check to which custom types they refer. auto bound_info = BindCreateTableInfo(move(stmt.info)); auto root = move(bound_info->query); @@ -151401,6 +160979,7 @@ BoundStatement Binder::Bind(CreateStatement &stmt) { + //===----------------------------------------------------------------------===// // DuckDB // @@ -151537,6 +161116,39 @@ static void BindConstraints(Binder &binder, BoundCreateTableInfo &info) { make_unique(move(keys), move(key_set), unique.is_primary_key)); break; } + case ConstraintType::FOREIGN_KEY: { + auto &fk = (ForeignKeyConstraint &)*cond; + D_ASSERT((fk.info.type == ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE && !fk.info.pk_keys.empty()) || + (fk.info.type == ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE && !fk.info.pk_keys.empty()) || + fk.info.type == ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE); + if (fk.info.type == ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE && fk.info.pk_keys.empty()) { + for (auto &keyname : fk.pk_columns) { + auto entry = info.name_map.find(keyname); + if (entry == info.name_map.end()) { + throw BinderException("column \"%s\" named in key does not exist", keyname); + } + fk.info.pk_keys.push_back(entry->second); + } + } + if (fk.info.fk_keys.empty()) { + for (auto &keyname : fk.fk_columns) { + auto entry = info.name_map.find(keyname); + if (entry == info.name_map.end()) { + throw BinderException("column \"%s\" named in key does not exist", keyname); + } + fk.info.fk_keys.push_back(entry->second); + } + } + unordered_set fk_key_set, pk_key_set; + for (idx_t i = 0; i < fk.info.pk_keys.size(); i++) { + pk_key_set.insert(fk.info.pk_keys[i]); + } + for (idx_t i = 0; i < fk.info.fk_keys.size(); i++) { + fk_key_set.insert(fk.info.fk_keys[i]); + } + info.bound_constraints.push_back(make_unique(fk.info, pk_key_set, fk_key_set)); + break; + } default: throw NotImplementedException("unrecognized constraint type in bind"); } @@ -151616,6 +161228,32 @@ unique_ptr Binder::BindCreateTableInfo(unique_ptr *expr_ptr, idx_t depth, + bool root_expression = false) override; +}; + +} // namespace duckdb + @@ -151690,10 +161328,21 @@ BoundStatement Binder::Bind(DeleteStatement &stmt) { LogicalType::ROW_TYPE, ColumnBinding(get.table_index, get.column_ids.size()))); get.column_ids.push_back(COLUMN_IDENTIFIER_ROW_ID); - result.plan = move(del); - result.names = {"Count"}; - result.types = {LogicalType::BIGINT}; - this->allow_stream_result = false; + if (!stmt.returning_list.empty()) { + del->return_chunk = true; + + auto update_table_index = GenerateTableIndex(); + del->table_index = update_table_index; + + unique_ptr del_as_logicaloperator = move(del); + return BindReturning(move(stmt.returning_list), table, update_table_index, move(del_as_logicaloperator), + move(result)); + } else { + result.plan = move(del); + result.names = {"Count"}; + result.types = {LogicalType::BIGINT}; + this->allow_stream_result = false; + } return result; } @@ -151723,6 +161372,7 @@ BoundStatement Binder::Bind(DropStatement &stmt) { case CatalogType::VIEW_ENTRY: case CatalogType::SEQUENCE_ENTRY: case CatalogType::MACRO_ENTRY: + case CatalogType::TABLE_MACRO_ENTRY: case CatalogType::INDEX_ENTRY: case CatalogType::TABLE_ENTRY: case CatalogType::TYPE_ENTRY: { @@ -151785,6 +161435,7 @@ BoundStatement Binder::Bind(ExplainStatement &stmt) { + #include namespace duckdb { @@ -151813,6 +161464,51 @@ string SanitizeExportIdentifier(const string &str) { return result; } +bool IsExistMainKeyTable(string &table_name, vector &unordered) { + for (idx_t i = 0; i < unordered.size(); i++) { + if (unordered[i]->name == table_name) { + return true; + } + } + return false; +} + +void ScanForeignKeyTable(vector &ordered, vector &unordered, + bool move_only_pk_table) { + for (auto i = unordered.begin(); i != unordered.end();) { + auto table_entry = *i; + bool move_to_ordered = true; + for (idx_t j = 0; j < table_entry->constraints.size(); j++) { + auto &cond = table_entry->constraints[j]; + if (cond->type == ConstraintType::FOREIGN_KEY) { + auto &fk = (ForeignKeyConstraint &)*cond; + if ((move_only_pk_table && fk.info.type == ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE) || + (!move_only_pk_table && fk.info.type == ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE && + IsExistMainKeyTable(fk.info.table, unordered))) { + move_to_ordered = false; + break; + } + } + } + if (move_to_ordered) { + ordered.push_back(table_entry); + i = unordered.erase(i); + } else { + i++; + } + } +} + +void ReorderTableEntries(vector &tables) { + vector ordered; + vector unordered = tables; + ScanForeignKeyTable(ordered, unordered, true); + while (!unordered.empty()) { + ScanForeignKeyTable(ordered, unordered, false); + } + tables = ordered; +} + BoundStatement Binder::Bind(ExportStatement &stmt) { // COPY TO a file auto &config = DBConfig::GetConfig(context); @@ -151841,13 +161537,16 @@ BoundStatement Binder::Bind(ExportStatement &stmt) { }); } + // reorder tables because of foreign key constraint + ReorderTableEntries(tables); + // now generate the COPY statements for each of the tables auto &fs = FileSystem::GetFileSystem(context); unique_ptr child_operator; BoundExportData exported_tables; - idx_t id = 0; // Id for table + unordered_set table_name_index; for (auto &table : tables) { auto info = make_unique(); // we copy the options supplied to the EXPORT @@ -151856,16 +161555,26 @@ BoundStatement Binder::Bind(ExportStatement &stmt) { // set up the file name for the COPY TO auto exported_data = ExportedTableData(); - if (table->schema->name == DEFAULT_SCHEMA) { - info->file_path = - fs.JoinPath(stmt.info->file_path, - StringUtil::Format("%s_%s.%s", to_string(id), SanitizeExportIdentifier(table->name), - copy_function->function.extension)); - } else { - info->file_path = fs.JoinPath( - stmt.info->file_path, - StringUtil::Format("%s_%s_%s.%s", SanitizeExportIdentifier(table->schema->name), to_string(id), - SanitizeExportIdentifier(table->name), copy_function->function.extension)); + idx_t id = 0; + while (true) { + string id_suffix = id == 0 ? string() : "_" + to_string(id); + if (table->schema->name == DEFAULT_SCHEMA) { + info->file_path = fs.JoinPath(stmt.info->file_path, + StringUtil::Format("%s%s.%s", SanitizeExportIdentifier(table->name), + id_suffix, copy_function->function.extension)); + } else { + info->file_path = + fs.JoinPath(stmt.info->file_path, + StringUtil::Format("%s_%s%s.%s", SanitizeExportIdentifier(table->schema->name), + SanitizeExportIdentifier(table->name), id_suffix, + copy_function->function.extension)); + } + if (table_name_index.find(info->file_path) == table_name_index.end()) { + // this name was not yet taken: take it + table_name_index.insert(info->file_path); + break; + } + id++; } info->is_from = false; info->schema = table->schema->name; @@ -151875,7 +161584,10 @@ BoundStatement Binder::Bind(ExportStatement &stmt) { exported_data.schema_name = info->schema; exported_data.file_path = info->file_path; - exported_tables.data[table] = exported_data; + ExportedTableInfo table_info; + table_info.entry = table; + table_info.table_data = exported_data; + exported_tables.data.push_back(table_info); id++; // generate the copy statement and bind it @@ -151951,6 +161663,10 @@ class InsertBinder : public ExpressionBinder { + + + + namespace duckdb { static void CheckInsertColumnCountMismatch(int64_t expected_columns, int64_t result_columns, bool columns_provided, @@ -152058,18 +161774,31 @@ BoundStatement Binder::Bind(InsertStatement &stmt) { } } - // insert from select statement // parse select statement and add to logical plan auto root_select = Bind(*stmt.select_statement); CheckInsertColumnCountMismatch(expected_columns, root_select.types.size(), !stmt.columns.empty(), table->name.c_str()); auto root = CastLogicalOperatorToTypes(root_select.types, insert->expected_types, move(root_select.plan)); + insert->AddChild(move(root)); - result.plan = move(insert); - this->allow_stream_result = false; - return result; + if (!stmt.returning_list.empty()) { + insert->return_chunk = true; + result.types.clear(); + result.names.clear(); + auto insert_table_index = GenerateTableIndex(); + insert->table_index = insert_table_index; + unique_ptr index_as_logicaloperator = move(insert); + + return BindReturning(move(stmt.returning_list), table, insert_table_index, move(index_as_logicaloperator), + move(result)); + } else { + D_ASSERT(result.types.size() == result.names.size()); + result.plan = move(insert); + this->allow_stream_result = false; + return result; + } } } // namespace duckdb @@ -152191,7 +161920,7 @@ BoundStatement Binder::Bind(ShowStatement &stmt) { result.plan = move(show); - result.names = {"Field", "Type", "Null", "Key", "Default", "Extra"}; + result.names = {"column_name", "column_type", "null", "key", "default", "extra"}; result.types = {LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR, LogicalType::VARCHAR}; return result; @@ -152519,6 +162248,8 @@ static void BindUpdateConstraints(TableCatalogEntry &table, LogicalGet &get, Log } // for index updates we always turn any update into an insert and a delete // we thus need all the columns to be available, hence we check if the update touches any index columns + // If the returning keyword is used, we need access to the whole row in case the user requests it. + // Therefore switch the update to a delete and insert. update.update_is_del_and_insert = false; table.storage->info->indexes.Scan([&](Index &index) { if (index.IndexIsUpdated(update.columns)) { @@ -152536,8 +162267,9 @@ static void BindUpdateConstraints(TableCatalogEntry &table, LogicalGet &get, Log } } - if (update.update_is_del_and_insert) { - // the update updates a column required by an index, push projections for all columns + if (update.update_is_del_and_insert || update.return_chunk) { + // the update updates a column required by an index or requires returning the updated rows, + // push projections for all columns unordered_set all_columns; for (idx_t i = 0; i < table.storage->column_definitions.size(); i++) { all_columns.insert(i); @@ -152575,6 +162307,11 @@ BoundStatement Binder::Bind(UpdateStatement &stmt) { this->read_only = false; } auto update = make_unique(table); + + // set return_chunk boolean early because it needs uses update_is_del_and_insert logic + if (!stmt.returning_list.empty()) { + update->return_chunk = true; + } // bind the default values BindDefaultValues(table->columns, update->bound_defaults); @@ -152593,6 +162330,7 @@ BoundStatement Binder::Bind(UpdateStatement &stmt) { auto proj_index = GenerateTableIndex(); vector> projection_expressions; + for (idx_t i = 0; i < stmt.columns.size(); i++) { auto &colname = stmt.columns[i]; auto &expr = stmt.expressions[i]; @@ -152618,6 +162356,7 @@ BoundStatement Binder::Bind(UpdateStatement &stmt) { projection_expressions.push_back(move(bound_expr)); } } + // now create the projection auto proj = make_unique(proj_index, move(projection_expressions)); proj->AddChild(move(root)); @@ -152633,10 +162372,21 @@ BoundStatement Binder::Bind(UpdateStatement &stmt) { // set the projection as child of the update node and finalize the result update->AddChild(move(proj)); - result.names = {"Count"}; - result.types = {LogicalType::BIGINT}; - result.plan = move(update); - this->allow_stream_result = false; + if (!stmt.returning_list.empty()) { + auto update_table_index = GenerateTableIndex(); + update->table_index = update_table_index; + unique_ptr update_as_logicaloperator = move(update); + + return BindReturning(move(stmt.returning_list), table, update_table_index, move(update_as_logicaloperator), + move(result)); + + } else { + update->table_index = 0; + result.names = {"Count"}; + result.types = {LogicalType::BIGINT}; + result.plan = move(update); + this->allow_stream_result = false; + } return result; } @@ -152801,14 +162551,15 @@ unique_ptr Binder::Bind(BaseTableRef &ref) { } // not a CTE // extract a table or view from the catalog + auto &catalog = Catalog::GetCatalog(context); auto table_or_view = - Catalog::GetCatalog(context).GetEntry(context, CatalogType::TABLE_ENTRY, ref.schema_name, ref.table_name, - ref.schema_name.empty() ? true : false, error_context); + catalog.GetEntry(context, CatalogType::TABLE_ENTRY, ref.schema_name, ref.table_name, true, error_context); if (!table_or_view) { + auto table_name = ref.schema_name.empty() ? ref.table_name : (ref.schema_name + "." + ref.table_name); // table could not be found: try to bind a replacement scan auto &config = DBConfig::GetConfig(context); for (auto &scan : config.replacement_scans) { - auto replacement_function = scan.function(ref.table_name, scan.data); + auto replacement_function = scan.function(context, table_name, scan.data.get()); if (replacement_function) { replacement_function->alias = ref.alias.empty() ? ref.table_name : ref.alias; replacement_function->column_name_alias = ref.column_name_alias; @@ -152818,11 +162569,11 @@ unique_ptr Binder::Bind(BaseTableRef &ref) { // we still didn't find the table if (GetBindingMode() == BindingMode::EXTRACT_NAMES) { // if we are in EXTRACT_NAMES, we create a dummy table ref - AddTableName(ref.table_name); + AddTableName(table_name); // add a bind context entry auto table_index = GenerateTableIndex(); - auto alias = ref.alias.empty() ? ref.table_name : ref.alias; + auto alias = ref.alias.empty() ? table_name : ref.alias; vector types {LogicalType::INTEGER}; vector names {"__dummy_col" + to_string(table_index)}; bind_context.AddGenericBinding(table_index, alias, names, types); @@ -153370,6 +163121,7 @@ unique_ptr Binder::Bind(SubqueryRef &ref, CommonTableExpressionIn + namespace duckdb { bool Binder::BindFunctionParameters(vector> &expressions, vector &arguments, @@ -153434,6 +163186,40 @@ unique_ptr Binder::Bind(TableFunctionRef &ref) { D_ASSERT(ref.function->type == ExpressionType::FUNCTION); auto fexpr = (FunctionExpression *)ref.function.get(); + TableFunctionCatalogEntry *function = nullptr; + + // fetch the function from the catalog + auto &catalog = Catalog::GetCatalog(context); + + auto func_catalog = catalog.GetEntry(context, CatalogType::TABLE_FUNCTION_ENTRY, fexpr->schema, + fexpr->function_name, false, error_context); + + if (func_catalog->type == CatalogType::TABLE_FUNCTION_ENTRY) { + function = (TableFunctionCatalogEntry *)func_catalog; + + } else if (func_catalog->type == CatalogType::TABLE_MACRO_ENTRY) { + + auto macro_func = (TableMacroCatalogEntry *)func_catalog; + auto query_node = BindTableMacro(*fexpr, macro_func, 0); + D_ASSERT(query_node); + + auto binder = Binder::CreateBinder(context, this); + binder->can_contain_nulls = true; + + binder->alias = ref.alias.empty() ? "unnamed_query" : ref.alias; + auto query = binder->BindNode(*query_node); + + idx_t bind_index = query->GetRootIndex(); + // string alias; + string alias = (ref.alias.empty() ? "unnamed_query" + to_string(bind_index) : ref.alias); + + auto result = make_unique(move(binder), move(query)); + // remember ref here is TableFunctionRef and NOT base class + bind_context.AddSubquery(bind_index, alias, ref, *result->subquery); + MoveCorrelatedExpressions(*result->binder); + return move(result); + } + // evaluate the input parameters to the function vector arguments; vector parameters; @@ -153444,11 +163230,6 @@ unique_ptr Binder::Bind(TableFunctionRef &ref) { throw BinderException(FormatError(ref, error)); } - // fetch the function from the catalog - auto &catalog = Catalog::GetCatalog(context); - auto function = - catalog.GetEntry(context, fexpr->schema, fexpr->function_name, false, error_context); - // select the function based on the input parameters idx_t best_function_idx = Function::BindFunction(function->name, function->functions, arguments, error); if (best_function_idx == DConstants::INVALID_INDEX) { @@ -153481,11 +163262,19 @@ unique_ptr Binder::Bind(TableFunctionRef &ref) { vector return_types; vector return_names; if (table_function.bind) { - bind_data = table_function.bind(context, parameters, named_parameters, input_table_types, input_table_names, - return_types, return_names); + TableFunctionBindInput bind_input(parameters, named_parameters, input_table_types, input_table_names, + table_function.function_info.get()); + bind_data = table_function.bind(context, bind_input, return_types, return_names); + } + if (return_types.size() != return_names.size()) { + throw InternalException( + "Failed to bind \"%s\": Table function return_types and return_names must be of the same size", + table_function.name); + } + if (return_types.empty()) { + throw InternalException("Failed to bind \"%s\": Table function must return at least one column", + table_function.name); } - D_ASSERT(return_types.size() == return_names.size()); - D_ASSERT(return_types.size() > 0); // overwrite the names with any supplied aliases for (idx_t i = 0; i < ref.column_name_alias.size() && i < return_names.size(); i++) { return_names[i] = ref.column_name_alias[i]; @@ -153860,8 +163649,11 @@ unique_ptr Binder::CreatePlan(BoundTableFunction &ref) { + #include + + namespace duckdb { shared_ptr Binder::CreateBinder(ClientContext &context, Binder *parent, bool inherit_ctes) { @@ -154226,10 +164018,120 @@ string Binder::FormatErrorRecursive(idx_t query_location, const string &message, return context.FormatErrorRecursive(message, values); } +BoundStatement Binder::BindReturning(vector> returning_list, TableCatalogEntry *table, + idx_t update_table_index, unique_ptr child_operator, + BoundStatement result) { + + vector types; + vector names; + + auto binder = Binder::CreateBinder(context); + + for (auto &col : table->columns) { + names.push_back(col.name); + types.push_back(col.type); + } + + binder->bind_context.AddGenericBinding(update_table_index, table->name, names, types); + ReturningBinder returning_binder(*binder, context); + + vector> projection_expressions; + LogicalType result_type; + for (auto &returning_expr : returning_list) { + auto expr_type = returning_expr->GetExpressionType(); + if (expr_type == ExpressionType::STAR) { + auto generated_star_list = vector>(); + binder->bind_context.GenerateAllColumnExpressions((StarExpression &)*returning_expr, generated_star_list); + + for (auto &star_column : generated_star_list) { + auto star_expr = returning_binder.Bind(star_column, &result_type); + result.types.push_back(result_type); + result.names.push_back(star_expr->GetName()); + projection_expressions.push_back(move(star_expr)); + } + } else { + auto expr = returning_binder.Bind(returning_expr, &result_type); + result.names.push_back(expr->GetName()); + result.types.push_back(result_type); + projection_expressions.push_back(move(expr)); + } + } + + auto projection = make_unique(GenerateTableIndex(), move(projection_expressions)); + projection->AddChild(move(child_operator)); + D_ASSERT(result.types.size() == result.names.size()); + result.plan = move(projection); + this->allow_stream_result = true; + return result; +} + } // namespace duckdb +namespace duckdb { + +BoundResultModifier::BoundResultModifier(ResultModifierType type) : type(type) { +} + +BoundResultModifier::~BoundResultModifier() { +} + +BoundOrderByNode::BoundOrderByNode(OrderType type, OrderByNullType null_order, unique_ptr expression) + : type(type), null_order(null_order), expression(move(expression)) { +} +BoundOrderByNode::BoundOrderByNode(OrderType type, OrderByNullType null_order, unique_ptr expression, + unique_ptr stats) + : type(type), null_order(null_order), expression(move(expression)), stats(move(stats)) { +} +BoundOrderByNode BoundOrderByNode::Copy() const { + if (stats) { + return BoundOrderByNode(type, null_order, expression->Copy(), stats->Copy()); + } else { + return BoundOrderByNode(type, null_order, expression->Copy()); + } +} + +string BoundOrderByNode::ToString() const { + auto str = expression->ToString(); + switch (type) { + case OrderType::ASCENDING: + str += " ASC"; + break; + case OrderType::DESCENDING: + str += " DESC"; + break; + default: + break; + } + + switch (null_order) { + case OrderByNullType::NULLS_FIRST: + str += " NULLS FIRST"; + break; + case OrderByNullType::NULLS_LAST: + str += " NULLS LAST"; + break; + default: + break; + } + return str; +} + +BoundLimitModifier::BoundLimitModifier() : BoundResultModifier(ResultModifierType::LIMIT_MODIFIER) { +} + +BoundOrderModifier::BoundOrderModifier() : BoundResultModifier(ResultModifierType::ORDER_MODIFIER) { +} + +BoundDistinctModifier::BoundDistinctModifier() : BoundResultModifier(ResultModifierType::DISTINCT_MODIFIER) { +} + +BoundLimitPercentModifier::BoundLimitPercentModifier() + : BoundResultModifier(ResultModifierType::LIMIT_PERCENT_MODIFIER) { +} + +} // namespace duckdb @@ -154245,17 +164147,12 @@ BoundAggregateExpression::BoundAggregateExpression(AggregateFunction function, v : Expression(ExpressionType::BOUND_AGGREGATE, ExpressionClass::BOUND_AGGREGATE, function.return_type), function(move(function)), children(move(children)), bind_info(move(bind_info)), distinct(distinct), filter(move(filter)) { + D_ASSERT(!function.name.empty()); } string BoundAggregateExpression::ToString() const { - string result = function.name + "("; - if (distinct) { - result += "DISTINCT "; - } - result += StringUtil::Join(children, children.size(), ", ", - [](const unique_ptr &child) { return child->ToString(); }); - result += ")"; - return result; + return FunctionExpression::ToString(*this, string(), function.name, false, + distinct, filter.get()); } hash_t BoundAggregateExpression::Hash() const { @@ -154293,6 +164190,10 @@ bool BoundAggregateExpression::Equals(const BaseExpression *other_p) const { return true; } +bool BoundAggregateExpression::PropagatesNullValues() const { + return !function.propagates_null_values ? false : Expression::PropagatesNullValues(); +} + unique_ptr BoundAggregateExpression::Copy() { vector> new_children; for (auto &child : children) { @@ -154309,6 +164210,7 @@ unique_ptr BoundAggregateExpression::Copy() { } // namespace duckdb + namespace duckdb { BoundBetweenExpression::BoundBetweenExpression(unique_ptr input, unique_ptr lower, @@ -154319,7 +164221,7 @@ BoundBetweenExpression::BoundBetweenExpression(unique_ptr input, uni } string BoundBetweenExpression::ToString() const { - return input->ToString() + " BETWEEN " + lower->ToString() + " AND " + upper->ToString(); + return BetweenExpression::ToString(*this); } bool BoundBetweenExpression::Equals(const BaseExpression *other_p) const { @@ -154349,6 +164251,7 @@ unique_ptr BoundBetweenExpression::Copy() { } // namespace duckdb + namespace duckdb { BoundCaseExpression::BoundCaseExpression(LogicalType type) @@ -154366,13 +164269,7 @@ BoundCaseExpression::BoundCaseExpression(unique_ptr when_expr, uniqu } string BoundCaseExpression::ToString() const { - string result = "CASE"; - for (auto &check : case_checks) { - result += " WHEN (" + check.when_expr->ToString() + ")"; - result += " THEN (" + check.then_expr->ToString() + ")"; - } - result += " ELSE (" + else_expr->ToString() + ")"; - return result; + return CaseExpression::ToString(*this); } bool BoundCaseExpression::Equals(const BaseExpression *other_p) const { @@ -154546,10 +164443,10 @@ unique_ptr BoundCastExpression::Copy() { namespace duckdb { -BoundColumnRefExpression::BoundColumnRefExpression(string alias, LogicalType type, ColumnBinding binding, idx_t depth) +BoundColumnRefExpression::BoundColumnRefExpression(string alias_p, LogicalType type, ColumnBinding binding, idx_t depth) : Expression(ExpressionType::BOUND_COLUMN_REF, ExpressionClass::BOUND_COLUMN_REF, move(type)), binding(binding), depth(depth) { - this->alias = move(alias); + this->alias = move(alias_p); } BoundColumnRefExpression::BoundColumnRefExpression(LogicalType type, ColumnBinding binding, idx_t depth) @@ -154576,12 +164473,16 @@ bool BoundColumnRefExpression::Equals(const BaseExpression *other_p) const { } string BoundColumnRefExpression::ToString() const { + if (!alias.empty()) { + return alias; + } return "#[" + to_string(binding.table_index) + "." + to_string(binding.column_index) + "]"; } } // namespace duckdb + namespace duckdb { BoundComparisonExpression::BoundComparisonExpression(ExpressionType type, unique_ptr left, @@ -154590,7 +164491,7 @@ BoundComparisonExpression::BoundComparisonExpression(ExpressionType type, unique } string BoundComparisonExpression::ToString() const { - return left->GetName() + ExpressionTypeToOperator(type) + right->GetName(); + return ComparisonExpression::ToString(*this); } bool BoundComparisonExpression::Equals(const BaseExpression *other_p) const { @@ -154604,6 +164505,7 @@ bool BoundComparisonExpression::Equals(const BaseExpression *other_p) const { if (!Expression::Equals(right.get(), other->right.get())) { return false; } + return true; } @@ -154617,6 +164519,7 @@ unique_ptr BoundComparisonExpression::Copy() { + namespace duckdb { BoundConjunctionExpression::BoundConjunctionExpression(ExpressionType type) @@ -154631,11 +164534,7 @@ BoundConjunctionExpression::BoundConjunctionExpression(ExpressionType type, uniq } string BoundConjunctionExpression::ToString() const { - string result = "(" + children[0]->ToString(); - for (idx_t i = 1; i < children.size(); i++) { - result += " " + ExpressionTypeToOperator(type) + " " + children[i]->ToString(); - } - return result + ")"; + return ConjunctionExpression::ToString(*this); } bool BoundConjunctionExpression::Equals(const BaseExpression *other_p) const { @@ -154646,6 +164545,10 @@ bool BoundConjunctionExpression::Equals(const BaseExpression *other_p) const { return ExpressionUtil::SetEquals(children, other->children); } +bool BoundConjunctionExpression::PropagatesNullValues() const { + return false; +} + unique_ptr BoundConjunctionExpression::Copy() { auto copy = make_unique(type); for (auto &expr : children) { @@ -154669,7 +164572,7 @@ BoundConstantExpression::BoundConstantExpression(Value value_p) } string BoundConstantExpression::ToString() const { - return value.ToString(); + return value.ToSQLString(); } bool BoundConstantExpression::Equals(const BaseExpression *other_p) const { @@ -154698,7 +164601,6 @@ unique_ptr BoundConstantExpression::Copy() { - namespace duckdb { BoundFunctionExpression::BoundFunctionExpression(LogicalType return_type, ScalarFunction bound_function, @@ -154706,6 +164608,7 @@ BoundFunctionExpression::BoundFunctionExpression(LogicalType return_type, Scalar unique_ptr bind_info, bool is_operator) : Expression(ExpressionType::BOUND_FUNCTION, ExpressionClass::BOUND_FUNCTION, move(return_type)), function(move(bound_function)), children(move(arguments)), bind_info(move(bind_info)), is_operator(is_operator) { + D_ASSERT(!function.name.empty()); } bool BoundFunctionExpression::HasSideEffects() const { @@ -154718,11 +164621,11 @@ bool BoundFunctionExpression::IsFoldable() const { } string BoundFunctionExpression::ToString() const { - string result = function.name + "("; - result += StringUtil::Join(children, children.size(), ", ", - [](const unique_ptr &child) { return child->GetName(); }); - result += ")"; - return result; + return FunctionExpression::ToString(*this, string(), function.name, + is_operator); +} +bool BoundFunctionExpression::PropagatesNullValues() const { + return !function.propagates_null_values ? false : Expression::PropagatesNullValues(); } hash_t BoundFunctionExpression::Hash() const { @@ -154760,11 +164663,16 @@ unique_ptr BoundFunctionExpression::Copy() { return move(copy); } +void BoundFunctionExpression::Verify() const { + D_ASSERT(!function.name.empty()); +} + } // namespace duckdb + namespace duckdb { BoundOperatorExpression::BoundOperatorExpression(ExpressionType type, LogicalType return_type) @@ -154772,21 +164680,7 @@ BoundOperatorExpression::BoundOperatorExpression(ExpressionType type, LogicalTyp } string BoundOperatorExpression::ToString() const { - auto op = ExpressionTypeToOperator(type); - if (!op.empty()) { - // use the operator string to represent the operator - if (children.size() == 1) { - return op + "(" + children[0]->GetName() + ")"; - } else if (children.size() == 2) { - return children[0]->GetName() + " " + op + " " + children[1]->GetName(); - } - } - // if there is no operator we render it as a function - auto result = ExpressionTypeToString(type) + "("; - result += StringUtil::Join(children, children.size(), ", ", - [](const unique_ptr &child) { return child->GetName(); }); - result += ")"; - return result; + return OperatorExpression::ToString(*this); } bool BoundOperatorExpression::Equals(const BaseExpression *other_p) const { @@ -154876,6 +164770,9 @@ BoundReferenceExpression::BoundReferenceExpression(LogicalType type, idx_t index } string BoundReferenceExpression::ToString() const { + if (!alias.empty()) { + return alias; + } return "#" + to_string(index); } @@ -154919,6 +164816,11 @@ unique_ptr BoundSubqueryExpression::Copy() { throw SerializationException("Cannot copy BoundSubqueryExpression"); } +bool BoundSubqueryExpression::PropagatesNullValues() const { + // TODO this can be optimized further by checking the actual subquery node + return false; +} + } // namespace duckdb @@ -154967,6 +164869,7 @@ unique_ptr BoundUnnestExpression::Copy() { + namespace duckdb { BoundWindowExpression::BoundWindowExpression(ExpressionType type, LogicalType return_type, @@ -154977,134 +164880,9 @@ BoundWindowExpression::BoundWindowExpression(ExpressionType type, LogicalType re } string BoundWindowExpression::ToString() const { - string result = aggregate.get() ? aggregate->name : ExpressionTypeToString(type); - result += "("; - result += StringUtil::Join(children, children.size(), ", ", - [](const unique_ptr &child) { return child->GetName(); }); - // Lead/Lag extra arguments - if (offset_expr.get()) { - result += ", "; - result += offset_expr->GetName(); - } - if (default_expr.get()) { - result += ", "; - result += default_expr->GetName(); - } - - // IGNORE NULLS - if (ignore_nulls) { - result += " IGNORE NULLS"; - } - - // Over clause - result += ") OVER("; - string sep; - - // Partitions - if (!partitions.empty()) { - result += "PARTITION BY "; - result += StringUtil::Join(partitions, partitions.size(), ", ", - [](const unique_ptr &partition) { return partition->GetName(); }); - sep = " "; - } - - // Orders - if (!orders.empty()) { - result += sep; - result += "ORDER BY "; - result += StringUtil::Join(orders, orders.size(), ", ", [](const BoundOrderByNode &order) { - auto str = order.expression->GetName(); - str += (order.type == OrderType::ASCENDING) ? " ASC" : " DESC"; - switch (order.null_order) { - case OrderByNullType::NULLS_FIRST: - str += " NULLS FIRST"; - break; - case OrderByNullType::NULLS_LAST: - str += " NULLS LAST"; - break; - default: - break; - } - return str; - }); - sep = " "; - } - - // Rows/Range - string units = "ROWS"; - string from; - switch (start) { - case WindowBoundary::CURRENT_ROW_RANGE: - case WindowBoundary::CURRENT_ROW_ROWS: - from = "CURRENT ROW"; - units = (start == WindowBoundary::CURRENT_ROW_RANGE) ? "RANGE" : "ROWS"; - break; - case WindowBoundary::UNBOUNDED_PRECEDING: - if (end != WindowBoundary::CURRENT_ROW_RANGE) { - from = "UNBOUNDED PRECEDING"; - } - break; - case WindowBoundary::EXPR_PRECEDING_ROWS: - case WindowBoundary::EXPR_PRECEDING_RANGE: - from = start_expr->GetName() + " PRECEDING"; - units = (start == WindowBoundary::EXPR_PRECEDING_RANGE) ? "RANGE" : "ROWS"; - break; - case WindowBoundary::EXPR_FOLLOWING_ROWS: - case WindowBoundary::EXPR_FOLLOWING_RANGE: - from = start_expr->GetName() + " FOLLOWING"; - units = (start == WindowBoundary::EXPR_FOLLOWING_RANGE) ? "RANGE" : "ROWS"; - break; - default: - break; - } - - string to; - switch (end) { - case WindowBoundary::CURRENT_ROW_RANGE: - if (start != WindowBoundary::UNBOUNDED_PRECEDING) { - to = "CURRENT ROW"; - units = "RANGE"; - } - break; - case WindowBoundary::CURRENT_ROW_ROWS: - to = "CURRENT ROW"; - units = "ROWS"; - break; - case WindowBoundary::UNBOUNDED_PRECEDING: - to = "UNBOUNDED PRECEDING"; - break; - case WindowBoundary::EXPR_PRECEDING_ROWS: - case WindowBoundary::EXPR_PRECEDING_RANGE: - to = end_expr->GetName() + " PRECEDING"; - units = (start == WindowBoundary::EXPR_PRECEDING_RANGE) ? "RANGE" : "ROWS"; - break; - case WindowBoundary::EXPR_FOLLOWING_ROWS: - case WindowBoundary::EXPR_FOLLOWING_RANGE: - to = end_expr->GetName() + " FOLLOWING"; - units = (start == WindowBoundary::EXPR_FOLLOWING_RANGE) ? "RANGE" : "ROWS"; - break; - default: - break; - } - - if (!from.empty() || !to.empty()) { - result += sep + units; - } - if (!from.empty() && !to.empty()) { - result += " BETWEEN "; - result += from; - result += " AND "; - result += to; - } else if (!from.empty()) { - result += " "; - result += from; - } else if (!to.empty()) { - result += " "; - result += to; - } - - result += ")"; - return result; + string function_name = aggregate.get() ? aggregate->name : ExpressionTypeToString(type); + return WindowExpression::ToString(*this, string(), + function_name); } bool BoundWindowExpression::Equals(const BaseExpression *other_p) const { @@ -155252,6 +165030,21 @@ bool Expression::HasSideEffects() const { return has_side_effects; } +bool Expression::PropagatesNullValues() const { + if (type == ExpressionType::OPERATOR_IS_NULL || type == ExpressionType::OPERATOR_IS_NOT_NULL || + type == ExpressionType::COMPARE_NOT_DISTINCT_FROM || type == ExpressionType::COMPARE_DISTINCT_FROM || + type == ExpressionType::CONJUNCTION_OR || type == ExpressionType::CONJUNCTION_AND) { + return false; + } + bool propagate_null_values = true; + ExpressionIterator::EnumerateChildren(*this, [&](const Expression &child) { + if (!child.PropagatesNullValues()) { + propagate_null_values = false; + } + }); + return propagate_null_values; +} + bool Expression::IsFoldable() const { bool is_foldable = true; ExpressionIterator::EnumerateChildren(*this, [&](const Expression &child) { @@ -155698,10 +165491,22 @@ OrderBinder::OrderBinder(vector binders, idx_t projection_index, Selec } unique_ptr OrderBinder::CreateProjectionReference(ParsedExpression &expr, idx_t index) { - return make_unique(expr.GetName(), LogicalType::INVALID, + string alias; + if (extra_list && index < extra_list->size()) { + alias = extra_list->at(index)->ToString(); + } else { + alias = expr.GetName(); + } + return make_unique(move(alias), LogicalType::INVALID, ColumnBinding(projection_index, index)); } +unique_ptr OrderBinder::CreateExtraReference(unique_ptr expr) { + auto result = CreateProjectionReference(*expr, extra_list->size()); + extra_list->push_back(move(expr)); + return result; +} + unique_ptr OrderBinder::Bind(unique_ptr expr) { // in the ORDER BY clause we do not bind children // we bind ONLY to the select list @@ -155772,9 +165577,7 @@ unique_ptr OrderBinder::Bind(unique_ptr expr) { expr->ToString()); } // otherwise we need to push the ORDER BY entry into the select list - auto result = CreateProjectionReference(*expr, extra_list->size()); - extra_list->push_back(move(expr)); - return result; + return CreateExtraReference(move(expr)); } } // namespace duckdb @@ -155890,6 +165693,28 @@ string RelationBinder::UnsupportedAggregateMessage() { +namespace duckdb { + +ReturningBinder::ReturningBinder(Binder &binder, ClientContext &context) : ExpressionBinder(binder, context) { +} + +BindResult ReturningBinder::BindExpression(unique_ptr *expr_ptr, idx_t depth, bool root_expression) { + auto &expr = **expr_ptr; + switch (expr.GetExpressionClass()) { + case ExpressionClass::SUBQUERY: + return BindResult("SUBQUERY is not supported in returning statements"); + case ExpressionClass::BOUND_SUBQUERY: + return BindResult("BOUND SUBQUERY is not supported in returning statements"); + default: + return ExpressionBinder::BindExpression(expr_ptr, depth); + } +} + +} // namespace duckdb + + + + @@ -156310,6 +166135,7 @@ string ExpressionBinder::Bind(unique_ptr *expr, idx_t depth, b + namespace duckdb { void ExpressionIterator::EnumerateChildren(const Expression &expr, @@ -156471,10 +166297,13 @@ void ExpressionIterator::EnumerateTableRefChildren(BoundTableRef &ref, EnumerateQueryNodeChildren(*bound_subquery.subquery, callback); break; } - default: - D_ASSERT(ref.type == TableReferenceType::TABLE_FUNCTION || ref.type == TableReferenceType::BASE_TABLE || - ref.type == TableReferenceType::EMPTY); + case TableReferenceType::TABLE_FUNCTION: + case TableReferenceType::EMPTY: + case TableReferenceType::BASE_TABLE: + case TableReferenceType::CTE: break; + default: + throw NotImplementedException("Unimplemented table reference type in ExpressionIterator"); } } @@ -156487,8 +166316,13 @@ void ExpressionIterator::EnumerateQueryNodeChildren(BoundQueryNode &node, EnumerateQueryNodeChildren(*bound_setop.right, callback); break; } - default: - D_ASSERT(node.type == QueryNodeType::SELECT_NODE); + case QueryNodeType::RECURSIVE_CTE_NODE: { + auto &cte_node = (BoundRecursiveCTENode &)node; + EnumerateQueryNodeChildren(*cte_node.left, callback); + EnumerateQueryNodeChildren(*cte_node.right, callback); + break; + } + case QueryNodeType::SELECT_NODE: { auto &bound_select = (BoundSelectNode &)node; for (idx_t i = 0; i < bound_select.select_list.size(); i++) { EnumerateExpression(bound_select.select_list[i], callback); @@ -156512,6 +166346,9 @@ void ExpressionIterator::EnumerateQueryNodeChildren(BoundQueryNode &node, } break; } + default: + throw NotImplementedException("Unimplemented query node in ExpressionIterator"); + } for (idx_t i = 0; i < node.modifiers.size(); i++) { switch (node.modifiers[i]->type) { case ResultModifierType::DISTINCT_MODIFIER: @@ -156725,7 +166562,8 @@ string IsNotNullFilter::ToString(const string &column_name) { namespace duckdb { unique_ptr JoinCondition::CreateExpression(JoinCondition cond) { - return make_unique(cond.comparison, move(cond.left), move(cond.right)); + auto bound_comparison = make_unique(cond.comparison, move(cond.left), move(cond.right)); + return move(bound_comparison); } JoinSide JoinSide::CombineJoinSide(JoinSide left, JoinSide right) { @@ -156807,6 +166645,7 @@ JoinSide JoinSide::GetJoinSide(const unordered_set &bindings, unordered_s + namespace duckdb { string LogicalOperator::GetName() const { @@ -156883,6 +166722,7 @@ void LogicalOperator::Verify() { #ifdef DEBUG // verify expressions for (idx_t expr_idx = 0; expr_idx < expressions.size(); expr_idx++) { + auto str = expressions[expr_idx]->ToString(); // verify that we can (correctly) copy this expression auto copy = expressions[expr_idx]->Copy(); auto original_hash = expressions[expr_idx]->Hash(); @@ -156902,6 +166742,7 @@ void LogicalOperator::Verify() { D_ASSERT(!expr_equal); } } + D_ASSERT(!str.empty()); } D_ASSERT(!ToString().empty()); for (auto &child : children) { @@ -157985,8 +167826,9 @@ class RewriteCountAggregates : public LogicalOperatorVisitor { namespace duckdb { -FlattenDependentJoins::FlattenDependentJoins(Binder &binder, const vector &correlated) - : binder(binder), correlated_columns(correlated) { +FlattenDependentJoins::FlattenDependentJoins(Binder &binder, const vector &correlated, + bool any_join) + : binder(binder), correlated_columns(correlated), any_join(any_join) { for (idx_t i = 0; i < correlated_columns.size(); i++) { auto &col = correlated_columns[i]; correlated_map[col.binding] = i; @@ -158015,7 +167857,8 @@ bool FlattenDependentJoins::DetectCorrelatedExpressions(LogicalOperator *op) { } unique_ptr FlattenDependentJoins::PushDownDependentJoin(unique_ptr plan) { - auto result = PushDownDependentJoinInternal(move(plan)); + bool propagate_null_values = true; + auto result = PushDownDependentJoinInternal(move(plan), propagate_null_values); if (!replacement_map.empty()) { // check if we have to replace any COUNT aggregates into "CASE WHEN X IS NULL THEN 0 ELSE COUNT END" RewriteCountAggregates aggr(replacement_map); @@ -158024,7 +167867,23 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoin(unique_ return result; } -unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal(unique_ptr plan) { +bool SubqueryDependentFilter(Expression *expr) { + if (expr->expression_class == ExpressionClass::BOUND_CONJUNCTION && + expr->GetExpressionType() == ExpressionType::CONJUNCTION_AND) { + auto bound_conjuction = (BoundConjunctionExpression *)expr; + for (auto &child : bound_conjuction->children) { + if (SubqueryDependentFilter(child.get())) { + return true; + } + } + } + if (expr->expression_class == ExpressionClass::BOUND_SUBQUERY) { + return true; + } + return false; +} +unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal(unique_ptr plan, + bool &parent_propagate_null_values) { // first check if the logical operator has correlated expressions auto entry = has_correlated_expressions.find(plan.get()); D_ASSERT(entry != has_correlated_expressions.end()); @@ -158045,7 +167904,11 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal case LogicalOperatorType::LOGICAL_FILTER: { // filter // first we flatten the dependent join in the child of the filter - plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0])); + for (auto &expr : plan->expressions) { + any_join |= SubqueryDependentFilter(expr.get()); + } + plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0]), parent_propagate_null_values); + // then we replace any correlated expressions with the corresponding entry in the correlated_map RewriteCorrelatedExpressions rewriter(base_binding, correlated_map); rewriter.VisitOperator(*plan); @@ -158054,7 +167917,11 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal case LogicalOperatorType::LOGICAL_PROJECTION: { // projection // first we flatten the dependent join in the child of the projection - plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0])); + for (auto &expr : plan->expressions) { + parent_propagate_null_values &= expr->PropagatesNullValues(); + } + plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0]), parent_propagate_null_values); + // then we replace any correlated expressions with the corresponding entry in the correlated_map RewriteCorrelatedExpressions rewriter(base_binding, correlated_map); rewriter.VisitOperator(*plan); @@ -158075,7 +167942,10 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal auto &aggr = (LogicalAggregate &)*plan; // aggregate and group by // first we flatten the dependent join in the child of the projection - plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0])); + for (auto &expr : plan->expressions) { + parent_propagate_null_values &= expr->PropagatesNullValues(); + } + plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0]), parent_propagate_null_values); // then we replace any correlated expressions with the corresponding entry in the correlated_map RewriteCorrelatedExpressions rewriter(base_binding, correlated_map); rewriter.VisitOperator(*plan); @@ -158092,11 +167962,18 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal // we have to perform a LEFT OUTER JOIN between the result of this aggregate and the delim scan // FIXME: this does not always have to be a LEFT OUTER JOIN, depending on whether aggr.expressions return // NULL or a value - auto left_outer_join = make_unique(JoinType::LEFT); + unique_ptr join = make_unique(JoinType::INNER); + for (auto &aggr_exp : aggr.expressions) { + auto b_aggr_exp = (BoundAggregateExpression *)aggr_exp.get(); + if (!b_aggr_exp->PropagatesNullValues() || any_join || !parent_propagate_null_values) { + join = make_unique(JoinType::LEFT); + break; + } + } auto left_index = binder.GenerateTableIndex(); auto delim_scan = make_unique(left_index, delim_types); - left_outer_join->children.push_back(move(delim_scan)); - left_outer_join->children.push_back(move(plan)); + join->children.push_back(move(delim_scan)); + join->children.push_back(move(plan)); for (idx_t i = 0; i < correlated_columns.size(); i++) { JoinCondition cond; cond.left = @@ -158104,9 +167981,8 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal cond.right = make_unique( correlated_columns[i].type, ColumnBinding(aggr.group_index, (aggr.groups.size() - correlated_columns.size()) + i)); - cond.comparison = ExpressionType::COMPARE_EQUAL; - cond.null_values_are_equal = true; - left_outer_join->conditions.push_back(move(cond)); + cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; + join->conditions.push_back(move(cond)); } // for any COUNT aggregate we replace references to the column with: CASE WHEN COUNT(*) IS NULL THEN 0 // ELSE COUNT(*) END @@ -158124,7 +168000,7 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal base_binding.table_index = left_index; this->delim_offset = base_binding.column_index = 0; this->data_offset = 0; - return move(left_outer_join); + return move(join); } else { // update the delim_index base_binding.table_index = aggr.group_index; @@ -158140,20 +168016,20 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal bool right_has_correlation = has_correlated_expressions.find(plan->children[1].get())->second; if (!right_has_correlation) { // only left has correlation: push into left - plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0])); + plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0]), parent_propagate_null_values); return plan; } if (!left_has_correlation) { // only right has correlation: push into right - plan->children[1] = PushDownDependentJoinInternal(move(plan->children[1])); + plan->children[1] = PushDownDependentJoinInternal(move(plan->children[1]), parent_propagate_null_values); return plan; } // both sides have correlation // turn into an inner join auto join = make_unique(JoinType::INNER); - plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0])); + plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0]), parent_propagate_null_values); auto left_binding = this->base_binding; - plan->children[1] = PushDownDependentJoinInternal(move(plan->children[1])); + plan->children[1] = PushDownDependentJoinInternal(move(plan->children[1]), parent_propagate_null_values); // add the correlated columns to the join conditions for (idx_t i = 0; i < correlated_columns.size(); i++) { JoinCondition cond; @@ -158161,8 +168037,7 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal correlated_columns[i].type, ColumnBinding(left_binding.table_index, left_binding.column_index + i)); cond.right = make_unique( correlated_columns[i].type, ColumnBinding(base_binding.table_index, base_binding.column_index + i)); - cond.comparison = ExpressionType::COMPARE_EQUAL; - cond.null_values_are_equal = true; + cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; join->conditions.push_back(move(cond)); } join->children.push_back(move(plan->children[0])); @@ -158181,26 +168056,30 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal // inner join if (!right_has_correlation) { // only left has correlation: push into left - plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0])); + plan->children[0] = + PushDownDependentJoinInternal(move(plan->children[0]), parent_propagate_null_values); return plan; } if (!left_has_correlation) { // only right has correlation: push into right - plan->children[1] = PushDownDependentJoinInternal(move(plan->children[1])); + plan->children[1] = + PushDownDependentJoinInternal(move(plan->children[1]), parent_propagate_null_values); return plan; } } else if (join.join_type == JoinType::LEFT) { // left outer join if (!right_has_correlation) { // only left has correlation: push into left - plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0])); + plan->children[0] = + PushDownDependentJoinInternal(move(plan->children[0]), parent_propagate_null_values); return plan; } } else if (join.join_type == JoinType::RIGHT) { // left outer join if (!left_has_correlation) { // only right has correlation: push into right - plan->children[1] = PushDownDependentJoinInternal(move(plan->children[1])); + plan->children[1] = + PushDownDependentJoinInternal(move(plan->children[1]), parent_propagate_null_values); return plan; } } else if (join.join_type == JoinType::MARK) { @@ -158208,7 +168087,7 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal throw Exception("MARK join with correlation in RHS not supported"); } // push the child into the LHS - plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0])); + plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0]), parent_propagate_null_values); // rewrite expressions in the join conditions RewriteCorrelatedExpressions rewriter(base_binding, correlated_map); rewriter.VisitOperator(*plan); @@ -158218,9 +168097,9 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal } // both sides have correlation // push into both sides - plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0])); + plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0]), parent_propagate_null_values); auto left_binding = this->base_binding; - plan->children[1] = PushDownDependentJoinInternal(move(plan->children[1])); + plan->children[1] = PushDownDependentJoinInternal(move(plan->children[1]), parent_propagate_null_values); auto right_binding = this->base_binding; // NOTE: for OUTER JOINS it matters what the BASE BINDING is after the join // for the LEFT OUTER JOIN, we want the LEFT side to be the base binding after we push @@ -158241,8 +168120,7 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal JoinCondition cond; cond.left = move(left); cond.right = move(right); - cond.comparison = ExpressionType::COMPARE_EQUAL; - cond.null_values_are_equal = true; + cond.comparison = ExpressionType::COMPARE_NOT_DISTINCT_FROM; auto &comparison_join = (LogicalComparisonJoin &)join; comparison_join.conditions.push_back(move(cond)); @@ -158268,7 +168146,7 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal if (limit.limit) { throw ParserException("Non-constant limit not supported in correlated subquery"); } - plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0])); + plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0]), parent_propagate_null_values); if (limit.limit_val == 0) { // limit = 0 means we return zero columns here return plan; @@ -158283,7 +168161,7 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal case LogicalOperatorType::LOGICAL_WINDOW: { auto &window = (LogicalWindow &)*plan; // push into children - plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0])); + plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0]), parent_propagate_null_values); // add the correlated columns to the PARTITION BY clauses in the Window for (auto &expr : window.expressions) { D_ASSERT(expr->GetExpressionClass() == ExpressionClass::BOUND_WINDOW); @@ -158315,7 +168193,7 @@ unique_ptr FlattenDependentJoins::PushDownDependentJoinInternal case LogicalOperatorType::LOGICAL_EXPRESSION_GET: { // expression get // first we flatten the dependent join in the child - plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0])); + plan->children[0] = PushDownDependentJoinInternal(move(plan->children[0]), parent_propagate_null_values); // then we replace any correlated expressions with the corresponding entry in the correlated_map RewriteCorrelatedExpressions rewriter(base_binding, correlated_map); rewriter.VisitOperator(*plan); @@ -159407,7 +169285,8 @@ class CheckpointManager { void WriteTable(TableCatalogEntry &table); void WriteView(ViewCatalogEntry &table); void WriteSequence(SequenceCatalogEntry &table); - void WriteMacro(MacroCatalogEntry &table); + void WriteMacro(ScalarMacroCatalogEntry &table); + void WriteTableMacro(TableMacroCatalogEntry &table); void WriteType(TypeCatalogEntry &table); void ReadSchema(ClientContext &context, MetaBlockReader &reader); @@ -159415,6 +169294,7 @@ class CheckpointManager { void ReadView(ClientContext &context, MetaBlockReader &reader); void ReadSequence(ClientContext &context, MetaBlockReader &reader); void ReadMacro(ClientContext &context, MetaBlockReader &reader); + void ReadTableMacro(ClientContext &context, MetaBlockReader &reader); void ReadType(ClientContext &context, MetaBlockReader &reader); private: @@ -159786,11 +169666,12 @@ void WriteOverflowStringsToDisk::AllocateNewBlock(block_id_t new_block_id) { - namespace duckdb { +void ReorderTableEntries(vector &tables); + CheckpointManager::CheckpointManager(DatabaseInstance &db) : db(db) { } @@ -159914,43 +169795,64 @@ void CheckpointManager::WriteSchema(SchemaCatalogEntry &schema) { custom_types.push_back((TypeCatalogEntry *)entry); }); - vector macros; + vector macros; schema.Scan(CatalogType::SCALAR_FUNCTION_ENTRY, [&](CatalogEntry *entry) { if (entry->internal) { return; } if (entry->type == CatalogType::MACRO_ENTRY) { - macros.push_back((MacroCatalogEntry *)entry); + macros.push_back((ScalarMacroCatalogEntry *)entry); + } + }); + + vector table_macros; + schema.Scan(CatalogType::TABLE_FUNCTION_ENTRY, [&](CatalogEntry *entry) { + if (entry->internal) { + return; + } + if (entry->type == CatalogType::TABLE_MACRO_ENTRY) { + table_macros.push_back((TableMacroCatalogEntry *)entry); } }); + FieldWriter writer(*metadata_writer); + writer.WriteField(custom_types.size()); + writer.WriteField(sequences.size()); + writer.WriteField(tables.size()); + writer.WriteField(views.size()); + writer.WriteField(macros.size()); + writer.WriteField(table_macros.size()); + writer.Finalize(); + // write the custom_types - metadata_writer->Write(custom_types.size()); for (auto &custom_type : custom_types) { WriteType(*custom_type); } // write the sequences - metadata_writer->Write(sequences.size()); for (auto &seq : sequences) { WriteSequence(*seq); } + // reorder tables because of foreign key constraint + ReorderTableEntries(tables); // now write the tables - metadata_writer->Write(tables.size()); for (auto &table : tables) { WriteTable(*table); } // now write the views - metadata_writer->Write(views.size()); for (auto &view : views) { WriteView(*view); } // finally write the macro's - metadata_writer->Write(macros.size()); for (auto ¯o : macros) { WriteMacro(*macro); } + + // finally write the macro's + for (auto ¯o : table_macros) { + WriteTableMacro(*macro); + } } void CheckpointManager::ReadSchema(ClientContext &context, MetaBlockReader &reader) { @@ -159962,33 +169864,42 @@ void CheckpointManager::ReadSchema(ClientContext &context, MetaBlockReader &read info->on_conflict = OnCreateConflict::IGNORE_ON_CONFLICT; catalog.CreateSchema(context, info.get()); + // first read all the counts + FieldReader field_reader(reader); + uint32_t enum_count = field_reader.ReadRequired(); + uint32_t seq_count = field_reader.ReadRequired(); + uint32_t table_count = field_reader.ReadRequired(); + uint32_t view_count = field_reader.ReadRequired(); + uint32_t macro_count = field_reader.ReadRequired(); + uint32_t table_macro_count = field_reader.ReadRequired(); + field_reader.Finalize(); + // now read the enums - uint32_t enum_count = reader.Read(); for (uint32_t i = 0; i < enum_count; i++) { ReadType(context, reader); } // read the sequences - uint32_t seq_count = reader.Read(); for (uint32_t i = 0; i < seq_count; i++) { ReadSequence(context, reader); } // read the table count and recreate the tables - uint32_t table_count = reader.Read(); for (uint32_t i = 0; i < table_count; i++) { ReadTable(context, reader); } // now read the views - uint32_t view_count = reader.Read(); for (uint32_t i = 0; i < view_count; i++) { ReadView(context, reader); } // finally read the macro's - uint32_t macro_count = reader.Read(); for (uint32_t i = 0; i < macro_count; i++) { ReadMacro(context, reader); } + + for (uint32_t i = 0; i < table_macro_count; i++) { + ReadTableMacro(context, reader); + } } //===--------------------------------------------------------------------===// @@ -160036,13 +169947,22 @@ void CheckpointManager::ReadType(ClientContext &context, MetaBlockReader &reader //===--------------------------------------------------------------------===// // Macro's //===--------------------------------------------------------------------===// -void CheckpointManager::WriteMacro(MacroCatalogEntry ¯o) { +void CheckpointManager::WriteMacro(ScalarMacroCatalogEntry ¯o) { macro.Serialize(*metadata_writer); } void CheckpointManager::ReadMacro(ClientContext &context, MetaBlockReader &reader) { - auto info = MacroCatalogEntry::Deserialize(reader); + auto info = ScalarMacroCatalogEntry::Deserialize(reader); + auto &catalog = Catalog::GetCatalog(db); + catalog.CreateFunction(context, info.get()); +} + +void CheckpointManager::WriteTableMacro(TableMacroCatalogEntry ¯o) { + macro.Serialize(*metadata_writer); +} +void CheckpointManager::ReadTableMacro(ClientContext &context, MetaBlockReader &reader) { + auto info = TableMacroCatalogEntry::Deserialize(reader); auto &catalog = Catalog::GetCatalog(db); catalog.CreateFunction(context, info.get()); } @@ -160155,10 +170075,20 @@ void PartialBlock::FlushToDisk(DatabaseInstance &db) { } } // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/bitpacking.hpp +// +// +//===----------------------------------------------------------------------===// + + + // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #11 // See the end of this file for a list /** @@ -160171,7 +170101,7 @@ void PartialBlock::FlushToDisk(DatabaseInstance &db) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #11 // See the end of this file for a list /** @@ -161326,6 +171256,243 @@ inline void fastpack(const uint64_t *__restrict in, +namespace duckdb { + +using bitpacking_width_t = uint8_t; + +class BitpackingPrimitives { + +public: + static constexpr const idx_t BITPACKING_ALGORITHM_GROUP_SIZE = 32; + static constexpr const idx_t BITPACKING_HEADER_SIZE = sizeof(uint64_t); + static constexpr const bool BYTE_ALIGNED = false; + + // To ensure enough data is available, use GetRequiredSize() to determine the correct size for dst buffer + // Note: input should be aligned to BITPACKING_ALGORITHM_GROUP_SIZE for good performance. + template + inline static void PackBuffer(data_ptr_t dst, T *src, idx_t count, bitpacking_width_t width) { + if (ASSUME_INPUT_ALIGNED) { + for (idx_t i = 0; i < count; i += BITPACKING_ALGORITHM_GROUP_SIZE) { + PackGroup(dst + (i * width) / 8, src + i, width); + } + } else { + idx_t misaligned_count = count % BITPACKING_ALGORITHM_GROUP_SIZE; + T tmp_buffer[BITPACKING_ALGORITHM_GROUP_SIZE]; // TODO maybe faster on the heap? + + if (misaligned_count) { + count -= misaligned_count; + } + + for (idx_t i = 0; i < count; i += BITPACKING_ALGORITHM_GROUP_SIZE) { + PackGroup(dst + (i * width) / 8, src + i, width); + } + + // Input was not aligned to BITPACKING_ALGORITHM_GROUP_SIZE, we need a copy + if (misaligned_count) { + memcpy(tmp_buffer, src + count, misaligned_count * sizeof(T)); + PackGroup(dst + (count * width) / 8, tmp_buffer, width); + } + } + } + + // Unpacks a block of BITPACKING_ALGORITHM_GROUP_SIZE values + // Assumes both src and dst to be of the correct size + template + inline static void UnPackBuffer(data_ptr_t dst, data_ptr_t src, idx_t count, bitpacking_width_t width, + bool skip_sign_extension = false) { + + for (idx_t i = 0; i < count; i += BITPACKING_ALGORITHM_GROUP_SIZE) { + UnPackGroup(dst + i * sizeof(T), src + (i * width) / 8, width, skip_sign_extension); + } + } + + // Packs a block of BITPACKING_ALGORITHM_GROUP_SIZE values + template + inline static void PackBlock(data_ptr_t dst, T *src, bitpacking_width_t width) { + return PackGroup(dst, src, width); + } + + // Unpacks a block of BITPACKING_ALGORITHM_GROUP_SIZE values + template + inline static void UnPackBlock(data_ptr_t dst, data_ptr_t src, bitpacking_width_t width, + bool skip_sign_extension = false) { + return UnPackGroup(dst, src, width, skip_sign_extension); + } + + // Calculates the minimum required number of bits per value that can store all values + template + inline static bitpacking_width_t MinimumBitWidth(T value) { + return FindMinimumBitWidth(value, value); + } + + // Calculates the minimum required number of bits per value that can store all values + template + inline static bitpacking_width_t MinimumBitWidth(T *values, idx_t count) { + return FindMinimumBitWidth(values, count); + } + + template + inline static idx_t GetRequiredSize(idx_t count, bitpacking_width_t width) { + count = RoundUpToAlgorithmGroupSize(count); + return ((count * width) / 8); + } + + template + inline static T RoundUpToAlgorithmGroupSize(T num_to_round) { + int remainder = num_to_round % BITPACKING_ALGORITHM_GROUP_SIZE; + if (remainder == 0) { + return num_to_round; + } + + return num_to_round + BITPACKING_ALGORITHM_GROUP_SIZE - remainder; + } + +private: + template + static bitpacking_width_t FindMinimumBitWidth(T *values, idx_t count) { + T min_value = values[0]; + T max_value = values[0]; + + for (idx_t i = 1; i < count; i++) { + if (values[i] > max_value) { + max_value = values[i]; + } + + if (std::is_signed::value) { + if (values[i] < min_value) { + min_value = values[i]; + } + } + } + + return FindMinimumBitWidth(min_value, max_value); + } + + template + static bitpacking_width_t FindMinimumBitWidth(T min_value, T max_value) { + bitpacking_width_t bitwidth; + T value; + + if (std::is_signed::value) { + if (min_value == NumericLimits::Minimum()) { + // handle special case of the minimal value, as it cannot be negated like all other values. + return sizeof(T) * 8; + } else { + value = MaxValue((T)-min_value, max_value); + } + } else { + value = max_value; + } + + if (value == 0) { + return 0; + } + + if (std::is_signed::value) { + bitwidth = 1; + } else { + bitwidth = 0; + } + + while (value) { + bitwidth++; + value >>= 1; + } + + bitwidth = GetEffectiveWidth(bitwidth); + + // Assert results are correct +#ifdef DEBUG + if (bitwidth < sizeof(T) * 8 && bitwidth != 0) { + if (std::is_signed::value) { + D_ASSERT((int64_t)max_value <= (int64_t)(1L << (bitwidth - 1)) - 1); + D_ASSERT((int64_t)min_value >= (int64_t)(-1 * ((1L << (bitwidth - 1)) - 1) - 1)); + } else { + D_ASSERT((uint64_t)max_value <= (uint64_t)(1L << (bitwidth)) - 1); + } + } +#endif + if (round_to_next_byte) { + return (bitwidth / 8 + (bitwidth % 8 != 0)) * 8; + } else { + return bitwidth; + } + } + + template + static void UnPackGroup(data_ptr_t dst, data_ptr_t src, bitpacking_width_t width, + bool skip_sign_extension = false) { + if (std::is_same::value || std::is_same::value) { + duckdb_fastpforlib::fastunpack((const uint8_t *)src, (uint8_t *)dst, (uint32_t)width); + } else if (std::is_same::value || std::is_same::value) { + duckdb_fastpforlib::fastunpack((const uint16_t *)src, (uint16_t *)dst, (uint32_t)width); + } else if (std::is_same::value || std::is_same::value) { + duckdb_fastpforlib::fastunpack((const uint32_t *)src, (uint32_t *)dst, (uint32_t)width); + } else if (std::is_same::value || std::is_same::value) { + duckdb_fastpforlib::fastunpack((const uint32_t *)src, (uint64_t *)dst, (uint32_t)width); + } else { + throw InternalException("Unsupported type found in bitpacking."); + } + + if (NumericLimits::IsSigned() && !skip_sign_extension && width > 0 && width < sizeof(T) * 8) { + SignExtend(dst, width); + } + } + + // Prevent compression at widths that are ineffective + template + static bitpacking_width_t GetEffectiveWidth(bitpacking_width_t width) { + if (width > 56) { + return 64; + } + + if (width > 28 && (std::is_same::value || std::is_same::value)) { + return 32; + } + + else if (width > 14 && (std::is_same::value || std::is_same::value)) { + return 16; + } + + return width; + } + + // Sign bit extension + template ::type> + static void SignExtend(data_ptr_t dst, bitpacking_width_t width) { + T const mask = ((T_U)1) << (width - 1); + for (idx_t i = 0; i < BitpackingPrimitives::BITPACKING_ALGORITHM_GROUP_SIZE; ++i) { + T value = Load(dst + i * sizeof(T)); + value = value & ((((T_U)1) << width) - ((T_U)1)); + T result = (value ^ mask) - mask; + Store(result, dst + i * sizeof(T)); + } + } + + template + static void PackGroup(data_ptr_t dst, T *values, bitpacking_width_t width) { + if (std::is_same::value || std::is_same::value) { + duckdb_fastpforlib::fastpack((const uint8_t *)values, (uint8_t *)dst, (uint32_t)width); + } else if (std::is_same::value || std::is_same::value) { + duckdb_fastpforlib::fastpack((const uint16_t *)values, (uint16_t *)dst, (uint32_t)width); + } else if (std::is_same::value || std::is_same::value) { + duckdb_fastpforlib::fastpack((const uint32_t *)values, (uint32_t *)dst, (uint32_t)width); + } else if (std::is_same::value || std::is_same::value) { + duckdb_fastpforlib::fastpack((const uint64_t *)values, (uint32_t *)dst, (uint32_t)width); + } else { + throw InternalException("Unsupported type found in bitpacking."); + } + } +}; + +} // namespace duckdb + + + + + + + //===----------------------------------------------------------------------===// @@ -161571,172 +171738,10 @@ class ColumnDataCheckpointer { namespace duckdb { -using bitpacking_width_t = uint8_t; - // Note that optimizations in scanning only work if this value is equal to STANDARD_VECTOR_SIZE, however we keep them // separated to prevent the code from break on lower vector sizes static constexpr const idx_t BITPACKING_WIDTH_GROUP_SIZE = 1024; -class BitpackingPrimitives { -public: - static constexpr const idx_t BITPACKING_ALGORITHM_GROUP_SIZE = 32; - static constexpr const idx_t BITPACKING_HEADER_SIZE = sizeof(uint64_t); - static constexpr const bool BYTE_ALIGNED = false; - - // Packs a block of BITPACKING_ALGORITHM_GROUP_SIZE values - template - inline static void PackBlock(data_ptr_t dst, T *src, bitpacking_width_t width) { - return PackGroup(dst, src, width); - } - - // Unpacks a block of BITPACKING_ALGORITHM_GROUP_SIZE values - template - inline static void UnPackBlock(data_ptr_t dst, data_ptr_t src, bitpacking_width_t width, - bool skip_sign_extension = false) { - return UnPackGroup(dst, src, width, skip_sign_extension); - } - - // Calculates the minimum required number of bits per value that can store all values - template - inline static bitpacking_width_t MinimumBitWidth(T *values, idx_t count) { - return FindMinimumBitWidth(values, count); - } - -private: - template - static bitpacking_width_t MinimumBitWidth(T min_value, T max_value) { - bitpacking_width_t required_bits; - - if (std::is_signed::value) { - if (min_value == NumericLimits::Minimum()) { - // handle special case of the minimal value, as it cannot be negated like all other values. - return sizeof(T) * 8; - } else { - max_value = MaxValue((T)-min_value, max_value); - } - } - - if (max_value == 0) { - return 0; - } - - if (std::is_signed::value) { - required_bits = 1; - } else { - required_bits = 0; - } - - while (max_value) { - required_bits++; - max_value >>= 1; - } - - return GetEffectiveWidth(required_bits); - } - - template - static bitpacking_width_t FindMinimumBitWidth(T *values, idx_t count) { - T min_value = values[0]; - T max_value = values[0]; - - for (idx_t i = 1; i < count; i++) { - if (values[i] > max_value) { - max_value = values[i]; - } - - if (std::is_signed::value) { - if (values[i] < min_value) { - min_value = values[i]; - } - } - } - - bitpacking_width_t calc_width = MinimumBitWidth(std::is_signed::value ? min_value : 0, max_value); - - // Assert results are correct -#ifdef DEBUG - if (calc_width < sizeof(T) * 8 && calc_width != 0) { - if (std::is_signed::value) { - D_ASSERT((int64_t)max_value <= (int64_t)(1L << (calc_width - 1)) - 1); - D_ASSERT((int64_t)min_value >= (int64_t)(-1 * ((1L << (calc_width - 1)) - 1) - 1)); - } else { - D_ASSERT((uint64_t)max_value <= (uint64_t)(1L << (calc_width)) - 1); - } - } -#endif - if (round_to_next_byte) { - return (calc_width / 8 + (calc_width % 8 != 0)) * 8; - } else { - return calc_width; - } - } - - template - static void UnPackGroup(data_ptr_t dst, data_ptr_t src, bitpacking_width_t width, - bool skip_sign_extension = false) { - if (std::is_same::value || std::is_same::value) { - duckdb_fastpforlib::fastunpack((const uint8_t *)src, (uint8_t *)dst, (uint32_t)width); - } else if (std::is_same::value || std::is_same::value) { - duckdb_fastpforlib::fastunpack((const uint16_t *)src, (uint16_t *)dst, (uint32_t)width); - } else if (std::is_same::value || std::is_same::value) { - duckdb_fastpforlib::fastunpack((const uint32_t *)src, (uint32_t *)dst, (uint32_t)width); - } else if (std::is_same::value || std::is_same::value) { - duckdb_fastpforlib::fastunpack((const uint32_t *)src, (uint64_t *)dst, (uint32_t)width); - } else { - throw InternalException("Unsupported type found in bitpacking."); - } - - if (NumericLimits::IsSigned() && !skip_sign_extension && width > 0 && width < sizeof(T) * 8) { - SignExtend(dst, width); - } - } - - // Prevent compression at widths that are ineffective - template - static bitpacking_width_t GetEffectiveWidth(bitpacking_width_t width) { - if (width > 56) { - return 64; - } - - if (width > 28 && (std::is_same::value || std::is_same::value)) { - return 32; - } - - else if (width > 14 && (std::is_same::value || std::is_same::value)) { - return 16; - } - - return width; - } - - // Sign bit extension - template ::type> - static void SignExtend(data_ptr_t dst, bitpacking_width_t width) { - T const mask = ((T_U)1) << (width - 1); - for (idx_t i = 0; i < BitpackingPrimitives::BITPACKING_ALGORITHM_GROUP_SIZE; ++i) { - T value = Load(dst + i * sizeof(T)); - value = value & ((((T_U)1) << width) - ((T_U)1)); - T result = (value ^ mask) - mask; - Store(result, dst + i * sizeof(T)); - } - } - - template - static void PackGroup(data_ptr_t dst, T *values, bitpacking_width_t width) { - if (std::is_same::value || std::is_same::value) { - duckdb_fastpforlib::fastpack((const uint8_t *)values, (uint8_t *)dst, (uint32_t)width); - } else if (std::is_same::value || std::is_same::value) { - duckdb_fastpforlib::fastpack((const uint16_t *)values, (uint16_t *)dst, (uint32_t)width); - } else if (std::is_same::value || std::is_same::value) { - duckdb_fastpforlib::fastpack((const uint32_t *)values, (uint32_t *)dst, (uint32_t)width); - } else if (std::is_same::value || std::is_same::value) { - duckdb_fastpforlib::fastpack((const uint64_t *)values, (uint32_t *)dst, (uint32_t)width); - } else { - throw InternalException("Unsupported type found in bitpacking."); - } - } -}; - struct EmptyBitpackingWriter { template static void Operation(T *values, bool *validity, bitpacking_width_t width, idx_t count, void *data_ptr) { @@ -161901,12 +171906,8 @@ struct BitpackingCompressState : public CompressionState { void WriteValues(T *values, bitpacking_width_t width, idx_t count) { // TODO we can optimize this by stopping early if count < BITPACKING_WIDTH_GROUP_SIZE - idx_t compress_loops = BITPACKING_WIDTH_GROUP_SIZE / BitpackingPrimitives::BITPACKING_ALGORITHM_GROUP_SIZE; - for (idx_t i = 0; i < compress_loops; i++) { - BitpackingPrimitives::PackBlock( - data_ptr, &values[i * BitpackingPrimitives::BITPACKING_ALGORITHM_GROUP_SIZE], width); - data_ptr += (BitpackingPrimitives::BITPACKING_ALGORITHM_GROUP_SIZE * width) / 8; - } + BitpackingPrimitives::PackBuffer(data_ptr, values, count, width); + data_ptr += (BITPACKING_WIDTH_GROUP_SIZE * width) / 8; Store(width, width_ptr); width_ptr -= sizeof(bitpacking_width_t); @@ -162191,6 +172192,11 @@ bool BitpackingFun::TypeIsSupported(PhysicalType type) { } } // namespace duckdb + + + + + //===----------------------------------------------------------------------===// // DuckDB // @@ -162251,6 +172257,842 @@ struct StringUncompressed { + + + + + +namespace duckdb { +struct StringDictionaryContainer { + //! The size of the dictionary + uint32_t size; + //! The end of the dictionary (typically Storage::BLOCK_SIZE) + uint32_t end; + + void Verify() { + D_ASSERT(size <= Storage::BLOCK_SIZE); + D_ASSERT(end <= Storage::BLOCK_SIZE); + D_ASSERT(size <= end); + } +}; + +struct StringScanState : public SegmentScanState { + unique_ptr handle; +}; + +struct UncompressedStringStorage { +public: + //! Dictionary header size at the beginning of the string segment (offset + length) + static constexpr uint16_t DICTIONARY_HEADER_SIZE = sizeof(uint32_t) + sizeof(uint32_t); + //! Marker used in length field to indicate the presence of a big string + static constexpr uint16_t BIG_STRING_MARKER = (uint16_t)-1; + //! Base size of big string marker (block id + offset) + static constexpr idx_t BIG_STRING_MARKER_BASE_SIZE = sizeof(block_id_t) + sizeof(int32_t); + //! The marker size of the big string + static constexpr idx_t BIG_STRING_MARKER_SIZE = BIG_STRING_MARKER_BASE_SIZE + sizeof(uint16_t); + //! The size below which the segment is compacted on flushing + static constexpr size_t COMPACTION_FLUSH_LIMIT = (size_t)Storage::BLOCK_SIZE / 5 * 4; + +public: + static unique_ptr StringInitAnalyze(ColumnData &col_data, PhysicalType type); + static bool StringAnalyze(AnalyzeState &state_p, Vector &input, idx_t count); + static idx_t StringFinalAnalyze(AnalyzeState &state_p); + static unique_ptr StringInitScan(ColumnSegment &segment); + static void StringScanPartial(ColumnSegment &segment, ColumnScanState &state, idx_t scan_count, Vector &result, + idx_t result_offset); + static void StringScan(ColumnSegment &segment, ColumnScanState &state, idx_t scan_count, Vector &result); + static void StringFetchRow(ColumnSegment &segment, ColumnFetchState &state, row_t row_id, Vector &result, + idx_t result_idx); + static unique_ptr StringInitSegment(ColumnSegment &segment, block_id_t block_id); + + static idx_t StringAppend(ColumnSegment &segment, SegmentStatistics &stats, VectorData &data, idx_t offset, + idx_t count) { + return StringAppendBase(segment, stats, data, offset, count); + } + + template + static idx_t StringAppendBase(ColumnSegment &segment, SegmentStatistics &stats, VectorData &data, idx_t offset, + idx_t count, std::unordered_map *seen_strings = nullptr) { + auto &buffer_manager = BufferManager::GetBufferManager(segment.db); + auto handle = buffer_manager.Pin(segment.block); + + D_ASSERT(segment.GetBlockOffset() == 0); + auto source_data = (string_t *)data.data; + auto result_data = (int32_t *)(handle->node->buffer + DICTIONARY_HEADER_SIZE); + for (idx_t i = 0; i < count; i++) { + auto source_idx = data.sel->get_index(offset + i); + auto target_idx = segment.count.load(); + idx_t remaining_space = RemainingSpace(segment, *handle); + if (remaining_space < sizeof(int32_t)) { + // string index does not fit in the block at all + return i; + } + remaining_space -= sizeof(int32_t); + if (!data.validity.RowIsValid(source_idx)) { + // null value is stored as -1 + result_data[target_idx] = 0; + } else { + auto dictionary = GetDictionary(segment, *handle); + auto end = handle->node->buffer + dictionary.end; + + dictionary.Verify(); + + int32_t match; + bool found; + if (DUPLICATE_ELIMINATE) { + auto search = seen_strings->find(source_data[source_idx].GetString()); + if (search != seen_strings->end()) { + match = search->second; + found = true; + } else { + found = false; + } + } + + if (DUPLICATE_ELIMINATE && found) { + // We have seen this string + result_data[target_idx] = match; + } else { + // Unknown string, continue + // non-null value, check if we can fit it within the block + idx_t string_length = source_data[source_idx].GetSize(); + idx_t dictionary_length = string_length + sizeof(uint16_t); + + // determine whether or not we have space in the block for this string + bool use_overflow_block = false; + idx_t required_space = dictionary_length; + if (required_space >= StringUncompressed::STRING_BLOCK_LIMIT) { + // string exceeds block limit, store in overflow block and only write a marker here + required_space = BIG_STRING_MARKER_SIZE; + use_overflow_block = true; + } + if (required_space > remaining_space) { + // no space remaining: return how many tuples we ended up writing + return i; + } + + // we have space: write the string + UpdateStringStats(stats, source_data[source_idx]); + + if (use_overflow_block) { + // write to overflow blocks + block_id_t block; + int32_t offset; + // write the string into the current string block + WriteString(segment, source_data[source_idx], block, offset); + dictionary.size += BIG_STRING_MARKER_SIZE; + auto dict_pos = end - dictionary.size; + + // write a big string marker into the dictionary + WriteStringMarker(dict_pos, block, offset); + } else { + // string fits in block, append to dictionary and increment dictionary position + D_ASSERT(string_length < NumericLimits::Maximum()); + dictionary.size += required_space; + auto dict_pos = end - dictionary.size; // first write the length as u16 + Store(string_length, dict_pos); + // now write the actual string data into the dictionary + memcpy(dict_pos + sizeof(uint16_t), source_data[source_idx].GetDataUnsafe(), string_length); + } + D_ASSERT(RemainingSpace(segment, *handle) <= Storage::BLOCK_SIZE); + // place the dictionary offset into the set of vectors + dictionary.Verify(); + + result_data[target_idx] = dictionary.size; + if (DUPLICATE_ELIMINATE) { + seen_strings->insert({source_data[source_idx].GetString(), dictionary.size}); + } + SetDictionary(segment, *handle, dictionary); + } + } + segment.count++; + } + return count; + } + + static idx_t FinalizeAppend(ColumnSegment &segment, SegmentStatistics &stats); + +public: + static inline void UpdateStringStats(SegmentStatistics &stats, const string_t &new_value) { + auto &sstats = (StringStatistics &)*stats.statistics; + sstats.Update(new_value); + } + + static void SetDictionary(ColumnSegment &segment, BufferHandle &handle, StringDictionaryContainer dict); + static StringDictionaryContainer GetDictionary(ColumnSegment &segment, BufferHandle &handle); + static idx_t RemainingSpace(ColumnSegment &segment, BufferHandle &handle); + static void WriteString(ColumnSegment &segment, string_t string, block_id_t &result_block, int32_t &result_offset); + static void WriteStringMemory(ColumnSegment &segment, string_t string, block_id_t &result_block, + int32_t &result_offset); + static string_t ReadString(ColumnSegment &segment, Vector &result, block_id_t block, int32_t offset); + static string_t ReadString(data_ptr_t target, int32_t offset); + static void WriteStringMarker(data_ptr_t target, block_id_t block_id, int32_t offset); + static void ReadStringMarker(data_ptr_t target, block_id_t &block_id, int32_t &offset); + + static string_location_t FetchStringLocation(StringDictionaryContainer dict, data_ptr_t baseptr, + int32_t dict_offset); + static string_t FetchStringFromDict(ColumnSegment &segment, StringDictionaryContainer dict, Vector &result, + data_ptr_t baseptr, int32_t dict_offset); + static string_t FetchString(ColumnSegment &segment, StringDictionaryContainer dict, Vector &result, + data_ptr_t baseptr, string_location_t location); +}; +} // namespace duckdb + + + +namespace duckdb { + +struct StringHash { + std::size_t operator()(const string_t &k) const { + return Hash(k.GetDataUnsafe(), k.GetSize()); + } +}; + +struct StringCompare { + bool operator()(const string_t &lhs, const string_t &rhs) const { + return StringComparisonOperators::EqualsOrNot(lhs, rhs); + } +}; + +// Abstract class for keeping compression state either for compression or size analysis +class DictionaryCompressionState : public CompressionState { +public: + bool UpdateState(Vector &scan_vector, idx_t count) { + VectorData vdata; + scan_vector.Orrify(count, vdata); + auto data = (string_t *)vdata.data; + Verify(); + + for (idx_t i = 0; i < count; i++) { + auto idx = vdata.sel->get_index(i); + size_t string_size = 0; + bool new_string = false; + auto row_is_valid = vdata.validity.RowIsValid(idx); + + if (row_is_valid) { + string_size = data[idx].GetSize(); + if (string_size >= StringUncompressed::STRING_BLOCK_LIMIT) { + // Big strings not implemented for dictionary compression + return false; + } + new_string = !LookupString(data[idx]); + } + + bool fits = HasEnoughSpace(new_string, string_size); + if (!fits) { + Flush(); + new_string = true; + D_ASSERT(HasEnoughSpace(new_string, string_size)); + } + + if (!row_is_valid) { + AddNull(); + } else if (new_string) { + AddNewString(data[idx]); + } else { + AddLastLookup(); + } + + Verify(); + } + + return true; + } + +protected: + // Should verify the State + virtual void Verify() = 0; + // Performs a lookup of str, storing the result internally + virtual bool LookupString(string_t str) = 0; + // Add the most recently looked up str to compression state + virtual void AddLastLookup() = 0; + // Add string to the state that is known to not be seen yet + virtual void AddNewString(string_t str) = 0; + // Add a null value to the compression state + virtual void AddNull() = 0; + // Check if we have enough space to add a string + virtual bool HasEnoughSpace(bool new_string, size_t string_size) = 0; + // Flush the segment to disk if compressing or reset the counters if analyzing + virtual void Flush(bool final = false) = 0; +}; + +typedef struct { + uint32_t dict_size; + uint32_t dict_end; + uint32_t index_buffer_offset; + uint32_t index_buffer_count; + uint32_t bitpacking_width; +} dictionary_compression_header_t; + +struct DictionaryCompressionStorage { + static constexpr float MINIMUM_COMPRESSION_RATIO = 1.2; + static constexpr uint16_t DICTIONARY_HEADER_SIZE = sizeof(dictionary_compression_header_t); + static constexpr size_t COMPACTION_FLUSH_LIMIT = (size_t)Storage::BLOCK_SIZE / 5 * 4; + + static unique_ptr StringInitAnalyze(ColumnData &col_data, PhysicalType type); + static bool StringAnalyze(AnalyzeState &state_p, Vector &input, idx_t count); + static idx_t StringFinalAnalyze(AnalyzeState &state_p); + + static unique_ptr InitCompression(ColumnDataCheckpointer &checkpointer, + unique_ptr state); + static void Compress(CompressionState &state_p, Vector &scan_vector, idx_t count); + static void FinalizeCompress(CompressionState &state_p); + + static unique_ptr StringInitScan(ColumnSegment &segment); + template + static void StringScanPartial(ColumnSegment &segment, ColumnScanState &state, idx_t scan_count, Vector &result, + idx_t result_offset); + static void StringScan(ColumnSegment &segment, ColumnScanState &state, idx_t scan_count, Vector &result); + static void StringFetchRow(ColumnSegment &segment, ColumnFetchState &state, row_t row_id, Vector &result, + idx_t result_idx); + + static bool HasEnoughSpace(idx_t current_count, idx_t index_count, idx_t dict_size, + bitpacking_width_t packing_width); + static idx_t RequiredSpace(idx_t current_count, idx_t index_count, idx_t dict_size, + bitpacking_width_t packing_width); + + static StringDictionaryContainer GetDictionary(ColumnSegment &segment, BufferHandle &handle); + static void SetDictionary(ColumnSegment &segment, BufferHandle &handle, StringDictionaryContainer container); + static string_t FetchStringFromDict(ColumnSegment &segment, StringDictionaryContainer dict, data_ptr_t baseptr, + int32_t dict_offset, uint16_t string_len); + static uint16_t GetStringLength(uint32_t *index_buffer_ptr, sel_t index); +}; + +// Dictionary compression uses a combination of bitpacking and a dictionary to compress string segments. The data is +// stored across three buffers: the index buffer, the selection buffer and the dictionary. Firstly the Index buffer +// contains the offsets into the dictionary which are also used to determine the string lengths. Each value in the +// dictionary gets a single unique index in the index buffer. Secondly, the selection buffer maps the tuples to an index +// in the index buffer. The selection buffer is compressed with bitpacking. Finally, the dictionary contains simply all +// the unique strings without lenghts or null termination as we can deduce the lengths from the index buffer. The +// addition of the selection buffer is done for two reasons: firstly, to allow the scan to emit dictionary vectors by +// scanning the whole dictionary at once and then scanning the selection buffer for each emitted vector. Secondly, it +// allows for efficient bitpacking compression as the selection values should remain relatively small. +struct DictionaryCompressionCompressState : public DictionaryCompressionState { + explicit DictionaryCompressionCompressState(ColumnDataCheckpointer &checkpointer) : checkpointer(checkpointer) { + auto &db = checkpointer.GetDatabase(); + auto &config = DBConfig::GetConfig(db); + function = config.GetCompressionFunction(CompressionType::COMPRESSION_DICTIONARY, PhysicalType::VARCHAR); + CreateEmptySegment(checkpointer.GetRowGroup().start); + } + + void CreateEmptySegment(idx_t row_start) { + auto &db = checkpointer.GetDatabase(); + auto &type = checkpointer.GetType(); + auto compressed_segment = ColumnSegment::CreateTransientSegment(db, type, row_start); + current_segment = move(compressed_segment); + + current_segment->function = function; + + // Reset the buffers and string map + current_string_map.clear(); + index_buffer.clear(); + index_buffer.push_back(0); // Reserve index 0 for null strings + selection_buffer.clear(); + + current_width = 0; + next_width = 0; + + // Reset the pointers into the current segment + auto &buffer_manager = BufferManager::GetBufferManager(current_segment->db); + current_handle = buffer_manager.Pin(current_segment->block); + current_dictionary = DictionaryCompressionStorage::GetDictionary(*current_segment, *current_handle); + current_end_ptr = current_handle->node->buffer + current_dictionary.end; + } + + ColumnDataCheckpointer &checkpointer; + CompressionFunction *function; + + // State regarding current segment + unique_ptr current_segment; + unique_ptr current_handle; + StringDictionaryContainer current_dictionary; + data_ptr_t current_end_ptr; + + // Buffers and map for current segment + std::unordered_map current_string_map; + std::vector index_buffer; + std::vector selection_buffer; + + bitpacking_width_t current_width = 0; + bitpacking_width_t next_width = 0; + + // Result of latest LookupString call + uint32_t latest_lookup_result; + + void Verify() override { + current_dictionary.Verify(); + D_ASSERT(current_segment->count == selection_buffer.size()); + D_ASSERT(DictionaryCompressionStorage::HasEnoughSpace(current_segment->count.load(), index_buffer.size(), + current_dictionary.size, current_width)); + D_ASSERT(current_dictionary.end == Storage::BLOCK_SIZE); + D_ASSERT(index_buffer.size() == current_string_map.size() + 1); // +1 is for null value + } + + bool LookupString(string_t str) override { + auto search = current_string_map.find(str); + auto has_result = search != current_string_map.end(); + + if (has_result) { + latest_lookup_result = search->second; + } + return has_result; + } + + void AddNewString(string_t str) override { + UncompressedStringStorage::UpdateStringStats(current_segment->stats, str); + + // Copy string to dict + current_dictionary.size += str.GetSize(); + auto dict_pos = current_end_ptr - current_dictionary.size; + memcpy(dict_pos, str.GetDataUnsafe(), str.GetSize()); + current_dictionary.Verify(); + D_ASSERT(current_dictionary.end == Storage::BLOCK_SIZE); + + // Update buffers and map + index_buffer.push_back(current_dictionary.size); + selection_buffer.push_back(index_buffer.size() - 1); + current_string_map.insert({str, index_buffer.size() - 1}); + DictionaryCompressionStorage::SetDictionary(*current_segment, *current_handle, current_dictionary); + + current_width = next_width; + current_segment->count++; + } + + void AddNull() override { + selection_buffer.push_back(0); + current_segment->count++; + } + + void AddLastLookup() override { + selection_buffer.push_back(latest_lookup_result); + current_segment->count++; + } + + bool HasEnoughSpace(bool new_string, size_t string_size) override { + if (new_string) { + next_width = BitpackingPrimitives::MinimumBitWidth(index_buffer.size() - 1 + new_string); + return DictionaryCompressionStorage::HasEnoughSpace(current_segment->count.load() + 1, + index_buffer.size() + 1, + current_dictionary.size + string_size, next_width); + } else { + return DictionaryCompressionStorage::HasEnoughSpace(current_segment->count.load() + 1, index_buffer.size(), + current_dictionary.size, current_width); + } + } + + void Flush(bool final = false) override { + auto next_start = current_segment->start + current_segment->count; + + auto segment_size = Finalize(); + auto &state = checkpointer.GetCheckpointState(); + state.FlushSegment(move(current_segment), segment_size); + + if (!final) { + CreateEmptySegment(next_start); + } + } + + idx_t Finalize() { + auto &buffer_manager = BufferManager::GetBufferManager(current_segment->db); + auto handle = buffer_manager.Pin(current_segment->block); + D_ASSERT(current_dictionary.end == Storage::BLOCK_SIZE); + + // calculate sizes + auto compressed_selection_buffer_size = + BitpackingPrimitives::GetRequiredSize(current_segment->count, current_width); + auto index_buffer_size = index_buffer.size() * sizeof(uint32_t); + auto total_size = DictionaryCompressionStorage::DICTIONARY_HEADER_SIZE + compressed_selection_buffer_size + + index_buffer_size + current_dictionary.size; + + // calculate ptr and offsets + auto base_ptr = handle->node->buffer; + auto header_ptr = (dictionary_compression_header_t *)base_ptr; + auto compressed_selection_buffer_offset = DictionaryCompressionStorage::DICTIONARY_HEADER_SIZE; + auto index_buffer_offset = compressed_selection_buffer_offset + compressed_selection_buffer_size; + + // Write compressed selection buffer + BitpackingPrimitives::PackBuffer(base_ptr + compressed_selection_buffer_offset, + (sel_t *)(selection_buffer.data()), current_segment->count, + current_width); + + // Write the index buffer + memcpy(base_ptr + index_buffer_offset, index_buffer.data(), index_buffer_size); + + // Store sizes and offsets in segment header + Store(index_buffer_offset, (data_ptr_t)&header_ptr->index_buffer_offset); + Store(index_buffer.size(), (data_ptr_t)&header_ptr->index_buffer_count); + Store((uint32_t)current_width, (data_ptr_t)&header_ptr->bitpacking_width); + + D_ASSERT(current_width == BitpackingPrimitives::MinimumBitWidth(index_buffer.size() - 1)); + D_ASSERT(DictionaryCompressionStorage::HasEnoughSpace(current_segment->count, index_buffer.size(), + current_dictionary.size, current_width)); + D_ASSERT((uint64_t)*max_element(std::begin(selection_buffer), std::end(selection_buffer)) == + index_buffer.size() - 1); + + if (total_size >= DictionaryCompressionStorage::COMPACTION_FLUSH_LIMIT) { + // the block is full enough, don't bother moving around the dictionary + return Storage::BLOCK_SIZE; + } + // the block has space left: figure out how much space we can save + auto move_amount = Storage::BLOCK_SIZE - total_size; + // move the dictionary so it lines up exactly with the offsets + auto new_dictionary_offset = index_buffer_offset + index_buffer_size; + memmove(base_ptr + new_dictionary_offset, base_ptr + current_dictionary.end - current_dictionary.size, + current_dictionary.size); + current_dictionary.end -= move_amount; + D_ASSERT(current_dictionary.end == total_size); + // write the new dictionary (with the updated "end") + DictionaryCompressionStorage::SetDictionary(*current_segment, *handle, current_dictionary); + return total_size; + } +}; + +//===--------------------------------------------------------------------===// +// Analyze +//===--------------------------------------------------------------------===// +struct DictionaryCompressionAnalyzeState : public AnalyzeState, DictionaryCompressionState { + DictionaryCompressionAnalyzeState() + : segment_count(0), current_tuple_count(0), current_unique_count(0), current_dict_size(0), current_width(0), + next_width(0) { + } + + size_t segment_count; + idx_t current_tuple_count; + idx_t current_unique_count; + size_t current_dict_size; + std::unordered_set current_set; + bitpacking_width_t current_width; + bitpacking_width_t next_width; + + bool LookupString(string_t str) override { + return current_set.count(str); + } + + void AddNewString(string_t str) override { + current_tuple_count++; + current_unique_count++; + current_dict_size += str.GetSize(); + current_set.insert(str); + current_width = next_width; + } + + void AddLastLookup() override { + current_tuple_count++; + } + + void AddNull() override { + current_tuple_count++; + } + + bool HasEnoughSpace(bool new_string, size_t string_size) override { + if (new_string) { + next_width = + BitpackingPrimitives::MinimumBitWidth(current_unique_count + 2); // 1 for null, one for new string + return DictionaryCompressionStorage::HasEnoughSpace(current_tuple_count + 1, current_unique_count + 1, + current_dict_size + string_size, next_width); + } else { + return DictionaryCompressionStorage::HasEnoughSpace(current_tuple_count + 1, current_unique_count, + current_dict_size, current_width); + } + } + + void Flush(bool final = false) override { + segment_count++; + current_tuple_count = 0; + current_unique_count = 0; + current_dict_size = 0; + current_set.clear(); + } + void Verify() override {}; +}; + +unique_ptr DictionaryCompressionStorage::StringInitAnalyze(ColumnData &col_data, PhysicalType type) { + return make_unique(); +} + +bool DictionaryCompressionStorage::StringAnalyze(AnalyzeState &state_p, Vector &input, idx_t count) { + auto &state = (DictionaryCompressionAnalyzeState &)state_p; + return state.UpdateState(input, count); +} + +idx_t DictionaryCompressionStorage::StringFinalAnalyze(AnalyzeState &state_p) { + auto &state = (DictionaryCompressionAnalyzeState &)state_p; + + auto width = BitpackingPrimitives::MinimumBitWidth(state.current_unique_count + 1); + auto req_space = + RequiredSpace(state.current_tuple_count, state.current_unique_count, state.current_dict_size, width); + + return MINIMUM_COMPRESSION_RATIO * (state.segment_count * Storage::BLOCK_SIZE + req_space); +} + +//===--------------------------------------------------------------------===// +// Compress +//===--------------------------------------------------------------------===// +unique_ptr DictionaryCompressionStorage::InitCompression(ColumnDataCheckpointer &checkpointer, + unique_ptr state) { + return make_unique(checkpointer); +} + +void DictionaryCompressionStorage::Compress(CompressionState &state_p, Vector &scan_vector, idx_t count) { + auto &state = (DictionaryCompressionCompressState &)state_p; + state.UpdateState(scan_vector, count); +} + +void DictionaryCompressionStorage::FinalizeCompress(CompressionState &state_p) { + auto &state = (DictionaryCompressionCompressState &)state_p; + state.Flush(true); +} + +//===--------------------------------------------------------------------===// +// Scan +//===--------------------------------------------------------------------===// +struct CompressedStringScanState : public StringScanState { + unique_ptr handle; + buffer_ptr dictionary; + bitpacking_width_t current_width; + buffer_ptr sel_vec; + idx_t sel_vec_size = 0; +}; + +unique_ptr DictionaryCompressionStorage::StringInitScan(ColumnSegment &segment) { + auto state = make_unique(); + auto &buffer_manager = BufferManager::GetBufferManager(segment.db); + state->handle = buffer_manager.Pin(segment.block); + + auto baseptr = state->handle->node->buffer + segment.GetBlockOffset(); + + // Load header values + auto dict = DictionaryCompressionStorage::GetDictionary(segment, *(state->handle)); + auto header_ptr = (dictionary_compression_header_t *)baseptr; + auto index_buffer_offset = Load((data_ptr_t)&header_ptr->index_buffer_offset); + auto index_buffer_count = Load((data_ptr_t)&header_ptr->index_buffer_count); + state->current_width = (bitpacking_width_t)(Load((data_ptr_t)&header_ptr->bitpacking_width)); + + auto index_buffer_ptr = (uint32_t *)(baseptr + index_buffer_offset); + + state->dictionary = make_buffer(segment.type, index_buffer_count); + auto dict_child_data = FlatVector::GetData(*(state->dictionary)); + + for (uint32_t i = 0; i < index_buffer_count; i++) { + // NOTE: the passing of dict_child_vector, will not be used, its for big strings + uint16_t str_len = GetStringLength(index_buffer_ptr, i); + dict_child_data[i] = FetchStringFromDict(segment, dict, baseptr, index_buffer_ptr[i], str_len); + } + + return move(state); +} + +//===--------------------------------------------------------------------===// +// Scan base data +//===--------------------------------------------------------------------===// +template +void DictionaryCompressionStorage::StringScanPartial(ColumnSegment &segment, ColumnScanState &state, idx_t scan_count, + Vector &result, idx_t result_offset) { + // clear any previously locked buffers and get the primary buffer handle + auto &scan_state = (CompressedStringScanState &)*state.scan_state; + auto start = segment.GetRelativeIndex(state.row_index); + + auto baseptr = scan_state.handle->node->buffer + segment.GetBlockOffset(); + auto dict = DictionaryCompressionStorage::GetDictionary(segment, *scan_state.handle); + + auto header_ptr = (dictionary_compression_header_t *)baseptr; + auto index_buffer_offset = Load((data_ptr_t)&header_ptr->index_buffer_offset); + auto index_buffer_ptr = (uint32_t *)(baseptr + index_buffer_offset); + + auto base_data = (data_ptr_t)(baseptr + DICTIONARY_HEADER_SIZE); + auto result_data = FlatVector::GetData(result); + + if (!ALLOW_DICT_VECTORS || scan_count != STANDARD_VECTOR_SIZE || + start % BitpackingPrimitives::BITPACKING_ALGORITHM_GROUP_SIZE != 0) { + // Emit regular vector + + // Handling non-bitpacking-group-aligned start values; + idx_t start_offset = start % BitpackingPrimitives::BITPACKING_ALGORITHM_GROUP_SIZE; + + // We will scan in blocks of BITPACKING_ALGORITHM_GROUP_SIZE, so we may scan some extra values. + idx_t decompress_count = BitpackingPrimitives::RoundUpToAlgorithmGroupSize(scan_count + start_offset); + + // Create a decompression buffer of sufficient size if we don't already have one. + if (!scan_state.sel_vec || scan_state.sel_vec_size < decompress_count) { + scan_state.sel_vec_size = decompress_count; + scan_state.sel_vec = make_buffer(decompress_count); + } + + data_ptr_t src = &base_data[((start - start_offset) * scan_state.current_width) / 8]; + sel_t *sel_vec_ptr = scan_state.sel_vec->data(); + + BitpackingPrimitives::UnPackBuffer((data_ptr_t)sel_vec_ptr, src, decompress_count, + scan_state.current_width); + + for (idx_t i = 0; i < scan_count; i++) { + // Lookup dict offset in index buffer + auto string_number = scan_state.sel_vec->get_index(i + start_offset); + auto dict_offset = index_buffer_ptr[string_number]; + uint16_t str_len = GetStringLength(index_buffer_ptr, string_number); + result_data[result_offset + i] = FetchStringFromDict(segment, dict, baseptr, dict_offset, str_len); + } + + } else { + D_ASSERT(start % BitpackingPrimitives::BITPACKING_ALGORITHM_GROUP_SIZE == 0); + D_ASSERT(scan_count == STANDARD_VECTOR_SIZE); + D_ASSERT(result_offset == 0); + + idx_t decompress_count = BitpackingPrimitives::RoundUpToAlgorithmGroupSize(scan_count); + + // Create a selection vector of sufficient size if we don't already have one. + if (!scan_state.sel_vec || scan_state.sel_vec_size < decompress_count) { + scan_state.sel_vec_size = decompress_count; + scan_state.sel_vec = make_buffer(decompress_count); + } + + // Scanning 1024 values, emitting a dict vector + data_ptr_t dst = (data_ptr_t)(scan_state.sel_vec->data()); + data_ptr_t src = (data_ptr_t)&base_data[(start * scan_state.current_width) / 8]; + + BitpackingPrimitives::UnPackBuffer(dst, src, scan_count, scan_state.current_width); + + result.Slice(*(scan_state.dictionary), *scan_state.sel_vec, scan_count); + } +} + +void DictionaryCompressionStorage::StringScan(ColumnSegment &segment, ColumnScanState &state, idx_t scan_count, + Vector &result) { + StringScanPartial(segment, state, scan_count, result, 0); +} + +//===--------------------------------------------------------------------===// +// Fetch +//===--------------------------------------------------------------------===// +void DictionaryCompressionStorage::StringFetchRow(ColumnSegment &segment, ColumnFetchState &state, row_t row_id, + Vector &result, idx_t result_idx) { + // fetch a single row from the string segment + // first pin the main buffer if it is not already pinned + auto primary_id = segment.block->BlockId(); + + BufferHandle *handle_ptr; + auto entry = state.handles.find(primary_id); + if (entry == state.handles.end()) { + // not pinned yet: pin it + auto &buffer_manager = BufferManager::GetBufferManager(segment.db); + auto handle = buffer_manager.Pin(segment.block); + handle_ptr = handle.get(); + state.handles[primary_id] = move(handle); + } else { + // already pinned: use the pinned handle + handle_ptr = entry->second.get(); + } + + auto baseptr = handle_ptr->node->buffer + segment.GetBlockOffset(); + auto header_ptr = (dictionary_compression_header_t *)baseptr; + auto dict = DictionaryCompressionStorage::GetDictionary(segment, *handle_ptr); + auto index_buffer_offset = Load((data_ptr_t)&header_ptr->index_buffer_offset); + auto width = (bitpacking_width_t)(Load((data_ptr_t)&header_ptr->bitpacking_width)); + auto index_buffer_ptr = (uint32_t *)(baseptr + index_buffer_offset); + auto base_data = (data_ptr_t)(baseptr + DICTIONARY_HEADER_SIZE); + auto result_data = FlatVector::GetData(result); + + // Handling non-bitpacking-group-aligned start values; + idx_t start_offset = row_id % BitpackingPrimitives::BITPACKING_ALGORITHM_GROUP_SIZE; + + // Decompress part of selection buffer we need for this value. + sel_t decompression_buffer[BitpackingPrimitives::BITPACKING_ALGORITHM_GROUP_SIZE]; + data_ptr_t src = (data_ptr_t)&base_data[((row_id - start_offset) * width) / 8]; + BitpackingPrimitives::UnPackBuffer((data_ptr_t)decompression_buffer, src, + BitpackingPrimitives::BITPACKING_ALGORITHM_GROUP_SIZE, width); + + auto selection_value = decompression_buffer[start_offset]; + auto dict_offset = index_buffer_ptr[selection_value]; + uint16_t str_len = GetStringLength(index_buffer_ptr, selection_value); + + result_data[result_idx] = FetchStringFromDict(segment, dict, baseptr, dict_offset, str_len); +} + +//===--------------------------------------------------------------------===// +// Helper Functions +//===--------------------------------------------------------------------===// +bool DictionaryCompressionStorage::HasEnoughSpace(idx_t current_count, idx_t index_count, idx_t dict_size, + bitpacking_width_t packing_width) { + return RequiredSpace(current_count, index_count, dict_size, packing_width) <= Storage::BLOCK_SIZE; +} + +idx_t DictionaryCompressionStorage::RequiredSpace(idx_t current_count, idx_t index_count, idx_t dict_size, + bitpacking_width_t packing_width) { + idx_t base_space = DICTIONARY_HEADER_SIZE + dict_size; + idx_t string_number_space = BitpackingPrimitives::GetRequiredSize(current_count, packing_width); + idx_t index_space = index_count * sizeof(uint32_t); + + idx_t used_space = base_space + index_space + string_number_space; + + return used_space; +} + +StringDictionaryContainer DictionaryCompressionStorage::GetDictionary(ColumnSegment &segment, BufferHandle &handle) { + auto header_ptr = (dictionary_compression_header_t *)(handle.node->buffer + segment.GetBlockOffset()); + StringDictionaryContainer container; + container.size = Load((data_ptr_t)&header_ptr->dict_size); + container.end = Load((data_ptr_t)&header_ptr->dict_end); + return container; +} + +void DictionaryCompressionStorage::SetDictionary(ColumnSegment &segment, BufferHandle &handle, + StringDictionaryContainer container) { + auto header_ptr = (dictionary_compression_header_t *)(handle.node->buffer + segment.GetBlockOffset()); + Store(container.size, (data_ptr_t)&header_ptr->dict_size); + Store(container.end, (data_ptr_t)&header_ptr->dict_end); +} + +string_t DictionaryCompressionStorage::FetchStringFromDict(ColumnSegment &segment, StringDictionaryContainer dict, + data_ptr_t baseptr, int32_t dict_offset, + uint16_t string_len) { + D_ASSERT(dict_offset >= 0 && dict_offset <= Storage::BLOCK_SIZE); + + if (dict_offset == 0) { + return string_t(nullptr, 0); + } + // normal string: read string from this block + auto dict_end = baseptr + dict.end; + auto dict_pos = dict_end - dict_offset; + + auto str_ptr = (char *)(dict_pos); + return string_t(str_ptr, string_len); +} + +uint16_t DictionaryCompressionStorage::GetStringLength(uint32_t *index_buffer_ptr, sel_t index) { + if (index == 0) { + return 0; + } else { + return index_buffer_ptr[index] - index_buffer_ptr[index - 1]; + } +} + +//===--------------------------------------------------------------------===// +// Get Function +//===--------------------------------------------------------------------===// +CompressionFunction DictionaryCompressionFun::GetFunction(PhysicalType data_type) { + return CompressionFunction( + CompressionType::COMPRESSION_DICTIONARY, data_type, DictionaryCompressionStorage ::StringInitAnalyze, + DictionaryCompressionStorage::StringAnalyze, DictionaryCompressionStorage::StringFinalAnalyze, + DictionaryCompressionStorage::InitCompression, DictionaryCompressionStorage::Compress, + DictionaryCompressionStorage::FinalizeCompress, DictionaryCompressionStorage::StringInitScan, + DictionaryCompressionStorage::StringScan, DictionaryCompressionStorage::StringScanPartial, + DictionaryCompressionStorage::StringFetchRow, UncompressedFunctions::EmptySkip); +} + +bool DictionaryCompressionFun::TypeIsSupported(PhysicalType type) { + return type == PhysicalType::VARCHAR; +} +} // namespace duckdb + + + + + + + + + + + namespace duckdb { //===--------------------------------------------------------------------===// @@ -162282,35 +173124,31 @@ idx_t FixedSizeFinalAnalyze(AnalyzeState &state_p) { //===--------------------------------------------------------------------===// // Compress //===--------------------------------------------------------------------===// -struct UncompressedCompressState : public CompressionState { - explicit UncompressedCompressState(ColumnDataCheckpointer &checkpointer) : checkpointer(checkpointer) { - CreateEmptySegment(checkpointer.GetRowGroup().start); - } - - void CreateEmptySegment(idx_t row_start) { - auto &db = checkpointer.GetDatabase(); - auto &type = checkpointer.GetType(); - auto compressed_segment = ColumnSegment::CreateTransientSegment(db, type, row_start); - if (type.InternalType() == PhysicalType::VARCHAR) { - auto &state = (UncompressedStringSegmentState &)*compressed_segment->GetSegmentState(); - state.overflow_writer = make_unique(db); - } - current_segment = move(compressed_segment); - } +UncompressedCompressState::UncompressedCompressState(ColumnDataCheckpointer &checkpointer) + : checkpointer(checkpointer) { + CreateEmptySegment(checkpointer.GetRowGroup().start); +} - void FlushSegment(idx_t segment_size) { - auto &state = checkpointer.GetCheckpointState(); - state.FlushSegment(move(current_segment), segment_size); +void UncompressedCompressState::CreateEmptySegment(idx_t row_start) { + auto &db = checkpointer.GetDatabase(); + auto &type = checkpointer.GetType(); + auto compressed_segment = ColumnSegment::CreateTransientSegment(db, type, row_start); + if (type.InternalType() == PhysicalType::VARCHAR) { + auto &state = (UncompressedStringSegmentState &)*compressed_segment->GetSegmentState(); + state.overflow_writer = make_unique(db); } + current_segment = move(compressed_segment); +} - void Finalize(idx_t segment_size) { - FlushSegment(segment_size); - current_segment.reset(); - } +void UncompressedCompressState::FlushSegment(idx_t segment_size) { + auto &state = checkpointer.GetCheckpointState(); + state.FlushSegment(move(current_segment), segment_size); +} - ColumnDataCheckpointer &checkpointer; - unique_ptr current_segment; -}; +void UncompressedCompressState::Finalize(idx_t segment_size) { + FlushSegment(segment_size); + current_segment.reset(); +} unique_ptr UncompressedFunctions::InitCompression(ColumnDataCheckpointer &checkpointer, unique_ptr state) { @@ -163069,17 +173907,6 @@ bool RLEFun::TypeIsSupported(PhysicalType type) { } // namespace duckdb - - - - - - - - - - - namespace duckdb { //===--------------------------------------------------------------------===// @@ -163092,70 +173919,6 @@ UncompressedStringSegmentState::~UncompressedStringSegmentState() { } } -struct StringDictionaryContainer { - //! The size of the dictionary - uint32_t size; - //! The end of the dictionary (typically Storage::BLOCK_SIZE) - uint32_t end; - - void Verify() { - D_ASSERT(size <= Storage::BLOCK_SIZE); - D_ASSERT(end <= Storage::BLOCK_SIZE); - D_ASSERT(size <= end); - } -}; - -struct UncompressedStringStorage { -public: - //! Dictionary header size at the beginning of the string segment (offset + length) - static constexpr uint16_t DICTIONARY_HEADER_SIZE = sizeof(uint32_t) + sizeof(uint32_t); - //! Marker used in length field to indicate the presence of a big string - static constexpr uint16_t BIG_STRING_MARKER = (uint16_t)-1; - //! Base size of big string marker (block id + offset) - static constexpr idx_t BIG_STRING_MARKER_BASE_SIZE = sizeof(block_id_t) + sizeof(int32_t); - //! The marker size of the big string - static constexpr idx_t BIG_STRING_MARKER_SIZE = BIG_STRING_MARKER_BASE_SIZE + sizeof(uint16_t); - -public: - static unique_ptr StringInitAnalyze(ColumnData &col_data, PhysicalType type); - static bool StringAnalyze(AnalyzeState &state_p, Vector &input, idx_t count); - static idx_t StringFinalAnalyze(AnalyzeState &state_p); - static unique_ptr StringInitScan(ColumnSegment &segment); - static void StringScanPartial(ColumnSegment &segment, ColumnScanState &state, idx_t scan_count, Vector &result, - idx_t result_offset); - static void StringScan(ColumnSegment &segment, ColumnScanState &state, idx_t scan_count, Vector &result); - static void StringFetchRow(ColumnSegment &segment, ColumnFetchState &state, row_t row_id, Vector &result, - idx_t result_idx); - static unique_ptr StringInitSegment(ColumnSegment &segment, block_id_t block_id); - static idx_t StringAppend(ColumnSegment &segment, SegmentStatistics &stats, VectorData &data, idx_t offset, - idx_t count); - static idx_t FinalizeAppend(ColumnSegment &segment, SegmentStatistics &stats); - -public: - static inline void UpdateStringStats(SegmentStatistics &stats, const string_t &new_value) { - auto &sstats = (StringStatistics &)*stats.statistics; - sstats.Update(new_value); - } - - static void SetDictionary(ColumnSegment &segment, BufferHandle &handle, StringDictionaryContainer dict); - static StringDictionaryContainer GetDictionary(ColumnSegment &segment, BufferHandle &handle); - static idx_t RemainingSpace(ColumnSegment &segment, BufferHandle &handle); - static void WriteString(ColumnSegment &segment, string_t string, block_id_t &result_block, int32_t &result_offset); - static void WriteStringMemory(ColumnSegment &segment, string_t string, block_id_t &result_block, - int32_t &result_offset); - static string_t ReadString(ColumnSegment &segment, Vector &result, block_id_t block, int32_t offset); - static string_t ReadString(data_ptr_t target, int32_t offset); - static void WriteStringMarker(data_ptr_t target, block_id_t block_id, int32_t offset); - static void ReadStringMarker(data_ptr_t target, block_id_t &block_id, int32_t &offset); - - static string_location_t FetchStringLocation(StringDictionaryContainer dict, data_ptr_t baseptr, - int32_t dict_offset); - static string_t FetchStringFromDict(ColumnSegment &segment, StringDictionaryContainer dict, Vector &result, - data_ptr_t baseptr, int32_t dict_offset); - static string_t FetchString(ColumnSegment &segment, StringDictionaryContainer dict, Vector &result, - data_ptr_t baseptr, string_location_t location); -}; - //===--------------------------------------------------------------------===// // Analyze //===--------------------------------------------------------------------===// @@ -163200,10 +173963,6 @@ idx_t UncompressedStringStorage::StringFinalAnalyze(AnalyzeState &state_p) { //===--------------------------------------------------------------------===// // Scan //===--------------------------------------------------------------------===// -struct StringScanState : public SegmentScanState { - unique_ptr handle; -}; - unique_ptr UncompressedStringStorage::StringInitScan(ColumnSegment &segment) { auto result = make_unique(); auto &buffer_manager = BufferManager::GetBufferManager(segment.db); @@ -163280,82 +174039,6 @@ unique_ptr UncompressedStringStorage::StringInitSegment( return make_unique(); } -idx_t UncompressedStringStorage::StringAppend(ColumnSegment &segment, SegmentStatistics &stats, VectorData &data, - idx_t offset, idx_t count) { - auto &buffer_manager = BufferManager::GetBufferManager(segment.db); - auto handle = buffer_manager.Pin(segment.block); - - D_ASSERT(segment.GetBlockOffset() == 0); - auto source_data = (string_t *)data.data; - auto result_data = (int32_t *)(handle->node->buffer + DICTIONARY_HEADER_SIZE); - for (idx_t i = 0; i < count; i++) { - auto source_idx = data.sel->get_index(offset + i); - auto target_idx = segment.count.load(); - idx_t remaining_space = RemainingSpace(segment, *handle); - if (remaining_space < sizeof(int32_t)) { - // string index does not fit in the block at all - return i; - } - remaining_space -= sizeof(int32_t); - if (!data.validity.RowIsValid(source_idx)) { - // null value is stored as -1 - result_data[target_idx] = 0; - } else { - auto dictionary = GetDictionary(segment, *handle); - auto end = handle->node->buffer + dictionary.end; - - dictionary.Verify(); - // non-null value, check if we can fit it within the block - idx_t string_length = source_data[source_idx].GetSize(); - idx_t dictionary_length = string_length + sizeof(uint16_t); - - // determine whether or not we have space in the block for this string - bool use_overflow_block = false; - idx_t required_space = dictionary_length; - if (required_space >= StringUncompressed::STRING_BLOCK_LIMIT) { - // string exceeds block limit, store in overflow block and only write a marker here - required_space = BIG_STRING_MARKER_SIZE; - use_overflow_block = true; - } - if (required_space > remaining_space) { - // no space remaining: return how many tuples we ended up writing - return i; - } - // we have space: write the string - UpdateStringStats(stats, source_data[source_idx]); - - if (use_overflow_block) { - // write to overflow blocks - block_id_t block; - int32_t offset; - // write the string into the current string block - WriteString(segment, source_data[source_idx], block, offset); - dictionary.size += BIG_STRING_MARKER_SIZE; - auto dict_pos = end - dictionary.size; - - // write a big string marker into the dictionary - WriteStringMarker(dict_pos, block, offset); - } else { - // string fits in block, append to dictionary and increment dictionary position - D_ASSERT(string_length < NumericLimits::Maximum()); - dictionary.size += required_space; - auto dict_pos = end - dictionary.size; // first write the length as u16 - Store(string_length, dict_pos); - // now write the actual string data into the dictionary - memcpy(dict_pos + sizeof(uint16_t), source_data[source_idx].GetDataUnsafe(), string_length); - } - D_ASSERT(RemainingSpace(segment, *handle) <= Storage::BLOCK_SIZE); - // place the dictionary offset into the set of vectors - dictionary.Verify(); - - result_data[target_idx] = dictionary.size; - SetDictionary(segment, *handle, dictionary); - } - segment.count++; - } - return count; -} - idx_t UncompressedStringStorage::FinalizeAppend(ColumnSegment &segment, SegmentStatistics &stats) { auto &buffer_manager = BufferManager::GetBufferManager(segment.db); auto handle = buffer_manager.Pin(segment.block); @@ -163364,7 +174047,7 @@ idx_t UncompressedStringStorage::FinalizeAppend(ColumnSegment &segment, SegmentS // compute the total size required to store this segment auto offset_size = DICTIONARY_HEADER_SIZE + segment.count * sizeof(int32_t); auto total_size = offset_size + dict.size; - if (total_size >= Storage::BLOCK_SIZE / 5 * 4) { + if (total_size >= COMPACTION_FLUSH_LIMIT) { // the block is full enough, don't bother moving around the dictionary return Storage::BLOCK_SIZE; } @@ -163873,7 +174556,12 @@ void ValidityScanPartial(ColumnSegment &segment, ColumnScanState &state, idx_t s // the bitwise ops we use below don't work if the vector size is too small ValidityMask source_mask(input_data); for (idx_t i = 0; i < scan_count; i++) { - result_mask.Set(result_offset + i, source_mask.RowIsValid(start + i)); + if (!source_mask.RowIsValid(start + i)) { + if (result_mask.AllValid()) { + result_mask.Initialize(MaxValue(STANDARD_VECTOR_SIZE, result_offset + scan_count)); + } + result_mask.SetInvalid(result_offset + i); + } } #else // the code below does what the fallback code above states, but using bitwise ops: @@ -164627,7 +175315,147 @@ static void VerifyCheckConstraint(TableCatalogEntry &table, Expression &expr, Da } } -void DataTable::VerifyAppendConstraints(TableCatalogEntry &table, DataChunk &chunk) { +static bool IsForeignKeyIndex(const vector &fk_keys, Index &index, ForeignKeyType fk_type) { + if (fk_type == ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE ? !index.IsUnique() : !index.IsForeign()) { + return false; + } + if (fk_keys.size() != index.column_ids.size()) { + return false; + } + for (auto &fk_key : fk_keys) { + bool is_found = false; + for (auto &index_key : index.column_ids) { + if (fk_key == index_key) { + is_found = true; + break; + } + } + if (!is_found) { + return false; + } + } + return true; +} + +Index *TableIndexList::FindForeignKeyIndex(const vector &fk_keys, ForeignKeyType fk_type) { + Index *result = nullptr; + Scan([&](Index &index) { + if (IsForeignKeyIndex(fk_keys, index, fk_type)) { + result = &index; + } + return false; + }); + return result; +} + +static void VerifyForeignKeyConstraint(const BoundForeignKeyConstraint &bfk, ClientContext &context, DataChunk &chunk, + bool is_append) { + const vector *src_keys_ptr = &bfk.info.fk_keys; + const vector *dst_keys_ptr = &bfk.info.pk_keys; + if (!is_append) { + src_keys_ptr = &bfk.info.pk_keys; + dst_keys_ptr = &bfk.info.fk_keys; + } + + auto table_entry_ptr = + Catalog::GetCatalog(context).GetEntry(context, bfk.info.schema, bfk.info.table); + if (table_entry_ptr == nullptr) { + throw InternalException("Can't find table \"%s\" in foreign key constraint", bfk.info.table); + } + + // make the data chunk to check + vector types; + for (idx_t i = 0; i < table_entry_ptr->columns.size(); i++) { + types.emplace_back(table_entry_ptr->columns[i].type); + } + DataChunk dst_chunk; + dst_chunk.InitializeEmpty(types); + for (idx_t i = 0; i < src_keys_ptr->size(); i++) { + dst_chunk.data[(*dst_keys_ptr)[i]].Reference(chunk.data[(*src_keys_ptr)[i]]); + } + dst_chunk.SetCardinality(chunk.size()); + auto data_table = table_entry_ptr->storage.get(); + + idx_t count = dst_chunk.size(); + if (count <= 0) { + return; + } + + // we need to look at the error messages concurrently in data table's index and transaction local storage's index + vector err_msgs, tran_err_msgs; + err_msgs.resize(count); + tran_err_msgs.resize(count); + + auto fk_type = is_append ? ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE : ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE; + // check whether or not the chunk can be inserted or deleted into the referenced table' storage + auto index = data_table->info->indexes.FindForeignKeyIndex(*dst_keys_ptr, fk_type); + if (!index) { + throw InternalException("Internal Foreign Key error: could not find index to verify..."); + } + if (is_append) { + index->VerifyAppendForeignKey(dst_chunk, err_msgs.data()); + } else { + index->VerifyDeleteForeignKey(dst_chunk, err_msgs.data()); + } + // check whether or not the chunk can be inserted or deleted into the referenced table' transaction local storage + auto &transaction = Transaction::GetTransaction(context); + bool transaction_check = transaction.storage.Find(data_table); + if (transaction_check) { + vector> &transact_index_vec = transaction.storage.GetIndexes(data_table); + for (idx_t i = 0; i < transact_index_vec.size(); i++) { + if (IsForeignKeyIndex(*dst_keys_ptr, *transact_index_vec[i], fk_type)) { + if (is_append) { + transact_index_vec[i]->VerifyAppendForeignKey(dst_chunk, tran_err_msgs.data()); + } else { + transact_index_vec[i]->VerifyDeleteForeignKey(dst_chunk, tran_err_msgs.data()); + } + } + } + } + + // we need to look at the error messages concurrently in data table's index and transaction local storage's index + for (idx_t i = 0; i < count; i++) { + if (!transaction_check) { + // if there is no transaction-local data we only need to check if there is an error message in the main + // index + if (!err_msgs[i].empty()) { + throw ConstraintException(err_msgs[i]); + } else { + continue; + } + } + if (is_append) { + // if we are appending we need to check to ensure the foreign key exists in either the transaction-local + // storage or the main table + if (!err_msgs[i].empty() && !tran_err_msgs[i].empty()) { + throw ConstraintException(err_msgs[i]); + } else { + continue; + } + } + // if we are deleting we need to ensure the foreign key DOES NOT exist in EITHER the transaction-local storage + // OR the main table + if (!err_msgs[i].empty() || !tran_err_msgs[i].empty()) { + string &err_msg = err_msgs[i]; + if (err_msg.empty()) { + err_msg = tran_err_msgs[i]; + } + throw ConstraintException(err_msg); + } + } +} + +static void VerifyAppendForeignKeyConstraint(const BoundForeignKeyConstraint &bfk, ClientContext &context, + DataChunk &chunk) { + VerifyForeignKeyConstraint(bfk, context, chunk, true); +} + +static void VerifyDeleteForeignKeyConstraint(const BoundForeignKeyConstraint &bfk, ClientContext &context, + DataChunk &chunk) { + VerifyForeignKeyConstraint(bfk, context, chunk, false); +} + +void DataTable::VerifyAppendConstraints(TableCatalogEntry &table, ClientContext &context, DataChunk &chunk) { for (auto &constraint : table.bound_constraints) { switch (constraint->type) { case ConstraintType::NOT_NULL: { @@ -164649,7 +175477,14 @@ void DataTable::VerifyAppendConstraints(TableCatalogEntry &table, DataChunk &chu }); break; } - case ConstraintType::FOREIGN_KEY: + case ConstraintType::FOREIGN_KEY: { + auto &bfk = *reinterpret_cast(constraint.get()); + if (bfk.info.type == ForeignKeyType::FK_TYPE_FOREIGN_KEY_TABLE || + bfk.info.type == ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE) { + VerifyAppendForeignKeyConstraint(bfk, context, chunk); + } + break; + } default: throw NotImplementedException("Constraint type not implemented!"); } @@ -164670,7 +175505,7 @@ void DataTable::Append(TableCatalogEntry &table, ClientContext &context, DataChu chunk.Verify(); // verify any constraints on the new chunk - VerifyAppendConstraints(table, chunk); + VerifyAppendConstraints(table, context, chunk); // append to the transaction local data auto &transaction = Transaction::GetTransaction(context); @@ -164962,6 +175797,27 @@ void DataTable::RemoveFromIndexes(Vector &row_identifiers, idx_t count) { }); } +void DataTable::VerifyDeleteConstraints(TableCatalogEntry &table, ClientContext &context, DataChunk &chunk) { + for (auto &constraint : table.bound_constraints) { + switch (constraint->type) { + case ConstraintType::NOT_NULL: + case ConstraintType::CHECK: + case ConstraintType::UNIQUE: + break; + case ConstraintType::FOREIGN_KEY: { + auto &bfk = *reinterpret_cast(constraint.get()); + if (bfk.info.type == ForeignKeyType::FK_TYPE_PRIMARY_KEY_TABLE || + bfk.info.type == ForeignKeyType::FK_TYPE_SELF_REFERENCE_TABLE) { + VerifyDeleteForeignKeyConstraint(bfk, context, chunk); + } + break; + } + default: + throw NotImplementedException("Constraint type not implemented!"); + } + } +} + //===--------------------------------------------------------------------===// // Delete //===--------------------------------------------------------------------===// @@ -164977,6 +175833,23 @@ idx_t DataTable::Delete(TableCatalogEntry &table, ClientContext &context, Vector auto ids = FlatVector::GetData(row_identifiers); auto first_id = ids[0]; + // verify any constraints on the delete rows + DataChunk verify_chunk; + if (first_id >= MAX_ROW_ID) { + transaction.storage.FetchChunk(this, row_identifiers, count, verify_chunk); + } else { + ColumnFetchState fetch_state; + vector col_ids; + vector types; + for (idx_t i = 0; i < column_definitions.size(); i++) { + col_ids.push_back(column_definitions[i].oid); + types.emplace_back(column_definitions[i].type); + } + verify_chunk.Initialize(types); + Fetch(transaction, verify_chunk, col_ids, row_identifiers, count, fetch_state); + } + VerifyDeleteConstraints(table, context, verify_chunk); + if (first_id >= MAX_ROW_ID) { // deletion is in transaction-local storage: push delete into local chunk collection return transaction.storage.Delete(this, row_identifiers, count); @@ -165349,8 +176222,8 @@ vector> DataTable::GetStorageInfo() { namespace duckdb { Index::Index(IndexType type, const vector &column_ids_p, - const vector> &unbound_expressions, bool is_unique, bool is_primary) - : type(type), column_ids(column_ids_p), is_unique(is_unique), is_primary(is_primary) { + const vector> &unbound_expressions, IndexConstraintType constraint_type_p) + : type(type), column_ids(column_ids_p), constraint_type(constraint_type_p) { for (auto &expr : unbound_expressions) { types.push_back(expr->return_type.InternalType()); logical_types.push_back(expr->return_type); @@ -165431,7 +176304,7 @@ void LocalTableStorage::InitializeScan(LocalScanState &state, TableFilterSet *ta // nothing to scan return; } - state.SetStorage(this); + state.SetStorage(shared_from_this()); state.chunk_index = 0; state.max_index = collection.ChunkCount() - 1; @@ -165455,12 +176328,12 @@ LocalScanState::~LocalScanState() { SetStorage(nullptr); } -void LocalScanState::SetStorage(LocalTableStorage *new_storage) { - if (storage != nullptr) { +void LocalScanState::SetStorage(shared_ptr new_storage) { + if (storage) { D_ASSERT(storage->active_scans > 0); storage->active_scans--; } - storage = new_storage; + storage = move(new_storage); if (storage) { storage->active_scans++; } @@ -165474,13 +176347,13 @@ void LocalTableStorage::Clear() { table.info->indexes.Scan([&](Index &index) { D_ASSERT(index.type == IndexType::ART); auto &art = (ART &)index; - if (art.is_unique) { + if (art.constraint_type != IndexConstraintType::NONE) { // unique index: create a local ART index that maintains the same unique constraint vector> unbound_expressions; for (auto &expr : art.unbound_expressions) { unbound_expressions.push_back(expr->Copy()); } - indexes.push_back(make_unique(art.column_ids, move(unbound_expressions), true)); + indexes.push_back(make_unique(art.column_ids, move(unbound_expressions), art.constraint_type)); } return false; }); @@ -165574,7 +176447,7 @@ void LocalStorage::Append(DataTable *table, DataChunk &chunk) { auto entry = table_storage.find(table); LocalTableStorage *storage; if (entry == table_storage.end()) { - auto new_storage = make_unique(*table); + auto new_storage = make_shared(*table); storage = new_storage.get(); table_storage.insert(make_pair(table, move(new_storage))); } else { @@ -165874,6 +176747,30 @@ void LocalStorage::ChangeType(DataTable *old_dt, DataTable *new_dt, idx_t change throw NotImplementedException("FIXME: ALTER TYPE with transaction local data not currently supported"); } +void LocalStorage::FetchChunk(DataTable *table, Vector &row_ids, idx_t count, DataChunk &dst_chunk) { + auto storage = GetStorage(table); + idx_t chunk_idx = GetChunk(row_ids); + auto &chunk = storage->collection.GetChunk(chunk_idx); + + VectorData row_ids_data; + row_ids.Orrify(count, row_ids_data); + auto row_identifiers = (const row_t *)row_ids_data.data; + SelectionVector sel(count); + for (idx_t i = 0; i < count; ++i) { + const auto idx = row_ids_data.sel->get_index(i); + sel.set_index(i, row_identifiers[idx] - MAX_ROW_ID); + } + + dst_chunk.InitializeEmpty(chunk.GetTypes()); + dst_chunk.Slice(chunk, sel, count); +} + +vector> &LocalStorage::GetIndexes(DataTable *table) { + auto storage = GetStorage(table); + + return storage->indexes; +} + } // namespace duckdb @@ -167399,7 +178296,7 @@ string ValidityStatistics::ToString() const { namespace duckdb { -const uint64_t VERSION_NUMBER = 31; +const uint64_t VERSION_NUMBER = 33; } // namespace duckdb @@ -172569,8 +183466,6 @@ bool ValidityColumnData::CheckZonemap(ColumnScanState &state, TableFilter &filte - - namespace duckdb { @@ -172612,6 +183507,9 @@ class ReplayState { void ReplayCreateMacro(); void ReplayDropMacro(); + void ReplayCreateTableMacro(); + void ReplayDropTableMacro(); + void ReplayUseTable(); void ReplayInsert(); void ReplayDelete(); @@ -172746,6 +183644,12 @@ void ReplayState::ReplayEntry(WALType entry_type) { case WALType::DROP_MACRO: ReplayDropMacro(); break; + case WALType::CREATE_TABLE_MACRO: + ReplayCreateTableMacro(); + break; + case WALType::DROP_TABLE_MACRO: + ReplayDropTableMacro(); + break; case WALType::USE_TABLE: ReplayUseTable(); break; @@ -172940,7 +183844,7 @@ void ReplayState::ReplaySequenceValue() { // Replay Macro //===--------------------------------------------------------------------===// void ReplayState::ReplayCreateMacro() { - auto entry = MacroCatalogEntry::Deserialize(source); + auto entry = ScalarMacroCatalogEntry::Deserialize(source); if (deserialize_only) { return; } @@ -172962,6 +183866,32 @@ void ReplayState::ReplayDropMacro() { catalog.DropEntry(context, &info); } +//===--------------------------------------------------------------------===// +// Replay Table Macro +//===--------------------------------------------------------------------===// +void ReplayState::ReplayCreateTableMacro() { + auto entry = TableMacroCatalogEntry::Deserialize(source); + if (deserialize_only) { + return; + } + + auto &catalog = Catalog::GetCatalog(context); + catalog.CreateFunction(context, entry.get()); +} + +void ReplayState::ReplayDropTableMacro() { + DropInfo info; + info.type = CatalogType::TABLE_MACRO_ENTRY; + info.schema = source.Read(); + info.name = source.Read(); + if (deserialize_only) { + return; + } + + auto &catalog = Catalog::GetCatalog(context); + catalog.DropEntry(context, &info); +} + //===--------------------------------------------------------------------===// // Replay Data //===--------------------------------------------------------------------===// @@ -173053,7 +183983,6 @@ void ReplayState::ReplayCheckpoint() { - #include namespace duckdb { @@ -173170,7 +184099,7 @@ void WriteAheadLog::WriteSequenceValue(SequenceCatalogEntry *entry, SequenceValu //===--------------------------------------------------------------------===// // MACRO'S //===--------------------------------------------------------------------===// -void WriteAheadLog::WriteCreateMacro(MacroCatalogEntry *entry) { +void WriteAheadLog::WriteCreateMacro(ScalarMacroCatalogEntry *entry) { if (skip_writing) { return; } @@ -173178,7 +184107,7 @@ void WriteAheadLog::WriteCreateMacro(MacroCatalogEntry *entry) { entry->Serialize(*writer); } -void WriteAheadLog::WriteDropMacro(MacroCatalogEntry *entry) { +void WriteAheadLog::WriteDropMacro(ScalarMacroCatalogEntry *entry) { if (skip_writing) { return; } @@ -173187,6 +184116,23 @@ void WriteAheadLog::WriteDropMacro(MacroCatalogEntry *entry) { writer->WriteString(entry->name); } +void WriteAheadLog::WriteCreateTableMacro(TableMacroCatalogEntry *entry) { + if (skip_writing) { + return; + } + writer->Write(WALType::CREATE_TABLE_MACRO); + entry->Serialize(*writer); +} + +void WriteAheadLog::WriteDropTableMacro(TableMacroCatalogEntry *entry) { + if (skip_writing) { + return; + } + writer->Write(WALType::DROP_TABLE_MACRO); + writer->WriteString(entry->schema->name); + writer->WriteString(entry->name); +} + //===--------------------------------------------------------------------===// // Custom Types //===--------------------------------------------------------------------===// @@ -173556,6 +184502,7 @@ struct AppendInfo { + namespace duckdb { CommitState::CommitState(transaction_t commit_id, WriteAheadLog *log) @@ -173620,8 +184567,12 @@ void CommitState::WriteCatalogEntry(CatalogEntry *entry, data_ptr_t dataptr) { log->WriteCreateSequence((SequenceCatalogEntry *)parent); break; case CatalogType::MACRO_ENTRY: - log->WriteCreateMacro((MacroCatalogEntry *)parent); + log->WriteCreateMacro((ScalarMacroCatalogEntry *)parent); + break; + case CatalogType::TABLE_MACRO_ENTRY: + log->WriteCreateTableMacro((TableMacroCatalogEntry *)parent); break; + case CatalogType::TYPE_ENTRY: log->WriteCreateType((TypeCatalogEntry *)parent); break; @@ -173643,7 +184594,10 @@ void CommitState::WriteCatalogEntry(CatalogEntry *entry, data_ptr_t dataptr) { log->WriteDropSequence((SequenceCatalogEntry *)entry); break; case CatalogType::MACRO_ENTRY: - log->WriteDropMacro((MacroCatalogEntry *)entry); + log->WriteDropMacro((ScalarMacroCatalogEntry *)entry); + break; + case CatalogType::TABLE_MACRO_ENTRY: + log->WriteDropTableMacro((TableMacroCatalogEntry *)entry); break; case CatalogType::TYPE_ENTRY: log->WriteDropType((TypeCatalogEntry *)entry); @@ -183609,7 +194563,7 @@ mz_bool mz_zip_end(mz_zip_archive *pZip) // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2008 The RE2 Authors. All Rights Reserved. @@ -183640,7 +194594,7 @@ mz_bool mz_zip_end(mz_zip_archive *pZip) // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2009 The RE2 Authors. All Rights Reserved. @@ -183661,7 +194615,7 @@ mz_bool mz_zip_end(mz_zip_archive *pZip) // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2009 The RE2 Authors. All Rights Reserved. @@ -183808,7 +194762,7 @@ class LogMessageFatal : public LogMessage { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2018 The RE2 Authors. All Rights Reserved. @@ -183873,7 +194827,7 @@ class PODArray { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2007 The RE2 Authors. All Rights Reserved. @@ -183900,7 +194854,7 @@ class PODArray { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2006 The RE2 Authors. All Rights Reserved. @@ -184302,7 +195256,7 @@ template bool SparseArray::less(const IndexValue& a, // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2006 The RE2 Authors. All Rights Reserved. @@ -184991,7 +195945,7 @@ class Prog { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2006 The RE2 Authors. All Rights Reserved. @@ -185092,7 +196046,7 @@ class Prog { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list /* @@ -186066,7 +197020,7 @@ bool Prog::SearchBitState(const StringPiece& text, // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2007 The RE2 Authors. All Rights Reserved. @@ -186093,7 +197047,7 @@ bool Prog::SearchBitState(const StringPiece& text, // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2006 The RE2 Authors. All Rights Reserved. @@ -187609,7 +198563,7 @@ Prog* Prog::CompileSet(Regexp* re, RE2::Anchor anchor, int64_t max_mem) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2008 The RE2 Authors. All Rights Reserved. @@ -187654,7 +198608,7 @@ Prog* Prog::CompileSet(Regexp* re, RE2::Anchor anchor, int64_t max_mem) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2016 The RE2 Authors. All Rights Reserved. @@ -187705,7 +198659,7 @@ class HashMix { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2007 The RE2 Authors. All Rights Reserved. @@ -187849,7 +198803,7 @@ class WriterMutexLock { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2016 The RE2 Authors. All Rights Reserved. @@ -189925,7 +200879,7 @@ bool Prog::PossibleMatchRange(std::string* min, std::string* max, int maxlen) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2009 The RE2 Authors. All Rights Reserved. @@ -189935,7 +200889,7 @@ bool Prog::PossibleMatchRange(std::string* min, std::string* max, int maxlen) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2009 The RE2 Authors. All Rights Reserved. @@ -190061,7 +201015,7 @@ class FilteredRE2 { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2009 The RE2 Authors. All Rights Reserved. @@ -190179,7 +201133,7 @@ class Prefilter { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2009 The RE2 Authors. All Rights Reserved. @@ -190439,7 +201393,7 @@ void FilteredRE2::PrintPrefilter(int regexpid) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2008 The RE2 Authors. All Rights Reserved. @@ -190635,7 +201589,7 @@ static bool CanBeEmptyString(Regexp* re) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2006-2007 The RE2 Authors. All Rights Reserved. @@ -191358,7 +202312,7 @@ void Prog::Fanout(SparseArray* fanout) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2008 The RE2 Authors. All Rights Reserved. @@ -191942,7 +202896,7 @@ bool Prog::IsOnePass() { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2006 The RE2 Authors. All Rights Reserved. @@ -191982,7 +202936,7 @@ bool Prog::IsOnePass() { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2008 The RE2 Authors. All Rights Reserved. @@ -192070,7 +203024,7 @@ extern Rune ApplyFold(const CaseFold *f, Rune r); // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2008 The RE2 Authors. All Rights Reserved. @@ -194578,7 +205532,7 @@ Regexp* Regexp::Parse(const StringPiece& s, ParseFlags global_flags, // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // GENERATED BY make_perl_groups.pl; DO NOT EDIT. @@ -194706,7 +205660,7 @@ const int num_posix_groups = 28; // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2009 The RE2 Authors. All Rights Reserved. @@ -195407,7 +206361,7 @@ Prefilter* Prefilter::FromRE2(const RE2* re2) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2009 The RE2 Authors. All Rights Reserved. @@ -195818,7 +206772,7 @@ std::string PrefilterTree::DebugNodeString(Prefilter* node) const { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2007 The RE2 Authors. All Rights Reserved. @@ -195842,7 +206796,7 @@ std::string PrefilterTree::DebugNodeString(Prefilter* node) const { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2016 The RE2 Authors. All Rights Reserved. @@ -196868,7 +207822,7 @@ void Prog::ComputeHints(std::vector* flat, int begin, int end) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2003-2009 The RE2 Authors. All Rights Reserved. @@ -198112,7 +209066,7 @@ DEFINE_INTEGER_PARSER(ulonglong) // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2006 The RE2 Authors. All Rights Reserved. @@ -199092,7 +210046,7 @@ CharClass* CharClassBuilder::GetCharClass() { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2010 The RE2 Authors. All Rights Reserved. @@ -199102,7 +210056,7 @@ CharClass* CharClassBuilder::GetCharClass() { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2010 The RE2 Authors. All Rights Reserved. @@ -199343,7 +210297,7 @@ bool RE2::Set::Match(const StringPiece& text, std::vector* v, // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2006 The RE2 Authors. All Rights Reserved. @@ -200008,7 +210962,7 @@ Regexp* SimplifyWalker::SimplifyCharClass(Regexp* re) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2004 The RE2 Authors. All Rights Reserved. @@ -200082,7 +211036,7 @@ std::ostream& operator<<(std::ostream& o, const StringPiece& p) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 2006 The RE2 Authors. All Rights Reserved. @@ -200440,7 +211394,7 @@ static void AppendCCRange(std::string* t, Rune lo, Rune hi) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list @@ -201016,7 +211970,7 @@ const int num_unicode_tolower = 194; // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list @@ -207084,7 +218038,7 @@ const int num_unicode_groups = 184; // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list /* @@ -207353,7 +218307,7 @@ utfrune(const char *s, Rune c) // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #5 // See the end of this file for a list // Copyright 1999-2005 The RE2 Authors. All Rights Reserved. @@ -207526,7 +218480,7 @@ void StringAppendF(std::string* dst, const char* format, ...) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #4 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 // See the end of this file for a list /* hyperloglog.c - Redis HyperLogLog probabilistic cardinality approximation. @@ -207564,7 +218518,7 @@ void StringAppendF(std::string* dst, const char* format, ...) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #4 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 // See the end of this file for a list /* SDSLib 2.0 -- A C dynamic strings library @@ -209068,7 +220022,7 @@ robj *hll_merge(robj **hlls, size_t hll_count) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #4 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #6 // See the end of this file for a list /* SDSLib 2.0 -- A C dynamic strings library @@ -210191,7 +221145,7 @@ void sdfree(void *ptr) { free(ptr); } // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #11 // See the end of this file for a list @@ -227330,7 +238284,7 @@ size_t Utf8Proc::RenderWidth(const char *s, size_t len, size_t pos) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list #include @@ -227340,12 +238294,13 @@ size_t Utf8Proc::RenderWidth(const char *s, size_t len, size_t pos) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list #include +#include @@ -227358,7 +238313,7 @@ typedef struct parse_result_str parse_result; struct parse_result_str { bool success; PGList *parse_tree; - char *error_message; + std::string error_message; int error_location; }; @@ -227439,6 +238394,7 @@ static void allocate_new(parser_state *state, size_t n) { if (state->malloc_ptr_idx >= state->malloc_ptr_size) { size_t new_size = state->malloc_ptr_size * 2; auto new_malloc_ptrs = (char **) malloc(sizeof(char *) * new_size); + memset(new_malloc_ptrs, 0, sizeof(char*) * new_size); memcpy(new_malloc_ptrs, state->malloc_ptrs, state->malloc_ptr_size * sizeof(char*)); free(state->malloc_ptrs); state->malloc_ptr_size = new_size; @@ -227480,6 +238436,7 @@ void pg_parser_init() { pg_parser_state.malloc_ptr_size = 4; pg_parser_state.malloc_ptrs = (char **) malloc(sizeof(char *) * pg_parser_state.malloc_ptr_size); + memset(pg_parser_state.malloc_ptrs, 0, sizeof(char*) * pg_parser_state.malloc_ptr_size); pg_parser_state.malloc_ptr_idx = 0; allocate_new(&pg_parser_state, 1); } @@ -227491,14 +238448,7 @@ void pg_parser_parse(const char *query, parse_result *res) { res->success = pg_parser_state.pg_err_code == PGUNDEFINED; } catch (std::exception &ex) { res->success = false; - // copy the error message of the exception - auto error_message = ex.what(); - uint32_t pos = 0; - while(pos < 1023 && error_message[pos]) { - pg_parser_state.pg_err_msg[pos] = error_message[pos]; - pos++; - } - pg_parser_state.pg_err_msg[pos] = '\0'; + res->error_message = ex.what(); } res->error_message = pg_parser_state.pg_err_msg; res->error_location = pg_parser_state.pg_err_pos; @@ -227668,7 +238618,7 @@ PGNode *newNode(size_t size, PGNodeTag type) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list @@ -227678,7 +238628,7 @@ PGNode *newNode(size_t size, PGNodeTag type) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -227717,7 +238667,7 @@ bool get_preserve_identifier_case(); // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -227765,7 +238715,7 @@ PostgresParser::PostgresParser() : success(false), parse_tree(nullptr), error_me void PostgresParser::Parse(const string &query) { duckdb_libpgquery::pg_parser_init(); - duckdb_libpgquery::parse_result res; + duckdb_libpgquery::parse_result res; pg_parser_parse(query.c_str(), &res); success = res.success; @@ -227807,7 +238757,7 @@ void PostgresParser::SetPreserveIdentifierCase(bool preserve) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*-------------------------------------------------------------------- @@ -228355,7 +239305,7 @@ int length(const PGList *list); // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*-------------------------------------------------------------------- @@ -228396,7 +239346,7 @@ int length(const PGList *list); // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -228431,7 +239381,7 @@ typedef struct PGFunctionCallInfoData *PGFunctionCallInfo; // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -228509,7 +239459,7 @@ PGGroupingSet *makeGroupingSet(GroupingSetKind kind, PGList *content, int locati // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -228856,7 +239806,7 @@ PGGroupingSet *makeGroupingSet(GroupingSetKind kind, PGList *content, int locati // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*-------------------------------------------------------------------- @@ -228938,7 +239888,7 @@ PGValue *makeString(const char *str) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /* A Bison parser, made by GNU Bison 2.3. */ @@ -229167,335 +240117,337 @@ PGValue *makeString(const char *str) { EXISTS = 405, EXPLAIN = 406, EXPORT_P = 407, - EXTENSION = 408, - EXTERNAL = 409, - EXTRACT = 410, - FALSE_P = 411, - FAMILY = 412, - FETCH = 413, - FILTER = 414, - FIRST_P = 415, - FLOAT_P = 416, - FOLLOWING = 417, - FOR = 418, - FORCE = 419, - FOREIGN = 420, - FORWARD = 421, - FREEZE = 422, - FROM = 423, - FULL = 424, - FUNCTION = 425, - FUNCTIONS = 426, - GENERATED = 427, - GLOB = 428, - GLOBAL = 429, - GRANT = 430, - GRANTED = 431, - GROUP_P = 432, - GROUPING = 433, - GROUPING_ID = 434, - HANDLER = 435, - HAVING = 436, - HEADER_P = 437, - HOLD = 438, - HOUR_P = 439, - HOURS_P = 440, - IDENTITY_P = 441, - IF_P = 442, - IGNORE_P = 443, - ILIKE = 444, - IMMEDIATE = 445, - IMMUTABLE = 446, - IMPLICIT_P = 447, - IMPORT_P = 448, - IN_P = 449, - INCLUDING = 450, - INCREMENT = 451, - INDEX = 452, - INDEXES = 453, - INHERIT = 454, - INHERITS = 455, - INITIALLY = 456, - INLINE_P = 457, - INNER_P = 458, - INOUT = 459, - INPUT_P = 460, - INSENSITIVE = 461, - INSERT = 462, - INSTALL = 463, - INSTEAD = 464, - INT_P = 465, - INTEGER = 466, - INTERSECT = 467, - INTERVAL = 468, - INTO = 469, - INVOKER = 470, - IS = 471, - ISNULL = 472, - ISOLATION = 473, - JOIN = 474, - KEY = 475, - LABEL = 476, - LANGUAGE = 477, - LARGE_P = 478, - LAST_P = 479, - LATERAL_P = 480, - LEADING = 481, - LEAKPROOF = 482, - LEFT = 483, - LEVEL = 484, - LIKE = 485, - LIMIT = 486, - LISTEN = 487, - LOAD = 488, - LOCAL = 489, - LOCALTIME = 490, - LOCALTIMESTAMP = 491, - LOCATION = 492, - LOCK_P = 493, - LOCKED = 494, - LOGGED = 495, - MACRO = 496, - MAP = 497, - MAPPING = 498, - MATCH = 499, - MATERIALIZED = 500, - MAXVALUE = 501, - METHOD = 502, - MICROSECOND_P = 503, - MICROSECONDS_P = 504, - MILLISECOND_P = 505, - MILLISECONDS_P = 506, - MINUTE_P = 507, - MINUTES_P = 508, - MINVALUE = 509, - MODE = 510, - MONTH_P = 511, - MONTHS_P = 512, - MOVE = 513, - NAME_P = 514, - NAMES = 515, - NATIONAL = 516, - NATURAL = 517, - NCHAR = 518, - NEW = 519, - NEXT = 520, - NO = 521, - NONE = 522, - NOT = 523, - NOTHING = 524, - NOTIFY = 525, - NOTNULL = 526, - NOWAIT = 527, - NULL_P = 528, - NULLIF = 529, - NULLS_P = 530, - NUMERIC = 531, - OBJECT_P = 532, - OF = 533, - OFF = 534, - OFFSET = 535, - OIDS = 536, - OLD = 537, - ON = 538, - ONLY = 539, - OPERATOR = 540, - OPTION = 541, - OPTIONS = 542, - OR = 543, - ORDER = 544, - ORDINALITY = 545, - OUT_P = 546, - OUTER_P = 547, - OVER = 548, - OVERLAPS = 549, - OVERLAY = 550, - OVERRIDING = 551, - OWNED = 552, - OWNER = 553, - PARALLEL = 554, - PARSER = 555, - PARTIAL = 556, - PARTITION = 557, - PASSING = 558, - PASSWORD = 559, - PERCENT = 560, - PLACING = 561, - PLANS = 562, - POLICY = 563, - POSITION = 564, - PRAGMA_P = 565, - PRECEDING = 566, - PRECISION = 567, - PREPARE = 568, - PREPARED = 569, - PRESERVE = 570, - PRIMARY = 571, - PRIOR = 572, - PRIVILEGES = 573, - PROCEDURAL = 574, - PROCEDURE = 575, - PROGRAM = 576, - PUBLICATION = 577, - QUALIFY = 578, - QUOTE = 579, - RANGE = 580, - READ_P = 581, - REAL = 582, - REASSIGN = 583, - RECHECK = 584, - RECURSIVE = 585, - REF = 586, - REFERENCES = 587, - REFERENCING = 588, - REFRESH = 589, - REINDEX = 590, - RELATIVE_P = 591, - RELEASE = 592, - RENAME = 593, - REPEATABLE = 594, - REPLACE = 595, - REPLICA = 596, - RESET = 597, - RESPECT_P = 598, - RESTART = 599, - RESTRICT = 600, - RETURNING = 601, - RETURNS = 602, - REVOKE = 603, - RIGHT = 604, - ROLE = 605, - ROLLBACK = 606, - ROLLUP = 607, - ROW = 608, - ROWS = 609, - RULE = 610, - SAMPLE = 611, - SAVEPOINT = 612, - SCHEMA = 613, - SCHEMAS = 614, - SCROLL = 615, - SEARCH = 616, - SECOND_P = 617, - SECONDS_P = 618, - SECURITY = 619, - SELECT = 620, - SEQUENCE = 621, - SEQUENCES = 622, - SERIALIZABLE = 623, - SERVER = 624, - SESSION = 625, - SESSION_USER = 626, - SET = 627, - SETOF = 628, - SETS = 629, - SHARE = 630, - SHOW = 631, - SIMILAR = 632, - SIMPLE = 633, - SKIP = 634, - SMALLINT = 635, - SNAPSHOT = 636, - SOME = 637, - SQL_P = 638, - STABLE = 639, - STANDALONE_P = 640, - START = 641, - STATEMENT = 642, - STATISTICS = 643, - STDIN = 644, - STDOUT = 645, - STORAGE = 646, - STRICT_P = 647, - STRIP_P = 648, - STRUCT = 649, - SUBSCRIPTION = 650, - SUBSTRING = 651, - SUMMARIZE = 652, - SYMMETRIC = 653, - SYSID = 654, - SYSTEM_P = 655, - TABLE = 656, - TABLES = 657, - TABLESAMPLE = 658, - TABLESPACE = 659, - TEMP = 660, - TEMPLATE = 661, - TEMPORARY = 662, - TEXT_P = 663, - THEN = 664, - TIME = 665, - TIMESTAMP = 666, - TO = 667, - TRAILING = 668, - TRANSACTION = 669, - TRANSFORM = 670, - TREAT = 671, - TRIGGER = 672, - TRIM = 673, - TRUE_P = 674, - TRUNCATE = 675, - TRUSTED = 676, - TRY_CAST = 677, - TYPE_P = 678, - TYPES_P = 679, - UNBOUNDED = 680, - UNCOMMITTED = 681, - UNENCRYPTED = 682, - UNION = 683, - UNIQUE = 684, - UNKNOWN = 685, - UNLISTEN = 686, - UNLOGGED = 687, - UNTIL = 688, - UPDATE = 689, - USER = 690, - USING = 691, - VACUUM = 692, - VALID = 693, - VALIDATE = 694, - VALIDATOR = 695, - VALUE_P = 696, - VALUES = 697, - VARCHAR = 698, - VARIADIC = 699, - VARYING = 700, - VERBOSE = 701, - VERSION_P = 702, - VIEW = 703, - VIEWS = 704, - VOLATILE = 705, - WHEN = 706, - WHERE = 707, - WHITESPACE_P = 708, - WINDOW = 709, - WITH = 710, - WITHIN = 711, - WITHOUT = 712, - WORK = 713, - WRAPPER = 714, - WRITE_P = 715, - XML_P = 716, - XMLATTRIBUTES = 717, - XMLCONCAT = 718, - XMLELEMENT = 719, - XMLEXISTS = 720, - XMLFOREST = 721, - XMLNAMESPACES = 722, - XMLPARSE = 723, - XMLPI = 724, - XMLROOT = 725, - XMLSERIALIZE = 726, - XMLTABLE = 727, - YEAR_P = 728, - YEARS_P = 729, - YES_P = 730, - ZONE = 731, - NOT_LA = 732, - NULLS_LA = 733, - WITH_LA = 734, - POSTFIXOP = 735, - UMINUS = 736 + EXPORT_STATE = 408, + EXTENSION = 409, + EXTERNAL = 410, + EXTRACT = 411, + FALSE_P = 412, + FAMILY = 413, + FETCH = 414, + FILTER = 415, + FIRST_P = 416, + FLOAT_P = 417, + FOLLOWING = 418, + FOR = 419, + FORCE = 420, + FOREIGN = 421, + FORWARD = 422, + FREEZE = 423, + FROM = 424, + FULL = 425, + FUNCTION = 426, + FUNCTIONS = 427, + GENERATED = 428, + GLOB = 429, + GLOBAL = 430, + GRANT = 431, + GRANTED = 432, + GROUP_P = 433, + GROUPING = 434, + GROUPING_ID = 435, + HANDLER = 436, + HAVING = 437, + HEADER_P = 438, + HOLD = 439, + HOUR_P = 440, + HOURS_P = 441, + IDENTITY_P = 442, + IF_P = 443, + IGNORE_P = 444, + ILIKE = 445, + IMMEDIATE = 446, + IMMUTABLE = 447, + IMPLICIT_P = 448, + IMPORT_P = 449, + IN_P = 450, + INCLUDING = 451, + INCREMENT = 452, + INDEX = 453, + INDEXES = 454, + INHERIT = 455, + INHERITS = 456, + INITIALLY = 457, + INLINE_P = 458, + INNER_P = 459, + INOUT = 460, + INPUT_P = 461, + INSENSITIVE = 462, + INSERT = 463, + INSTALL = 464, + INSTEAD = 465, + INT_P = 466, + INTEGER = 467, + INTERSECT = 468, + INTERVAL = 469, + INTO = 470, + INVOKER = 471, + IS = 472, + ISNULL = 473, + ISOLATION = 474, + JOIN = 475, + JSON = 476, + KEY = 477, + LABEL = 478, + LANGUAGE = 479, + LARGE_P = 480, + LAST_P = 481, + LATERAL_P = 482, + LEADING = 483, + LEAKPROOF = 484, + LEFT = 485, + LEVEL = 486, + LIKE = 487, + LIMIT = 488, + LISTEN = 489, + LOAD = 490, + LOCAL = 491, + LOCALTIME = 492, + LOCALTIMESTAMP = 493, + LOCATION = 494, + LOCK_P = 495, + LOCKED = 496, + LOGGED = 497, + MACRO = 498, + MAP = 499, + MAPPING = 500, + MATCH = 501, + MATERIALIZED = 502, + MAXVALUE = 503, + METHOD = 504, + MICROSECOND_P = 505, + MICROSECONDS_P = 506, + MILLISECOND_P = 507, + MILLISECONDS_P = 508, + MINUTE_P = 509, + MINUTES_P = 510, + MINVALUE = 511, + MODE = 512, + MONTH_P = 513, + MONTHS_P = 514, + MOVE = 515, + NAME_P = 516, + NAMES = 517, + NATIONAL = 518, + NATURAL = 519, + NCHAR = 520, + NEW = 521, + NEXT = 522, + NO = 523, + NONE = 524, + NOT = 525, + NOTHING = 526, + NOTIFY = 527, + NOTNULL = 528, + NOWAIT = 529, + NULL_P = 530, + NULLIF = 531, + NULLS_P = 532, + NUMERIC = 533, + OBJECT_P = 534, + OF = 535, + OFF = 536, + OFFSET = 537, + OIDS = 538, + OLD = 539, + ON = 540, + ONLY = 541, + OPERATOR = 542, + OPTION = 543, + OPTIONS = 544, + OR = 545, + ORDER = 546, + ORDINALITY = 547, + OUT_P = 548, + OUTER_P = 549, + OVER = 550, + OVERLAPS = 551, + OVERLAY = 552, + OVERRIDING = 553, + OWNED = 554, + OWNER = 555, + PARALLEL = 556, + PARSER = 557, + PARTIAL = 558, + PARTITION = 559, + PASSING = 560, + PASSWORD = 561, + PERCENT = 562, + PLACING = 563, + PLANS = 564, + POLICY = 565, + POSITION = 566, + PRAGMA_P = 567, + PRECEDING = 568, + PRECISION = 569, + PREPARE = 570, + PREPARED = 571, + PRESERVE = 572, + PRIMARY = 573, + PRIOR = 574, + PRIVILEGES = 575, + PROCEDURAL = 576, + PROCEDURE = 577, + PROGRAM = 578, + PUBLICATION = 579, + QUALIFY = 580, + QUOTE = 581, + RANGE = 582, + READ_P = 583, + REAL = 584, + REASSIGN = 585, + RECHECK = 586, + RECURSIVE = 587, + REF = 588, + REFERENCES = 589, + REFERENCING = 590, + REFRESH = 591, + REINDEX = 592, + RELATIVE_P = 593, + RELEASE = 594, + RENAME = 595, + REPEATABLE = 596, + REPLACE = 597, + REPLICA = 598, + RESET = 599, + RESPECT_P = 600, + RESTART = 601, + RESTRICT = 602, + RETURNING = 603, + RETURNS = 604, + REVOKE = 605, + RIGHT = 606, + ROLE = 607, + ROLLBACK = 608, + ROLLUP = 609, + ROW = 610, + ROWS = 611, + RULE = 612, + SAMPLE = 613, + SAVEPOINT = 614, + SCHEMA = 615, + SCHEMAS = 616, + SCROLL = 617, + SEARCH = 618, + SECOND_P = 619, + SECONDS_P = 620, + SECURITY = 621, + SELECT = 622, + SEQUENCE = 623, + SEQUENCES = 624, + SERIALIZABLE = 625, + SERVER = 626, + SESSION = 627, + SESSION_USER = 628, + SET = 629, + SETOF = 630, + SETS = 631, + SHARE = 632, + SHOW = 633, + SIMILAR = 634, + SIMPLE = 635, + SKIP = 636, + SMALLINT = 637, + SNAPSHOT = 638, + SOME = 639, + SQL_P = 640, + STABLE = 641, + STANDALONE_P = 642, + START = 643, + STATEMENT = 644, + STATISTICS = 645, + STDIN = 646, + STDOUT = 647, + STORAGE = 648, + STRICT_P = 649, + STRIP_P = 650, + STRUCT = 651, + SUBSCRIPTION = 652, + SUBSTRING = 653, + SUMMARIZE = 654, + SYMMETRIC = 655, + SYSID = 656, + SYSTEM_P = 657, + TABLE = 658, + TABLES = 659, + TABLESAMPLE = 660, + TABLESPACE = 661, + TEMP = 662, + TEMPLATE = 663, + TEMPORARY = 664, + TEXT_P = 665, + THEN = 666, + TIME = 667, + TIMESTAMP = 668, + TO = 669, + TRAILING = 670, + TRANSACTION = 671, + TRANSFORM = 672, + TREAT = 673, + TRIGGER = 674, + TRIM = 675, + TRUE_P = 676, + TRUNCATE = 677, + TRUSTED = 678, + TRY_CAST = 679, + TYPE_P = 680, + TYPES_P = 681, + UNBOUNDED = 682, + UNCOMMITTED = 683, + UNENCRYPTED = 684, + UNION = 685, + UNIQUE = 686, + UNKNOWN = 687, + UNLISTEN = 688, + UNLOGGED = 689, + UNTIL = 690, + UPDATE = 691, + USER = 692, + USING = 693, + VACUUM = 694, + VALID = 695, + VALIDATE = 696, + VALIDATOR = 697, + VALUE_P = 698, + VALUES = 699, + VARCHAR = 700, + VARIADIC = 701, + VARYING = 702, + VERBOSE = 703, + VERSION_P = 704, + VIEW = 705, + VIEWS = 706, + VOLATILE = 707, + WHEN = 708, + WHERE = 709, + WHITESPACE_P = 710, + WINDOW = 711, + WITH = 712, + WITHIN = 713, + WITHOUT = 714, + WORK = 715, + WRAPPER = 716, + WRITE_P = 717, + XML_P = 718, + XMLATTRIBUTES = 719, + XMLCONCAT = 720, + XMLELEMENT = 721, + XMLEXISTS = 722, + XMLFOREST = 723, + XMLNAMESPACES = 724, + XMLPARSE = 725, + XMLPI = 726, + XMLROOT = 727, + XMLSERIALIZE = 728, + XMLTABLE = 729, + YEAR_P = 730, + YEARS_P = 731, + YES_P = 732, + ZONE = 733, + NOT_LA = 734, + NULLS_LA = 735, + WITH_LA = 736, + POSTFIXOP = 737, + UMINUS = 738 }; #endif /* Tokens. */ @@ -229649,335 +240601,337 @@ PGValue *makeString(const char *str) { #define EXISTS 405 #define EXPLAIN 406 #define EXPORT_P 407 -#define EXTENSION 408 -#define EXTERNAL 409 -#define EXTRACT 410 -#define FALSE_P 411 -#define FAMILY 412 -#define FETCH 413 -#define FILTER 414 -#define FIRST_P 415 -#define FLOAT_P 416 -#define FOLLOWING 417 -#define FOR 418 -#define FORCE 419 -#define FOREIGN 420 -#define FORWARD 421 -#define FREEZE 422 -#define FROM 423 -#define FULL 424 -#define FUNCTION 425 -#define FUNCTIONS 426 -#define GENERATED 427 -#define GLOB 428 -#define GLOBAL 429 -#define GRANT 430 -#define GRANTED 431 -#define GROUP_P 432 -#define GROUPING 433 -#define GROUPING_ID 434 -#define HANDLER 435 -#define HAVING 436 -#define HEADER_P 437 -#define HOLD 438 -#define HOUR_P 439 -#define HOURS_P 440 -#define IDENTITY_P 441 -#define IF_P 442 -#define IGNORE_P 443 -#define ILIKE 444 -#define IMMEDIATE 445 -#define IMMUTABLE 446 -#define IMPLICIT_P 447 -#define IMPORT_P 448 -#define IN_P 449 -#define INCLUDING 450 -#define INCREMENT 451 -#define INDEX 452 -#define INDEXES 453 -#define INHERIT 454 -#define INHERITS 455 -#define INITIALLY 456 -#define INLINE_P 457 -#define INNER_P 458 -#define INOUT 459 -#define INPUT_P 460 -#define INSENSITIVE 461 -#define INSERT 462 -#define INSTALL 463 -#define INSTEAD 464 -#define INT_P 465 -#define INTEGER 466 -#define INTERSECT 467 -#define INTERVAL 468 -#define INTO 469 -#define INVOKER 470 -#define IS 471 -#define ISNULL 472 -#define ISOLATION 473 -#define JOIN 474 -#define KEY 475 -#define LABEL 476 -#define LANGUAGE 477 -#define LARGE_P 478 -#define LAST_P 479 -#define LATERAL_P 480 -#define LEADING 481 -#define LEAKPROOF 482 -#define LEFT 483 -#define LEVEL 484 -#define LIKE 485 -#define LIMIT 486 -#define LISTEN 487 -#define LOAD 488 -#define LOCAL 489 -#define LOCALTIME 490 -#define LOCALTIMESTAMP 491 -#define LOCATION 492 -#define LOCK_P 493 -#define LOCKED 494 -#define LOGGED 495 -#define MACRO 496 -#define MAP 497 -#define MAPPING 498 -#define MATCH 499 -#define MATERIALIZED 500 -#define MAXVALUE 501 -#define METHOD 502 -#define MICROSECOND_P 503 -#define MICROSECONDS_P 504 -#define MILLISECOND_P 505 -#define MILLISECONDS_P 506 -#define MINUTE_P 507 -#define MINUTES_P 508 -#define MINVALUE 509 -#define MODE 510 -#define MONTH_P 511 -#define MONTHS_P 512 -#define MOVE 513 -#define NAME_P 514 -#define NAMES 515 -#define NATIONAL 516 -#define NATURAL 517 -#define NCHAR 518 -#define NEW 519 -#define NEXT 520 -#define NO 521 -#define NONE 522 -#define NOT 523 -#define NOTHING 524 -#define NOTIFY 525 -#define NOTNULL 526 -#define NOWAIT 527 -#define NULL_P 528 -#define NULLIF 529 -#define NULLS_P 530 -#define NUMERIC 531 -#define OBJECT_P 532 -#define OF 533 -#define OFF 534 -#define OFFSET 535 -#define OIDS 536 -#define OLD 537 -#define ON 538 -#define ONLY 539 -#define OPERATOR 540 -#define OPTION 541 -#define OPTIONS 542 -#define OR 543 -#define ORDER 544 -#define ORDINALITY 545 -#define OUT_P 546 -#define OUTER_P 547 -#define OVER 548 -#define OVERLAPS 549 -#define OVERLAY 550 -#define OVERRIDING 551 -#define OWNED 552 -#define OWNER 553 -#define PARALLEL 554 -#define PARSER 555 -#define PARTIAL 556 -#define PARTITION 557 -#define PASSING 558 -#define PASSWORD 559 -#define PERCENT 560 -#define PLACING 561 -#define PLANS 562 -#define POLICY 563 -#define POSITION 564 -#define PRAGMA_P 565 -#define PRECEDING 566 -#define PRECISION 567 -#define PREPARE 568 -#define PREPARED 569 -#define PRESERVE 570 -#define PRIMARY 571 -#define PRIOR 572 -#define PRIVILEGES 573 -#define PROCEDURAL 574 -#define PROCEDURE 575 -#define PROGRAM 576 -#define PUBLICATION 577 -#define QUALIFY 578 -#define QUOTE 579 -#define RANGE 580 -#define READ_P 581 -#define REAL 582 -#define REASSIGN 583 -#define RECHECK 584 -#define RECURSIVE 585 -#define REF 586 -#define REFERENCES 587 -#define REFERENCING 588 -#define REFRESH 589 -#define REINDEX 590 -#define RELATIVE_P 591 -#define RELEASE 592 -#define RENAME 593 -#define REPEATABLE 594 -#define REPLACE 595 -#define REPLICA 596 -#define RESET 597 -#define RESPECT_P 598 -#define RESTART 599 -#define RESTRICT 600 -#define RETURNING 601 -#define RETURNS 602 -#define REVOKE 603 -#define RIGHT 604 -#define ROLE 605 -#define ROLLBACK 606 -#define ROLLUP 607 -#define ROW 608 -#define ROWS 609 -#define RULE 610 -#define SAMPLE 611 -#define SAVEPOINT 612 -#define SCHEMA 613 -#define SCHEMAS 614 -#define SCROLL 615 -#define SEARCH 616 -#define SECOND_P 617 -#define SECONDS_P 618 -#define SECURITY 619 -#define SELECT 620 -#define SEQUENCE 621 -#define SEQUENCES 622 -#define SERIALIZABLE 623 -#define SERVER 624 -#define SESSION 625 -#define SESSION_USER 626 -#define SET 627 -#define SETOF 628 -#define SETS 629 -#define SHARE 630 -#define SHOW 631 -#define SIMILAR 632 -#define SIMPLE 633 -#define SKIP 634 -#define SMALLINT 635 -#define SNAPSHOT 636 -#define SOME 637 -#define SQL_P 638 -#define STABLE 639 -#define STANDALONE_P 640 -#define START 641 -#define STATEMENT 642 -#define STATISTICS 643 -#define STDIN 644 -#define STDOUT 645 -#define STORAGE 646 -#define STRICT_P 647 -#define STRIP_P 648 -#define STRUCT 649 -#define SUBSCRIPTION 650 -#define SUBSTRING 651 -#define SUMMARIZE 652 -#define SYMMETRIC 653 -#define SYSID 654 -#define SYSTEM_P 655 -#define TABLE 656 -#define TABLES 657 -#define TABLESAMPLE 658 -#define TABLESPACE 659 -#define TEMP 660 -#define TEMPLATE 661 -#define TEMPORARY 662 -#define TEXT_P 663 -#define THEN 664 -#define TIME 665 -#define TIMESTAMP 666 -#define TO 667 -#define TRAILING 668 -#define TRANSACTION 669 -#define TRANSFORM 670 -#define TREAT 671 -#define TRIGGER 672 -#define TRIM 673 -#define TRUE_P 674 -#define TRUNCATE 675 -#define TRUSTED 676 -#define TRY_CAST 677 -#define TYPE_P 678 -#define TYPES_P 679 -#define UNBOUNDED 680 -#define UNCOMMITTED 681 -#define UNENCRYPTED 682 -#define UNION 683 -#define UNIQUE 684 -#define UNKNOWN 685 -#define UNLISTEN 686 -#define UNLOGGED 687 -#define UNTIL 688 -#define UPDATE 689 -#define USER 690 -#define USING 691 -#define VACUUM 692 -#define VALID 693 -#define VALIDATE 694 -#define VALIDATOR 695 -#define VALUE_P 696 -#define VALUES 697 -#define VARCHAR 698 -#define VARIADIC 699 -#define VARYING 700 -#define VERBOSE 701 -#define VERSION_P 702 -#define VIEW 703 -#define VIEWS 704 -#define VOLATILE 705 -#define WHEN 706 -#define WHERE 707 -#define WHITESPACE_P 708 -#define WINDOW 709 -#define WITH 710 -#define WITHIN 711 -#define WITHOUT 712 -#define WORK 713 -#define WRAPPER 714 -#define WRITE_P 715 -#define XML_P 716 -#define XMLATTRIBUTES 717 -#define XMLCONCAT 718 -#define XMLELEMENT 719 -#define XMLEXISTS 720 -#define XMLFOREST 721 -#define XMLNAMESPACES 722 -#define XMLPARSE 723 -#define XMLPI 724 -#define XMLROOT 725 -#define XMLSERIALIZE 726 -#define XMLTABLE 727 -#define YEAR_P 728 -#define YEARS_P 729 -#define YES_P 730 -#define ZONE 731 -#define NOT_LA 732 -#define NULLS_LA 733 -#define WITH_LA 734 -#define POSTFIXOP 735 -#define UMINUS 736 +#define EXPORT_STATE 408 +#define EXTENSION 409 +#define EXTERNAL 410 +#define EXTRACT 411 +#define FALSE_P 412 +#define FAMILY 413 +#define FETCH 414 +#define FILTER 415 +#define FIRST_P 416 +#define FLOAT_P 417 +#define FOLLOWING 418 +#define FOR 419 +#define FORCE 420 +#define FOREIGN 421 +#define FORWARD 422 +#define FREEZE 423 +#define FROM 424 +#define FULL 425 +#define FUNCTION 426 +#define FUNCTIONS 427 +#define GENERATED 428 +#define GLOB 429 +#define GLOBAL 430 +#define GRANT 431 +#define GRANTED 432 +#define GROUP_P 433 +#define GROUPING 434 +#define GROUPING_ID 435 +#define HANDLER 436 +#define HAVING 437 +#define HEADER_P 438 +#define HOLD 439 +#define HOUR_P 440 +#define HOURS_P 441 +#define IDENTITY_P 442 +#define IF_P 443 +#define IGNORE_P 444 +#define ILIKE 445 +#define IMMEDIATE 446 +#define IMMUTABLE 447 +#define IMPLICIT_P 448 +#define IMPORT_P 449 +#define IN_P 450 +#define INCLUDING 451 +#define INCREMENT 452 +#define INDEX 453 +#define INDEXES 454 +#define INHERIT 455 +#define INHERITS 456 +#define INITIALLY 457 +#define INLINE_P 458 +#define INNER_P 459 +#define INOUT 460 +#define INPUT_P 461 +#define INSENSITIVE 462 +#define INSERT 463 +#define INSTALL 464 +#define INSTEAD 465 +#define INT_P 466 +#define INTEGER 467 +#define INTERSECT 468 +#define INTERVAL 469 +#define INTO 470 +#define INVOKER 471 +#define IS 472 +#define ISNULL 473 +#define ISOLATION 474 +#define JOIN 475 +#define JSON 476 +#define KEY 477 +#define LABEL 478 +#define LANGUAGE 479 +#define LARGE_P 480 +#define LAST_P 481 +#define LATERAL_P 482 +#define LEADING 483 +#define LEAKPROOF 484 +#define LEFT 485 +#define LEVEL 486 +#define LIKE 487 +#define LIMIT 488 +#define LISTEN 489 +#define LOAD 490 +#define LOCAL 491 +#define LOCALTIME 492 +#define LOCALTIMESTAMP 493 +#define LOCATION 494 +#define LOCK_P 495 +#define LOCKED 496 +#define LOGGED 497 +#define MACRO 498 +#define MAP 499 +#define MAPPING 500 +#define MATCH 501 +#define MATERIALIZED 502 +#define MAXVALUE 503 +#define METHOD 504 +#define MICROSECOND_P 505 +#define MICROSECONDS_P 506 +#define MILLISECOND_P 507 +#define MILLISECONDS_P 508 +#define MINUTE_P 509 +#define MINUTES_P 510 +#define MINVALUE 511 +#define MODE 512 +#define MONTH_P 513 +#define MONTHS_P 514 +#define MOVE 515 +#define NAME_P 516 +#define NAMES 517 +#define NATIONAL 518 +#define NATURAL 519 +#define NCHAR 520 +#define NEW 521 +#define NEXT 522 +#define NO 523 +#define NONE 524 +#define NOT 525 +#define NOTHING 526 +#define NOTIFY 527 +#define NOTNULL 528 +#define NOWAIT 529 +#define NULL_P 530 +#define NULLIF 531 +#define NULLS_P 532 +#define NUMERIC 533 +#define OBJECT_P 534 +#define OF 535 +#define OFF 536 +#define OFFSET 537 +#define OIDS 538 +#define OLD 539 +#define ON 540 +#define ONLY 541 +#define OPERATOR 542 +#define OPTION 543 +#define OPTIONS 544 +#define OR 545 +#define ORDER 546 +#define ORDINALITY 547 +#define OUT_P 548 +#define OUTER_P 549 +#define OVER 550 +#define OVERLAPS 551 +#define OVERLAY 552 +#define OVERRIDING 553 +#define OWNED 554 +#define OWNER 555 +#define PARALLEL 556 +#define PARSER 557 +#define PARTIAL 558 +#define PARTITION 559 +#define PASSING 560 +#define PASSWORD 561 +#define PERCENT 562 +#define PLACING 563 +#define PLANS 564 +#define POLICY 565 +#define POSITION 566 +#define PRAGMA_P 567 +#define PRECEDING 568 +#define PRECISION 569 +#define PREPARE 570 +#define PREPARED 571 +#define PRESERVE 572 +#define PRIMARY 573 +#define PRIOR 574 +#define PRIVILEGES 575 +#define PROCEDURAL 576 +#define PROCEDURE 577 +#define PROGRAM 578 +#define PUBLICATION 579 +#define QUALIFY 580 +#define QUOTE 581 +#define RANGE 582 +#define READ_P 583 +#define REAL 584 +#define REASSIGN 585 +#define RECHECK 586 +#define RECURSIVE 587 +#define REF 588 +#define REFERENCES 589 +#define REFERENCING 590 +#define REFRESH 591 +#define REINDEX 592 +#define RELATIVE_P 593 +#define RELEASE 594 +#define RENAME 595 +#define REPEATABLE 596 +#define REPLACE 597 +#define REPLICA 598 +#define RESET 599 +#define RESPECT_P 600 +#define RESTART 601 +#define RESTRICT 602 +#define RETURNING 603 +#define RETURNS 604 +#define REVOKE 605 +#define RIGHT 606 +#define ROLE 607 +#define ROLLBACK 608 +#define ROLLUP 609 +#define ROW 610 +#define ROWS 611 +#define RULE 612 +#define SAMPLE 613 +#define SAVEPOINT 614 +#define SCHEMA 615 +#define SCHEMAS 616 +#define SCROLL 617 +#define SEARCH 618 +#define SECOND_P 619 +#define SECONDS_P 620 +#define SECURITY 621 +#define SELECT 622 +#define SEQUENCE 623 +#define SEQUENCES 624 +#define SERIALIZABLE 625 +#define SERVER 626 +#define SESSION 627 +#define SESSION_USER 628 +#define SET 629 +#define SETOF 630 +#define SETS 631 +#define SHARE 632 +#define SHOW 633 +#define SIMILAR 634 +#define SIMPLE 635 +#define SKIP 636 +#define SMALLINT 637 +#define SNAPSHOT 638 +#define SOME 639 +#define SQL_P 640 +#define STABLE 641 +#define STANDALONE_P 642 +#define START 643 +#define STATEMENT 644 +#define STATISTICS 645 +#define STDIN 646 +#define STDOUT 647 +#define STORAGE 648 +#define STRICT_P 649 +#define STRIP_P 650 +#define STRUCT 651 +#define SUBSCRIPTION 652 +#define SUBSTRING 653 +#define SUMMARIZE 654 +#define SYMMETRIC 655 +#define SYSID 656 +#define SYSTEM_P 657 +#define TABLE 658 +#define TABLES 659 +#define TABLESAMPLE 660 +#define TABLESPACE 661 +#define TEMP 662 +#define TEMPLATE 663 +#define TEMPORARY 664 +#define TEXT_P 665 +#define THEN 666 +#define TIME 667 +#define TIMESTAMP 668 +#define TO 669 +#define TRAILING 670 +#define TRANSACTION 671 +#define TRANSFORM 672 +#define TREAT 673 +#define TRIGGER 674 +#define TRIM 675 +#define TRUE_P 676 +#define TRUNCATE 677 +#define TRUSTED 678 +#define TRY_CAST 679 +#define TYPE_P 680 +#define TYPES_P 681 +#define UNBOUNDED 682 +#define UNCOMMITTED 683 +#define UNENCRYPTED 684 +#define UNION 685 +#define UNIQUE 686 +#define UNKNOWN 687 +#define UNLISTEN 688 +#define UNLOGGED 689 +#define UNTIL 690 +#define UPDATE 691 +#define USER 692 +#define USING 693 +#define VACUUM 694 +#define VALID 695 +#define VALIDATE 696 +#define VALIDATOR 697 +#define VALUE_P 698 +#define VALUES 699 +#define VARCHAR 700 +#define VARIADIC 701 +#define VARYING 702 +#define VERBOSE 703 +#define VERSION_P 704 +#define VIEW 705 +#define VIEWS 706 +#define VOLATILE 707 +#define WHEN 708 +#define WHERE 709 +#define WHITESPACE_P 710 +#define WINDOW 711 +#define WITH 712 +#define WITHIN 713 +#define WITHOUT 714 +#define WORK 715 +#define WRAPPER 716 +#define WRITE_P 717 +#define XML_P 718 +#define XMLATTRIBUTES 719 +#define XMLCONCAT 720 +#define XMLELEMENT 721 +#define XMLEXISTS 722 +#define XMLFOREST 723 +#define XMLNAMESPACES 724 +#define XMLPARSE 725 +#define XMLPI 726 +#define XMLROOT 727 +#define XMLSERIALIZE 728 +#define XMLTABLE 729 +#define YEAR_P 730 +#define YEARS_P 731 +#define YES_P 732 +#define ZONE 733 +#define NOT_LA 734 +#define NULLS_LA 735 +#define WITH_LA 736 +#define POSTFIXOP 737 +#define UMINUS 738 @@ -230040,7 +240994,7 @@ PGValue *makeString(const char *str) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -230067,7 +241021,7 @@ PGValue *makeString(const char *str) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -230205,7 +241159,7 @@ namespace duckdb_libpgquery { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /* A Bison parser, made by GNU Bison 2.3. */ @@ -230399,335 +241353,337 @@ namespace duckdb_libpgquery { EXISTS = 405, EXPLAIN = 406, EXPORT_P = 407, - EXTENSION = 408, - EXTERNAL = 409, - EXTRACT = 410, - FALSE_P = 411, - FAMILY = 412, - FETCH = 413, - FILTER = 414, - FIRST_P = 415, - FLOAT_P = 416, - FOLLOWING = 417, - FOR = 418, - FORCE = 419, - FOREIGN = 420, - FORWARD = 421, - FREEZE = 422, - FROM = 423, - FULL = 424, - FUNCTION = 425, - FUNCTIONS = 426, - GENERATED = 427, - GLOB = 428, - GLOBAL = 429, - GRANT = 430, - GRANTED = 431, - GROUP_P = 432, - GROUPING = 433, - GROUPING_ID = 434, - HANDLER = 435, - HAVING = 436, - HEADER_P = 437, - HOLD = 438, - HOUR_P = 439, - HOURS_P = 440, - IDENTITY_P = 441, - IF_P = 442, - IGNORE_P = 443, - ILIKE = 444, - IMMEDIATE = 445, - IMMUTABLE = 446, - IMPLICIT_P = 447, - IMPORT_P = 448, - IN_P = 449, - INCLUDING = 450, - INCREMENT = 451, - INDEX = 452, - INDEXES = 453, - INHERIT = 454, - INHERITS = 455, - INITIALLY = 456, - INLINE_P = 457, - INNER_P = 458, - INOUT = 459, - INPUT_P = 460, - INSENSITIVE = 461, - INSERT = 462, - INSTALL = 463, - INSTEAD = 464, - INT_P = 465, - INTEGER = 466, - INTERSECT = 467, - INTERVAL = 468, - INTO = 469, - INVOKER = 470, - IS = 471, - ISNULL = 472, - ISOLATION = 473, - JOIN = 474, - KEY = 475, - LABEL = 476, - LANGUAGE = 477, - LARGE_P = 478, - LAST_P = 479, - LATERAL_P = 480, - LEADING = 481, - LEAKPROOF = 482, - LEFT = 483, - LEVEL = 484, - LIKE = 485, - LIMIT = 486, - LISTEN = 487, - LOAD = 488, - LOCAL = 489, - LOCALTIME = 490, - LOCALTIMESTAMP = 491, - LOCATION = 492, - LOCK_P = 493, - LOCKED = 494, - LOGGED = 495, - MACRO = 496, - MAP = 497, - MAPPING = 498, - MATCH = 499, - MATERIALIZED = 500, - MAXVALUE = 501, - METHOD = 502, - MICROSECOND_P = 503, - MICROSECONDS_P = 504, - MILLISECOND_P = 505, - MILLISECONDS_P = 506, - MINUTE_P = 507, - MINUTES_P = 508, - MINVALUE = 509, - MODE = 510, - MONTH_P = 511, - MONTHS_P = 512, - MOVE = 513, - NAME_P = 514, - NAMES = 515, - NATIONAL = 516, - NATURAL = 517, - NCHAR = 518, - NEW = 519, - NEXT = 520, - NO = 521, - NONE = 522, - NOT = 523, - NOTHING = 524, - NOTIFY = 525, - NOTNULL = 526, - NOWAIT = 527, - NULL_P = 528, - NULLIF = 529, - NULLS_P = 530, - NUMERIC = 531, - OBJECT_P = 532, - OF = 533, - OFF = 534, - OFFSET = 535, - OIDS = 536, - OLD = 537, - ON = 538, - ONLY = 539, - OPERATOR = 540, - OPTION = 541, - OPTIONS = 542, - OR = 543, - ORDER = 544, - ORDINALITY = 545, - OUT_P = 546, - OUTER_P = 547, - OVER = 548, - OVERLAPS = 549, - OVERLAY = 550, - OVERRIDING = 551, - OWNED = 552, - OWNER = 553, - PARALLEL = 554, - PARSER = 555, - PARTIAL = 556, - PARTITION = 557, - PASSING = 558, - PASSWORD = 559, - PERCENT = 560, - PLACING = 561, - PLANS = 562, - POLICY = 563, - POSITION = 564, - PRAGMA_P = 565, - PRECEDING = 566, - PRECISION = 567, - PREPARE = 568, - PREPARED = 569, - PRESERVE = 570, - PRIMARY = 571, - PRIOR = 572, - PRIVILEGES = 573, - PROCEDURAL = 574, - PROCEDURE = 575, - PROGRAM = 576, - PUBLICATION = 577, - QUALIFY = 578, - QUOTE = 579, - RANGE = 580, - READ_P = 581, - REAL = 582, - REASSIGN = 583, - RECHECK = 584, - RECURSIVE = 585, - REF = 586, - REFERENCES = 587, - REFERENCING = 588, - REFRESH = 589, - REINDEX = 590, - RELATIVE_P = 591, - RELEASE = 592, - RENAME = 593, - REPEATABLE = 594, - REPLACE = 595, - REPLICA = 596, - RESET = 597, - RESPECT_P = 598, - RESTART = 599, - RESTRICT = 600, - RETURNING = 601, - RETURNS = 602, - REVOKE = 603, - RIGHT = 604, - ROLE = 605, - ROLLBACK = 606, - ROLLUP = 607, - ROW = 608, - ROWS = 609, - RULE = 610, - SAMPLE = 611, - SAVEPOINT = 612, - SCHEMA = 613, - SCHEMAS = 614, - SCROLL = 615, - SEARCH = 616, - SECOND_P = 617, - SECONDS_P = 618, - SECURITY = 619, - SELECT = 620, - SEQUENCE = 621, - SEQUENCES = 622, - SERIALIZABLE = 623, - SERVER = 624, - SESSION = 625, - SESSION_USER = 626, - SET = 627, - SETOF = 628, - SETS = 629, - SHARE = 630, - SHOW = 631, - SIMILAR = 632, - SIMPLE = 633, - SKIP = 634, - SMALLINT = 635, - SNAPSHOT = 636, - SOME = 637, - SQL_P = 638, - STABLE = 639, - STANDALONE_P = 640, - START = 641, - STATEMENT = 642, - STATISTICS = 643, - STDIN = 644, - STDOUT = 645, - STORAGE = 646, - STRICT_P = 647, - STRIP_P = 648, - STRUCT = 649, - SUBSCRIPTION = 650, - SUBSTRING = 651, - SUMMARIZE = 652, - SYMMETRIC = 653, - SYSID = 654, - SYSTEM_P = 655, - TABLE = 656, - TABLES = 657, - TABLESAMPLE = 658, - TABLESPACE = 659, - TEMP = 660, - TEMPLATE = 661, - TEMPORARY = 662, - TEXT_P = 663, - THEN = 664, - TIME = 665, - TIMESTAMP = 666, - TO = 667, - TRAILING = 668, - TRANSACTION = 669, - TRANSFORM = 670, - TREAT = 671, - TRIGGER = 672, - TRIM = 673, - TRUE_P = 674, - TRUNCATE = 675, - TRUSTED = 676, - TRY_CAST = 677, - TYPE_P = 678, - TYPES_P = 679, - UNBOUNDED = 680, - UNCOMMITTED = 681, - UNENCRYPTED = 682, - UNION = 683, - UNIQUE = 684, - UNKNOWN = 685, - UNLISTEN = 686, - UNLOGGED = 687, - UNTIL = 688, - UPDATE = 689, - USER = 690, - USING = 691, - VACUUM = 692, - VALID = 693, - VALIDATE = 694, - VALIDATOR = 695, - VALUE_P = 696, - VALUES = 697, - VARCHAR = 698, - VARIADIC = 699, - VARYING = 700, - VERBOSE = 701, - VERSION_P = 702, - VIEW = 703, - VIEWS = 704, - VOLATILE = 705, - WHEN = 706, - WHERE = 707, - WHITESPACE_P = 708, - WINDOW = 709, - WITH = 710, - WITHIN = 711, - WITHOUT = 712, - WORK = 713, - WRAPPER = 714, - WRITE_P = 715, - XML_P = 716, - XMLATTRIBUTES = 717, - XMLCONCAT = 718, - XMLELEMENT = 719, - XMLEXISTS = 720, - XMLFOREST = 721, - XMLNAMESPACES = 722, - XMLPARSE = 723, - XMLPI = 724, - XMLROOT = 725, - XMLSERIALIZE = 726, - XMLTABLE = 727, - YEAR_P = 728, - YEARS_P = 729, - YES_P = 730, - ZONE = 731, - NOT_LA = 732, - NULLS_LA = 733, - WITH_LA = 734, - POSTFIXOP = 735, - UMINUS = 736 + EXPORT_STATE = 408, + EXTENSION = 409, + EXTERNAL = 410, + EXTRACT = 411, + FALSE_P = 412, + FAMILY = 413, + FETCH = 414, + FILTER = 415, + FIRST_P = 416, + FLOAT_P = 417, + FOLLOWING = 418, + FOR = 419, + FORCE = 420, + FOREIGN = 421, + FORWARD = 422, + FREEZE = 423, + FROM = 424, + FULL = 425, + FUNCTION = 426, + FUNCTIONS = 427, + GENERATED = 428, + GLOB = 429, + GLOBAL = 430, + GRANT = 431, + GRANTED = 432, + GROUP_P = 433, + GROUPING = 434, + GROUPING_ID = 435, + HANDLER = 436, + HAVING = 437, + HEADER_P = 438, + HOLD = 439, + HOUR_P = 440, + HOURS_P = 441, + IDENTITY_P = 442, + IF_P = 443, + IGNORE_P = 444, + ILIKE = 445, + IMMEDIATE = 446, + IMMUTABLE = 447, + IMPLICIT_P = 448, + IMPORT_P = 449, + IN_P = 450, + INCLUDING = 451, + INCREMENT = 452, + INDEX = 453, + INDEXES = 454, + INHERIT = 455, + INHERITS = 456, + INITIALLY = 457, + INLINE_P = 458, + INNER_P = 459, + INOUT = 460, + INPUT_P = 461, + INSENSITIVE = 462, + INSERT = 463, + INSTALL = 464, + INSTEAD = 465, + INT_P = 466, + INTEGER = 467, + INTERSECT = 468, + INTERVAL = 469, + INTO = 470, + INVOKER = 471, + IS = 472, + ISNULL = 473, + ISOLATION = 474, + JOIN = 475, + JSON = 476, + KEY = 477, + LABEL = 478, + LANGUAGE = 479, + LARGE_P = 480, + LAST_P = 481, + LATERAL_P = 482, + LEADING = 483, + LEAKPROOF = 484, + LEFT = 485, + LEVEL = 486, + LIKE = 487, + LIMIT = 488, + LISTEN = 489, + LOAD = 490, + LOCAL = 491, + LOCALTIME = 492, + LOCALTIMESTAMP = 493, + LOCATION = 494, + LOCK_P = 495, + LOCKED = 496, + LOGGED = 497, + MACRO = 498, + MAP = 499, + MAPPING = 500, + MATCH = 501, + MATERIALIZED = 502, + MAXVALUE = 503, + METHOD = 504, + MICROSECOND_P = 505, + MICROSECONDS_P = 506, + MILLISECOND_P = 507, + MILLISECONDS_P = 508, + MINUTE_P = 509, + MINUTES_P = 510, + MINVALUE = 511, + MODE = 512, + MONTH_P = 513, + MONTHS_P = 514, + MOVE = 515, + NAME_P = 516, + NAMES = 517, + NATIONAL = 518, + NATURAL = 519, + NCHAR = 520, + NEW = 521, + NEXT = 522, + NO = 523, + NONE = 524, + NOT = 525, + NOTHING = 526, + NOTIFY = 527, + NOTNULL = 528, + NOWAIT = 529, + NULL_P = 530, + NULLIF = 531, + NULLS_P = 532, + NUMERIC = 533, + OBJECT_P = 534, + OF = 535, + OFF = 536, + OFFSET = 537, + OIDS = 538, + OLD = 539, + ON = 540, + ONLY = 541, + OPERATOR = 542, + OPTION = 543, + OPTIONS = 544, + OR = 545, + ORDER = 546, + ORDINALITY = 547, + OUT_P = 548, + OUTER_P = 549, + OVER = 550, + OVERLAPS = 551, + OVERLAY = 552, + OVERRIDING = 553, + OWNED = 554, + OWNER = 555, + PARALLEL = 556, + PARSER = 557, + PARTIAL = 558, + PARTITION = 559, + PASSING = 560, + PASSWORD = 561, + PERCENT = 562, + PLACING = 563, + PLANS = 564, + POLICY = 565, + POSITION = 566, + PRAGMA_P = 567, + PRECEDING = 568, + PRECISION = 569, + PREPARE = 570, + PREPARED = 571, + PRESERVE = 572, + PRIMARY = 573, + PRIOR = 574, + PRIVILEGES = 575, + PROCEDURAL = 576, + PROCEDURE = 577, + PROGRAM = 578, + PUBLICATION = 579, + QUALIFY = 580, + QUOTE = 581, + RANGE = 582, + READ_P = 583, + REAL = 584, + REASSIGN = 585, + RECHECK = 586, + RECURSIVE = 587, + REF = 588, + REFERENCES = 589, + REFERENCING = 590, + REFRESH = 591, + REINDEX = 592, + RELATIVE_P = 593, + RELEASE = 594, + RENAME = 595, + REPEATABLE = 596, + REPLACE = 597, + REPLICA = 598, + RESET = 599, + RESPECT_P = 600, + RESTART = 601, + RESTRICT = 602, + RETURNING = 603, + RETURNS = 604, + REVOKE = 605, + RIGHT = 606, + ROLE = 607, + ROLLBACK = 608, + ROLLUP = 609, + ROW = 610, + ROWS = 611, + RULE = 612, + SAMPLE = 613, + SAVEPOINT = 614, + SCHEMA = 615, + SCHEMAS = 616, + SCROLL = 617, + SEARCH = 618, + SECOND_P = 619, + SECONDS_P = 620, + SECURITY = 621, + SELECT = 622, + SEQUENCE = 623, + SEQUENCES = 624, + SERIALIZABLE = 625, + SERVER = 626, + SESSION = 627, + SESSION_USER = 628, + SET = 629, + SETOF = 630, + SETS = 631, + SHARE = 632, + SHOW = 633, + SIMILAR = 634, + SIMPLE = 635, + SKIP = 636, + SMALLINT = 637, + SNAPSHOT = 638, + SOME = 639, + SQL_P = 640, + STABLE = 641, + STANDALONE_P = 642, + START = 643, + STATEMENT = 644, + STATISTICS = 645, + STDIN = 646, + STDOUT = 647, + STORAGE = 648, + STRICT_P = 649, + STRIP_P = 650, + STRUCT = 651, + SUBSCRIPTION = 652, + SUBSTRING = 653, + SUMMARIZE = 654, + SYMMETRIC = 655, + SYSID = 656, + SYSTEM_P = 657, + TABLE = 658, + TABLES = 659, + TABLESAMPLE = 660, + TABLESPACE = 661, + TEMP = 662, + TEMPLATE = 663, + TEMPORARY = 664, + TEXT_P = 665, + THEN = 666, + TIME = 667, + TIMESTAMP = 668, + TO = 669, + TRAILING = 670, + TRANSACTION = 671, + TRANSFORM = 672, + TREAT = 673, + TRIGGER = 674, + TRIM = 675, + TRUE_P = 676, + TRUNCATE = 677, + TRUSTED = 678, + TRY_CAST = 679, + TYPE_P = 680, + TYPES_P = 681, + UNBOUNDED = 682, + UNCOMMITTED = 683, + UNENCRYPTED = 684, + UNION = 685, + UNIQUE = 686, + UNKNOWN = 687, + UNLISTEN = 688, + UNLOGGED = 689, + UNTIL = 690, + UPDATE = 691, + USER = 692, + USING = 693, + VACUUM = 694, + VALID = 695, + VALIDATE = 696, + VALIDATOR = 697, + VALUE_P = 698, + VALUES = 699, + VARCHAR = 700, + VARIADIC = 701, + VARYING = 702, + VERBOSE = 703, + VERSION_P = 704, + VIEW = 705, + VIEWS = 706, + VOLATILE = 707, + WHEN = 708, + WHERE = 709, + WHITESPACE_P = 710, + WINDOW = 711, + WITH = 712, + WITHIN = 713, + WITHOUT = 714, + WORK = 715, + WRAPPER = 716, + WRITE_P = 717, + XML_P = 718, + XMLATTRIBUTES = 719, + XMLCONCAT = 720, + XMLELEMENT = 721, + XMLEXISTS = 722, + XMLFOREST = 723, + XMLNAMESPACES = 724, + XMLPARSE = 725, + XMLPI = 726, + XMLROOT = 727, + XMLSERIALIZE = 728, + XMLTABLE = 729, + YEAR_P = 730, + YEARS_P = 731, + YES_P = 732, + ZONE = 733, + NOT_LA = 734, + NULLS_LA = 735, + WITH_LA = 736, + POSTFIXOP = 737, + UMINUS = 738 }; #endif /* Tokens. */ @@ -230881,335 +241837,337 @@ namespace duckdb_libpgquery { #define EXISTS 405 #define EXPLAIN 406 #define EXPORT_P 407 -#define EXTENSION 408 -#define EXTERNAL 409 -#define EXTRACT 410 -#define FALSE_P 411 -#define FAMILY 412 -#define FETCH 413 -#define FILTER 414 -#define FIRST_P 415 -#define FLOAT_P 416 -#define FOLLOWING 417 -#define FOR 418 -#define FORCE 419 -#define FOREIGN 420 -#define FORWARD 421 -#define FREEZE 422 -#define FROM 423 -#define FULL 424 -#define FUNCTION 425 -#define FUNCTIONS 426 -#define GENERATED 427 -#define GLOB 428 -#define GLOBAL 429 -#define GRANT 430 -#define GRANTED 431 -#define GROUP_P 432 -#define GROUPING 433 -#define GROUPING_ID 434 -#define HANDLER 435 -#define HAVING 436 -#define HEADER_P 437 -#define HOLD 438 -#define HOUR_P 439 -#define HOURS_P 440 -#define IDENTITY_P 441 -#define IF_P 442 -#define IGNORE_P 443 -#define ILIKE 444 -#define IMMEDIATE 445 -#define IMMUTABLE 446 -#define IMPLICIT_P 447 -#define IMPORT_P 448 -#define IN_P 449 -#define INCLUDING 450 -#define INCREMENT 451 -#define INDEX 452 -#define INDEXES 453 -#define INHERIT 454 -#define INHERITS 455 -#define INITIALLY 456 -#define INLINE_P 457 -#define INNER_P 458 -#define INOUT 459 -#define INPUT_P 460 -#define INSENSITIVE 461 -#define INSERT 462 -#define INSTALL 463 -#define INSTEAD 464 -#define INT_P 465 -#define INTEGER 466 -#define INTERSECT 467 -#define INTERVAL 468 -#define INTO 469 -#define INVOKER 470 -#define IS 471 -#define ISNULL 472 -#define ISOLATION 473 -#define JOIN 474 -#define KEY 475 -#define LABEL 476 -#define LANGUAGE 477 -#define LARGE_P 478 -#define LAST_P 479 -#define LATERAL_P 480 -#define LEADING 481 -#define LEAKPROOF 482 -#define LEFT 483 -#define LEVEL 484 -#define LIKE 485 -#define LIMIT 486 -#define LISTEN 487 -#define LOAD 488 -#define LOCAL 489 -#define LOCALTIME 490 -#define LOCALTIMESTAMP 491 -#define LOCATION 492 -#define LOCK_P 493 -#define LOCKED 494 -#define LOGGED 495 -#define MACRO 496 -#define MAP 497 -#define MAPPING 498 -#define MATCH 499 -#define MATERIALIZED 500 -#define MAXVALUE 501 -#define METHOD 502 -#define MICROSECOND_P 503 -#define MICROSECONDS_P 504 -#define MILLISECOND_P 505 -#define MILLISECONDS_P 506 -#define MINUTE_P 507 -#define MINUTES_P 508 -#define MINVALUE 509 -#define MODE 510 -#define MONTH_P 511 -#define MONTHS_P 512 -#define MOVE 513 -#define NAME_P 514 -#define NAMES 515 -#define NATIONAL 516 -#define NATURAL 517 -#define NCHAR 518 -#define NEW 519 -#define NEXT 520 -#define NO 521 -#define NONE 522 -#define NOT 523 -#define NOTHING 524 -#define NOTIFY 525 -#define NOTNULL 526 -#define NOWAIT 527 -#define NULL_P 528 -#define NULLIF 529 -#define NULLS_P 530 -#define NUMERIC 531 -#define OBJECT_P 532 -#define OF 533 -#define OFF 534 -#define OFFSET 535 -#define OIDS 536 -#define OLD 537 -#define ON 538 -#define ONLY 539 -#define OPERATOR 540 -#define OPTION 541 -#define OPTIONS 542 -#define OR 543 -#define ORDER 544 -#define ORDINALITY 545 -#define OUT_P 546 -#define OUTER_P 547 -#define OVER 548 -#define OVERLAPS 549 -#define OVERLAY 550 -#define OVERRIDING 551 -#define OWNED 552 -#define OWNER 553 -#define PARALLEL 554 -#define PARSER 555 -#define PARTIAL 556 -#define PARTITION 557 -#define PASSING 558 -#define PASSWORD 559 -#define PERCENT 560 -#define PLACING 561 -#define PLANS 562 -#define POLICY 563 -#define POSITION 564 -#define PRAGMA_P 565 -#define PRECEDING 566 -#define PRECISION 567 -#define PREPARE 568 -#define PREPARED 569 -#define PRESERVE 570 -#define PRIMARY 571 -#define PRIOR 572 -#define PRIVILEGES 573 -#define PROCEDURAL 574 -#define PROCEDURE 575 -#define PROGRAM 576 -#define PUBLICATION 577 -#define QUALIFY 578 -#define QUOTE 579 -#define RANGE 580 -#define READ_P 581 -#define REAL 582 -#define REASSIGN 583 -#define RECHECK 584 -#define RECURSIVE 585 -#define REF 586 -#define REFERENCES 587 -#define REFERENCING 588 -#define REFRESH 589 -#define REINDEX 590 -#define RELATIVE_P 591 -#define RELEASE 592 -#define RENAME 593 -#define REPEATABLE 594 -#define REPLACE 595 -#define REPLICA 596 -#define RESET 597 -#define RESPECT_P 598 -#define RESTART 599 -#define RESTRICT 600 -#define RETURNING 601 -#define RETURNS 602 -#define REVOKE 603 -#define RIGHT 604 -#define ROLE 605 -#define ROLLBACK 606 -#define ROLLUP 607 -#define ROW 608 -#define ROWS 609 -#define RULE 610 -#define SAMPLE 611 -#define SAVEPOINT 612 -#define SCHEMA 613 -#define SCHEMAS 614 -#define SCROLL 615 -#define SEARCH 616 -#define SECOND_P 617 -#define SECONDS_P 618 -#define SECURITY 619 -#define SELECT 620 -#define SEQUENCE 621 -#define SEQUENCES 622 -#define SERIALIZABLE 623 -#define SERVER 624 -#define SESSION 625 -#define SESSION_USER 626 -#define SET 627 -#define SETOF 628 -#define SETS 629 -#define SHARE 630 -#define SHOW 631 -#define SIMILAR 632 -#define SIMPLE 633 -#define SKIP 634 -#define SMALLINT 635 -#define SNAPSHOT 636 -#define SOME 637 -#define SQL_P 638 -#define STABLE 639 -#define STANDALONE_P 640 -#define START 641 -#define STATEMENT 642 -#define STATISTICS 643 -#define STDIN 644 -#define STDOUT 645 -#define STORAGE 646 -#define STRICT_P 647 -#define STRIP_P 648 -#define STRUCT 649 -#define SUBSCRIPTION 650 -#define SUBSTRING 651 -#define SUMMARIZE 652 -#define SYMMETRIC 653 -#define SYSID 654 -#define SYSTEM_P 655 -#define TABLE 656 -#define TABLES 657 -#define TABLESAMPLE 658 -#define TABLESPACE 659 -#define TEMP 660 -#define TEMPLATE 661 -#define TEMPORARY 662 -#define TEXT_P 663 -#define THEN 664 -#define TIME 665 -#define TIMESTAMP 666 -#define TO 667 -#define TRAILING 668 -#define TRANSACTION 669 -#define TRANSFORM 670 -#define TREAT 671 -#define TRIGGER 672 -#define TRIM 673 -#define TRUE_P 674 -#define TRUNCATE 675 -#define TRUSTED 676 -#define TRY_CAST 677 -#define TYPE_P 678 -#define TYPES_P 679 -#define UNBOUNDED 680 -#define UNCOMMITTED 681 -#define UNENCRYPTED 682 -#define UNION 683 -#define UNIQUE 684 -#define UNKNOWN 685 -#define UNLISTEN 686 -#define UNLOGGED 687 -#define UNTIL 688 -#define UPDATE 689 -#define USER 690 -#define USING 691 -#define VACUUM 692 -#define VALID 693 -#define VALIDATE 694 -#define VALIDATOR 695 -#define VALUE_P 696 -#define VALUES 697 -#define VARCHAR 698 -#define VARIADIC 699 -#define VARYING 700 -#define VERBOSE 701 -#define VERSION_P 702 -#define VIEW 703 -#define VIEWS 704 -#define VOLATILE 705 -#define WHEN 706 -#define WHERE 707 -#define WHITESPACE_P 708 -#define WINDOW 709 -#define WITH 710 -#define WITHIN 711 -#define WITHOUT 712 -#define WORK 713 -#define WRAPPER 714 -#define WRITE_P 715 -#define XML_P 716 -#define XMLATTRIBUTES 717 -#define XMLCONCAT 718 -#define XMLELEMENT 719 -#define XMLEXISTS 720 -#define XMLFOREST 721 -#define XMLNAMESPACES 722 -#define XMLPARSE 723 -#define XMLPI 724 -#define XMLROOT 725 -#define XMLSERIALIZE 726 -#define XMLTABLE 727 -#define YEAR_P 728 -#define YEARS_P 729 -#define YES_P 730 -#define ZONE 731 -#define NOT_LA 732 -#define NULLS_LA 733 -#define WITH_LA 734 -#define POSTFIXOP 735 -#define UMINUS 736 +#define EXPORT_STATE 408 +#define EXTENSION 409 +#define EXTERNAL 410 +#define EXTRACT 411 +#define FALSE_P 412 +#define FAMILY 413 +#define FETCH 414 +#define FILTER 415 +#define FIRST_P 416 +#define FLOAT_P 417 +#define FOLLOWING 418 +#define FOR 419 +#define FORCE 420 +#define FOREIGN 421 +#define FORWARD 422 +#define FREEZE 423 +#define FROM 424 +#define FULL 425 +#define FUNCTION 426 +#define FUNCTIONS 427 +#define GENERATED 428 +#define GLOB 429 +#define GLOBAL 430 +#define GRANT 431 +#define GRANTED 432 +#define GROUP_P 433 +#define GROUPING 434 +#define GROUPING_ID 435 +#define HANDLER 436 +#define HAVING 437 +#define HEADER_P 438 +#define HOLD 439 +#define HOUR_P 440 +#define HOURS_P 441 +#define IDENTITY_P 442 +#define IF_P 443 +#define IGNORE_P 444 +#define ILIKE 445 +#define IMMEDIATE 446 +#define IMMUTABLE 447 +#define IMPLICIT_P 448 +#define IMPORT_P 449 +#define IN_P 450 +#define INCLUDING 451 +#define INCREMENT 452 +#define INDEX 453 +#define INDEXES 454 +#define INHERIT 455 +#define INHERITS 456 +#define INITIALLY 457 +#define INLINE_P 458 +#define INNER_P 459 +#define INOUT 460 +#define INPUT_P 461 +#define INSENSITIVE 462 +#define INSERT 463 +#define INSTALL 464 +#define INSTEAD 465 +#define INT_P 466 +#define INTEGER 467 +#define INTERSECT 468 +#define INTERVAL 469 +#define INTO 470 +#define INVOKER 471 +#define IS 472 +#define ISNULL 473 +#define ISOLATION 474 +#define JOIN 475 +#define JSON 476 +#define KEY 477 +#define LABEL 478 +#define LANGUAGE 479 +#define LARGE_P 480 +#define LAST_P 481 +#define LATERAL_P 482 +#define LEADING 483 +#define LEAKPROOF 484 +#define LEFT 485 +#define LEVEL 486 +#define LIKE 487 +#define LIMIT 488 +#define LISTEN 489 +#define LOAD 490 +#define LOCAL 491 +#define LOCALTIME 492 +#define LOCALTIMESTAMP 493 +#define LOCATION 494 +#define LOCK_P 495 +#define LOCKED 496 +#define LOGGED 497 +#define MACRO 498 +#define MAP 499 +#define MAPPING 500 +#define MATCH 501 +#define MATERIALIZED 502 +#define MAXVALUE 503 +#define METHOD 504 +#define MICROSECOND_P 505 +#define MICROSECONDS_P 506 +#define MILLISECOND_P 507 +#define MILLISECONDS_P 508 +#define MINUTE_P 509 +#define MINUTES_P 510 +#define MINVALUE 511 +#define MODE 512 +#define MONTH_P 513 +#define MONTHS_P 514 +#define MOVE 515 +#define NAME_P 516 +#define NAMES 517 +#define NATIONAL 518 +#define NATURAL 519 +#define NCHAR 520 +#define NEW 521 +#define NEXT 522 +#define NO 523 +#define NONE 524 +#define NOT 525 +#define NOTHING 526 +#define NOTIFY 527 +#define NOTNULL 528 +#define NOWAIT 529 +#define NULL_P 530 +#define NULLIF 531 +#define NULLS_P 532 +#define NUMERIC 533 +#define OBJECT_P 534 +#define OF 535 +#define OFF 536 +#define OFFSET 537 +#define OIDS 538 +#define OLD 539 +#define ON 540 +#define ONLY 541 +#define OPERATOR 542 +#define OPTION 543 +#define OPTIONS 544 +#define OR 545 +#define ORDER 546 +#define ORDINALITY 547 +#define OUT_P 548 +#define OUTER_P 549 +#define OVER 550 +#define OVERLAPS 551 +#define OVERLAY 552 +#define OVERRIDING 553 +#define OWNED 554 +#define OWNER 555 +#define PARALLEL 556 +#define PARSER 557 +#define PARTIAL 558 +#define PARTITION 559 +#define PASSING 560 +#define PASSWORD 561 +#define PERCENT 562 +#define PLACING 563 +#define PLANS 564 +#define POLICY 565 +#define POSITION 566 +#define PRAGMA_P 567 +#define PRECEDING 568 +#define PRECISION 569 +#define PREPARE 570 +#define PREPARED 571 +#define PRESERVE 572 +#define PRIMARY 573 +#define PRIOR 574 +#define PRIVILEGES 575 +#define PROCEDURAL 576 +#define PROCEDURE 577 +#define PROGRAM 578 +#define PUBLICATION 579 +#define QUALIFY 580 +#define QUOTE 581 +#define RANGE 582 +#define READ_P 583 +#define REAL 584 +#define REASSIGN 585 +#define RECHECK 586 +#define RECURSIVE 587 +#define REF 588 +#define REFERENCES 589 +#define REFERENCING 590 +#define REFRESH 591 +#define REINDEX 592 +#define RELATIVE_P 593 +#define RELEASE 594 +#define RENAME 595 +#define REPEATABLE 596 +#define REPLACE 597 +#define REPLICA 598 +#define RESET 599 +#define RESPECT_P 600 +#define RESTART 601 +#define RESTRICT 602 +#define RETURNING 603 +#define RETURNS 604 +#define REVOKE 605 +#define RIGHT 606 +#define ROLE 607 +#define ROLLBACK 608 +#define ROLLUP 609 +#define ROW 610 +#define ROWS 611 +#define RULE 612 +#define SAMPLE 613 +#define SAVEPOINT 614 +#define SCHEMA 615 +#define SCHEMAS 616 +#define SCROLL 617 +#define SEARCH 618 +#define SECOND_P 619 +#define SECONDS_P 620 +#define SECURITY 621 +#define SELECT 622 +#define SEQUENCE 623 +#define SEQUENCES 624 +#define SERIALIZABLE 625 +#define SERVER 626 +#define SESSION 627 +#define SESSION_USER 628 +#define SET 629 +#define SETOF 630 +#define SETS 631 +#define SHARE 632 +#define SHOW 633 +#define SIMILAR 634 +#define SIMPLE 635 +#define SKIP 636 +#define SMALLINT 637 +#define SNAPSHOT 638 +#define SOME 639 +#define SQL_P 640 +#define STABLE 641 +#define STANDALONE_P 642 +#define START 643 +#define STATEMENT 644 +#define STATISTICS 645 +#define STDIN 646 +#define STDOUT 647 +#define STORAGE 648 +#define STRICT_P 649 +#define STRIP_P 650 +#define STRUCT 651 +#define SUBSCRIPTION 652 +#define SUBSTRING 653 +#define SUMMARIZE 654 +#define SYMMETRIC 655 +#define SYSID 656 +#define SYSTEM_P 657 +#define TABLE 658 +#define TABLES 659 +#define TABLESAMPLE 660 +#define TABLESPACE 661 +#define TEMP 662 +#define TEMPLATE 663 +#define TEMPORARY 664 +#define TEXT_P 665 +#define THEN 666 +#define TIME 667 +#define TIMESTAMP 668 +#define TO 669 +#define TRAILING 670 +#define TRANSACTION 671 +#define TRANSFORM 672 +#define TREAT 673 +#define TRIGGER 674 +#define TRIM 675 +#define TRUE_P 676 +#define TRUNCATE 677 +#define TRUSTED 678 +#define TRY_CAST 679 +#define TYPE_P 680 +#define TYPES_P 681 +#define UNBOUNDED 682 +#define UNCOMMITTED 683 +#define UNENCRYPTED 684 +#define UNION 685 +#define UNIQUE 686 +#define UNKNOWN 687 +#define UNLISTEN 688 +#define UNLOGGED 689 +#define UNTIL 690 +#define UPDATE 691 +#define USER 692 +#define USING 693 +#define VACUUM 694 +#define VALID 695 +#define VALIDATE 696 +#define VALIDATOR 697 +#define VALUE_P 698 +#define VALUES 699 +#define VARCHAR 700 +#define VARIADIC 701 +#define VARYING 702 +#define VERBOSE 703 +#define VERSION_P 704 +#define VIEW 705 +#define VIEWS 706 +#define VOLATILE 707 +#define WHEN 708 +#define WHERE 709 +#define WHITESPACE_P 710 +#define WINDOW 711 +#define WITH 712 +#define WITHIN 713 +#define WITHOUT 714 +#define WORK 715 +#define WRAPPER 716 +#define WRITE_P 717 +#define XML_P 718 +#define XMLATTRIBUTES 719 +#define XMLCONCAT 720 +#define XMLELEMENT 721 +#define XMLEXISTS 722 +#define XMLFOREST 723 +#define XMLNAMESPACES 724 +#define XMLPARSE 725 +#define XMLPI 726 +#define XMLROOT 727 +#define XMLSERIALIZE 728 +#define XMLTABLE 729 +#define YEAR_P 730 +#define YEARS_P 731 +#define YES_P 732 +#define ZONE 733 +#define NOT_LA 734 +#define NULLS_LA 735 +#define WITH_LA 736 +#define POSTFIXOP 737 +#define UMINUS 738 @@ -231260,8 +242218,8 @@ typedef union YYSTYPE PGSubLinkType subquerytype; PGViewCheckOption viewcheckoption; } -/* Line 1529 of yacc.c. */ -#line 1055 "third_party/libpg_query/grammar/grammar_out.hpp" +/* Line 1489 of yacc.c. */ +#line 1059 "third_party/libpg_query/grammar/grammar_out.hpp" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -231338,7 +242296,7 @@ int base_yyparse(core_yyscan_t yyscanner); // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -231362,7 +242320,7 @@ int base_yyparse(core_yyscan_t yyscanner); // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -231382,7 +242340,7 @@ int base_yyparse(core_yyscan_t yyscanner); // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -231443,7 +242401,7 @@ typedef struct { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -231769,8 +242727,8 @@ typedef union YYSTYPE PGSubLinkType subquerytype; PGViewCheckOption viewcheckoption; } -/* Line 193 of yacc.c. */ -#line 1276 "third_party/libpg_query/grammar/grammar_out.cpp" +/* Line 187 of yacc.c. */ +#line 1280 "third_party/libpg_query/grammar/grammar_out.cpp" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -231795,7 +242753,7 @@ typedef struct YYLTYPE /* Line 216 of yacc.c. */ -#line 1301 "third_party/libpg_query/grammar/grammar_out.cpp" +#line 1305 "third_party/libpg_query/grammar/grammar_out.cpp" #ifdef short # undef short @@ -231845,7 +242803,7 @@ typedef short int yytype_int16; #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS +# if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) @@ -232012,20 +242970,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 596 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 54005 +#define YYLAST 54723 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 503 +#define YYNTOKENS 505 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 384 +#define YYNNTS 395 /* YYNRULES -- Number of rules. */ -#define YYNRULES 1808 +#define YYNRULES 1836 /* YYNRULES -- Number of states. */ -#define YYNSTATES 2991 +#define YYNSTATES 3023 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 736 +#define YYMAXUTOK 738 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -232036,16 +242994,16 @@ static const yytype_uint16 yytranslate[] = 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 500, 2, 488, 2, 2, - 493, 494, 486, 484, 497, 485, 495, 487, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 502, 496, - 480, 482, 481, 501, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 502, 2, 490, 2, 2, + 495, 496, 488, 486, 499, 487, 497, 489, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 504, 498, + 482, 484, 483, 503, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 491, 2, 492, 489, 2, 2, 2, 2, 2, + 2, 493, 2, 494, 491, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 498, 2, 499, 2, 2, 2, 2, + 2, 2, 2, 500, 2, 501, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -232106,7 +243064,7 @@ static const yytype_uint16 yytranslate[] = 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, 478, 479, 483, 490 + 475, 476, 477, 478, 479, 480, 481, 485, 492 }; #if YYDEBUG @@ -232118,772 +243076,746 @@ static const yytype_uint16 yyprhs[] = 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 65, 67, 69, 71, 73, 75, 77, 79, - 80, 85, 92, 97, 104, 109, 116, 121, 128, 130, - 133, 137, 140, 142, 146, 149, 153, 155, 159, 162, - 168, 172, 179, 184, 191, 198, 205, 211, 217, 224, - 234, 239, 245, 253, 260, 265, 274, 279, 282, 287, - 291, 298, 303, 306, 309, 312, 315, 317, 320, 321, - 323, 326, 329, 332, 334, 338, 343, 346, 348, 349, - 352, 356, 359, 363, 372, 374, 375, 377, 381, 388, - 395, 404, 411, 420, 427, 436, 443, 452, 461, 472, - 481, 492, 494, 495, 503, 505, 510, 515, 523, 526, - 528, 532, 537, 541, 542, 544, 545, 548, 552, 558, - 567, 573, 574, 580, 586, 594, 597, 598, 600, 602, - 604, 608, 611, 612, 614, 615, 617, 621, 623, 627, - 629, 633, 636, 639, 644, 650, 656, 665, 667, 668, - 672, 682, 695, 699, 700, 705, 712, 714, 717, 719, - 721, 722, 724, 727, 730, 732, 735, 738, 740, 743, - 747, 750, 753, 756, 759, 763, 767, 771, 773, 777, - 779, 780, 782, 785, 788, 791, 794, 797, 800, 803, - 806, 808, 810, 811, 821, 834, 846, 847, 850, 852, - 854, 856, 858, 860, 862, 866, 867, 869, 872, 874, - 876, 879, 882, 886, 888, 890, 893, 896, 898, 901, - 905, 911, 915, 918, 924, 930, 933, 937, 939, 941, - 944, 947, 948, 953, 954, 958, 963, 968, 969, 973, - 976, 977, 981, 983, 985, 987, 989, 991, 993, 995, - 997, 999, 1001, 1005, 1009, 1011, 1014, 1017, 1020, 1023, - 1026, 1029, 1030, 1034, 1038, 1042, 1043, 1045, 1048, 1050, - 1053, 1056, 1059, 1062, 1067, 1069, 1073, 1075, 1079, 1081, - 1083, 1085, 1087, 1091, 1093, 1096, 1097, 1099, 1100, 1102, - 1106, 1107, 1110, 1111, 1115, 1119, 1121, 1127, 1131, 1133, - 1137, 1139, 1144, 1150, 1156, 1163, 1167, 1175, 1180, 1192, - 1194, 1198, 1201, 1204, 1207, 1208, 1212, 1214, 1216, 1219, - 1222, 1225, 1228, 1230, 1231, 1233, 1236, 1243, 1248, 1255, - 1260, 1267, 1276, 1281, 1288, 1290, 1292, 1294, 1296, 1298, - 1301, 1303, 1306, 1308, 1310, 1312, 1316, 1320, 1324, 1328, - 1331, 1334, 1336, 1340, 1342, 1344, 1346, 1348, 1352, 1354, - 1356, 1357, 1359, 1361, 1363, 1365, 1369, 1376, 1378, 1380, - 1383, 1387, 1396, 1408, 1418, 1420, 1422, 1426, 1427, 1429, - 1433, 1435, 1436, 1438, 1439, 1441, 1442, 1444, 1448, 1450, - 1452, 1454, 1458, 1459, 1462, 1465, 1466, 1469, 1470, 1472, - 1473, 1475, 1477, 1479, 1483, 1487, 1489, 1491, 1495, 1499, - 1503, 1507, 1512, 1516, 1519, 1521, 1523, 1525, 1527, 1529, - 1533, 1535, 1537, 1541, 1545, 1547, 1550, 1555, 1560, 1563, - 1567, 1573, 1579, 1581, 1583, 1595, 1607, 1609, 1612, 1617, - 1622, 1627, 1630, 1633, 1637, 1639, 1643, 1650, 1653, 1654, - 1658, 1662, 1667, 1672, 1677, 1682, 1686, 1689, 1691, 1693, - 1694, 1696, 1698, 1699, 1701, 1707, 1709, 1710, 1713, 1716, - 1717, 1719, 1720, 1724, 1730, 1736, 1738, 1742, 1747, 1751, - 1753, 1755, 1756, 1759, 1762, 1763, 1766, 1769, 1771, 1773, - 1775, 1776, 1779, 1784, 1790, 1795, 1798, 1802, 1805, 1808, - 1811, 1814, 1816, 1819, 1823, 1824, 1826, 1827, 1833, 1835, - 1840, 1847, 1850, 1852, 1853, 1858, 1859, 1861, 1863, 1866, - 1869, 1872, 1874, 1876, 1879, 1882, 1884, 1886, 1888, 1890, - 1892, 1894, 1898, 1902, 1906, 1907, 1909, 1913, 1915, 1917, - 1919, 1921, 1923, 1926, 1931, 1936, 1942, 1944, 1946, 1949, - 1950, 1953, 1954, 1956, 1960, 1962, 1963, 1965, 1968, 1972, - 1975, 1980, 1983, 1987, 1990, 1991, 1993, 1996, 1997, 2002, - 2008, 2011, 2012, 2014, 2018, 2022, 2026, 2030, 2034, 2038, - 2040, 2045, 2049, 2054, 2060, 2065, 2071, 2076, 2082, 2085, - 2090, 2092, 2094, 2095, 2097, 2102, 2108, 2113, 2114, 2117, - 2120, 2123, 2125, 2127, 2128, 2133, 2136, 2138, 2141, 2144, - 2149, 2152, 2159, 2162, 2164, 2168, 2173, 2174, 2177, 2178, - 2181, 2182, 2184, 2188, 2192, 2195, 2196, 2199, 2204, 2206, - 2208, 2211, 2215, 2221, 2228, 2231, 2235, 2241, 2247, 2251, - 2256, 2257, 2259, 2261, 2263, 2265, 2267, 2270, 2275, 2277, - 2279, 2281, 2283, 2286, 2290, 2291, 2293, 2295, 2297, 2299, - 2301, 2304, 2307, 2310, 2313, 2316, 2318, 2322, 2323, 2325, - 2327, 2329, 2331, 2337, 2340, 2342, 2344, 2346, 2348, 2353, - 2355, 2358, 2361, 2363, 2367, 2371, 2374, 2376, 2377, 2383, - 2386, 2392, 2395, 2397, 2401, 2405, 2406, 2408, 2410, 2412, - 2414, 2416, 2418, 2420, 2422, 2424, 2426, 2428, 2430, 2432, - 2434, 2436, 2438, 2440, 2442, 2444, 2446, 2448, 2450, 2452, - 2454, 2458, 2462, 2466, 2470, 2474, 2478, 2482, 2483, 2485, - 2489, 2493, 2499, 2502, 2505, 2509, 2513, 2517, 2521, 2525, - 2529, 2533, 2537, 2541, 2545, 2549, 2553, 2557, 2560, 2563, - 2567, 2571, 2574, 2577, 2581, 2585, 2591, 2596, 2603, 2607, - 2613, 2618, 2625, 2630, 2637, 2643, 2651, 2655, 2658, 2663, - 2667, 2670, 2672, 2676, 2680, 2684, 2688, 2692, 2696, 2701, - 2705, 2710, 2714, 2719, 2725, 2732, 2739, 2747, 2754, 2762, - 2769, 2777, 2781, 2786, 2791, 2798, 2800, 2805, 2807, 2811, - 2814, 2817, 2821, 2825, 2829, 2833, 2837, 2841, 2845, 2849, - 2853, 2857, 2861, 2865, 2869, 2872, 2875, 2881, 2888, 2895, - 2903, 2905, 2907, 2910, 2913, 2916, 2921, 2923, 2926, 2928, - 2931, 2934, 2939, 2943, 2950, 2958, 2968, 2976, 2984, 2989, - 2994, 2996, 2998, 3000, 3006, 3008, 3010, 3015, 3017, 3022, - 3024, 3029, 3031, 3036, 3038, 3040, 3042, 3044, 3046, 3048, - 3055, 3062, 3067, 3072, 3077, 3082, 3089, 3095, 3101, 3107, - 3112, 3119, 3124, 3130, 3131, 3137, 3138, 3141, 3142, 3144, - 3148, 3152, 3155, 3158, 3159, 3166, 3168, 3169, 3173, 3174, - 3177, 3180, 3181, 3183, 3188, 3191, 3194, 3197, 3200, 3203, - 3208, 3212, 3214, 3220, 3224, 3226, 3230, 3232, 3234, 3236, - 3238, 3240, 3242, 3244, 3246, 3248, 3250, 3252, 3254, 3256, - 3258, 3260, 3262, 3264, 3266, 3271, 3273, 3278, 3280, 3285, - 3287, 3290, 3292, 3295, 3297, 3300, 3302, 3306, 3308, 3312, - 3314, 3315, 3317, 3321, 3323, 3327, 3331, 3333, 3337, 3341, - 3342, 3344, 3346, 3348, 3350, 3352, 3354, 3356, 3358, 3360, - 3362, 3367, 3371, 3374, 3378, 3379, 3383, 3387, 3390, 3393, - 3395, 3396, 3399, 3402, 3406, 3409, 3411, 3413, 3417, 3423, - 3425, 3428, 3433, 3436, 3437, 3439, 3440, 3442, 3445, 3448, - 3452, 3458, 3460, 3461, 3463, 3466, 3467, 3470, 3472, 3473, - 3475, 3476, 3478, 3482, 3486, 3489, 3491, 3495, 3501, 3506, - 3509, 3511, 3512, 3516, 3518, 3522, 3527, 3530, 3531, 3533, - 3537, 3539, 3542, 3544, 3548, 3550, 3552, 3554, 3557, 3559, - 3561, 3564, 3566, 3568, 3571, 3579, 3582, 3588, 3592, 3596, - 3598, 3600, 3602, 3604, 3606, 3608, 3610, 3612, 3614, 3616, - 3618, 3620, 3622, 3624, 3626, 3628, 3630, 3632, 3634, 3636, - 3639, 3642, 3646, 3650, 3651, 3653, 3655, 3657, 3659, 3661, - 3663, 3665, 3671, 3675, 3676, 3678, 3680, 3682, 3684, 3689, - 3697, 3700, 3701, 3703, 3705, 3707, 3709, 3723, 3740, 3742, - 3745, 3746, 3748, 3749, 3751, 3752, 3755, 3756, 3758, 3759, - 3766, 3775, 3782, 3791, 3798, 3807, 3810, 3812, 3817, 3821, - 3824, 3829, 3833, 3839, 3841, 3842, 3844, 3846, 3847, 3849, - 3851, 3853, 3855, 3857, 3859, 3861, 3863, 3865, 3867, 3869, - 3873, 3875, 3877, 3879, 3881, 3883, 3885, 3888, 3890, 3892, - 3895, 3899, 3903, 3907, 3909, 3913, 3917, 3920, 3924, 3928, - 3932, 3936, 3938, 3940, 3942, 3944, 3948, 3954, 3956, 3958, - 3960, 3962, 3966, 3969, 3972, 3976, 3978, 3980, 3985, 3991, - 3997, 4002, 4009, 4011, 4013, 4015, 4017, 4019, 4021, 4022, - 4024, 4028, 4030, 4031, 4039, 4041, 4044, 4048, 4051, 4052, - 4055, 4056, 4059, 4064, 4067, 4069, 4071, 4073, 4076, 4080, - 4083, 4086, 4089, 4092, 4096, 4101, 4104, 4106, 4108, 4110, - 4114, 4117, 4127, 4139, 4152, 4167, 4171, 4176, 4181, 4182, - 4190, 4201, 4204, 4208, 4209, 4214, 4216, 4218, 4220, 4222, - 4224, 4226, 4228, 4230, 4232, 4234, 4236, 4238, 4240, 4242, - 4244, 4246, 4248, 4250, 4252, 4254, 4256, 4258, 4260, 4262, - 4264, 4266, 4268, 4270, 4272, 4274, 4276, 4278, 4280, 4282, - 4284, 4286, 4288, 4290, 4292, 4294, 4296, 4298, 4300, 4302, - 4304, 4306, 4308, 4310, 4312, 4314, 4316, 4318, 4320, 4322, - 4324, 4326, 4328, 4330, 4332, 4334, 4336, 4338, 4340, 4342, - 4344, 4346, 4348, 4350, 4352, 4354, 4356, 4358, 4360, 4362, - 4364, 4366, 4368, 4370, 4372, 4374, 4376, 4378, 4380, 4382, - 4384, 4386, 4388, 4390, 4392, 4394, 4396, 4398, 4400, 4402, - 4404, 4406, 4408, 4410, 4412, 4414, 4416, 4418, 4420, 4422, - 4424, 4426, 4428, 4430, 4432, 4434, 4436, 4438, 4440, 4442, - 4444, 4446, 4448, 4450, 4452, 4454, 4456, 4458, 4460, 4462, - 4464, 4466, 4468, 4470, 4472, 4474, 4476, 4478, 4480, 4482, - 4484, 4486, 4488, 4490, 4492, 4494, 4496, 4498, 4500, 4502, - 4504, 4506, 4508, 4510, 4512, 4514, 4516, 4518, 4520, 4522, - 4524, 4526, 4528, 4530, 4532, 4534, 4536, 4538, 4540, 4542, - 4544, 4546, 4548, 4550, 4552, 4554, 4556, 4558, 4560, 4562, - 4564, 4566, 4568, 4570, 4572, 4574, 4576, 4578, 4580, 4582, - 4584, 4586, 4588, 4590, 4592, 4594, 4596, 4598, 4600, 4602, - 4604, 4606, 4608, 4610, 4612, 4614, 4616, 4618, 4620, 4622, - 4624, 4626, 4628, 4630, 4632, 4634, 4636, 4638, 4640, 4642, - 4644, 4646, 4648, 4650, 4652, 4654, 4656, 4658, 4660, 4662, - 4664, 4666, 4668, 4670, 4672, 4674, 4676, 4678, 4680, 4682, - 4684, 4686, 4688, 4690, 4692, 4694, 4696, 4698, 4700, 4702, - 4704, 4706, 4708, 4710, 4712, 4714, 4716, 4718, 4720, 4722, - 4724, 4726, 4728, 4730, 4732, 4734, 4736, 4738, 4740, 4742, - 4744, 4746, 4748, 4750, 4752, 4754, 4756, 4758, 4760, 4762, - 4764, 4766, 4768, 4770, 4772, 4774, 4776, 4778, 4780, 4782, - 4784, 4786, 4788, 4790, 4792, 4794, 4796, 4798, 4800, 4802, - 4804, 4806, 4808, 4810, 4812, 4814, 4816, 4818, 4820, 4822, - 4824, 4826, 4828, 4830, 4832, 4834, 4836, 4838, 4840, 4842, - 4844, 4846, 4848, 4850, 4852, 4854, 4856, 4858, 4860, 4862, - 4864, 4866, 4868, 4870, 4872, 4874, 4876, 4878, 4880, 4882, - 4884, 4886, 4888, 4890, 4892, 4894, 4896, 4898, 4900, 4902, - 4904, 4906, 4908, 4910, 4912, 4914, 4916, 4918, 4920, 4922, - 4924, 4926, 4928, 4930, 4932, 4934, 4936, 4938, 4940, 4942, - 4944, 4946, 4948, 4950, 4952, 4954, 4956, 4958, 4960, 4962, - 4964, 4966, 4968, 4970, 4972, 4974, 4976, 4978, 4980, 4982, - 4984, 4986, 4988, 4990, 4992, 4994, 4996, 4998, 5000, 5002, - 5004, 5006, 5008, 5010, 5012, 5014, 5016, 5018, 5020, 5022, - 5024, 5026, 5028, 5030, 5032, 5034, 5036, 5038, 5040, 5042, - 5044, 5046, 5048, 5050, 5052, 5054, 5056, 5058, 5060, 5062, - 5064, 5066, 5068, 5070, 5072, 5074, 5076, 5078, 5080, 5082, - 5084, 5086, 5088, 5090, 5092, 5094, 5096, 5098, 5100, 5102, - 5104, 5106, 5108, 5110, 5112, 5114, 5116, 5118, 5120, 5122, - 5124, 5126, 5128, 5130, 5132, 5134, 5136, 5138, 5140, 5142, - 5144, 5146, 5148, 5150, 5152, 5154, 5156, 5158, 5160, 5162, - 5164, 5166, 5168, 5170, 5172, 5174, 5176, 5178, 5180, 5182, - 5184, 5186, 5188, 5190, 5192, 5194, 5196, 5198, 5200, 5202, - 5204, 5206, 5208, 5210, 5212, 5214, 5216, 5218, 5220, 5222, - 5224, 5226, 5228, 5230, 5232, 5234, 5236, 5238, 5240, 5242, - 5244, 5246, 5248, 5250, 5252, 5254, 5256, 5258, 5260, 5262, - 5264, 5266, 5268, 5270, 5272, 5274, 5276, 5278, 5280, 5282, - 5284, 5286, 5288, 5290, 5292, 5294, 5296, 5298, 5300, 5302, - 5304, 5306, 5308, 5310, 5312, 5314, 5316, 5318, 5320, 5322, - 5324, 5326, 5328, 5330, 5332, 5334, 5336, 5338, 5340 + 80, 88, 90, 93, 97, 100, 101, 104, 105, 113, + 124, 134, 137, 141, 142, 147, 157, 169, 182, 197, + 201, 206, 211, 212, 218, 222, 223, 225, 227, 229, + 231, 233, 235, 239, 243, 245, 248, 253, 258, 261, + 265, 271, 277, 279, 281, 293, 305, 307, 310, 315, + 320, 325, 328, 331, 335, 337, 341, 348, 351, 352, + 356, 360, 365, 370, 375, 380, 384, 387, 389, 391, + 392, 394, 396, 397, 399, 405, 407, 408, 411, 414, + 415, 417, 418, 422, 428, 434, 436, 440, 445, 449, + 451, 453, 454, 457, 460, 461, 464, 467, 469, 471, + 473, 474, 477, 482, 488, 493, 496, 500, 503, 506, + 509, 512, 514, 517, 521, 522, 524, 525, 531, 533, + 538, 545, 548, 550, 551, 556, 557, 559, 561, 564, + 567, 570, 572, 574, 577, 580, 582, 584, 586, 588, + 590, 592, 596, 600, 604, 605, 607, 611, 613, 616, + 618, 620, 622, 624, 626, 629, 634, 639, 645, 647, + 649, 652, 653, 656, 657, 659, 663, 665, 666, 668, + 671, 675, 678, 683, 686, 690, 693, 694, 696, 699, + 700, 705, 711, 713, 716, 719, 720, 722, 726, 728, + 731, 735, 739, 743, 747, 751, 753, 758, 762, 767, + 773, 778, 784, 789, 795, 798, 803, 805, 807, 808, + 810, 815, 821, 826, 827, 830, 833, 836, 838, 840, + 841, 846, 849, 851, 854, 857, 862, 865, 872, 875, + 877, 881, 886, 887, 890, 891, 894, 895, 897, 901, + 905, 908, 909, 912, 917, 919, 921, 924, 928, 934, + 941, 944, 948, 954, 960, 964, 969, 970, 972, 974, + 976, 978, 980, 983, 988, 990, 992, 994, 996, 999, + 1003, 1004, 1006, 1008, 1010, 1012, 1014, 1017, 1020, 1023, + 1026, 1029, 1031, 1035, 1036, 1038, 1040, 1042, 1044, 1050, + 1053, 1055, 1057, 1059, 1061, 1066, 1068, 1071, 1074, 1076, + 1080, 1084, 1087, 1089, 1090, 1096, 1099, 1105, 1108, 1110, + 1114, 1118, 1119, 1121, 1123, 1125, 1127, 1129, 1131, 1133, + 1135, 1137, 1139, 1141, 1143, 1145, 1147, 1149, 1151, 1153, + 1155, 1157, 1159, 1161, 1163, 1165, 1167, 1171, 1175, 1179, + 1183, 1187, 1191, 1195, 1196, 1198, 1202, 1206, 1212, 1215, + 1218, 1222, 1226, 1230, 1234, 1238, 1242, 1246, 1250, 1254, + 1258, 1262, 1266, 1270, 1273, 1276, 1280, 1284, 1287, 1290, + 1294, 1298, 1304, 1309, 1316, 1320, 1326, 1331, 1338, 1343, + 1350, 1356, 1364, 1368, 1371, 1376, 1380, 1383, 1385, 1389, + 1393, 1397, 1401, 1405, 1410, 1414, 1419, 1423, 1428, 1434, + 1441, 1448, 1456, 1463, 1471, 1478, 1486, 1490, 1495, 1500, + 1507, 1509, 1514, 1516, 1520, 1523, 1526, 1530, 1534, 1538, + 1542, 1546, 1550, 1554, 1558, 1562, 1566, 1570, 1574, 1578, + 1581, 1584, 1590, 1597, 1604, 1612, 1614, 1616, 1619, 1622, + 1625, 1630, 1632, 1635, 1637, 1640, 1643, 1648, 1652, 1659, + 1667, 1677, 1685, 1693, 1698, 1704, 1706, 1708, 1710, 1716, + 1718, 1720, 1725, 1727, 1732, 1734, 1739, 1741, 1746, 1748, + 1750, 1752, 1754, 1756, 1758, 1765, 1772, 1777, 1782, 1787, + 1792, 1799, 1805, 1811, 1817, 1822, 1829, 1834, 1840, 1841, + 1847, 1848, 1850, 1851, 1854, 1855, 1857, 1861, 1865, 1868, + 1871, 1872, 1879, 1881, 1882, 1886, 1887, 1890, 1893, 1894, + 1896, 1901, 1904, 1907, 1910, 1913, 1916, 1921, 1925, 1927, + 1933, 1937, 1939, 1943, 1945, 1948, 1950, 1952, 1954, 1956, + 1958, 1960, 1962, 1964, 1966, 1968, 1970, 1972, 1974, 1976, + 1978, 1980, 1982, 1984, 1989, 1991, 1996, 1998, 2003, 2005, + 2008, 2010, 2013, 2015, 2018, 2020, 2024, 2026, 2030, 2032, + 2035, 2037, 2038, 2040, 2044, 2046, 2050, 2054, 2056, 2060, + 2064, 2065, 2067, 2069, 2071, 2073, 2075, 2077, 2079, 2081, + 2083, 2085, 2090, 2094, 2097, 2101, 2102, 2106, 2110, 2113, + 2116, 2118, 2119, 2122, 2125, 2129, 2132, 2134, 2136, 2140, + 2146, 2148, 2151, 2156, 2159, 2160, 2162, 2163, 2165, 2168, + 2171, 2175, 2181, 2183, 2184, 2186, 2189, 2190, 2193, 2195, + 2196, 2198, 2199, 2201, 2205, 2207, 2210, 2214, 2217, 2219, + 2223, 2229, 2234, 2237, 2239, 2240, 2244, 2246, 2250, 2252, + 2255, 2260, 2263, 2264, 2266, 2270, 2272, 2275, 2277, 2281, + 2283, 2286, 2288, 2290, 2292, 2295, 2297, 2299, 2302, 2304, + 2306, 2309, 2317, 2320, 2326, 2330, 2334, 2336, 2338, 2340, + 2342, 2344, 2346, 2348, 2350, 2352, 2354, 2356, 2358, 2360, + 2362, 2364, 2366, 2368, 2370, 2372, 2374, 2377, 2380, 2384, + 2388, 2389, 2391, 2393, 2395, 2397, 2399, 2401, 2403, 2408, + 2414, 2420, 2425, 2432, 2434, 2436, 2438, 2440, 2442, 2444, + 2445, 2447, 2451, 2453, 2454, 2457, 2460, 2463, 2466, 2469, + 2472, 2474, 2476, 2477, 2480, 2482, 2484, 2486, 2489, 2493, + 2502, 2505, 2509, 2512, 2516, 2519, 2524, 2530, 2539, 2547, + 2549, 2551, 2554, 2558, 2563, 2570, 2575, 2582, 2587, 2594, + 2599, 2606, 2608, 2611, 2615, 2618, 2620, 2624, 2627, 2631, + 2633, 2637, 2640, 2646, 2650, 2657, 2662, 2669, 2676, 2683, + 2689, 2695, 2702, 2712, 2717, 2723, 2731, 2738, 2743, 2752, + 2757, 2760, 2765, 2769, 2776, 2781, 2784, 2787, 2790, 2793, + 2795, 2798, 2799, 2801, 2804, 2807, 2810, 2812, 2816, 2821, + 2824, 2826, 2827, 2832, 2840, 2843, 2844, 2846, 2848, 2850, + 2852, 2855, 2858, 2861, 2864, 2868, 2873, 2876, 2878, 2880, + 2882, 2884, 2888, 2898, 2911, 2923, 2924, 2927, 2929, 2931, + 2933, 2935, 2937, 2939, 2943, 2944, 2946, 2949, 2951, 2953, + 2956, 2959, 2963, 2965, 2967, 2970, 2973, 2975, 2978, 2982, + 2988, 2992, 2995, 3001, 3007, 3010, 3014, 3016, 3018, 3021, + 3024, 3025, 3030, 3031, 3035, 3040, 3045, 3046, 3050, 3053, + 3054, 3058, 3060, 3062, 3064, 3066, 3068, 3070, 3072, 3074, + 3076, 3078, 3082, 3086, 3088, 3091, 3094, 3097, 3100, 3103, + 3106, 3107, 3111, 3115, 3119, 3120, 3122, 3125, 3127, 3130, + 3133, 3136, 3139, 3144, 3146, 3150, 3152, 3156, 3158, 3160, + 3162, 3164, 3168, 3170, 3173, 3174, 3176, 3179, 3180, 3182, + 3186, 3187, 3190, 3191, 3195, 3199, 3201, 3207, 3211, 3213, + 3217, 3219, 3222, 3224, 3229, 3235, 3241, 3248, 3252, 3260, + 3265, 3277, 3279, 3283, 3286, 3289, 3292, 3293, 3297, 3299, + 3301, 3304, 3307, 3310, 3313, 3315, 3316, 3318, 3321, 3328, + 3335, 3344, 3351, 3360, 3367, 3376, 3383, 3392, 3401, 3412, + 3421, 3432, 3434, 3435, 3442, 3447, 3454, 3459, 3466, 3475, + 3480, 3487, 3489, 3491, 3493, 3495, 3498, 3500, 3503, 3505, + 3508, 3510, 3512, 3514, 3518, 3522, 3526, 3530, 3533, 3536, + 3538, 3542, 3544, 3546, 3548, 3550, 3554, 3556, 3558, 3559, + 3561, 3563, 3565, 3567, 3571, 3574, 3577, 3581, 3583, 3585, + 3593, 3595, 3600, 3605, 3613, 3616, 3618, 3622, 3627, 3631, + 3632, 3634, 3635, 3638, 3642, 3648, 3657, 3663, 3664, 3670, + 3676, 3684, 3687, 3688, 3690, 3692, 3694, 3698, 3701, 3702, + 3704, 3705, 3707, 3711, 3713, 3717, 3719, 3722, 3724, 3728, + 3731, 3735, 3745, 3758, 3762, 3763, 3766, 3771, 3776, 3780, + 3783, 3788, 3792, 3798, 3800, 3801, 3803, 3805, 3806, 3808, + 3810, 3812, 3814, 3816, 3818, 3820, 3822, 3824, 3826, 3828, + 3832, 3834, 3836, 3838, 3840, 3842, 3844, 3847, 3849, 3851, + 3857, 3866, 3868, 3869, 3874, 3881, 3883, 3886, 3888, 3890, + 3891, 3893, 3896, 3899, 3901, 3904, 3907, 3909, 3912, 3916, + 3919, 3922, 3925, 3928, 3932, 3936, 3940, 3942, 3946, 3948, + 3949, 3951, 3954, 3957, 3964, 3973, 3980, 3989, 3996, 4005, + 4014, 4016, 4017, 4019, 4023, 4026, 4030, 4034, 4038, 4040, + 4044, 4048, 4051, 4055, 4059, 4063, 4067, 4069, 4071, 4073, + 4075, 4079, 4085, 4087, 4089, 4091, 4093, 4097, 4111, 4128, + 4130, 4133, 4134, 4136, 4137, 4139, 4140, 4143, 4144, 4146, + 4147, 4150, 4152, 4155, 4167, 4177, 4179, 4181, 4185, 4186, + 4188, 4192, 4194, 4195, 4197, 4198, 4200, 4201, 4203, 4207, + 4209, 4211, 4213, 4217, 4218, 4221, 4224, 4225, 4228, 4229, + 4231, 4232, 4234, 4236, 4238, 4242, 4246, 4248, 4250, 4254, + 4258, 4262, 4266, 4271, 4275, 4278, 4280, 4282, 4284, 4286, + 4288, 4292, 4294, 4296, 4298, 4300, 4302, 4304, 4306, 4308, + 4310, 4312, 4314, 4316, 4318, 4320, 4322, 4324, 4326, 4328, + 4330, 4332, 4334, 4336, 4338, 4340, 4342, 4344, 4346, 4348, + 4350, 4352, 4354, 4356, 4358, 4360, 4362, 4364, 4366, 4368, + 4370, 4372, 4374, 4376, 4378, 4380, 4382, 4384, 4386, 4388, + 4390, 4392, 4394, 4396, 4398, 4400, 4402, 4404, 4406, 4408, + 4410, 4412, 4414, 4416, 4418, 4420, 4422, 4424, 4426, 4428, + 4430, 4432, 4434, 4436, 4438, 4440, 4442, 4444, 4446, 4448, + 4450, 4452, 4454, 4456, 4458, 4460, 4462, 4464, 4466, 4468, + 4470, 4472, 4474, 4476, 4478, 4480, 4482, 4484, 4486, 4488, + 4490, 4492, 4494, 4496, 4498, 4500, 4502, 4504, 4506, 4508, + 4510, 4512, 4514, 4516, 4518, 4520, 4522, 4524, 4526, 4528, + 4530, 4532, 4534, 4536, 4538, 4540, 4542, 4544, 4546, 4548, + 4550, 4552, 4554, 4556, 4558, 4560, 4562, 4564, 4566, 4568, + 4570, 4572, 4574, 4576, 4578, 4580, 4582, 4584, 4586, 4588, + 4590, 4592, 4594, 4596, 4598, 4600, 4602, 4604, 4606, 4608, + 4610, 4612, 4614, 4616, 4618, 4620, 4622, 4624, 4626, 4628, + 4630, 4632, 4634, 4636, 4638, 4640, 4642, 4644, 4646, 4648, + 4650, 4652, 4654, 4656, 4658, 4660, 4662, 4664, 4666, 4668, + 4670, 4672, 4674, 4676, 4678, 4680, 4682, 4684, 4686, 4688, + 4690, 4692, 4694, 4696, 4698, 4700, 4702, 4704, 4706, 4708, + 4710, 4712, 4714, 4716, 4718, 4720, 4722, 4724, 4726, 4728, + 4730, 4732, 4734, 4736, 4738, 4740, 4742, 4744, 4746, 4748, + 4750, 4752, 4754, 4756, 4758, 4760, 4762, 4764, 4766, 4768, + 4770, 4772, 4774, 4776, 4778, 4780, 4782, 4784, 4786, 4788, + 4790, 4792, 4794, 4796, 4798, 4800, 4802, 4804, 4806, 4808, + 4810, 4812, 4814, 4816, 4818, 4820, 4822, 4824, 4826, 4828, + 4830, 4832, 4834, 4836, 4838, 4840, 4842, 4844, 4846, 4848, + 4850, 4852, 4854, 4856, 4858, 4860, 4862, 4864, 4866, 4868, + 4870, 4872, 4874, 4876, 4878, 4880, 4882, 4884, 4886, 4888, + 4890, 4892, 4894, 4896, 4898, 4900, 4902, 4904, 4906, 4908, + 4910, 4912, 4914, 4916, 4918, 4920, 4922, 4924, 4926, 4928, + 4930, 4932, 4934, 4936, 4938, 4940, 4942, 4944, 4946, 4948, + 4950, 4952, 4954, 4956, 4958, 4960, 4962, 4964, 4966, 4968, + 4970, 4972, 4974, 4976, 4978, 4980, 4982, 4984, 4986, 4988, + 4990, 4992, 4994, 4996, 4998, 5000, 5002, 5004, 5006, 5008, + 5010, 5012, 5014, 5016, 5018, 5020, 5022, 5024, 5026, 5028, + 5030, 5032, 5034, 5036, 5038, 5040, 5042, 5044, 5046, 5048, + 5050, 5052, 5054, 5056, 5058, 5060, 5062, 5064, 5066, 5068, + 5070, 5072, 5074, 5076, 5078, 5080, 5082, 5084, 5086, 5088, + 5090, 5092, 5094, 5096, 5098, 5100, 5102, 5104, 5106, 5108, + 5110, 5112, 5114, 5116, 5118, 5120, 5122, 5124, 5126, 5128, + 5130, 5132, 5134, 5136, 5138, 5140, 5142, 5144, 5146, 5148, + 5150, 5152, 5154, 5156, 5158, 5160, 5162, 5164, 5166, 5168, + 5170, 5172, 5174, 5176, 5178, 5180, 5182, 5184, 5186, 5188, + 5190, 5192, 5194, 5196, 5198, 5200, 5202, 5204, 5206, 5208, + 5210, 5212, 5214, 5216, 5218, 5220, 5222, 5224, 5226, 5228, + 5230, 5232, 5234, 5236, 5238, 5240, 5242, 5244, 5246, 5248, + 5250, 5252, 5254, 5256, 5258, 5260, 5262, 5264, 5266, 5268, + 5270, 5272, 5274, 5276, 5278, 5280, 5282, 5284, 5286, 5288, + 5290, 5292, 5294, 5296, 5298, 5300, 5302, 5304, 5306, 5308, + 5310, 5312, 5314, 5316, 5318, 5320, 5322, 5324, 5326, 5328, + 5330, 5332, 5334, 5336, 5338, 5340, 5342, 5344, 5346, 5348, + 5350, 5352, 5354, 5356, 5358, 5360, 5362, 5364, 5366, 5368, + 5370, 5372, 5374, 5376, 5378, 5380, 5382, 5384, 5386, 5388, + 5390, 5392, 5394, 5396, 5398, 5400, 5402, 5404, 5406, 5408, + 5410, 5412, 5414, 5416, 5418, 5420, 5422 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 504, 0, -1, 505, -1, 505, 496, 506, -1, 506, - -1, 835, -1, 547, -1, 507, -1, 867, -1, 874, - -1, 836, -1, 613, -1, 877, -1, 519, -1, 609, - -1, 825, -1, 543, -1, 556, -1, 518, -1, 863, - -1, 602, -1, 545, -1, 839, -1, 837, -1, 838, - -1, 828, -1, 524, -1, 856, -1, 542, -1, 822, - -1, 522, -1, 630, -1, 554, -1, 612, -1, 858, - -1, 868, -1, 850, -1, 871, -1, 875, -1, -1, - 29, 401, 696, 515, -1, 29, 401, 187, 150, 696, - 515, -1, 29, 197, 803, 515, -1, 29, 197, 187, - 150, 803, 515, -1, 29, 366, 803, 515, -1, 29, - 366, 187, 150, 803, 515, -1, 29, 448, 803, 515, - -1, 29, 448, 187, 150, 803, 515, -1, 510, -1, - 508, 510, -1, 372, 115, 738, -1, 135, 115, -1, - 344, -1, 344, 549, 550, -1, 372, 551, -1, 372, - 172, 601, -1, 514, -1, 511, 497, 514, -1, 23, - 581, -1, 23, 187, 268, 150, 581, -1, 23, 75, - 581, -1, 23, 75, 187, 268, 150, 581, -1, 29, - 523, 811, 509, -1, 29, 523, 811, 135, 268, 273, - -1, 29, 523, 811, 372, 268, 273, -1, 29, 523, - 811, 372, 388, 553, -1, 29, 523, 811, 372, 569, - -1, 29, 523, 811, 342, 569, -1, 29, 523, 811, - 372, 391, 811, -1, 29, 523, 811, 23, 172, 601, - 36, 186, 559, -1, 29, 523, 811, 508, -1, 29, - 523, 811, 135, 186, -1, 29, 523, 811, 135, 186, - 187, 150, -1, 135, 523, 187, 150, 811, 606, -1, - 135, 523, 811, 606, -1, 29, 523, 811, 517, 423, - 708, 705, 513, -1, 29, 523, 811, 516, -1, 23, - 571, -1, 29, 86, 805, 557, -1, 439, 86, 805, - -1, 135, 86, 187, 150, 805, 606, -1, 135, 86, - 805, 606, -1, 372, 240, -1, 372, 432, -1, 372, - 569, -1, 342, 569, -1, 516, -1, 436, 738, -1, - -1, 564, -1, 372, 564, -1, 23, 564, -1, 135, - 579, -1, 512, -1, 515, 497, 512, -1, 287, 493, - 511, 494, -1, 372, 107, -1, 372, -1, -1, 111, - 805, -1, 111, 313, 805, -1, 111, 27, -1, 111, - 313, 27, -1, 93, 423, 816, 36, 142, 493, 520, - 494, -1, 521, -1, -1, 810, -1, 521, 497, 810, - -1, 29, 358, 805, 338, 412, 805, -1, 29, 401, - 696, 338, 412, 805, -1, 29, 401, 187, 150, 696, - 338, 412, 805, -1, 29, 366, 803, 338, 412, 805, - -1, 29, 366, 187, 150, 803, 338, 412, 805, -1, - 29, 448, 803, 338, 412, 805, -1, 29, 448, 187, - 150, 803, 338, 412, 805, -1, 29, 197, 803, 338, - 412, 805, -1, 29, 197, 187, 150, 803, 338, 412, - 805, -1, 29, 401, 696, 338, 523, 805, 412, 805, - -1, 29, 401, 187, 150, 696, 338, 523, 805, 412, - 805, -1, 29, 401, 696, 338, 86, 805, 412, 805, - -1, 29, 401, 187, 150, 696, 338, 86, 805, 412, - 805, -1, 75, -1, -1, 528, 207, 214, 526, 525, - 531, 533, -1, 630, -1, 296, 534, 441, 630, -1, - 493, 538, 494, 630, -1, 493, 538, 494, 296, 534, - 441, 630, -1, 115, 442, -1, 803, -1, 803, 36, - 811, -1, 493, 540, 494, 702, -1, 283, 86, 805, - -1, -1, 635, -1, -1, 811, 792, -1, 541, 482, - 738, -1, 493, 535, 494, 482, 738, -1, 283, 84, - 527, 131, 434, 372, 539, 702, -1, 283, 84, 527, - 131, 269, -1, -1, 811, 536, 537, 649, 650, -1, - 743, 536, 537, 649, 650, -1, 493, 738, 494, 536, - 537, 649, 650, -1, 346, 795, -1, -1, 435, -1, - 400, -1, 541, -1, 535, 497, 541, -1, 73, 816, - -1, -1, 816, -1, -1, 529, -1, 538, 497, 529, - -1, 530, -1, 539, 497, 530, -1, 532, -1, 540, - 497, 532, -1, 811, 792, -1, 310, 811, -1, 310, - 811, 482, 855, -1, 310, 811, 493, 770, 494, -1, - 93, 600, 366, 803, 544, -1, 93, 600, 366, 187, - 268, 150, 803, 544, -1, 548, -1, -1, 149, 805, - 546, -1, 93, 600, 401, 879, 36, 149, 805, 546, - 878, -1, 93, 600, 401, 187, 268, 150, 879, 36, - 149, 805, 546, 878, -1, 493, 768, 494, -1, -1, - 29, 366, 803, 548, -1, 29, 366, 187, 150, 803, - 548, -1, 551, -1, 548, 551, -1, 455, -1, 479, - -1, -1, 4, -1, 484, 4, -1, 485, 4, -1, - 553, -1, 36, 710, -1, 55, 550, -1, 106, -1, - 266, 106, -1, 196, 552, 550, -1, 246, 550, -1, - 254, 550, -1, 266, 246, -1, 266, 254, -1, 297, - 54, 816, -1, 366, 259, 816, -1, 386, 549, 550, - -1, 344, -1, 344, 549, 550, -1, 54, -1, -1, - 809, -1, 484, 809, -1, 485, 809, -1, 19, 555, - -1, 47, 555, -1, 386, 555, -1, 79, 555, -1, - 141, 555, -1, 351, 555, -1, 458, -1, 414, -1, - -1, 93, 600, 401, 803, 493, 588, 494, 576, 568, - -1, 93, 600, 401, 187, 268, 150, 803, 493, 588, - 494, 576, 568, -1, 93, 288, 340, 600, 401, 803, - 493, 588, 494, 576, 568, -1, -1, 557, 580, -1, - 595, -1, 886, -1, 765, -1, 550, -1, 810, -1, - 267, -1, 493, 548, 494, -1, -1, 810, -1, 266, - 22, -1, 345, -1, 58, -1, 372, 273, -1, 372, - 115, -1, 86, 805, 563, -1, 563, -1, 575, -1, - 73, 816, -1, 268, 273, -1, 273, -1, 429, 587, - -1, 316, 220, 587, -1, 67, 493, 738, 494, 570, - -1, 436, 81, 805, -1, 115, 739, -1, 172, 601, - 36, 186, 559, -1, 332, 803, 590, 598, 566, -1, - 579, 560, -1, 283, 434, 561, -1, 565, -1, 592, - -1, 565, 592, -1, 592, 565, -1, -1, 287, 493, - 582, 494, -1, -1, 283, 79, 135, -1, 283, 79, - 120, 354, -1, 283, 79, 315, 354, -1, -1, 493, - 573, 494, -1, 266, 199, -1, -1, 86, 805, 596, - -1, 596, -1, 78, -1, 87, -1, 116, -1, 186, - -1, 198, -1, 388, -1, 391, -1, 27, -1, 593, - -1, 573, 497, 593, -1, 436, 197, 584, -1, 117, - -1, 268, 117, -1, 201, 118, -1, 201, 190, -1, - 455, 569, -1, 455, 281, -1, 457, 281, -1, -1, - 493, 583, 494, -1, 578, 195, 572, -1, 578, 147, - 572, -1, -1, 820, -1, 268, 117, -1, 117, -1, - 201, 190, -1, 201, 118, -1, 268, 438, -1, 266, - 199, -1, 811, 708, 567, 591, -1, 564, -1, 582, - 497, 564, -1, 586, -1, 583, 497, 586, -1, 811, - -1, 581, -1, 599, -1, 571, -1, 820, 482, 558, - -1, 820, -1, 455, 577, -1, -1, 597, -1, -1, - 811, -1, 493, 594, 494, -1, -1, 591, 562, -1, - -1, 283, 120, 561, -1, 820, 482, 558, -1, 820, - -1, 820, 495, 820, 482, 558, -1, 820, 495, 820, - -1, 589, -1, 594, 497, 589, -1, 708, -1, 813, - 817, 488, 423, -1, 373, 813, 817, 488, 423, -1, - 67, 493, 738, 494, 557, -1, 429, 493, 594, 494, - 587, 557, -1, 429, 574, 557, -1, 316, 220, 493, - 594, 494, 587, 557, -1, 316, 220, 574, 557, -1, - 165, 220, 493, 594, 494, 332, 803, 590, 598, 566, - 557, -1, 585, -1, 597, 497, 585, -1, 244, 169, - -1, 244, 301, -1, 244, 378, -1, -1, 230, 803, - 578, -1, 407, -1, 405, -1, 234, 407, -1, 234, - 405, -1, 174, 407, -1, 174, 405, -1, 432, -1, - -1, 30, -1, 54, 115, -1, 135, 603, 187, 150, - 605, 606, -1, 135, 603, 605, 606, -1, 135, 604, - 187, 150, 804, 606, -1, 135, 604, 804, 606, -1, - 135, 607, 805, 283, 816, 606, -1, 135, 607, 187, - 150, 805, 283, 816, 606, -1, 135, 423, 608, 606, - -1, 135, 423, 187, 150, 608, 606, -1, 401, -1, - 366, -1, 170, -1, 241, -1, 448, -1, 245, 448, - -1, 197, -1, 165, 401, -1, 74, -1, 90, -1, - 388, -1, 408, 361, 300, -1, 408, 361, 127, -1, - 408, 361, 406, -1, 408, 361, 83, -1, 21, 247, - -1, 144, 417, -1, 153, -1, 165, 107, 459, -1, - 322, -1, 358, -1, 369, -1, 816, -1, 605, 497, - 816, -1, 58, -1, 345, -1, -1, 308, -1, 355, - -1, 417, -1, 708, -1, 608, 497, 708, -1, 93, - 610, 803, 611, 36, 738, -1, 170, -1, 241, -1, - 493, 494, -1, 493, 770, 494, -1, 528, 434, 864, - 372, 539, 686, 865, 533, -1, 91, 625, 803, 590, - 623, 614, 619, 628, 615, 549, 620, -1, 91, 493, - 824, 494, 412, 619, 628, 549, 620, -1, 168, -1, - 412, -1, 617, 122, 810, -1, -1, 627, -1, 616, - 497, 627, -1, 436, -1, -1, 36, -1, -1, 321, - -1, -1, 624, -1, 493, 629, 494, -1, 847, -1, - 550, -1, 486, -1, 493, 616, 494, -1, -1, 820, - 621, -1, 455, 281, -1, -1, 624, 626, -1, -1, - 50, -1, -1, 50, -1, 281, -1, 167, -1, 121, - 618, 810, -1, 273, 618, 810, -1, 95, -1, 182, - -1, 324, 618, 810, -1, 143, 618, 810, -1, 164, - 324, 594, -1, 164, 324, 486, -1, 164, 268, 273, - 594, -1, 164, 273, 594, -1, 139, 810, -1, 847, - -1, 810, -1, 389, -1, 390, -1, 622, -1, 629, - 497, 622, -1, 632, -1, 631, -1, 493, 632, 494, - -1, 493, 631, 494, -1, 634, -1, 633, 646, -1, - 633, 645, 678, 652, -1, 633, 645, 651, 679, -1, - 635, 633, -1, 635, 633, 646, -1, 635, 633, 645, - 678, 652, -1, 635, 633, 645, 651, 679, -1, 634, - -1, 631, -1, 365, 643, 794, 638, 686, 702, 668, - 676, 747, 677, 656, -1, 365, 642, 795, 638, 686, - 702, 668, 676, 747, 677, 656, -1, 685, -1, 401, - 696, -1, 633, 428, 641, 633, -1, 633, 212, 641, - 633, -1, 633, 145, 641, 633, -1, 455, 636, -1, - 479, 636, -1, 455, 330, 636, -1, 637, -1, 636, - 497, 637, -1, 805, 818, 36, 493, 824, 494, -1, - 214, 639, -1, -1, 407, 640, 803, -1, 405, 640, - 803, -1, 234, 407, 640, 803, -1, 234, 405, 640, - 803, -1, 174, 407, 640, 803, -1, 174, 405, 640, - 803, -1, 432, 640, 803, -1, 401, 803, -1, 803, - -1, 401, -1, -1, 27, -1, 130, -1, -1, 130, - -1, 130, 283, 493, 768, 494, -1, 27, -1, -1, - 188, 275, -1, 343, 275, -1, -1, 646, -1, -1, - 289, 54, 647, -1, 289, 54, 27, 649, 650, -1, - 289, 54, 486, 649, 650, -1, 648, -1, 647, 497, - 648, -1, 738, 436, 765, 650, -1, 738, 649, 650, - -1, 37, -1, 124, -1, -1, 478, 160, -1, 478, - 224, -1, -1, 653, 654, -1, 654, 653, -1, 653, - -1, 654, -1, 651, -1, -1, 231, 662, -1, 231, - 662, 497, 663, -1, 158, 667, 664, 666, 284, -1, - 158, 667, 666, 284, -1, 280, 663, -1, 280, 664, - 666, -1, 4, 488, -1, 9, 488, -1, 4, 305, - -1, 9, 305, -1, 9, -1, 9, 354, -1, 436, - 356, 658, -1, -1, 811, -1, -1, 657, 493, 655, - 494, 661, -1, 655, -1, 655, 493, 811, 494, -1, - 655, 493, 811, 497, 9, 494, -1, 403, 658, -1, - 659, -1, -1, 339, 493, 9, 494, -1, -1, 738, - -1, 27, -1, 738, 488, -1, 4, 305, -1, 9, - 305, -1, 738, -1, 740, -1, 484, 665, -1, 485, - 665, -1, 809, -1, 4, -1, 353, -1, 354, -1, - 160, -1, 265, -1, 177, 54, 669, -1, 177, 54, - 27, -1, 177, 54, 486, -1, -1, 670, -1, 669, - 497, 670, -1, 738, -1, 671, -1, 673, -1, 672, - -1, 674, -1, 493, 494, -1, 352, 493, 768, 494, - -1, 96, 493, 768, 494, -1, 178, 374, 493, 669, - 494, -1, 178, -1, 179, -1, 181, 738, -1, -1, - 323, 738, -1, -1, 680, -1, 163, 326, 284, -1, - 678, -1, -1, 681, -1, 680, 681, -1, 682, 683, - 684, -1, 163, 434, -1, 163, 266, 220, 434, -1, - 163, 375, -1, 163, 220, 375, -1, 278, 802, -1, - -1, 272, -1, 379, 239, -1, -1, 442, 493, 768, - 494, -1, 685, 497, 493, 768, 494, -1, 168, 687, - -1, -1, 688, -1, 687, 497, 688, -1, 696, 691, - 660, -1, 697, 692, 660, -1, 225, 697, 692, -1, - 631, 691, 660, -1, 225, 631, 691, -1, 689, -1, - 493, 689, 494, 690, -1, 493, 689, 494, -1, 688, - 94, 219, 688, -1, 688, 693, 219, 688, 695, -1, - 688, 219, 688, 695, -1, 688, 262, 693, 219, 688, - -1, 688, 262, 219, 688, -1, 36, 811, 493, 804, - 494, -1, 36, 812, -1, 811, 493, 804, 494, -1, - 811, -1, 690, -1, -1, 690, -1, 36, 493, 703, - 494, -1, 36, 811, 493, 703, 494, -1, 811, 493, - 703, 494, -1, -1, 169, 694, -1, 228, 694, -1, - 349, 694, -1, 203, -1, 292, -1, -1, 436, 493, - 804, 494, -1, 283, 738, -1, 803, -1, 803, 486, - -1, 284, 803, -1, 284, 493, 803, 494, -1, 743, - 701, -1, 354, 168, 493, 699, 494, 701, -1, 743, - 700, -1, 698, -1, 699, 497, 698, -1, 36, 493, - 703, 494, -1, -1, 479, 290, -1, -1, 452, 738, - -1, -1, 704, -1, 703, 497, 704, -1, 811, 708, - 705, -1, 73, 816, -1, -1, 811, 708, -1, 706, - 497, 811, 708, -1, 353, -1, 394, -1, 710, 709, - -1, 373, 710, 709, -1, 710, 35, 491, 809, 492, - -1, 373, 710, 35, 491, 809, 492, -1, 710, 35, - -1, 373, 710, 35, -1, 707, 493, 706, 494, 709, - -1, 242, 493, 772, 494, 709, -1, 709, 491, 492, - -1, 709, 491, 809, 492, -1, -1, 712, -1, 714, - -1, 716, -1, 720, -1, 726, -1, 727, 737, -1, - 727, 493, 809, 494, -1, 714, -1, 717, -1, 721, - -1, 726, -1, 815, 713, -1, 493, 768, 494, -1, - -1, 210, -1, 211, -1, 380, -1, 49, -1, 327, - -1, 161, 715, -1, 134, 312, -1, 113, 713, -1, - 112, 713, -1, 276, 713, -1, 52, -1, 493, 809, - 494, -1, -1, 718, -1, 719, -1, 718, -1, 719, - -1, 51, 725, 493, 768, 494, -1, 51, 725, -1, - 722, -1, 723, -1, 722, -1, 723, -1, 724, 493, - 809, 494, -1, 724, -1, 65, 725, -1, 64, 725, - -1, 443, -1, 261, 65, 725, -1, 261, 64, 725, - -1, 263, 725, -1, 445, -1, -1, 411, 493, 809, - 494, 728, -1, 411, 728, -1, 410, 493, 809, 494, - 728, -1, 410, 728, -1, 213, -1, 479, 410, 476, - -1, 457, 410, 476, -1, -1, 473, -1, 474, -1, - 256, -1, 257, -1, 109, -1, 110, -1, 184, -1, - 185, -1, 252, -1, 253, -1, 362, -1, 363, -1, - 250, -1, 251, -1, 248, -1, 249, -1, 729, -1, - 730, -1, 731, -1, 732, -1, 733, -1, 734, -1, - 735, -1, 736, -1, 729, 412, 730, -1, 731, 412, - 732, -1, 731, 412, 733, -1, 731, 412, 734, -1, - 732, 412, 733, -1, 732, 412, 734, -1, 733, 412, - 734, -1, -1, 740, -1, 738, 11, 708, -1, 738, - 73, 816, -1, 738, 41, 410, 476, 738, -1, 484, - 738, -1, 485, 738, -1, 738, 484, 738, -1, 738, - 485, 738, -1, 738, 486, 738, -1, 738, 487, 738, - -1, 738, 488, 738, -1, 738, 489, 738, -1, 738, - 480, 738, -1, 738, 481, 738, -1, 738, 482, 738, - -1, 738, 16, 738, -1, 738, 17, 738, -1, 738, - 18, 738, -1, 738, 764, 738, -1, 764, 738, -1, - 738, 764, -1, 738, 33, 738, -1, 738, 288, 738, - -1, 268, 738, -1, 477, 738, -1, 738, 173, 738, - -1, 738, 230, 738, -1, 738, 230, 738, 143, 738, - -1, 738, 477, 230, 738, -1, 738, 477, 230, 738, - 143, 738, -1, 738, 189, 738, -1, 738, 189, 738, - 143, 738, -1, 738, 477, 189, 738, -1, 738, 477, - 189, 738, 143, 738, -1, 738, 377, 412, 738, -1, - 738, 377, 412, 738, 143, 738, -1, 738, 477, 377, - 412, 738, -1, 738, 477, 377, 412, 738, 143, 738, - -1, 738, 216, 273, -1, 738, 217, -1, 738, 216, - 268, 273, -1, 738, 268, 273, -1, 738, 271, -1, - 758, -1, 498, 760, 499, -1, 491, 769, 492, -1, - 758, 15, 738, -1, 788, 15, 738, -1, 758, 294, - 758, -1, 738, 216, 419, -1, 738, 216, 268, 419, - -1, 738, 216, 156, -1, 738, 216, 268, 156, -1, - 738, 216, 430, -1, 738, 216, 268, 430, -1, 738, - 216, 130, 168, 738, -1, 738, 216, 268, 130, 168, - 738, -1, 738, 216, 278, 493, 772, 494, -1, 738, - 216, 268, 278, 493, 772, 494, -1, 738, 48, 793, - 739, 33, 738, -1, 738, 477, 48, 793, 739, 33, - 738, -1, 738, 48, 398, 739, 33, 738, -1, 738, - 477, 48, 398, 739, 33, 738, -1, 738, 194, 782, - -1, 738, 477, 194, 782, -1, 738, 766, 761, 631, - -1, 738, 766, 761, 493, 738, 494, -1, 115, -1, - 35, 491, 769, 492, -1, 740, -1, 739, 11, 708, - -1, 484, 739, -1, 485, 739, -1, 739, 484, 739, - -1, 739, 485, 739, -1, 739, 486, 739, -1, 739, - 487, 739, -1, 739, 488, 739, -1, 739, 489, 739, - -1, 739, 480, 739, -1, 739, 481, 739, -1, 739, - 482, 739, -1, 739, 16, 739, -1, 739, 17, 739, - -1, 739, 18, 739, -1, 739, 764, 739, -1, 764, - 739, -1, 739, 764, -1, 739, 216, 130, 168, 739, - -1, 739, 216, 268, 130, 168, 739, -1, 739, 216, - 278, 493, 772, 494, -1, 739, 216, 268, 278, 493, - 772, 494, -1, 788, -1, 808, -1, 500, 9, -1, - 501, 792, -1, 10, 792, -1, 493, 738, 494, 792, - -1, 783, -1, 742, 792, -1, 631, -1, 631, 791, - -1, 150, 631, -1, 675, 493, 768, 494, -1, 807, - 493, 494, -1, 807, 493, 770, 645, 644, 494, -1, - 807, 493, 444, 771, 645, 644, 494, -1, 807, 493, - 770, 497, 444, 771, 645, 644, 494, -1, 807, 493, - 27, 770, 645, 644, 494, -1, 807, 493, 130, 770, - 645, 644, 494, -1, 807, 493, 486, 494, -1, 741, - 745, 746, 750, -1, 744, -1, 741, -1, 744, -1, - 74, 163, 493, 738, 494, -1, 99, -1, 102, -1, - 102, 493, 809, 494, -1, 103, -1, 103, 493, 809, - 494, -1, 235, -1, 235, 493, 809, 494, -1, 236, - -1, 236, 493, 809, 494, -1, 100, -1, 104, -1, - 371, -1, 435, -1, 98, -1, 101, -1, 61, 493, - 738, 36, 708, 494, -1, 422, 493, 738, 36, 708, - 494, -1, 155, 493, 773, 494, -1, 295, 493, 775, - 494, -1, 309, 493, 777, 494, -1, 396, 493, 778, - 494, -1, 416, 493, 738, 36, 708, 494, -1, 418, - 493, 53, 781, 494, -1, 418, 493, 226, 781, 494, - -1, 418, 493, 413, 781, 494, -1, 418, 493, 781, - 494, -1, 274, 493, 738, 497, 738, 494, -1, 72, - 493, 768, 494, -1, 456, 177, 493, 646, 494, -1, - -1, 159, 493, 452, 738, 494, -1, -1, 454, 748, - -1, -1, 749, -1, 748, 497, 749, -1, 811, 36, - 751, -1, 293, 751, -1, 293, 811, -1, -1, 493, - 752, 753, 645, 754, 494, -1, 811, -1, -1, 302, - 54, 768, -1, -1, 325, 755, -1, 354, 755, -1, - -1, 756, -1, 48, 756, 33, 756, -1, 425, 311, - -1, 425, 162, -1, 97, 353, -1, 738, 311, -1, - 738, 162, -1, 353, 493, 768, 494, -1, 353, 493, - 494, -1, 757, -1, 493, 768, 497, 738, 494, -1, - 812, 502, 738, -1, 759, -1, 760, 497, 759, -1, - 34, -1, 382, -1, 27, -1, 8, -1, 763, -1, - 484, -1, 485, -1, 486, -1, 487, -1, 488, -1, - 489, -1, 480, -1, 481, -1, 482, -1, 16, -1, - 17, -1, 18, -1, 8, -1, 285, 493, 767, 494, - -1, 762, -1, 285, 493, 767, 494, -1, 762, -1, - 285, 493, 767, 494, -1, 230, -1, 477, 230, -1, - 173, -1, 477, 173, -1, 189, -1, 477, 189, -1, - 762, -1, 811, 495, 767, -1, 738, -1, 768, 497, - 738, -1, 768, -1, -1, 771, -1, 770, 497, 771, - -1, 738, -1, 819, 13, 738, -1, 819, 14, 738, - -1, 708, -1, 772, 497, 708, -1, 774, 168, 738, - -1, -1, 3, -1, 729, -1, 730, -1, 731, -1, - 732, -1, 733, -1, 734, -1, 735, -1, 736, -1, - 810, -1, 738, 776, 779, 780, -1, 738, 776, 779, - -1, 306, 738, -1, 739, 194, 739, -1, -1, 738, - 779, 780, -1, 738, 780, 779, -1, 738, 779, -1, - 738, 780, -1, 768, -1, -1, 168, 738, -1, 163, - 738, -1, 738, 168, 768, -1, 168, 768, -1, 768, - -1, 631, -1, 493, 768, 494, -1, 60, 787, 784, - 786, 141, -1, 785, -1, 784, 785, -1, 451, 738, - 409, 738, -1, 137, 738, -1, -1, 738, -1, -1, - 811, -1, 811, 791, -1, 495, 806, -1, 491, 738, - 492, -1, 491, 790, 502, 790, 492, -1, 738, -1, - -1, 789, -1, 791, 789, -1, -1, 792, 789, -1, - 40, -1, -1, 795, -1, -1, 796, -1, 795, 497, - 796, -1, 738, 36, 821, -1, 738, 3, -1, 738, - -1, 486, 798, 801, -1, 811, 495, 486, 798, 801, - -1, 146, 493, 804, 494, -1, 146, 811, -1, 797, - -1, -1, 738, 36, 811, -1, 799, -1, 800, 497, - 799, -1, 340, 493, 800, 494, -1, 340, 799, -1, - -1, 803, -1, 802, 497, 803, -1, 812, -1, 811, - 791, -1, 805, -1, 804, 497, 805, -1, 811, -1, - 820, -1, 814, -1, 811, 791, -1, 809, -1, 4, - -1, 810, 792, -1, 6, -1, 7, -1, 807, 810, - -1, 807, 493, 770, 645, 644, 494, 810, -1, 711, - 810, -1, 727, 493, 738, 494, 737, -1, 727, 809, - 737, -1, 727, 810, 737, -1, 419, -1, 156, -1, - 273, -1, 9, -1, 5, -1, 3, -1, 880, -1, - 881, -1, 811, -1, 5, -1, 3, -1, 880, -1, - 885, -1, 3, -1, 880, -1, 882, -1, 3, -1, - 880, -1, 883, -1, 811, -1, 811, 817, -1, 495, - 806, -1, 817, 495, 806, -1, 493, 804, 494, -1, - -1, 813, -1, 3, -1, 884, -1, 880, -1, 886, - -1, 820, -1, 5, -1, 313, 805, 823, 36, 824, - -1, 493, 772, 494, -1, -1, 630, -1, 524, -1, - 612, -1, 863, -1, 93, 358, 811, 826, -1, 93, - 358, 187, 268, 150, 811, 826, -1, 826, 827, -1, - -1, 556, -1, 828, -1, 543, -1, 875, -1, 93, - 834, 197, 831, 832, 283, 803, 830, 493, 540, 494, - 833, 702, -1, 93, 834, 197, 831, 187, 268, 150, - 584, 283, 803, 830, 493, 540, 494, 833, 702, -1, - 811, -1, 436, 829, -1, -1, 82, -1, -1, 584, - -1, -1, 455, 569, -1, -1, 429, -1, -1, 29, - 401, 696, 372, 358, 805, -1, 29, 401, 187, 150, - 696, 372, 358, 805, -1, 29, 366, 803, 372, 358, - 805, -1, 29, 366, 187, 150, 803, 372, 358, 805, - -1, 29, 448, 803, 372, 358, 805, -1, 29, 448, - 187, 150, 803, 372, 358, 805, -1, 164, 68, -1, - 68, -1, 152, 108, 810, 620, -1, 193, 108, 810, - -1, 151, 842, -1, 151, 846, 840, 842, -1, 151, - 446, 842, -1, 151, 493, 845, 494, 842, -1, 446, - -1, -1, 847, -1, 550, -1, -1, 630, -1, 524, - -1, 612, -1, 863, -1, 877, -1, 3, -1, 880, - -1, 884, -1, 843, -1, 810, -1, 848, -1, 845, - 497, 848, -1, 32, -1, 31, -1, 419, -1, 156, - -1, 283, -1, 844, -1, 849, 841, -1, 843, -1, - 846, -1, 372, 851, -1, 372, 234, 851, -1, 372, - 370, 851, -1, 372, 174, 851, -1, 852, -1, 873, - 168, 97, -1, 410, 476, 854, -1, 358, 810, -1, - 873, 412, 855, -1, 873, 482, 855, -1, 873, 412, - 115, -1, 873, 482, 115, -1, 847, -1, 550, -1, - 810, -1, 3, -1, 727, 810, 737, -1, 727, 493, - 809, 494, 810, -1, 550, -1, 115, -1, 234, -1, - 853, -1, 855, 497, 853, -1, 233, 857, -1, 208, - 857, -1, 164, 208, 857, -1, 810, -1, 811, -1, - 437, 860, 862, 840, -1, 437, 860, 862, 840, 803, - -1, 437, 860, 862, 840, 867, -1, 437, 493, 861, - 494, -1, 437, 493, 861, 494, 803, 818, -1, 846, - -1, 446, -1, 167, -1, 169, -1, 3, -1, 169, - -1, -1, 859, -1, 861, 497, 859, -1, 167, -1, - -1, 528, 120, 168, 864, 866, 865, 533, -1, 696, - -1, 696, 811, -1, 696, 36, 811, -1, 452, 738, - -1, -1, 436, 687, -1, -1, 846, 840, -1, 846, - 840, 803, 818, -1, 342, 870, -1, 873, -1, 27, - -1, 869, -1, 410, 476, -1, 414, 218, 229, -1, - 872, 630, -1, 397, 630, -1, 397, 873, -1, 872, - 873, -1, 872, 410, 476, -1, 872, 414, 218, 229, - -1, 872, 27, -1, 376, -1, 125, -1, 811, -1, - 873, 495, 811, -1, 56, 741, -1, 93, 600, 448, - 803, 590, 833, 36, 630, 876, -1, 93, 288, 340, - 600, 448, 803, 590, 833, 36, 630, 876, -1, 93, - 600, 330, 448, 803, 493, 594, 494, 833, 36, 630, - 876, -1, 93, 288, 340, 600, 330, 448, 803, 493, - 594, 494, 833, 36, 630, 876, -1, 455, 67, 286, - -1, 455, 59, 67, 286, -1, 455, 234, 67, 286, - -1, -1, 93, 600, 401, 879, 36, 630, 878, -1, - 93, 600, 401, 187, 268, 150, 879, 36, 630, 878, - -1, 455, 107, -1, 455, 266, 107, -1, -1, 803, - 590, 576, 568, -1, 19, -1, 20, -1, 21, -1, - 22, -1, 23, -1, 24, -1, 25, -1, 26, -1, - 28, -1, 29, -1, 30, -1, 38, -1, 39, -1, - 41, -1, 42, -1, 43, -1, 45, -1, 46, -1, - 47, -1, 54, -1, 55, -1, 56, -1, 57, -1, - 58, -1, 59, -1, 62, -1, 63, -1, 66, -1, - 68, -1, 69, -1, 70, -1, 71, -1, 76, -1, - 77, -1, 78, -1, 79, -1, 80, -1, 81, -1, - 83, -1, 84, -1, 85, -1, 87, -1, 88, -1, - 89, -1, 90, -1, 91, -1, 92, -1, 95, -1, - 96, -1, 97, -1, 105, -1, 106, -1, 107, -1, - 108, -1, 109, -1, 110, -1, 111, -1, 114, -1, - 116, -1, 118, -1, 119, -1, 120, -1, 121, -1, - 122, -1, 123, -1, 125, -1, 126, -1, 127, -1, - 128, -1, 129, -1, 132, -1, 133, -1, 134, -1, - 135, -1, 136, -1, 138, -1, 139, -1, 140, -1, - 142, -1, 143, -1, 144, -1, 146, -1, 147, -1, - 148, -1, 149, -1, 151, -1, 152, -1, 153, -1, - 154, -1, 157, -1, 159, -1, 160, -1, 162, -1, - 164, -1, 166, -1, 170, -1, 171, -1, 172, -1, - 174, -1, 176, -1, 180, -1, 182, -1, 183, -1, - 184, -1, 185, -1, 186, -1, 187, -1, 188, -1, - 190, -1, 191, -1, 192, -1, 193, -1, 195, -1, - 196, -1, 197, -1, 198, -1, 199, -1, 200, -1, - 202, -1, 205, -1, 206, -1, 207, -1, 208, -1, - 209, -1, 215, -1, 218, -1, 220, -1, 221, -1, - 222, -1, 223, -1, 224, -1, 227, -1, 229, -1, - 232, -1, 233, -1, 234, -1, 237, -1, 238, -1, - 239, -1, 240, -1, 241, -1, 243, -1, 244, -1, - 245, -1, 246, -1, 247, -1, 248, -1, 249, -1, - 250, -1, 251, -1, 252, -1, 253, -1, 254, -1, - 255, -1, 256, -1, 257, -1, 258, -1, 259, -1, - 260, -1, 264, -1, 265, -1, 266, -1, 269, -1, - 270, -1, 272, -1, 275, -1, 277, -1, 278, -1, - 279, -1, 281, -1, 282, -1, 285, -1, 286, -1, - 287, -1, 290, -1, 293, -1, 296, -1, 297, -1, - 298, -1, 299, -1, 300, -1, 301, -1, 302, -1, - 303, -1, 304, -1, 305, -1, 307, -1, 308, -1, - 310, -1, 311, -1, 313, -1, 314, -1, 315, -1, - 317, -1, 318, -1, 319, -1, 320, -1, 321, -1, - 322, -1, 324, -1, 325, -1, 326, -1, 328, -1, - 329, -1, 330, -1, 331, -1, 333, -1, 334, -1, - 335, -1, 336, -1, 337, -1, 338, -1, 339, -1, - 340, -1, 341, -1, 342, -1, 343, -1, 344, -1, - 345, -1, 347, -1, 348, -1, 350, -1, 351, -1, - 352, -1, 354, -1, 355, -1, 356, -1, 357, -1, - 358, -1, 359, -1, 360, -1, 361, -1, 362, -1, - 363, -1, 364, -1, 366, -1, 367, -1, 368, -1, - 369, -1, 370, -1, 372, -1, 374, -1, 375, -1, - 376, -1, 378, -1, 379, -1, 381, -1, 383, -1, - 384, -1, 385, -1, 386, -1, 387, -1, 388, -1, - 389, -1, 390, -1, 391, -1, 392, -1, 393, -1, - 395, -1, 397, -1, 399, -1, 400, -1, 402, -1, - 404, -1, 405, -1, 406, -1, 407, -1, 408, -1, - 414, -1, 415, -1, 417, -1, 420, -1, 421, -1, - 423, -1, 424, -1, 425, -1, 426, -1, 427, -1, - 430, -1, 431, -1, 432, -1, 433, -1, 434, -1, - 437, -1, 438, -1, 439, -1, 440, -1, 441, -1, - 445, -1, 447, -1, 448, -1, 449, -1, 450, -1, - 453, -1, 456, -1, 457, -1, 458, -1, 459, -1, - 460, -1, 461, -1, 473, -1, 474, -1, 475, -1, - 476, -1, 48, -1, 49, -1, 51, -1, 52, -1, - 64, -1, 65, -1, 72, -1, 112, -1, 113, -1, - 150, -1, 155, -1, 161, -1, 178, -1, 179, -1, - 204, -1, 210, -1, 211, -1, 213, -1, 242, -1, - 261, -1, 263, -1, 267, -1, 274, -1, 276, -1, - 291, -1, 295, -1, 309, -1, 312, -1, 327, -1, - 353, -1, 373, -1, 380, -1, 394, -1, 396, -1, - 410, -1, 411, -1, 416, -1, 418, -1, 422, -1, - 442, -1, 443, -1, 462, -1, 463, -1, 464, -1, - 465, -1, 466, -1, 467, -1, 468, -1, 469, -1, - 470, -1, 471, -1, 472, -1, 44, -1, 50, -1, - 74, -1, 82, -1, 94, -1, 101, -1, 167, -1, - 169, -1, 173, -1, 189, -1, 203, -1, 216, -1, - 217, -1, 219, -1, 228, -1, 230, -1, 242, -1, - 262, -1, 271, -1, 292, -1, 294, -1, 349, -1, - 377, -1, 394, -1, 403, -1, 446, -1, 44, -1, + 506, 0, -1, 507, -1, 507, 498, 508, -1, 508, + -1, 857, -1, 850, -1, 738, -1, 834, -1, 875, + -1, 874, -1, 876, -1, 513, -1, 858, -1, 735, + -1, 749, -1, 848, -1, 755, -1, 733, -1, 509, + -1, 804, -1, 832, -1, 837, -1, 835, -1, 836, + -1, 867, -1, 813, -1, 811, -1, 734, -1, 518, + -1, 802, -1, 521, -1, 727, -1, 732, -1, 722, + -1, 729, -1, 861, -1, 752, -1, 516, -1, -1, + 817, 120, 169, 510, 512, 511, 822, -1, 590, -1, + 590, 711, -1, 590, 36, 711, -1, 454, 632, -1, + -1, 438, 581, -1, -1, 93, 800, 403, 515, 36, + 521, 514, -1, 93, 800, 403, 188, 270, 150, 515, + 36, 521, 514, -1, 93, 290, 342, 800, 403, 515, + 36, 521, 514, -1, 457, 107, -1, 457, 268, 107, + -1, -1, 702, 789, 775, 767, -1, 93, 800, 450, + 702, 789, 872, 36, 521, 517, -1, 93, 290, 342, + 800, 450, 702, 789, 872, 36, 521, 517, -1, 93, + 800, 332, 450, 702, 495, 793, 496, 872, 36, 521, + 517, -1, 93, 290, 342, 800, 332, 450, 702, 495, + 793, 496, 872, 36, 521, 517, -1, 457, 67, 288, + -1, 457, 59, 67, 288, -1, 457, 236, 67, 288, + -1, -1, 315, 705, 519, 36, 520, -1, 495, 669, + 496, -1, -1, 521, -1, 813, -1, 732, -1, 509, + -1, 523, -1, 522, -1, 495, 523, 496, -1, 495, + 522, 496, -1, 525, -1, 524, 537, -1, 524, 536, + 570, 543, -1, 524, 536, 542, 571, -1, 526, 524, + -1, 526, 524, 537, -1, 526, 524, 536, 570, 543, + -1, 526, 524, 536, 542, 571, -1, 525, -1, 522, + -1, 367, 534, 691, 529, 579, 596, 559, 568, 642, + 569, 547, -1, 367, 533, 693, 529, 579, 596, 559, + 568, 642, 569, 547, -1, 578, -1, 403, 590, -1, + 524, 430, 532, 524, -1, 524, 213, 532, 524, -1, + 524, 145, 532, 524, -1, 457, 527, -1, 481, 527, + -1, 457, 332, 527, -1, 528, -1, 527, 499, 528, + -1, 705, 718, 36, 495, 520, 496, -1, 215, 530, + -1, -1, 409, 531, 702, -1, 407, 531, 702, -1, + 236, 409, 531, 702, -1, 236, 407, 531, 702, -1, + 175, 409, 531, 702, -1, 175, 407, 531, 702, -1, + 434, 531, 702, -1, 403, 702, -1, 702, -1, 403, + -1, -1, 27, -1, 130, -1, -1, 130, -1, 130, + 285, 495, 665, 496, -1, 27, -1, -1, 189, 277, + -1, 345, 277, -1, -1, 537, -1, -1, 291, 54, + 538, -1, 291, 54, 27, 540, 541, -1, 291, 54, + 488, 540, 541, -1, 539, -1, 538, 499, 539, -1, + 632, 438, 661, 541, -1, 632, 540, 541, -1, 37, + -1, 124, -1, -1, 480, 161, -1, 480, 226, -1, + -1, 544, 545, -1, 545, 544, -1, 544, -1, 545, + -1, 542, -1, -1, 233, 553, -1, 233, 553, 499, + 554, -1, 159, 558, 555, 557, 286, -1, 159, 558, + 557, 286, -1, 282, 554, -1, 282, 555, 557, -1, + 4, 490, -1, 9, 490, -1, 4, 307, -1, 9, + 307, -1, 9, -1, 9, 356, -1, 438, 358, 549, + -1, -1, 711, -1, -1, 548, 495, 546, 496, 552, + -1, 546, -1, 546, 495, 711, 496, -1, 546, 495, + 711, 499, 9, 496, -1, 405, 549, -1, 550, -1, + -1, 341, 495, 9, 496, -1, -1, 632, -1, 27, + -1, 632, 490, -1, 4, 307, -1, 9, 307, -1, + 632, -1, 634, -1, 486, 556, -1, 487, 556, -1, + 709, -1, 4, -1, 355, -1, 356, -1, 161, -1, + 267, -1, 178, 54, 561, -1, 178, 54, 27, -1, + 178, 54, 488, -1, -1, 562, -1, 560, 499, 562, + -1, 560, -1, 560, 499, -1, 632, -1, 563, -1, + 565, -1, 564, -1, 566, -1, 495, 496, -1, 354, + 495, 665, 496, -1, 96, 495, 665, 496, -1, 179, + 376, 495, 561, 496, -1, 179, -1, 180, -1, 182, + 632, -1, -1, 325, 632, -1, -1, 572, -1, 164, + 328, 286, -1, 570, -1, -1, 573, -1, 572, 573, + -1, 574, 575, 576, -1, 164, 436, -1, 164, 268, + 222, 436, -1, 164, 377, -1, 164, 222, 377, -1, + 280, 701, -1, -1, 274, -1, 381, 241, -1, -1, + 444, 495, 665, 496, -1, 577, 499, 495, 665, 496, + -1, 577, -1, 577, 499, -1, 169, 581, -1, -1, + 582, -1, 580, 499, 582, -1, 580, -1, 580, 499, + -1, 590, 585, 551, -1, 591, 586, 551, -1, 227, + 591, 586, -1, 522, 585, 551, -1, 227, 522, 585, + -1, 583, -1, 495, 583, 496, 584, -1, 495, 583, + 496, -1, 582, 94, 220, 582, -1, 582, 587, 220, + 582, 589, -1, 582, 220, 582, 589, -1, 582, 264, + 587, 220, 582, -1, 582, 264, 220, 582, -1, 36, + 711, 495, 704, 496, -1, 36, 712, -1, 711, 495, + 704, 496, -1, 711, -1, 584, -1, -1, 584, -1, + 36, 495, 597, 496, -1, 36, 711, 495, 597, 496, + -1, 711, 495, 597, 496, -1, -1, 170, 588, -1, + 230, 588, -1, 351, 588, -1, 204, -1, 294, -1, + -1, 438, 495, 704, 496, -1, 285, 632, -1, 702, + -1, 702, 488, -1, 286, 702, -1, 286, 495, 702, + 496, -1, 637, 595, -1, 356, 169, 495, 593, 496, + 595, -1, 637, 594, -1, 592, -1, 593, 499, 592, + -1, 36, 495, 597, 496, -1, -1, 481, 292, -1, + -1, 454, 632, -1, -1, 598, -1, 597, 499, 598, + -1, 711, 602, 599, -1, 73, 716, -1, -1, 711, + 602, -1, 600, 499, 711, 602, -1, 355, -1, 396, + -1, 604, 603, -1, 375, 604, 603, -1, 604, 35, + 493, 709, 494, -1, 375, 604, 35, 493, 709, 494, + -1, 604, 35, -1, 375, 604, 35, -1, 601, 495, + 600, 496, 603, -1, 244, 495, 669, 496, 603, -1, + 603, 493, 494, -1, 603, 493, 709, 494, -1, -1, + 606, -1, 608, -1, 610, -1, 614, -1, 620, -1, + 621, 631, -1, 621, 495, 709, 496, -1, 608, -1, + 611, -1, 615, -1, 620, -1, 715, 607, -1, 495, + 665, 496, -1, -1, 211, -1, 212, -1, 382, -1, + 49, -1, 329, -1, 162, 609, -1, 134, 314, -1, + 113, 607, -1, 112, 607, -1, 278, 607, -1, 52, + -1, 495, 709, 496, -1, -1, 612, -1, 613, -1, + 612, -1, 613, -1, 51, 619, 495, 665, 496, -1, + 51, 619, -1, 616, -1, 617, -1, 616, -1, 617, + -1, 618, 495, 709, 496, -1, 618, -1, 65, 619, + -1, 64, 619, -1, 445, -1, 263, 65, 619, -1, + 263, 64, 619, -1, 265, 619, -1, 447, -1, -1, + 413, 495, 709, 496, 622, -1, 413, 622, -1, 412, + 495, 709, 496, 622, -1, 412, 622, -1, 214, -1, + 481, 412, 478, -1, 459, 412, 478, -1, -1, 475, + -1, 476, -1, 258, -1, 259, -1, 109, -1, 110, + -1, 185, -1, 186, -1, 254, -1, 255, -1, 364, + -1, 365, -1, 252, -1, 253, -1, 250, -1, 251, + -1, 623, -1, 624, -1, 625, -1, 626, -1, 627, + -1, 628, -1, 629, -1, 630, -1, 623, 414, 624, + -1, 625, 414, 626, -1, 625, 414, 627, -1, 625, + 414, 628, -1, 626, 414, 627, -1, 626, 414, 628, + -1, 627, 414, 628, -1, -1, 634, -1, 632, 11, + 602, -1, 632, 73, 716, -1, 632, 41, 412, 478, + 632, -1, 486, 632, -1, 487, 632, -1, 632, 486, + 632, -1, 632, 487, 632, -1, 632, 488, 632, -1, + 632, 489, 632, -1, 632, 490, 632, -1, 632, 491, + 632, -1, 632, 482, 632, -1, 632, 483, 632, -1, + 632, 484, 632, -1, 632, 16, 632, -1, 632, 17, + 632, -1, 632, 18, 632, -1, 632, 660, 632, -1, + 660, 632, -1, 632, 660, -1, 632, 33, 632, -1, + 632, 290, 632, -1, 270, 632, -1, 479, 632, -1, + 632, 174, 632, -1, 632, 232, 632, -1, 632, 232, + 632, 143, 632, -1, 632, 479, 232, 632, -1, 632, + 479, 232, 632, 143, 632, -1, 632, 190, 632, -1, + 632, 190, 632, 143, 632, -1, 632, 479, 190, 632, + -1, 632, 479, 190, 632, 143, 632, -1, 632, 379, + 414, 632, -1, 632, 379, 414, 632, 143, 632, -1, + 632, 479, 379, 414, 632, -1, 632, 479, 379, 414, + 632, 143, 632, -1, 632, 217, 275, -1, 632, 218, + -1, 632, 217, 270, 275, -1, 632, 270, 275, -1, + 632, 273, -1, 653, -1, 500, 656, 501, -1, 493, + 666, 494, -1, 632, 15, 632, -1, 653, 296, 653, + -1, 632, 217, 421, -1, 632, 217, 270, 421, -1, + 632, 217, 157, -1, 632, 217, 270, 157, -1, 632, + 217, 432, -1, 632, 217, 270, 432, -1, 632, 217, + 130, 169, 632, -1, 632, 217, 270, 130, 169, 632, + -1, 632, 217, 280, 495, 669, 496, -1, 632, 217, + 270, 280, 495, 669, 496, -1, 632, 48, 690, 633, + 33, 632, -1, 632, 479, 48, 690, 633, 33, 632, + -1, 632, 48, 400, 633, 33, 632, -1, 632, 479, + 48, 400, 633, 33, 632, -1, 632, 195, 679, -1, + 632, 479, 195, 679, -1, 632, 662, 657, 522, -1, + 632, 662, 657, 495, 632, 496, -1, 115, -1, 35, + 493, 666, 494, -1, 634, -1, 633, 11, 602, -1, + 486, 633, -1, 487, 633, -1, 633, 486, 633, -1, + 633, 487, 633, -1, 633, 488, 633, -1, 633, 489, + 633, -1, 633, 490, 633, -1, 633, 491, 633, -1, + 633, 482, 633, -1, 633, 483, 633, -1, 633, 484, + 633, -1, 633, 16, 633, -1, 633, 17, 633, -1, + 633, 18, 633, -1, 633, 660, 633, -1, 660, 633, + -1, 633, 660, -1, 633, 217, 130, 169, 633, -1, + 633, 217, 270, 130, 169, 633, -1, 633, 217, 280, + 495, 669, 496, -1, 633, 217, 270, 280, 495, 669, + 496, -1, 685, -1, 708, -1, 502, 9, -1, 503, + 689, -1, 10, 689, -1, 495, 632, 496, 689, -1, + 680, -1, 636, 689, -1, 522, -1, 522, 688, -1, + 150, 522, -1, 567, 495, 665, 496, -1, 707, 495, + 496, -1, 707, 495, 667, 536, 535, 496, -1, 707, + 495, 446, 668, 536, 535, 496, -1, 707, 495, 667, + 499, 446, 668, 536, 535, 496, -1, 707, 495, 27, + 667, 536, 535, 496, -1, 707, 495, 130, 667, 536, + 535, 496, -1, 707, 495, 488, 496, -1, 635, 639, + 640, 641, 645, -1, 638, -1, 635, -1, 638, -1, + 74, 164, 495, 632, 496, -1, 99, -1, 102, -1, + 102, 495, 709, 496, -1, 103, -1, 103, 495, 709, + 496, -1, 237, -1, 237, 495, 709, 496, -1, 238, + -1, 238, 495, 709, 496, -1, 100, -1, 104, -1, + 373, -1, 437, -1, 98, -1, 101, -1, 61, 495, + 632, 36, 602, 496, -1, 424, 495, 632, 36, 602, + 496, -1, 156, 495, 670, 496, -1, 297, 495, 672, + 496, -1, 311, 495, 674, 496, -1, 398, 495, 675, + 496, -1, 418, 495, 632, 36, 602, 496, -1, 420, + 495, 53, 678, 496, -1, 420, 495, 228, 678, 496, + -1, 420, 495, 415, 678, 496, -1, 420, 495, 678, + 496, -1, 276, 495, 632, 499, 632, 496, -1, 72, + 495, 665, 496, -1, 458, 178, 495, 537, 496, -1, + -1, 160, 495, 454, 632, 496, -1, -1, 153, -1, + -1, 456, 643, -1, -1, 644, -1, 643, 499, 644, + -1, 711, 36, 646, -1, 295, 646, -1, 295, 711, + -1, -1, 495, 647, 648, 536, 649, 496, -1, 711, + -1, -1, 304, 54, 664, -1, -1, 327, 650, -1, + 356, 650, -1, -1, 651, -1, 48, 651, 33, 651, + -1, 427, 313, -1, 427, 163, -1, 97, 355, -1, + 632, 313, -1, 632, 163, -1, 355, 495, 665, 496, + -1, 355, 495, 496, -1, 652, -1, 495, 664, 499, + 632, 496, -1, 712, 504, 632, -1, 654, -1, 655, + 499, 654, -1, 655, -1, 655, 499, -1, 34, -1, + 384, -1, 27, -1, 8, -1, 659, -1, 486, -1, + 487, -1, 488, -1, 489, -1, 490, -1, 491, -1, + 482, -1, 483, -1, 484, -1, 16, -1, 17, -1, + 18, -1, 8, -1, 287, 495, 663, 496, -1, 658, + -1, 287, 495, 663, 496, -1, 658, -1, 287, 495, + 663, 496, -1, 232, -1, 479, 232, -1, 174, -1, + 479, 174, -1, 190, -1, 479, 190, -1, 658, -1, + 711, 497, 663, -1, 632, -1, 664, 499, 632, -1, + 664, -1, 664, 499, -1, 665, -1, -1, 668, -1, + 667, 499, 668, -1, 632, -1, 719, 13, 632, -1, + 719, 14, 632, -1, 602, -1, 669, 499, 602, -1, + 671, 169, 632, -1, -1, 3, -1, 623, -1, 624, + -1, 625, -1, 626, -1, 627, -1, 628, -1, 629, + -1, 630, -1, 710, -1, 632, 673, 676, 677, -1, + 632, 673, 676, -1, 308, 632, -1, 633, 195, 633, + -1, -1, 632, 676, 677, -1, 632, 677, 676, -1, + 632, 676, -1, 632, 677, -1, 664, -1, -1, 169, + 632, -1, 164, 632, -1, 632, 169, 665, -1, 169, + 665, -1, 665, -1, 522, -1, 495, 665, 496, -1, + 60, 684, 681, 683, 141, -1, 682, -1, 681, 682, + -1, 453, 632, 411, 632, -1, 137, 632, -1, -1, + 632, -1, -1, 711, -1, 711, 688, -1, 497, 706, + -1, 493, 632, 494, -1, 493, 687, 504, 687, 494, + -1, 632, -1, -1, 686, -1, 688, 686, -1, -1, + 689, 686, -1, 40, -1, -1, 693, -1, -1, 694, + -1, 692, 499, 694, -1, 692, -1, 692, 499, -1, + 632, 36, 721, -1, 632, 3, -1, 632, -1, 488, + 696, 700, -1, 711, 497, 488, 696, 700, -1, 146, + 495, 704, 496, -1, 146, 711, -1, 695, -1, -1, + 632, 36, 711, -1, 697, -1, 698, 499, 697, -1, + 698, -1, 698, 499, -1, 342, 495, 699, 496, -1, + 342, 697, -1, -1, 702, -1, 701, 499, 702, -1, + 712, -1, 711, 688, -1, 705, -1, 703, 499, 705, + -1, 703, -1, 703, 499, -1, 711, -1, 720, -1, + 714, -1, 711, 688, -1, 709, -1, 4, -1, 710, + 689, -1, 6, -1, 7, -1, 707, 710, -1, 707, + 495, 667, 536, 535, 496, 710, -1, 605, 710, -1, + 621, 495, 632, 496, 631, -1, 621, 709, 631, -1, + 621, 710, 631, -1, 421, -1, 157, -1, 275, -1, + 9, -1, 5, -1, 3, -1, 893, -1, 894, -1, + 711, -1, 5, -1, 3, -1, 893, -1, 898, -1, + 3, -1, 893, -1, 895, -1, 3, -1, 893, -1, + 896, -1, 711, -1, 711, 717, -1, 497, 706, -1, + 717, 497, 706, -1, 495, 703, 496, -1, -1, 713, + -1, 3, -1, 897, -1, 893, -1, 899, -1, 720, + -1, 5, -1, 439, 724, 726, 838, -1, 439, 724, + 726, 838, 702, -1, 439, 724, 726, 838, 834, -1, + 439, 495, 725, 496, -1, 439, 495, 725, 496, 702, + 718, -1, 844, -1, 448, -1, 168, -1, 170, -1, + 3, -1, 170, -1, -1, 723, -1, 725, 499, 723, + -1, 168, -1, -1, 19, 728, -1, 47, 728, -1, + 388, 728, -1, 79, 728, -1, 141, 728, -1, 353, + 728, -1, 460, -1, 416, -1, -1, 344, 731, -1, + 754, -1, 27, -1, 730, -1, 412, 478, -1, 416, + 219, 231, -1, 817, 436, 510, 374, 829, 579, 511, + 822, -1, 111, 705, -1, 111, 315, 705, -1, 111, + 27, -1, 111, 315, 27, -1, 312, 711, -1, 312, + 711, 484, 866, -1, 312, 711, 495, 667, 496, -1, + 93, 800, 736, 702, 737, 36, 403, 521, -1, 93, + 800, 736, 702, 737, 36, 632, -1, 171, -1, 243, + -1, 495, 496, -1, 495, 667, 496, -1, 29, 403, + 590, 746, -1, 29, 403, 188, 150, 590, 746, -1, + 29, 198, 702, 746, -1, 29, 198, 188, 150, 702, + 746, -1, 29, 368, 702, 746, -1, 29, 368, 188, + 150, 702, 746, -1, 29, 450, 702, 746, -1, 29, + 450, 188, 150, 702, 746, -1, 741, -1, 739, 741, + -1, 374, 115, 632, -1, 135, 115, -1, 346, -1, + 346, 852, 853, -1, 374, 854, -1, 374, 173, 801, + -1, 745, -1, 742, 499, 745, -1, 23, 780, -1, + 23, 188, 270, 150, 780, -1, 23, 75, 780, -1, + 23, 75, 188, 270, 150, 780, -1, 29, 803, 711, + 740, -1, 29, 803, 711, 135, 270, 275, -1, 29, + 803, 711, 374, 270, 275, -1, 29, 803, 711, 374, + 390, 856, -1, 29, 803, 711, 374, 768, -1, 29, + 803, 711, 344, 768, -1, 29, 803, 711, 374, 393, + 711, -1, 29, 803, 711, 23, 173, 801, 36, 187, + 758, -1, 29, 803, 711, 739, -1, 29, 803, 711, + 135, 187, -1, 29, 803, 711, 135, 187, 188, 150, + -1, 135, 803, 188, 150, 711, 808, -1, 135, 803, + 711, 808, -1, 29, 803, 711, 748, 425, 602, 599, + 744, -1, 29, 803, 711, 747, -1, 23, 770, -1, + 29, 86, 705, 756, -1, 441, 86, 705, -1, 135, + 86, 188, 150, 705, 808, -1, 135, 86, 705, 808, + -1, 374, 242, -1, 374, 434, -1, 374, 768, -1, + 344, 768, -1, 747, -1, 438, 632, -1, -1, 763, + -1, 374, 763, -1, 23, 763, -1, 135, 778, -1, + 743, -1, 746, 499, 743, -1, 289, 495, 742, 496, + -1, 374, 107, -1, 374, -1, -1, 93, 360, 711, + 750, -1, 93, 360, 188, 270, 150, 711, 750, -1, + 750, 751, -1, -1, 755, -1, 867, -1, 848, -1, + 516, -1, 753, 521, -1, 399, 521, -1, 399, 754, + -1, 753, 754, -1, 753, 412, 478, -1, 753, 416, + 219, 231, -1, 753, 27, -1, 753, -1, 378, -1, + 125, -1, 711, -1, 754, 497, 711, -1, 93, 800, + 403, 702, 495, 787, 496, 775, 767, -1, 93, 800, + 403, 188, 270, 150, 702, 495, 787, 496, 775, 767, + -1, 93, 290, 342, 800, 403, 702, 495, 787, 496, + 775, 767, -1, -1, 756, 779, -1, 795, -1, 899, + -1, 661, -1, 853, -1, 710, -1, 269, -1, 495, + 851, 496, -1, -1, 710, -1, 268, 22, -1, 347, + -1, 58, -1, 374, 275, -1, 374, 115, -1, 86, + 705, 762, -1, 762, -1, 774, -1, 73, 716, -1, + 270, 275, -1, 275, -1, 431, 786, -1, 318, 222, + 786, -1, 67, 495, 632, 496, 769, -1, 438, 81, + 705, -1, 115, 633, -1, 173, 801, 36, 187, 758, + -1, 334, 702, 789, 798, 765, -1, 778, 759, -1, + 285, 436, 760, -1, 764, -1, 791, -1, 764, 791, + -1, 791, 764, -1, -1, 289, 495, 781, 496, -1, + -1, 285, 79, 135, -1, 285, 79, 120, 356, -1, + 285, 79, 317, 356, -1, -1, 495, 772, 496, -1, + 268, 200, -1, -1, 86, 705, 796, -1, 796, -1, + 78, -1, 87, -1, 116, -1, 187, -1, 199, -1, + 390, -1, 393, -1, 27, -1, 792, -1, 772, 499, + 792, -1, 438, 198, 783, -1, 117, -1, 270, 117, + -1, 202, 118, -1, 202, 191, -1, 457, 768, -1, + 457, 283, -1, 459, 283, -1, -1, 495, 782, 496, + -1, 777, 196, 771, -1, 777, 147, 771, -1, -1, + 720, -1, 270, 117, -1, 117, -1, 202, 191, -1, + 202, 118, -1, 270, 440, -1, 268, 200, -1, 711, + 602, 766, 790, -1, 763, -1, 781, 499, 763, -1, + 785, -1, 782, 499, 785, -1, 711, -1, 780, -1, + 799, -1, 770, -1, 720, 484, 757, -1, 720, -1, + 457, 776, -1, -1, 797, -1, 797, 499, -1, -1, + 711, -1, 495, 793, 496, -1, -1, 790, 761, -1, + -1, 285, 120, 760, -1, 720, 484, 757, -1, 720, + -1, 720, 497, 720, 484, 757, -1, 720, 497, 720, + -1, 788, -1, 793, 499, 788, -1, 793, -1, 793, + 499, -1, 602, -1, 713, 717, 490, 425, -1, 375, + 713, 717, 490, 425, -1, 67, 495, 632, 496, 756, + -1, 431, 495, 794, 496, 786, 756, -1, 431, 773, + 756, -1, 318, 222, 495, 794, 496, 786, 756, -1, + 318, 222, 773, 756, -1, 166, 222, 495, 794, 496, + 334, 702, 789, 798, 765, 756, -1, 784, -1, 797, + 499, 784, -1, 246, 170, -1, 246, 303, -1, 246, + 380, -1, -1, 232, 702, 777, -1, 409, -1, 407, + -1, 236, 409, -1, 236, 407, -1, 175, 409, -1, + 175, 407, -1, 434, -1, -1, 30, -1, 54, 115, + -1, 29, 360, 705, 340, 414, 705, -1, 29, 403, + 590, 340, 414, 705, -1, 29, 403, 188, 150, 590, + 340, 414, 705, -1, 29, 368, 702, 340, 414, 705, + -1, 29, 368, 188, 150, 702, 340, 414, 705, -1, + 29, 450, 702, 340, 414, 705, -1, 29, 450, 188, + 150, 702, 340, 414, 705, -1, 29, 198, 702, 340, + 414, 705, -1, 29, 198, 188, 150, 702, 340, 414, + 705, -1, 29, 403, 590, 340, 803, 705, 414, 705, + -1, 29, 403, 188, 150, 590, 340, 803, 705, 414, + 705, -1, 29, 403, 590, 340, 86, 705, 414, 705, + -1, 29, 403, 188, 150, 590, 340, 86, 705, 414, + 705, -1, 75, -1, -1, 135, 805, 188, 150, 807, + 808, -1, 135, 805, 807, 808, -1, 135, 806, 188, + 150, 703, 808, -1, 135, 806, 703, 808, -1, 135, + 809, 705, 285, 716, 808, -1, 135, 809, 188, 150, + 705, 285, 716, 808, -1, 135, 425, 810, 808, -1, + 135, 425, 188, 150, 810, 808, -1, 403, -1, 368, + -1, 171, -1, 243, -1, 243, 403, -1, 450, -1, + 247, 450, -1, 198, -1, 166, 403, -1, 74, -1, + 90, -1, 390, -1, 410, 363, 302, -1, 410, 363, + 127, -1, 410, 363, 408, -1, 410, 363, 83, -1, + 21, 249, -1, 144, 419, -1, 154, -1, 166, 107, + 461, -1, 324, -1, 360, -1, 371, -1, 716, -1, + 807, 499, 716, -1, 58, -1, 347, -1, -1, 310, + -1, 357, -1, 419, -1, 602, -1, 810, 499, 602, + -1, 235, 812, -1, 209, 812, -1, 165, 209, 812, + -1, 710, -1, 711, -1, 817, 208, 215, 815, 814, + 820, 822, -1, 521, -1, 298, 823, 443, 521, -1, + 495, 827, 496, 521, -1, 495, 827, 496, 298, 823, + 443, 521, -1, 115, 444, -1, 702, -1, 702, 36, + 711, -1, 495, 830, 496, 596, -1, 285, 86, 705, + -1, -1, 526, -1, -1, 711, 689, -1, 831, 484, + 632, -1, 495, 824, 496, 484, 632, -1, 285, 84, + 816, 131, 436, 374, 829, 596, -1, 285, 84, 816, + 131, 271, -1, -1, 711, 825, 826, 540, 541, -1, + 637, 825, 826, 540, 541, -1, 495, 632, 496, 825, + 826, 540, 541, -1, 348, 692, -1, -1, 437, -1, + 402, -1, 831, -1, 824, 499, 831, -1, 73, 716, + -1, -1, 716, -1, -1, 818, -1, 827, 499, 818, + -1, 819, -1, 828, 499, 819, -1, 828, -1, 828, + 499, -1, 821, -1, 830, 499, 821, -1, 711, 689, + -1, 149, 705, 833, -1, 93, 800, 403, 515, 36, + 149, 705, 833, 514, -1, 93, 800, 403, 188, 270, + 150, 515, 36, 149, 705, 833, 514, -1, 495, 665, + 496, -1, -1, 844, 838, -1, 844, 838, 702, 718, + -1, 152, 108, 710, 883, -1, 194, 108, 710, -1, + 151, 840, -1, 151, 844, 838, 840, -1, 151, 448, + 840, -1, 151, 495, 843, 496, 840, -1, 448, -1, + -1, 845, -1, 853, -1, -1, 521, -1, 813, -1, + 732, -1, 509, -1, 513, -1, 3, -1, 893, -1, + 897, -1, 841, -1, 710, -1, 846, -1, 843, 499, + 846, -1, 32, -1, 31, -1, 421, -1, 157, -1, + 285, -1, 842, -1, 847, 839, -1, 841, -1, 844, + -1, 93, 800, 368, 702, 849, -1, 93, 800, 368, + 188, 270, 150, 702, 849, -1, 851, -1, -1, 29, + 368, 702, 851, -1, 29, 368, 188, 150, 702, 851, + -1, 854, -1, 851, 854, -1, 457, -1, 481, -1, + -1, 4, -1, 486, 4, -1, 487, 4, -1, 856, + -1, 36, 604, -1, 55, 853, -1, 106, -1, 268, + 106, -1, 197, 855, 853, -1, 248, 853, -1, 256, + 853, -1, 268, 248, -1, 268, 256, -1, 299, 54, + 716, -1, 368, 261, 716, -1, 388, 852, 853, -1, + 346, -1, 346, 852, 853, -1, 54, -1, -1, 709, + -1, 486, 709, -1, 487, 709, -1, 29, 403, 590, + 374, 360, 705, -1, 29, 403, 188, 150, 590, 374, + 360, 705, -1, 29, 368, 702, 374, 360, 705, -1, + 29, 368, 188, 150, 702, 374, 360, 705, -1, 29, + 450, 702, 374, 360, 705, -1, 29, 450, 188, 150, + 702, 374, 360, 705, -1, 93, 425, 716, 36, 142, + 495, 859, 496, -1, 860, -1, -1, 710, -1, 860, + 499, 710, -1, 374, 862, -1, 374, 236, 862, -1, + 374, 372, 862, -1, 374, 175, 862, -1, 863, -1, + 754, 169, 97, -1, 412, 478, 865, -1, 360, 710, + -1, 754, 414, 866, -1, 754, 484, 866, -1, 754, + 414, 115, -1, 754, 484, 115, -1, 845, -1, 853, + -1, 710, -1, 3, -1, 621, 710, 631, -1, 621, + 495, 709, 496, 710, -1, 853, -1, 115, -1, 236, + -1, 864, -1, 866, 499, 864, -1, 93, 873, 198, + 870, 871, 285, 702, 869, 495, 830, 496, 872, 596, + -1, 93, 873, 198, 870, 188, 270, 150, 783, 285, + 702, 869, 495, 830, 496, 872, 596, -1, 711, -1, + 438, 868, -1, -1, 82, -1, -1, 783, -1, -1, + 457, 768, -1, -1, 431, -1, -1, 165, 68, -1, + 68, -1, 56, 635, -1, 91, 888, 702, 789, 886, + 877, 882, 891, 878, 852, 883, -1, 91, 495, 520, + 496, 414, 882, 891, 852, 883, -1, 169, -1, 414, + -1, 880, 122, 710, -1, -1, 890, -1, 879, 499, + 890, -1, 438, -1, -1, 36, -1, -1, 323, -1, + -1, 887, -1, 495, 892, 496, -1, 845, -1, 853, + -1, 488, -1, 495, 879, 496, -1, -1, 720, 884, + -1, 457, 283, -1, -1, 887, 889, -1, -1, 50, + -1, -1, 50, -1, 283, -1, 168, -1, 121, 881, + 710, -1, 275, 881, 710, -1, 95, -1, 183, -1, + 326, 881, 710, -1, 143, 881, 710, -1, 165, 326, + 793, -1, 165, 326, 488, -1, 165, 270, 275, 793, + -1, 165, 275, 793, -1, 139, 710, -1, 845, -1, + 710, -1, 391, -1, 392, -1, 885, -1, 892, 499, + 885, -1, 19, -1, 20, -1, 21, -1, 22, -1, + 23, -1, 24, -1, 25, -1, 26, -1, 28, -1, + 29, -1, 30, -1, 38, -1, 39, -1, 41, -1, + 42, -1, 43, -1, 45, -1, 46, -1, 47, -1, + 54, -1, 55, -1, 56, -1, 57, -1, 58, -1, + 59, -1, 62, -1, 63, -1, 66, -1, 68, -1, + 69, -1, 70, -1, 71, -1, 76, -1, 77, -1, + 78, -1, 79, -1, 80, -1, 81, -1, 83, -1, + 84, -1, 85, -1, 87, -1, 88, -1, 89, -1, + 90, -1, 91, -1, 92, -1, 95, -1, 96, -1, + 97, -1, 105, -1, 106, -1, 107, -1, 108, -1, + 109, -1, 110, -1, 111, -1, 114, -1, 116, -1, + 118, -1, 119, -1, 120, -1, 121, -1, 122, -1, + 123, -1, 125, -1, 126, -1, 127, -1, 128, -1, + 129, -1, 132, -1, 133, -1, 134, -1, 135, -1, + 136, -1, 138, -1, 139, -1, 140, -1, 142, -1, + 143, -1, 144, -1, 146, -1, 147, -1, 148, -1, + 149, -1, 151, -1, 152, -1, 153, -1, 154, -1, + 155, -1, 158, -1, 160, -1, 161, -1, 163, -1, + 165, -1, 167, -1, 171, -1, 172, -1, 173, -1, + 175, -1, 177, -1, 181, -1, 183, -1, 184, -1, + 185, -1, 186, -1, 187, -1, 188, -1, 189, -1, + 191, -1, 192, -1, 193, -1, 194, -1, 196, -1, + 197, -1, 198, -1, 199, -1, 200, -1, 201, -1, + 203, -1, 206, -1, 207, -1, 208, -1, 209, -1, + 210, -1, 216, -1, 219, -1, 221, -1, 222, -1, + 223, -1, 224, -1, 225, -1, 226, -1, 229, -1, + 231, -1, 234, -1, 235, -1, 236, -1, 239, -1, + 240, -1, 241, -1, 242, -1, 243, -1, 245, -1, + 246, -1, 247, -1, 248, -1, 249, -1, 250, -1, + 251, -1, 252, -1, 253, -1, 254, -1, 255, -1, + 256, -1, 257, -1, 258, -1, 259, -1, 260, -1, + 261, -1, 262, -1, 266, -1, 267, -1, 268, -1, + 271, -1, 272, -1, 274, -1, 277, -1, 279, -1, + 280, -1, 281, -1, 283, -1, 284, -1, 287, -1, + 288, -1, 289, -1, 292, -1, 295, -1, 298, -1, + 299, -1, 300, -1, 301, -1, 302, -1, 303, -1, + 304, -1, 305, -1, 306, -1, 307, -1, 309, -1, + 310, -1, 312, -1, 313, -1, 315, -1, 316, -1, + 317, -1, 319, -1, 320, -1, 321, -1, 322, -1, + 323, -1, 324, -1, 326, -1, 327, -1, 328, -1, + 330, -1, 331, -1, 332, -1, 333, -1, 335, -1, + 336, -1, 337, -1, 338, -1, 339, -1, 340, -1, + 341, -1, 342, -1, 343, -1, 344, -1, 345, -1, + 346, -1, 347, -1, 349, -1, 350, -1, 352, -1, + 353, -1, 354, -1, 356, -1, 357, -1, 358, -1, + 359, -1, 360, -1, 361, -1, 362, -1, 363, -1, + 364, -1, 365, -1, 366, -1, 368, -1, 369, -1, + 370, -1, 371, -1, 372, -1, 374, -1, 376, -1, + 377, -1, 378, -1, 380, -1, 381, -1, 383, -1, + 385, -1, 386, -1, 387, -1, 388, -1, 389, -1, + 390, -1, 391, -1, 392, -1, 393, -1, 394, -1, + 395, -1, 397, -1, 399, -1, 401, -1, 402, -1, + 404, -1, 406, -1, 407, -1, 408, -1, 409, -1, + 410, -1, 416, -1, 417, -1, 419, -1, 422, -1, + 423, -1, 425, -1, 426, -1, 427, -1, 428, -1, + 429, -1, 432, -1, 433, -1, 434, -1, 435, -1, + 436, -1, 439, -1, 440, -1, 441, -1, 442, -1, + 443, -1, 447, -1, 449, -1, 450, -1, 451, -1, + 452, -1, 455, -1, 458, -1, 459, -1, 460, -1, + 461, -1, 462, -1, 463, -1, 475, -1, 476, -1, + 477, -1, 478, -1, 48, -1, 49, -1, 51, -1, + 52, -1, 64, -1, 65, -1, 72, -1, 112, -1, + 113, -1, 150, -1, 156, -1, 162, -1, 179, -1, + 180, -1, 205, -1, 211, -1, 212, -1, 214, -1, + 244, -1, 263, -1, 265, -1, 269, -1, 276, -1, + 278, -1, 293, -1, 297, -1, 311, -1, 314, -1, + 329, -1, 355, -1, 375, -1, 382, -1, 396, -1, + 398, -1, 412, -1, 413, -1, 418, -1, 420, -1, + 424, -1, 444, -1, 445, -1, 464, -1, 465, -1, + 466, -1, 467, -1, 468, -1, 469, -1, 470, -1, + 471, -1, 472, -1, 473, -1, 474, -1, 44, -1, 50, -1, 74, -1, 82, -1, 94, -1, 101, -1, - 167, -1, 169, -1, 173, -1, 189, -1, 203, -1, - 216, -1, 217, -1, 219, -1, 228, -1, 230, -1, - 262, -1, 271, -1, 292, -1, 294, -1, 349, -1, - 377, -1, 403, -1, 422, -1, 446, -1, 48, -1, - 49, -1, 51, -1, 52, -1, 65, -1, 64, -1, - 72, -1, 112, -1, 113, -1, 150, -1, 155, -1, - 161, -1, 178, -1, 179, -1, 204, -1, 211, -1, - 213, -1, 210, -1, 242, -1, 261, -1, 263, -1, - 267, -1, 274, -1, 276, -1, 291, -1, 295, -1, - 309, -1, 312, -1, 327, -1, 353, -1, 373, -1, - 380, -1, 394, -1, 396, -1, 410, -1, 411, -1, - 416, -1, 418, -1, 422, -1, 442, -1, 443, -1, - 462, -1, 463, -1, 464, -1, 465, -1, 466, -1, - 467, -1, 468, -1, 469, -1, 470, -1, 471, -1, - 472, -1, 44, -1, 50, -1, 74, -1, 82, -1, - 94, -1, 101, -1, 167, -1, 169, -1, 173, -1, - 189, -1, 203, -1, 216, -1, 217, -1, 219, -1, - 228, -1, 230, -1, 242, -1, 262, -1, 271, -1, - 292, -1, 294, -1, 349, -1, 377, -1, 394, -1, - 403, -1, 422, -1, 446, -1, 27, -1, 31, -1, - 32, -1, 33, -1, 34, -1, 35, -1, 36, -1, - 37, -1, 40, -1, 53, -1, 60, -1, 61, -1, - 67, -1, 73, -1, 75, -1, 86, -1, 93, -1, - 98, -1, 99, -1, 100, -1, 102, -1, 103, -1, - 104, -1, 115, -1, 117, -1, 124, -1, 130, -1, - 131, -1, 137, -1, 141, -1, 145, -1, 156, -1, - 158, -1, 163, -1, 165, -1, 168, -1, 175, -1, - 177, -1, 181, -1, 194, -1, 201, -1, 212, -1, - 214, -1, 225, -1, 226, -1, 231, -1, 235, -1, - 236, -1, 268, -1, 273, -1, 280, -1, 283, -1, - 284, -1, 288, -1, 289, -1, 306, -1, 316, -1, - 323, -1, 332, -1, 346, -1, 365, -1, 371, -1, - 382, -1, 398, -1, 401, -1, 409, -1, 412, -1, - 413, -1, 419, -1, 428, -1, 429, -1, 435, -1, - 436, -1, 444, -1, 451, -1, 452, -1, 454, -1, - 455, -1 + 168, -1, 170, -1, 174, -1, 190, -1, 204, -1, + 217, -1, 218, -1, 220, -1, 230, -1, 232, -1, + 244, -1, 264, -1, 273, -1, 294, -1, 296, -1, + 351, -1, 379, -1, 396, -1, 405, -1, 448, -1, + 44, -1, 50, -1, 74, -1, 82, -1, 94, -1, + 101, -1, 168, -1, 170, -1, 174, -1, 190, -1, + 204, -1, 217, -1, 218, -1, 220, -1, 230, -1, + 232, -1, 264, -1, 273, -1, 294, -1, 296, -1, + 351, -1, 379, -1, 405, -1, 424, -1, 448, -1, + 48, -1, 49, -1, 51, -1, 52, -1, 65, -1, + 64, -1, 72, -1, 112, -1, 113, -1, 150, -1, + 156, -1, 162, -1, 179, -1, 180, -1, 205, -1, + 212, -1, 214, -1, 211, -1, 244, -1, 263, -1, + 265, -1, 269, -1, 276, -1, 278, -1, 293, -1, + 297, -1, 311, -1, 314, -1, 329, -1, 355, -1, + 375, -1, 382, -1, 396, -1, 398, -1, 412, -1, + 413, -1, 418, -1, 420, -1, 424, -1, 444, -1, + 445, -1, 464, -1, 465, -1, 466, -1, 467, -1, + 468, -1, 469, -1, 470, -1, 471, -1, 472, -1, + 473, -1, 474, -1, 44, -1, 50, -1, 74, -1, + 82, -1, 94, -1, 101, -1, 168, -1, 170, -1, + 174, -1, 190, -1, 204, -1, 217, -1, 218, -1, + 220, -1, 230, -1, 232, -1, 244, -1, 264, -1, + 273, -1, 294, -1, 296, -1, 351, -1, 379, -1, + 396, -1, 405, -1, 424, -1, 448, -1, 27, -1, + 31, -1, 32, -1, 33, -1, 34, -1, 35, -1, + 36, -1, 37, -1, 40, -1, 53, -1, 60, -1, + 61, -1, 67, -1, 73, -1, 75, -1, 86, -1, + 93, -1, 98, -1, 99, -1, 100, -1, 102, -1, + 103, -1, 104, -1, 115, -1, 117, -1, 124, -1, + 130, -1, 131, -1, 137, -1, 141, -1, 145, -1, + 157, -1, 159, -1, 164, -1, 166, -1, 169, -1, + 176, -1, 178, -1, 182, -1, 195, -1, 202, -1, + 213, -1, 215, -1, 227, -1, 228, -1, 233, -1, + 237, -1, 238, -1, 270, -1, 275, -1, 282, -1, + 285, -1, 286, -1, 290, -1, 291, -1, 308, -1, + 318, -1, 325, -1, 334, -1, 348, -1, 367, -1, + 373, -1, 384, -1, 400, -1, 403, -1, 411, -1, + 414, -1, 415, -1, 421, -1, 430, -1, 431, -1, + 437, -1, 438, -1, 446, -1, 453, -1, 454, -1, + 456, -1, 457, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 465, 465, 481, 493, 502, 503, 504, 505, 506, - 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, - 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, - 527, 528, 529, 530, 531, 532, 533, 534, 535, 537, - 9, 18, 27, 36, 45, 54, 63, 72, 85, 87, - 93, 94, 99, 103, 107, 118, 126, 130, 139, 148, - 157, 166, 175, 184, 192, 200, 209, 218, 227, 236, - 253, 262, 271, 280, 290, 303, 318, 327, 335, 350, - 358, 368, 378, 385, 392, 400, 407, 418, 419, 424, - 428, 433, 438, 446, 447, 452, 456, 457, 458, 7, - 13, 19, 25, 7, 17, 18, 21, 23, 6, 15, - 25, 35, 45, 55, 65, 75, 85, 95, 106, 117, - 127, 140, 141, 8, 21, 27, 34, 40, 47, 57, - 61, 70, 79, 88, 95, 96, 101, 113, 118, 143, - 153, 163, 169, 180, 191, 206, 207, 213, 214, 219, - 220, 226, 227, 231, 232, 237, 239, 245, 246, 250, - 251, 256, 7, 14, 22, 9, 19, 32, 33, 7, - 14, 31, 51, 52, 9, 17, 29, 30, 34, 35, - 36, 41, 42, 43, 48, 52, 56, 60, 64, 68, - 72, 76, 80, 84, 88, 92, 97, 101, 105, 112, - 113, 117, 118, 119, 2, 9, 15, 21, 28, 35, - 45, 46, 47, 7, 21, 36, 56, 57, 84, 85, - 86, 87, 88, 89, 93, 94, 99, 104, 105, 106, - 107, 108, 113, 120, 121, 122, 139, 146, 153, 163, - 173, 185, 193, 202, 211, 230, 237, 242, 244, 246, - 248, 251, 256, 257, 261, 262, 263, 264, 269, 273, - 274, 279, 286, 291, 292, 293, 294, 295, 296, 297, - 298, 304, 305, 309, 314, 321, 328, 335, 347, 348, - 349, 350, 354, 359, 360, 361, 366, 371, 372, 373, - 374, 375, 376, 381, 404, 408, 415, 416, 420, 424, - 425, 426, 430, 434, 442, 443, 448, 449, 453, 461, - 462, 467, 468, 472, 477, 481, 485, 490, 498, 499, - 503, 504, 510, 521, 534, 548, 562, 576, 590, 613, - 617, 624, 628, 636, 641, 648, 658, 659, 660, 661, - 662, 669, 676, 677, 682, 683, 9, 19, 29, 39, - 49, 59, 69, 79, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 112, - 113, 114, 115, 116, 117, 118, 123, 124, 129, 130, - 131, 136, 137, 138, 141, 142, 7, 18, 19, 23, - 27, 7, 1, 30, 53, 54, 59, 63, 68, 72, - 80, 81, 85, 86, 91, 92, 96, 97, 102, 103, - 104, 105, 106, 111, 119, 123, 128, 129, 134, 138, - 143, 147, 151, 155, 159, 163, 167, 171, 175, 179, - 183, 187, 191, 195, 203, 209, 210, 211, 216, 220, + 0, 467, 467, 483, 495, 504, 505, 506, 507, 508, + 509, 510, 511, 512, 513, 514, 515, 516, 517, 518, + 519, 520, 521, 522, 523, 524, 525, 526, 527, 528, + 529, 530, 531, 532, 533, 534, 535, 536, 537, 539, + 7, 21, 25, 32, 43, 44, 50, 51, 11, 24, + 37, 54, 55, 56, 61, 8, 21, 34, 52, 74, + 75, 76, 77, 7, 18, 19, 23, 24, 25, 26, 47, 48, 52, 53, 68, 69, 76, 84, 92, 100, 108, 116, 127, 128, 155, 171, 188, 189, 208, 212, 216, 233, 240, 247, 257, 258, 261, 273, 284, 292, @@ -232895,132 +243827,172 @@ static const yytype_uint16 yyrline[] = 499, 503, 507, 514, 519, 526, 527, 531, 535, 539, 543, 550, 557, 558, 563, 564, 568, 569, 574, 576, 578, 583, 603, 604, 606, 611, 612, 616, 617, 620, - 621, 646, 647, 652, 657, 661, 662, 666, 667, 668, - 669, 670, 674, 687, 694, 701, 708, 709, 713, 714, - 718, 719, 723, 724, 728, 729, 733, 734, 738, 749, - 750, 751, 752, 756, 757, 762, 763, 764, 773, 779, - 797, 798, 802, 803, 809, 815, 823, 831, 840, 849, - 853, 879, 883, 896, 910, 925, 937, 953, 959, 964, - 970, 977, 978, 986, 990, 994, 1000, 1007, 1012, 1013, - 1014, 1015, 1019, 1020, 1032, 1033, 1038, 1045, 1052, 1059, - 1091, 1102, 1115, 1120, 1121, 1124, 1125, 1128, 1129, 1134, - 1135, 1140, 1144, 1150, 1171, 1179, 1192, 1195, 1199, 1199, - 1201, 1206, 1213, 1218, 1224, 1229, 1235, 1241, 1250, 1252, - 1255, 1259, 1260, 1261, 1262, 1263, 1264, 1269, 1289, 1290, - 1291, 1292, 1303, 1317, 1318, 1324, 1329, 1334, 1339, 1344, - 1349, 1354, 1359, 1365, 1371, 1377, 1384, 1406, 1415, 1419, - 1427, 1431, 1439, 1451, 1472, 1476, 1482, 1486, 1499, 1507, - 1517, 1519, 1521, 1523, 1525, 1527, 1532, 1533, 1540, 1549, - 1557, 1566, 1577, 1585, 1586, 1587, 1591, 1591, 1594, 1594, - 1597, 1597, 1600, 1600, 1603, 1603, 1606, 1606, 1609, 1609, - 1612, 1612, 1615, 1617, 1619, 1621, 1623, 1625, 1627, 1629, - 1631, 1636, 1641, 1647, 1654, 1659, 1665, 1671, 1702, 1704, - 1706, 1714, 1729, 1731, 1733, 1735, 1737, 1739, 1741, 1743, - 1745, 1747, 1749, 1751, 1753, 1755, 1758, 1760, 1762, 1765, - 1767, 1769, 1771, 1774, 1779, 1784, 1791, 1796, 1803, 1808, - 1816, 1821, 1830, 1838, 1846, 1854, 1872, 1880, 1888, 1896, - 1904, 1912, 1916, 1920, 1924, 1932, 1940, 1956, 1964, 1972, - 1980, 1988, 1996, 2004, 2008, 2012, 2016, 2020, 2028, 2036, - 2044, 2052, 2072, 2094, 2105, 2112, 2126, 2142, 2144, 2146, - 2148, 2150, 2152, 2154, 2156, 2158, 2160, 2162, 2164, 2166, - 2168, 2170, 2172, 2174, 2176, 2178, 2180, 2184, 2188, 2192, - 2206, 2207, 2208, 2215, 2227, 2242, 2254, 2256, 2268, 2279, - 2303, 2314, 2323, 2327, 2334, 2342, 2350, 2361, 2369, 2397, - 2432, 2443, 2444, 2451, 2457, 2461, 2465, 2469, 2473, 2477, - 2481, 2485, 2489, 2493, 2497, 2501, 2505, 2509, 2513, 2517, - 2519, 2521, 2525, 2534, 2539, 2546, 2561, 2568, 2572, 2576, - 2580, 2584, 2598, 2599, 2603, 2604, 2612, 2613, 2617, 2618, - 2623, 2631, 2633, 2647, 2650, 2677, 2678, 2681, 2682, 2693, - 2699, 2706, 2715, 2732, 2777, 2785, 2793, 2801, 2809, 2830, - 2831, 2834, 2835, 2839, 2849, 2850, 2852, 2853, 2854, 2857, - 2858, 2861, 2862, 2863, 2864, 2865, 2866, 2867, 2868, 2869, - 2870, 2871, 2872, 2875, 2877, 2882, 2884, 2889, 2891, 2893, - 2895, 2897, 2899, 2901, 2903, 2917, 2919, 2923, 2927, 2934, - 2939, 2946, 2950, 2956, 2960, 2969, 2980, 2981, 2985, 2989, - 2996, 2997, 2998, 2999, 3000, 3001, 3002, 3003, 3004, 3005, - 3015, 3019, 3026, 3033, 3034, 3050, 3054, 3059, 3063, 3078, - 3083, 3087, 3090, 3093, 3094, 3095, 3098, 3105, 3115, 3129, - 3130, 3134, 3145, 3146, 3149, 3150, 3153, 3157, 3164, 3168, - 3176, 3187, 3188, 3192, 3193, 3197, 3198, 3201, 3202, 3212, - 3213, 3217, 3218, 3221, 3237, 3245, 3253, 3268, 3286, 3287, - 3290, 3291, 3294, 3298, 3299, 3302, 3303, 3304, 3314, 3315, - 3326, 3330, 3357, 3359, 3364, 3366, 3376, 3379, 3390, 3394, - 3398, 3410, 3414, 3423, 3430, 3468, 3472, 3476, 3480, 3484, - 3488, 3492, 3498, 3499, 3515, 3516, 3517, 3520, 3521, 3527, - 3528, 3529, 3532, 3533, 3534, 3537, 3538, 3539, 3542, 3543, - 3546, 3548, 3553, 3554, 3557, 3565, 3566, 3567, 3568, 3571, - 3572, 7, 18, 19, 23, 24, 25, 26, 7, 16, - 34, 41, 46, 47, 48, 49, 8, 33, 62, 66, - 67, 72, 73, 78, 79, 83, 84, 89, 90, 7, - 16, 25, 34, 43, 52, 5, 11, 7, 20, 9, + 621, 646, 647, 652, 657, 661, 662, 666, 667, 671, + 672, 673, 674, 675, 679, 692, 699, 706, 713, 714, + 718, 719, 723, 724, 728, 729, 733, 734, 738, 739, + 743, 754, 755, 756, 757, 761, 762, 767, 768, 769, + 778, 784, 793, 794, 807, 808, 812, 813, 817, 818, + 824, 830, 838, 846, 855, 864, 868, 894, 898, 911, + 925, 940, 952, 968, 974, 979, 985, 992, 993, 1001, + 1005, 1009, 1015, 1022, 1027, 1028, 1029, 1030, 1034, 1035, + 1047, 1048, 1053, 1060, 1067, 1074, 1106, 1117, 1130, 1135, + 1136, 1139, 1140, 1143, 1144, 1149, 1150, 1155, 1159, 1165, + 1186, 1194, 1207, 1210, 1214, 1214, 1216, 1221, 1228, 1233, + 1239, 1244, 1250, 1256, 1265, 1267, 1270, 1274, 1275, 1276, + 1277, 1278, 1279, 1284, 1304, 1305, 1306, 1307, 1318, 1332, + 1333, 1339, 1344, 1349, 1354, 1359, 1364, 1369, 1374, 1380, + 1386, 1392, 1399, 1421, 1430, 1434, 1442, 1446, 1454, 1466, + 1487, 1491, 1497, 1501, 1514, 1522, 1532, 1534, 1536, 1538, + 1540, 1542, 1547, 1548, 1555, 1564, 1572, 1581, 1592, 1600, + 1601, 1602, 1606, 1606, 1609, 1609, 1612, 1612, 1615, 1615, + 1618, 1618, 1621, 1621, 1624, 1624, 1627, 1627, 1630, 1632, + 1634, 1636, 1638, 1640, 1642, 1644, 1646, 1651, 1656, 1662, + 1669, 1674, 1680, 1686, 1717, 1719, 1721, 1729, 1744, 1746, + 1748, 1750, 1752, 1754, 1756, 1758, 1760, 1762, 1764, 1766, + 1768, 1770, 1773, 1775, 1777, 1780, 1782, 1784, 1786, 1789, + 1794, 1799, 1806, 1811, 1818, 1823, 1830, 1835, 1843, 1851, + 1859, 1867, 1885, 1893, 1901, 1909, 1917, 1925, 1929, 1933, + 1937, 1945, 1961, 1969, 1977, 1985, 1993, 2001, 2009, 2013, + 2017, 2021, 2025, 2033, 2041, 2049, 2057, 2077, 2099, 2110, + 2117, 2131, 2147, 2149, 2151, 2153, 2155, 2157, 2159, 2161, + 2163, 2165, 2167, 2169, 2171, 2173, 2175, 2177, 2179, 2181, + 2183, 2185, 2189, 2193, 2197, 2211, 2212, 2213, 2220, 2232, + 2247, 2259, 2261, 2273, 2284, 2308, 2319, 2328, 2332, 2339, + 2347, 2355, 2366, 2374, 2402, 2438, 2449, 2450, 2457, 2463, + 2467, 2471, 2475, 2479, 2483, 2487, 2491, 2495, 2499, 2503, + 2507, 2511, 2515, 2519, 2523, 2525, 2527, 2531, 2540, 2545, + 2552, 2567, 2574, 2578, 2582, 2586, 2590, 2604, 2605, 2609, + 2610, 2614, 2615, 2622, 2623, 2627, 2628, 2633, 2641, 2643, + 2657, 2660, 2687, 2688, 2691, 2692, 2703, 2709, 2716, 2725, + 2742, 2787, 2795, 2803, 2811, 2819, 2840, 2841, 2844, 2845, + 2849, 2859, 2860, 2864, 2865, 2869, 2870, 2871, 2874, 2875, + 2878, 2879, 2880, 2881, 2882, 2883, 2884, 2885, 2886, 2887, + 2888, 2889, 2892, 2894, 2899, 2901, 2906, 2908, 2910, 2912, + 2914, 2916, 2918, 2920, 2934, 2936, 2940, 2944, 2951, 2956, + 2974, 2979, 2987, 2991, 2997, 3001, 3010, 3021, 3022, 3026, + 3030, 3037, 3038, 3039, 3040, 3041, 3042, 3043, 3044, 3045, + 3046, 3056, 3060, 3067, 3074, 3075, 3091, 3095, 3100, 3104, + 3119, 3124, 3128, 3131, 3134, 3135, 3136, 3139, 3146, 3156, + 3170, 3171, 3175, 3186, 3187, 3190, 3191, 3194, 3198, 3205, + 3209, 3217, 3228, 3229, 3233, 3234, 3238, 3239, 3242, 3243, + 3253, 3254, 3258, 3259, 3263, 3264, 3267, 3283, 3291, 3299, + 3314, 3332, 3333, 3336, 3337, 3340, 3344, 3345, 3349, 3350, + 3353, 3354, 3355, 3365, 3366, 3377, 3381, 3408, 3410, 3416, + 3417, 3420, 3422, 3432, 3435, 3446, 3450, 3454, 3466, 3470, + 3479, 3486, 3524, 3528, 3532, 3536, 3540, 3544, 3548, 3554, + 3555, 3571, 3572, 3573, 3576, 3577, 3583, 3584, 3585, 3588, + 3589, 3590, 3593, 3594, 3595, 3598, 3599, 3602, 3604, 3609, + 3610, 3613, 3621, 3622, 3623, 3624, 3627, 3628, 8, 22, + 36, 48, 56, 70, 71, 72, 73, 74, 87, 88, + 93, 94, 98, 99, 2, 9, 15, 21, 28, 35, + 45, 46, 47, 2, 7, 14, 24, 25, 32, 7, + 7, 13, 19, 25, 7, 14, 22, 8, 20, 36, + 37, 41, 45, 9, 18, 27, 36, 45, 54, 63, + 72, 85, 87, 93, 94, 99, 103, 107, 118, 126, + 130, 139, 148, 157, 166, 175, 184, 192, 200, 209, + 218, 227, 236, 253, 262, 271, 280, 290, 303, 318, + 327, 335, 350, 358, 368, 378, 385, 392, 400, 407, + 418, 419, 424, 428, 433, 438, 446, 447, 452, 456, + 457, 458, 7, 16, 34, 41, 46, 47, 48, 49, + 3, 10, 17, 24, 31, 38, 45, 52, 61, 61, + 63, 64, 7, 21, 36, 56, 57, 84, 85, 86, + 87, 88, 89, 93, 94, 99, 104, 105, 106, 107, + 108, 113, 120, 121, 122, 139, 146, 153, 163, 173, + 185, 193, 202, 211, 230, 237, 242, 244, 246, 248, + 251, 256, 257, 261, 262, 263, 264, 269, 273, 274, + 279, 286, 291, 292, 293, 294, 295, 296, 297, 298, + 304, 305, 309, 314, 321, 328, 335, 347, 348, 349, + 350, 354, 359, 360, 361, 366, 371, 372, 373, 374, + 375, 376, 381, 404, 408, 415, 416, 420, 424, 425, + 426, 430, 434, 442, 443, 448, 449, 450, 454, 462, + 463, 468, 469, 473, 478, 482, 486, 491, 499, 500, + 504, 505, 509, 510, 516, 527, 540, 554, 568, 582, + 596, 619, 623, 630, 634, 642, 647, 654, 664, 665, + 666, 667, 668, 675, 682, 683, 688, 689, 6, 15, + 25, 35, 45, 55, 65, 75, 85, 95, 106, 117, + 127, 140, 141, 9, 19, 29, 39, 49, 59, 69, + 79, 93, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 113, 114, 115, + 116, 117, 118, 119, 124, 125, 130, 131, 132, 137, + 138, 139, 142, 143, 7, 14, 20, 28, 29, 8, + 21, 27, 34, 40, 47, 57, 61, 70, 79, 88, + 95, 96, 101, 113, 118, 143, 153, 163, 169, 180, + 191, 206, 207, 213, 214, 219, 220, 226, 227, 231, + 232, 237, 239, 245, 246, 250, 251, 254, 255, 260, + 7, 14, 31, 51, 52, 9, 19, 7, 20, 9, 16, 26, 33, 44, 45, 50, 51, 52, 57, 58, 59, 60, 61, 65, 66, 67, 72, 73, 78, 82, - 90, 91, 96, 97, 98, 104, 109, 117, 118, 10, - 16, 22, 28, 38, 39, 47, 58, 70, 78, 86, - 93, 103, 105, 111, 115, 119, 134, 141, 142, 143, - 147, 148, 7, 14, 20, 28, 29, 8, 22, 36, - 48, 56, 70, 71, 72, 73, 74, 87, 88, 93, - 94, 98, 99, 7, 21, 25, 32, 43, 44, 50, - 51, 9, 19, 2, 7, 14, 24, 25, 32, 3, - 10, 17, 24, 31, 38, 45, 55, 55, 57, 58, - 6, 8, 21, 34, 52, 74, 75, 76, 77, 11, - 24, 41, 42, 43, 48, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 62, - 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, - 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, - 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, - 63, 63, 63, 63, 63, 63, 63, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, - 65, 65, 65, 65, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, - 66, 66, 66, 66, 66, 66, 66, 66, 66, 66, - 66, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, - 67, 67, 67, 67, 67, 67, 67, 67, 67 + 90, 91, 96, 97, 98, 104, 109, 117, 118, 9, + 19, 32, 33, 9, 17, 29, 30, 34, 35, 36, + 41, 42, 43, 48, 52, 56, 60, 64, 68, 72, + 76, 80, 84, 88, 92, 97, 101, 105, 112, 113, + 117, 118, 119, 7, 16, 25, 34, 43, 52, 7, + 17, 18, 21, 23, 10, 16, 22, 28, 38, 39, + 47, 58, 70, 78, 86, 93, 103, 105, 111, 115, + 119, 134, 141, 142, 143, 147, 148, 8, 33, 62, + 66, 67, 72, 73, 78, 79, 83, 84, 89, 90, + 5, 11, 6, 1, 30, 53, 54, 59, 63, 68, + 72, 80, 81, 85, 86, 91, 92, 96, 97, 102, + 103, 104, 105, 106, 111, 119, 123, 128, 129, 134, + 138, 143, 147, 151, 155, 159, 163, 167, 171, 175, + 179, 183, 187, 191, 195, 203, 209, 210, 211, 216, + 220, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, + 227, 227, 227, 227, 227, 227, 227, 228, 228, 228, + 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, + 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, + 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, + 228, 228, 228, 228, 228, 228, 228, 228, 228, 228, + 228, 228, 228, 228, 228, 228, 228, 228, 228, 229, + 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, + 229, 229, 229, 229, 229, 229, 229, 229, 229, 229, + 229, 229, 229, 229, 229, 230, 230, 230, 230, 230, + 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, + 230, 230, 230, 230, 230, 230, 230, 230, 230, 230, + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 231, 231, 231, 231, 231, 231, 231, 231, + 231, 231, 232, 232, 232, 232, 232, 232, 232, 232, + 232, 232, 232, 232, 232, 232, 232, 232, 232, 232, + 232, 232, 232, 232, 232, 232, 232, 232, 232, 233, + 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, + 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, + 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, + 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, + 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, + 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, + 233, 233, 233, 233, 233, 233, 233, 233, 233, 233, + 233, 233, 233, 233, 233, 233, 233 }; #endif @@ -233053,40 +244025,41 @@ static const char *const yytname[] = "DISABLE_P", "DISCARD", "DISTINCT", "DO", "DOCUMENT_P", "DOMAIN_P", "DOUBLE_P", "DROP", "EACH", "ELSE", "ENABLE_P", "ENCODING", "ENCRYPTED", "END_P", "ENUM_P", "ESCAPE", "EVENT", "EXCEPT", "EXCLUDE", "EXCLUDING", - "EXCLUSIVE", "EXECUTE", "EXISTS", "EXPLAIN", "EXPORT_P", "EXTENSION", - "EXTERNAL", "EXTRACT", "FALSE_P", "FAMILY", "FETCH", "FILTER", "FIRST_P", - "FLOAT_P", "FOLLOWING", "FOR", "FORCE", "FOREIGN", "FORWARD", "FREEZE", - "FROM", "FULL", "FUNCTION", "FUNCTIONS", "GENERATED", "GLOB", "GLOBAL", - "GRANT", "GRANTED", "GROUP_P", "GROUPING", "GROUPING_ID", "HANDLER", - "HAVING", "HEADER_P", "HOLD", "HOUR_P", "HOURS_P", "IDENTITY_P", "IF_P", - "IGNORE_P", "ILIKE", "IMMEDIATE", "IMMUTABLE", "IMPLICIT_P", "IMPORT_P", - "IN_P", "INCLUDING", "INCREMENT", "INDEX", "INDEXES", "INHERIT", - "INHERITS", "INITIALLY", "INLINE_P", "INNER_P", "INOUT", "INPUT_P", - "INSENSITIVE", "INSERT", "INSTALL", "INSTEAD", "INT_P", "INTEGER", - "INTERSECT", "INTERVAL", "INTO", "INVOKER", "IS", "ISNULL", "ISOLATION", - "JOIN", "KEY", "LABEL", "LANGUAGE", "LARGE_P", "LAST_P", "LATERAL_P", - "LEADING", "LEAKPROOF", "LEFT", "LEVEL", "LIKE", "LIMIT", "LISTEN", - "LOAD", "LOCAL", "LOCALTIME", "LOCALTIMESTAMP", "LOCATION", "LOCK_P", - "LOCKED", "LOGGED", "MACRO", "MAP", "MAPPING", "MATCH", "MATERIALIZED", - "MAXVALUE", "METHOD", "MICROSECOND_P", "MICROSECONDS_P", "MILLISECOND_P", - "MILLISECONDS_P", "MINUTE_P", "MINUTES_P", "MINVALUE", "MODE", "MONTH_P", - "MONTHS_P", "MOVE", "NAME_P", "NAMES", "NATIONAL", "NATURAL", "NCHAR", - "NEW", "NEXT", "NO", "NONE", "NOT", "NOTHING", "NOTIFY", "NOTNULL", - "NOWAIT", "NULL_P", "NULLIF", "NULLS_P", "NUMERIC", "OBJECT_P", "OF", - "OFF", "OFFSET", "OIDS", "OLD", "ON", "ONLY", "OPERATOR", "OPTION", - "OPTIONS", "OR", "ORDER", "ORDINALITY", "OUT_P", "OUTER_P", "OVER", - "OVERLAPS", "OVERLAY", "OVERRIDING", "OWNED", "OWNER", "PARALLEL", - "PARSER", "PARTIAL", "PARTITION", "PASSING", "PASSWORD", "PERCENT", - "PLACING", "PLANS", "POLICY", "POSITION", "PRAGMA_P", "PRECEDING", - "PRECISION", "PREPARE", "PREPARED", "PRESERVE", "PRIMARY", "PRIOR", - "PRIVILEGES", "PROCEDURAL", "PROCEDURE", "PROGRAM", "PUBLICATION", - "QUALIFY", "QUOTE", "RANGE", "READ_P", "REAL", "REASSIGN", "RECHECK", - "RECURSIVE", "REF", "REFERENCES", "REFERENCING", "REFRESH", "REINDEX", - "RELATIVE_P", "RELEASE", "RENAME", "REPEATABLE", "REPLACE", "REPLICA", - "RESET", "RESPECT_P", "RESTART", "RESTRICT", "RETURNING", "RETURNS", - "REVOKE", "RIGHT", "ROLE", "ROLLBACK", "ROLLUP", "ROW", "ROWS", "RULE", - "SAMPLE", "SAVEPOINT", "SCHEMA", "SCHEMAS", "SCROLL", "SEARCH", - "SECOND_P", "SECONDS_P", "SECURITY", "SELECT", "SEQUENCE", "SEQUENCES", + "EXCLUSIVE", "EXECUTE", "EXISTS", "EXPLAIN", "EXPORT_P", "EXPORT_STATE", + "EXTENSION", "EXTERNAL", "EXTRACT", "FALSE_P", "FAMILY", "FETCH", + "FILTER", "FIRST_P", "FLOAT_P", "FOLLOWING", "FOR", "FORCE", "FOREIGN", + "FORWARD", "FREEZE", "FROM", "FULL", "FUNCTION", "FUNCTIONS", + "GENERATED", "GLOB", "GLOBAL", "GRANT", "GRANTED", "GROUP_P", "GROUPING", + "GROUPING_ID", "HANDLER", "HAVING", "HEADER_P", "HOLD", "HOUR_P", + "HOURS_P", "IDENTITY_P", "IF_P", "IGNORE_P", "ILIKE", "IMMEDIATE", + "IMMUTABLE", "IMPLICIT_P", "IMPORT_P", "IN_P", "INCLUDING", "INCREMENT", + "INDEX", "INDEXES", "INHERIT", "INHERITS", "INITIALLY", "INLINE_P", + "INNER_P", "INOUT", "INPUT_P", "INSENSITIVE", "INSERT", "INSTALL", + "INSTEAD", "INT_P", "INTEGER", "INTERSECT", "INTERVAL", "INTO", + "INVOKER", "IS", "ISNULL", "ISOLATION", "JOIN", "JSON", "KEY", "LABEL", + "LANGUAGE", "LARGE_P", "LAST_P", "LATERAL_P", "LEADING", "LEAKPROOF", + "LEFT", "LEVEL", "LIKE", "LIMIT", "LISTEN", "LOAD", "LOCAL", "LOCALTIME", + "LOCALTIMESTAMP", "LOCATION", "LOCK_P", "LOCKED", "LOGGED", "MACRO", + "MAP", "MAPPING", "MATCH", "MATERIALIZED", "MAXVALUE", "METHOD", + "MICROSECOND_P", "MICROSECONDS_P", "MILLISECOND_P", "MILLISECONDS_P", + "MINUTE_P", "MINUTES_P", "MINVALUE", "MODE", "MONTH_P", "MONTHS_P", + "MOVE", "NAME_P", "NAMES", "NATIONAL", "NATURAL", "NCHAR", "NEW", "NEXT", + "NO", "NONE", "NOT", "NOTHING", "NOTIFY", "NOTNULL", "NOWAIT", "NULL_P", + "NULLIF", "NULLS_P", "NUMERIC", "OBJECT_P", "OF", "OFF", "OFFSET", + "OIDS", "OLD", "ON", "ONLY", "OPERATOR", "OPTION", "OPTIONS", "OR", + "ORDER", "ORDINALITY", "OUT_P", "OUTER_P", "OVER", "OVERLAPS", "OVERLAY", + "OVERRIDING", "OWNED", "OWNER", "PARALLEL", "PARSER", "PARTIAL", + "PARTITION", "PASSING", "PASSWORD", "PERCENT", "PLACING", "PLANS", + "POLICY", "POSITION", "PRAGMA_P", "PRECEDING", "PRECISION", "PREPARE", + "PREPARED", "PRESERVE", "PRIMARY", "PRIOR", "PRIVILEGES", "PROCEDURAL", + "PROCEDURE", "PROGRAM", "PUBLICATION", "QUALIFY", "QUOTE", "RANGE", + "READ_P", "REAL", "REASSIGN", "RECHECK", "RECURSIVE", "REF", + "REFERENCES", "REFERENCING", "REFRESH", "REINDEX", "RELATIVE_P", + "RELEASE", "RENAME", "REPEATABLE", "REPLACE", "REPLICA", "RESET", + "RESPECT_P", "RESTART", "RESTRICT", "RETURNING", "RETURNS", "REVOKE", + "RIGHT", "ROLE", "ROLLBACK", "ROLLUP", "ROW", "ROWS", "RULE", "SAMPLE", + "SAVEPOINT", "SCHEMA", "SCHEMAS", "SCROLL", "SEARCH", "SECOND_P", + "SECONDS_P", "SECURITY", "SELECT", "SEQUENCE", "SEQUENCES", "SERIALIZABLE", "SERVER", "SESSION", "SESSION_USER", "SET", "SETOF", "SETS", "SHARE", "SHOW", "SIMILAR", "SIMPLE", "SKIP", "SMALLINT", "SNAPSHOT", "SOME", "SQL_P", "STABLE", "STANDALONE_P", "START", @@ -233108,59 +244081,30 @@ static const char *const yytname[] = "WITH_LA", "'<'", "'>'", "'='", "POSTFIXOP", "'+'", "'-'", "'*'", "'/'", "'%'", "'^'", "UMINUS", "'['", "']'", "'('", "')'", "'.'", "';'", "','", "'{'", "'}'", "'#'", "'?'", "':'", "$accept", "stmtblock", "stmtmulti", - "stmt", "AlterTableStmt", "alter_identity_column_option_list", - "alter_column_default", "alter_identity_column_option", - "alter_generic_option_list", "alter_table_cmd", "alter_using", - "alter_generic_option_elem", "alter_table_cmds", "alter_generic_options", - "opt_set_data", "DeallocateStmt", "CreateEnumStmt", "opt_enum_val_list", - "enum_val_list", "RenameStmt", "opt_column", "InsertStmt", "insert_rest", - "insert_target", "opt_conf_expr", "opt_with_clause", - "insert_column_item", "set_clause", "opt_on_conflict", "index_elem", - "returning_clause", "override_kind", "set_target_list", "opt_collate", - "opt_class", "insert_column_list", "set_clause_list", "index_params", - "set_target", "PragmaStmt", "CreateSeqStmt", "OptSeqOptList", - "ExecuteStmt", "execute_param_clause", "AlterSeqStmt", "SeqOptList", - "opt_with", "NumericOnly", "SeqOptElem", "opt_by", "SignedIconst", - "TransactionStmt", "opt_transaction", "CreateStmt", - "ConstraintAttributeSpec", "def_arg", "OptParenthesizedSeqOptList", - "generic_option_arg", "key_action", "ColConstraint", "ColConstraintElem", - "generic_option_elem", "key_update", "key_actions", - "create_generic_options", "OnCommitOption", "reloptions", - "opt_no_inherit", "TableConstraint", "TableLikeOption", "reloption_list", - "ExistingIndex", "ConstraintAttr", "OptWith", "definition", - "TableLikeOptionList", "generic_option_name", "ConstraintAttributeElem", - "columnDef", "generic_option_list", "def_list", "index_name", - "TableElement", "def_elem", "opt_definition", "OptTableElementList", - "columnElem", "opt_column_list", "ColQualList", "key_delete", - "reloption_elem", "columnList", "func_type", "ConstraintElem", - "TableElementList", "key_match", "TableLikeClause", "OptTemp", - "generated_when", "DropStmt", "drop_type_any_name", "drop_type_name", - "any_name_list", "opt_drop_behavior", "drop_type_name_on_any_name", - "type_name_list", "CreateFunctionStmt", "macro_alias", "param_list", - "UpdateStmt", "CopyStmt", "copy_from", "copy_delimiter", - "copy_generic_opt_arg_list", "opt_using", "opt_as", "opt_program", - "copy_options", "copy_generic_opt_arg", "copy_generic_opt_elem", - "opt_oids", "copy_opt_list", "opt_binary", "copy_opt_item", - "copy_generic_opt_arg_list_item", "copy_file_name", - "copy_generic_opt_list", "SelectStmt", "select_with_parens", - "select_no_parens", "select_clause", "simple_select", "with_clause", - "cte_list", "common_table_expr", "into_clause", "OptTempTableName", - "opt_table", "all_or_distinct", "distinct_clause", "opt_all_clause", - "opt_ignore_nulls", "opt_sort_clause", "sort_clause", "sortby_list", - "sortby", "opt_asc_desc", "opt_nulls_order", "select_limit", - "opt_select_limit", "limit_clause", "offset_clause", "sample_count", - "sample_clause", "opt_sample_func", "tablesample_entry", - "tablesample_clause", "opt_tablesample_clause", "opt_repeatable_clause", - "select_limit_value", "select_offset_value", "select_fetch_first_value", - "I_or_F_const", "row_or_rows", "first_or_next", "group_clause", - "group_by_list", "group_by_item", "empty_grouping_set", "rollup_clause", - "cube_clause", "grouping_sets_clause", "grouping_or_grouping_id", - "having_clause", "qualify_clause", "for_locking_clause", - "opt_for_locking_clause", "for_locking_items", "for_locking_item", - "for_locking_strength", "locked_rels_list", "opt_nowait_or_skip", - "values_clause", "from_clause", "from_list", "table_ref", "joined_table", - "alias_clause", "opt_alias_clause", "func_alias_clause", "join_type", - "join_outer", "join_qual", "relation_expr", "func_table", + "stmt", "DeleteStmt", "relation_expr_opt_alias", + "where_or_current_clause", "using_clause", "CreateAsStmt", + "opt_with_data", "create_as_target", "ViewStmt", "opt_check_option", + "PrepareStmt", "prep_type_clause", "PreparableStmt", "SelectStmt", + "select_with_parens", "select_no_parens", "select_clause", + "simple_select", "with_clause", "cte_list", "common_table_expr", + "into_clause", "OptTempTableName", "opt_table", "all_or_distinct", + "distinct_clause", "opt_all_clause", "opt_ignore_nulls", + "opt_sort_clause", "sort_clause", "sortby_list", "sortby", + "opt_asc_desc", "opt_nulls_order", "select_limit", "opt_select_limit", + "limit_clause", "offset_clause", "sample_count", "sample_clause", + "opt_sample_func", "tablesample_entry", "tablesample_clause", + "opt_tablesample_clause", "opt_repeatable_clause", "select_limit_value", + "select_offset_value", "select_fetch_first_value", "I_or_F_const", + "row_or_rows", "first_or_next", "group_clause", "group_by_list", + "group_by_list_opt_comma", "group_by_item", "empty_grouping_set", + "rollup_clause", "cube_clause", "grouping_sets_clause", + "grouping_or_grouping_id", "having_clause", "qualify_clause", + "for_locking_clause", "opt_for_locking_clause", "for_locking_items", + "for_locking_item", "for_locking_strength", "locked_rels_list", + "opt_nowait_or_skip", "values_clause", "values_clause_opt_comma", + "from_clause", "from_list", "from_list_opt_comma", "table_ref", + "joined_table", "alias_clause", "opt_alias_clause", "func_alias_clause", + "join_type", "join_outer", "join_qual", "relation_expr", "func_table", "rowsfrom_item", "rowsfrom_list", "opt_col_def_list", "opt_ordinality", "where_clause", "TableFuncElementList", "TableFuncElement", "opt_collate_clause", "colid_type_list", "RowOrStruct", "Typename", @@ -233174,43 +244118,76 @@ static const char *const yytname[] = "microsecond_keyword", "opt_interval", "a_expr", "b_expr", "c_expr", "func_application", "func_expr", "func_expr_windowless", "func_expr_common_subexpr", "within_group_clause", "filter_clause", - "window_clause", "window_definition_list", "window_definition", - "over_clause", "window_specification", "opt_existing_window_name", - "opt_partition_clause", "opt_frame_clause", "frame_extent", - "frame_bound", "qualified_row", "row", "dict_arg", "dict_arguments", - "sub_type", "all_Op", "MathOp", "qual_Op", "qual_all_Op", "subquery_Op", - "any_operator", "expr_list", "opt_expr_list", "func_arg_list", - "func_arg_expr", "type_list", "extract_list", "extract_arg", - "overlay_list", "overlay_placing", "position_list", "substr_list", - "substr_from", "substr_for", "trim_list", "in_expr", "case_expr", - "when_clause_list", "when_clause", "case_default", "case_arg", - "columnref", "indirection_el", "opt_slice_bound", "indirection", - "opt_indirection", "opt_asymmetric", "opt_target_list", "target_list", + "export_clause", "window_clause", "window_definition_list", + "window_definition", "over_clause", "window_specification", + "opt_existing_window_name", "opt_partition_clause", "opt_frame_clause", + "frame_extent", "frame_bound", "qualified_row", "row", "dict_arg", + "dict_arguments", "dict_arguments_opt_comma", "sub_type", "all_Op", + "MathOp", "qual_Op", "qual_all_Op", "subquery_Op", "any_operator", + "expr_list", "expr_list_opt_comma", "opt_expr_list_opt_comma", + "func_arg_list", "func_arg_expr", "type_list", "extract_list", + "extract_arg", "overlay_list", "overlay_placing", "position_list", + "substr_list", "substr_from", "substr_for", "trim_list", "in_expr", + "case_expr", "when_clause_list", "when_clause", "case_default", + "case_arg", "columnref", "indirection_el", "opt_slice_bound", + "indirection", "opt_indirection", "opt_asymmetric", + "opt_target_list_opt_comma", "target_list", "target_list_opt_comma", "target_el", "except_list", "opt_except_list", "replace_list_el", - "replace_list", "opt_replace_list", "qualified_name_list", - "qualified_name", "name_list", "name", "attr_name", "func_name", - "AexprConst", "Iconst", "Sconst", "ColId", "ColIdOrString", - "type_function_name", "function_name_token", "type_name_token", - "any_name", "attrs", "opt_name_list", "param_name", "ColLabel", - "ColLabelOrString", "PrepareStmt", "prep_type_clause", "PreparableStmt", - "CreateSchemaStmt", "OptSchemaEltList", "schema_stmt", "IndexStmt", - "access_method", "access_method_clause", "opt_concurrently", - "opt_index_name", "opt_reloptions", "opt_unique", - "AlterObjectSchemaStmt", "CheckPointStmt", "ExportStmt", "ImportStmt", - "ExplainStmt", "opt_verbose", "explain_option_arg", "ExplainableStmt", - "NonReservedWord", "NonReservedWord_or_Sconst", "explain_option_list", - "analyze_keyword", "opt_boolean_or_string", "explain_option_elem", - "explain_option_name", "VariableSetStmt", "set_rest", "generic_set", - "var_value", "zone_value", "var_list", "LoadStmt", "file_name", + "replace_list", "replace_list_opt_comma", "opt_replace_list", + "qualified_name_list", "qualified_name", "name_list", + "name_list_opt_comma", "name", "attr_name", "func_name", "AexprConst", + "Iconst", "Sconst", "ColId", "ColIdOrString", "type_function_name", + "function_name_token", "type_name_token", "any_name", "attrs", + "opt_name_list", "param_name", "ColLabel", "ColLabelOrString", "VacuumStmt", "vacuum_option_elem", "opt_full", "vacuum_option_list", - "opt_freeze", "DeleteStmt", "relation_expr_opt_alias", - "where_or_current_clause", "using_clause", "AnalyzeStmt", - "VariableResetStmt", "generic_reset", "reset_rest", "VariableShowStmt", - "show_or_describe", "var_name", "CallStmt", "ViewStmt", - "opt_check_option", "CreateAsStmt", "opt_with_data", "create_as_target", - "unreserved_keyword", "col_name_keyword", "func_name_keyword", - "type_name_keyword", "other_keyword", "type_func_name_keyword", - "reserved_keyword", 0 + "opt_freeze", "TransactionStmt", "opt_transaction", "VariableResetStmt", + "generic_reset", "reset_rest", "UpdateStmt", "DeallocateStmt", + "PragmaStmt", "CreateFunctionStmt", "macro_alias", "param_list", + "AlterTableStmt", "alter_identity_column_option_list", + "alter_column_default", "alter_identity_column_option", + "alter_generic_option_list", "alter_table_cmd", "alter_using", + "alter_generic_option_elem", "alter_table_cmds", "alter_generic_options", + "opt_set_data", "CreateSchemaStmt", "OptSchemaEltList", "schema_stmt", + "VariableShowStmt", "show_or_describe", "var_name", "CreateStmt", + "ConstraintAttributeSpec", "def_arg", "OptParenthesizedSeqOptList", + "generic_option_arg", "key_action", "ColConstraint", "ColConstraintElem", + "generic_option_elem", "key_update", "key_actions", + "create_generic_options", "OnCommitOption", "reloptions", + "opt_no_inherit", "TableConstraint", "TableLikeOption", "reloption_list", + "ExistingIndex", "ConstraintAttr", "OptWith", "definition", + "TableLikeOptionList", "generic_option_name", "ConstraintAttributeElem", + "columnDef", "generic_option_list", "def_list", "index_name", + "TableElement", "def_elem", "opt_definition", "OptTableElementList", + "columnElem", "opt_column_list", "ColQualList", "key_delete", + "reloption_elem", "columnList", "columnList_opt_comma", "func_type", + "ConstraintElem", "TableElementList", "key_match", "TableLikeClause", + "OptTemp", "generated_when", "RenameStmt", "opt_column", "DropStmt", + "drop_type_any_name", "drop_type_name", "any_name_list", + "opt_drop_behavior", "drop_type_name_on_any_name", "type_name_list", + "LoadStmt", "file_name", "InsertStmt", "insert_rest", "insert_target", + "opt_conf_expr", "opt_with_clause", "insert_column_item", "set_clause", + "opt_on_conflict", "index_elem", "returning_clause", "override_kind", + "set_target_list", "opt_collate", "opt_class", "insert_column_list", + "set_clause_list", "set_clause_list_opt_comma", "index_params", + "set_target", "ExecuteStmt", "execute_param_clause", "AnalyzeStmt", + "ExportStmt", "ImportStmt", "ExplainStmt", "opt_verbose", + "explain_option_arg", "ExplainableStmt", "NonReservedWord", + "NonReservedWord_or_Sconst", "explain_option_list", "analyze_keyword", + "opt_boolean_or_string", "explain_option_elem", "explain_option_name", + "CreateSeqStmt", "OptSeqOptList", "AlterSeqStmt", "SeqOptList", + "opt_with", "NumericOnly", "SeqOptElem", "opt_by", "SignedIconst", + "AlterObjectSchemaStmt", "CreateEnumStmt", "opt_enum_val_list", + "enum_val_list", "VariableSetStmt", "set_rest", "generic_set", + "var_value", "zone_value", "var_list", "IndexStmt", "access_method", + "access_method_clause", "opt_concurrently", "opt_index_name", + "opt_reloptions", "opt_unique", "CheckPointStmt", "CallStmt", "CopyStmt", + "copy_from", "copy_delimiter", "copy_generic_opt_arg_list", "opt_using", + "opt_as", "opt_program", "copy_options", "copy_generic_opt_arg", + "copy_generic_opt_elem", "opt_oids", "copy_opt_list", "opt_binary", + "copy_opt_item", "copy_generic_opt_arg_list_item", "copy_file_name", + "copy_generic_opt_list", "unreserved_keyword", "col_name_keyword", + "func_name_keyword", "type_name_keyword", "other_keyword", + "type_func_name_keyword", "reserved_keyword", 0 }; #endif @@ -233267,196 +244244,199 @@ static const yytype_uint16 yytoknum[] = 705, 706, 707, 708, 709, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 730, 731, 732, 733, 734, - 60, 62, 61, 735, 43, 45, 42, 47, 37, 94, - 736, 91, 93, 40, 41, 46, 59, 44, 123, 125, - 35, 63, 58 + 735, 736, 60, 62, 61, 737, 43, 45, 42, 47, + 37, 94, 738, 91, 93, 40, 41, 46, 59, 44, + 123, 125, 35, 63, 58 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { - 0, 503, 504, 505, 505, 506, 506, 506, 506, 506, - 506, 506, 506, 506, 506, 506, 506, 506, 506, 506, - 506, 506, 506, 506, 506, 506, 506, 506, 506, 506, - 506, 506, 506, 506, 506, 506, 506, 506, 506, 506, - 507, 507, 507, 507, 507, 507, 507, 507, 508, 508, - 509, 509, 510, 510, 510, 510, 511, 511, 512, 512, - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, - 512, 512, 512, 512, 512, 512, 512, 512, 512, 512, - 512, 512, 512, 512, 512, 512, 512, 513, 513, 514, - 514, 514, 514, 515, 515, 516, 517, 517, 517, 518, - 518, 518, 518, 519, 520, 520, 521, 521, 522, 522, - 522, 522, 522, 522, 522, 522, 522, 522, 522, 522, - 522, 523, 523, 524, 525, 525, 525, 525, 525, 526, - 526, 527, 527, 527, 528, 528, 529, 530, 530, 531, - 531, 531, 532, 532, 532, 533, 533, 534, 534, 535, - 535, 536, 536, 537, 537, 538, 538, 539, 539, 540, - 540, 541, 542, 542, 542, 543, 543, 544, 544, 545, - 545, 545, 546, 546, 547, 547, 548, 548, 549, 549, - 549, 550, 550, 550, 550, 551, 551, 551, 551, 551, - 551, 551, 551, 551, 551, 551, 551, 551, 551, 552, - 552, 553, 553, 553, 554, 554, 554, 554, 554, 554, - 555, 555, 555, 556, 556, 556, 557, 557, 558, 558, - 558, 558, 558, 558, 559, 559, 560, 561, 561, 561, - 561, 561, 562, 562, 562, 562, 563, 563, 563, 563, - 563, 563, 563, 563, 563, 564, 565, 566, 566, 566, - 566, 566, 567, 567, 568, 568, 568, 568, 569, 570, - 570, 571, 571, 572, 572, 572, 572, 572, 572, 572, - 572, 573, 573, 574, 575, 575, 575, 575, 576, 576, - 576, 576, 577, 578, 578, 578, 579, 580, 580, 580, - 580, 580, 580, 581, 582, 582, 583, 583, 584, 585, - 585, 585, 586, 586, 587, 587, 588, 588, 589, 590, - 590, 591, 591, 592, 593, 593, 593, 593, 594, 594, - 595, 595, 595, 596, 596, 596, 596, 596, 596, 597, - 597, 598, 598, 598, 598, 599, 600, 600, 600, 600, - 600, 600, 600, 600, 601, 601, 602, 602, 602, 602, - 602, 602, 602, 602, 603, 603, 603, 603, 603, 603, - 603, 603, 603, 603, 603, 603, 603, 603, 603, 604, - 604, 604, 604, 604, 604, 604, 605, 605, 606, 606, - 606, 607, 607, 607, 608, 608, 609, 610, 610, 611, - 611, 612, 613, 613, 614, 614, 615, 615, 616, 616, - 617, 617, 618, 618, 619, 619, 620, 620, 621, 621, - 621, 621, 621, 622, 623, 623, 624, 624, 625, 625, - 626, 626, 626, 626, 626, 626, 626, 626, 626, 626, - 626, 626, 626, 626, 627, 628, 628, 628, 629, 629, - 630, 630, 631, 631, 632, 632, 632, 632, 632, 632, - 632, 632, 633, 633, 634, 634, 634, 634, 634, 634, - 634, 635, 635, 635, 636, 636, 637, 638, 638, 639, - 639, 639, 639, 639, 639, 639, 639, 639, 640, 640, - 641, 641, 641, 642, 642, 643, 643, 644, 644, 644, - 645, 645, 646, 646, 646, 647, 647, 648, 648, 649, - 649, 649, 650, 650, 650, 651, 651, 651, 651, 652, - 652, 653, 653, 653, 653, 654, 654, 655, 655, 655, - 655, 655, 655, 656, 656, 657, 657, 658, 658, 658, - 658, 659, 660, 660, 661, 661, 662, 662, 662, 662, - 662, 663, 664, 664, 664, 665, 665, 666, 666, 667, - 667, 668, 668, 668, 668, 669, 669, 670, 670, 670, - 670, 670, 671, 672, 673, 674, 675, 675, 676, 676, - 677, 677, 678, 678, 679, 679, 680, 680, 681, 682, - 682, 682, 682, 683, 683, 684, 684, 684, 685, 685, - 686, 686, 687, 687, 688, 688, 688, 688, 688, 688, - 688, 689, 689, 689, 689, 689, 689, 690, 690, 690, - 690, 691, 691, 692, 692, 692, 692, 692, 693, 693, - 693, 693, 694, 694, 695, 695, 696, 696, 696, 696, - 697, 697, 698, 699, 699, 700, 700, 701, 701, 702, - 702, 703, 703, 704, 705, 705, 706, 706, 707, 707, - 708, 708, 708, 708, 708, 708, 708, 708, 709, 709, - 709, 710, 710, 710, 710, 710, 710, 710, 711, 711, - 711, 711, 712, 713, 713, 714, 714, 714, 714, 714, - 714, 714, 714, 714, 714, 714, 715, 715, 716, 716, - 717, 717, 718, 719, 720, 720, 721, 721, 722, 723, - 724, 724, 724, 724, 724, 724, 725, 725, 726, 726, - 726, 726, 727, 728, 728, 728, 729, 729, 730, 730, - 731, 731, 732, 732, 733, 733, 734, 734, 735, 735, - 736, 736, 737, 737, 737, 737, 737, 737, 737, 737, - 737, 737, 737, 737, 737, 737, 737, 737, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 738, 738, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 739, 739, - 740, 740, 740, 740, 740, 740, 740, 740, 740, 740, - 740, 740, 741, 741, 741, 741, 741, 741, 741, 742, - 742, 743, 743, 744, 744, 744, 744, 744, 744, 744, - 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, - 744, 744, 744, 744, 744, 744, 744, 744, 744, 744, - 744, 744, 745, 745, 746, 746, 747, 747, 748, 748, - 749, 750, 750, 750, 751, 752, 752, 753, 753, 754, - 754, 754, 755, 755, 756, 756, 756, 756, 756, 757, - 757, 758, 758, 759, 760, 760, 761, 761, 761, 762, - 762, 763, 763, 763, 763, 763, 763, 763, 763, 763, - 763, 763, 763, 764, 764, 765, 765, 766, 766, 766, - 766, 766, 766, 766, 766, 767, 767, 768, 768, 769, - 769, 770, 770, 771, 771, 771, 772, 772, 773, 773, - 774, 774, 774, 774, 774, 774, 774, 774, 774, 774, - 775, 775, 776, 777, 777, 778, 778, 778, 778, 778, - 778, 779, 780, 781, 781, 781, 782, 782, 783, 784, - 784, 785, 786, 786, 787, 787, 788, 788, 789, 789, - 789, 790, 790, 791, 791, 792, 792, 793, 793, 794, - 794, 795, 795, 796, 796, 796, 796, 796, 797, 797, - 798, 798, 799, 800, 800, 801, 801, 801, 802, 802, - 803, 803, 804, 804, 805, 806, 807, 807, 808, 808, - 808, 808, 808, 808, 808, 808, 808, 808, 808, 808, - 808, 808, 809, 810, 811, 811, 811, 812, 812, 813, - 813, 813, 814, 814, 814, 815, 815, 815, 816, 816, - 817, 817, 818, 818, 819, 820, 820, 820, 820, 821, - 821, 822, 823, 823, 824, 824, 824, 824, 825, 825, - 826, 826, 827, 827, 827, 827, 828, 828, 829, 830, - 830, 831, 831, 832, 832, 833, 833, 834, 834, 835, - 835, 835, 835, 835, 835, 836, 836, 837, 838, 839, - 839, 839, 839, 840, 840, 841, 841, 841, 842, 842, - 842, 842, 842, 843, 843, 843, 844, 844, 845, 845, - 846, 846, 847, 847, 847, 847, 848, 849, 849, 850, - 850, 850, 850, 851, 851, 851, 851, 852, 852, 852, - 852, 853, 853, 854, 854, 854, 854, 854, 854, 854, - 855, 855, 856, 856, 856, 857, 857, 858, 858, 858, - 858, 858, 859, 859, 859, 859, 859, 860, 860, 861, - 861, 862, 862, 863, 864, 864, 864, 865, 865, 866, - 866, 867, 867, 868, 869, 869, 870, 870, 870, 871, - 871, 871, 871, 871, 871, 871, 872, 872, 873, 873, - 874, 875, 875, 875, 875, 876, 876, 876, 876, 877, - 877, 878, 878, 878, 879, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 880, - 880, 880, 880, 880, 880, 880, 880, 880, 880, 881, - 881, 881, 881, 881, 881, 881, 881, 881, 881, 881, - 881, 881, 881, 881, 881, 881, 881, 881, 881, 881, - 881, 881, 881, 881, 881, 881, 881, 881, 881, 881, - 881, 881, 881, 881, 881, 881, 881, 881, 881, 881, - 881, 881, 881, 881, 881, 881, 881, 881, 881, 881, - 881, 882, 882, 882, 882, 882, 882, 882, 882, 882, - 882, 882, 882, 882, 882, 882, 882, 882, 882, 882, - 882, 882, 882, 882, 882, 882, 882, 883, 883, 883, - 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, - 883, 883, 883, 883, 883, 883, 883, 883, 883, 883, - 883, 883, 884, 884, 884, 884, 884, 884, 884, 884, - 884, 884, 884, 884, 884, 884, 884, 884, 884, 884, - 884, 884, 884, 884, 884, 884, 884, 884, 884, 884, - 884, 884, 884, 884, 884, 884, 884, 884, 884, 884, - 884, 884, 884, 884, 884, 884, 884, 884, 884, 884, - 884, 884, 884, 884, 885, 885, 885, 885, 885, 885, - 885, 885, 885, 885, 885, 885, 885, 885, 885, 885, - 885, 885, 885, 885, 885, 885, 885, 885, 885, 885, - 885, 886, 886, 886, 886, 886, 886, 886, 886, 886, - 886, 886, 886, 886, 886, 886, 886, 886, 886, 886, - 886, 886, 886, 886, 886, 886, 886, 886, 886, 886, - 886, 886, 886, 886, 886, 886, 886, 886, 886, 886, - 886, 886, 886, 886, 886, 886, 886, 886, 886, 886, - 886, 886, 886, 886, 886, 886, 886, 886, 886, 886, - 886, 886, 886, 886, 886, 886, 886, 886, 886, 886, - 886, 886, 886, 886, 886, 886, 886, 886, 886 + 0, 505, 506, 507, 507, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 508, 508, 508, 508, 508, 508, 508, 508, 508, 508, + 509, 510, 510, 510, 511, 511, 512, 512, 513, 513, + 513, 514, 514, 514, 515, 516, 516, 516, 516, 517, + 517, 517, 517, 518, 519, 519, 520, 520, 520, 520, + 521, 521, 522, 522, 523, 523, 523, 523, 523, 523, + 523, 523, 524, 524, 525, 525, 525, 525, 525, 525, + 525, 526, 526, 526, 527, 527, 528, 529, 529, 530, + 530, 530, 530, 530, 530, 530, 530, 530, 531, 531, + 532, 532, 532, 533, 533, 534, 534, 535, 535, 535, + 536, 536, 537, 537, 537, 538, 538, 539, 539, 540, + 540, 540, 541, 541, 541, 542, 542, 542, 542, 543, + 543, 544, 544, 544, 544, 545, 545, 546, 546, 546, + 546, 546, 546, 547, 547, 548, 548, 549, 549, 549, + 549, 550, 551, 551, 552, 552, 553, 553, 553, 553, + 553, 554, 555, 555, 555, 556, 556, 557, 557, 558, + 558, 559, 559, 559, 559, 560, 560, 561, 561, 562, + 562, 562, 562, 562, 563, 564, 565, 566, 567, 567, + 568, 568, 569, 569, 570, 570, 571, 571, 572, 572, + 573, 574, 574, 574, 574, 575, 575, 576, 576, 576, + 577, 577, 578, 578, 579, 579, 580, 580, 581, 581, + 582, 582, 582, 582, 582, 582, 582, 583, 583, 583, + 583, 583, 583, 584, 584, 584, 584, 585, 585, 586, + 586, 586, 586, 586, 587, 587, 587, 587, 588, 588, + 589, 589, 590, 590, 590, 590, 591, 591, 592, 593, + 593, 594, 594, 595, 595, 596, 596, 597, 597, 598, + 599, 599, 600, 600, 601, 601, 602, 602, 602, 602, + 602, 602, 602, 602, 603, 603, 603, 604, 604, 604, + 604, 604, 604, 604, 605, 605, 605, 605, 606, 607, + 607, 608, 608, 608, 608, 608, 608, 608, 608, 608, + 608, 608, 609, 609, 610, 610, 611, 611, 612, 613, + 614, 614, 615, 615, 616, 617, 618, 618, 618, 618, + 618, 618, 619, 619, 620, 620, 620, 620, 621, 622, + 622, 622, 623, 623, 624, 624, 625, 625, 626, 626, + 627, 627, 628, 628, 629, 629, 630, 630, 631, 631, + 631, 631, 631, 631, 631, 631, 631, 631, 631, 631, + 631, 631, 631, 631, 632, 632, 632, 632, 632, 632, + 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, + 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, + 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, + 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, + 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, + 632, 632, 632, 632, 632, 632, 632, 632, 632, 632, + 632, 632, 633, 633, 633, 633, 633, 633, 633, 633, + 633, 633, 633, 633, 633, 633, 633, 633, 633, 633, + 633, 633, 633, 633, 633, 634, 634, 634, 634, 634, + 634, 634, 634, 634, 634, 634, 634, 635, 635, 635, + 635, 635, 635, 635, 636, 636, 637, 637, 638, 638, + 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, + 638, 638, 638, 638, 638, 638, 638, 638, 638, 638, + 638, 638, 638, 638, 638, 638, 638, 639, 639, 640, + 640, 641, 641, 642, 642, 643, 643, 644, 645, 645, + 645, 646, 647, 647, 648, 648, 649, 649, 649, 650, + 650, 651, 651, 651, 651, 651, 652, 652, 653, 653, + 654, 655, 655, 656, 656, 657, 657, 657, 658, 658, + 659, 659, 659, 659, 659, 659, 659, 659, 659, 659, + 659, 659, 660, 660, 661, 661, 662, 662, 662, 662, + 662, 662, 662, 662, 663, 663, 664, 664, 665, 665, + 666, 666, 667, 667, 668, 668, 668, 669, 669, 670, + 670, 671, 671, 671, 671, 671, 671, 671, 671, 671, + 671, 672, 672, 673, 674, 674, 675, 675, 675, 675, + 675, 675, 676, 677, 678, 678, 678, 679, 679, 680, + 681, 681, 682, 683, 683, 684, 684, 685, 685, 686, + 686, 686, 687, 687, 688, 688, 689, 689, 690, 690, + 691, 691, 692, 692, 693, 693, 694, 694, 694, 694, + 694, 695, 695, 696, 696, 697, 698, 698, 699, 699, + 700, 700, 700, 701, 701, 702, 702, 703, 703, 704, + 704, 705, 706, 707, 707, 708, 708, 708, 708, 708, + 708, 708, 708, 708, 708, 708, 708, 708, 708, 709, + 710, 711, 711, 711, 712, 712, 713, 713, 713, 714, + 714, 714, 715, 715, 715, 716, 716, 717, 717, 718, + 718, 719, 720, 720, 720, 720, 721, 721, 722, 722, + 722, 722, 722, 723, 723, 723, 723, 723, 724, 724, + 725, 725, 726, 726, 727, 727, 727, 727, 727, 727, + 728, 728, 728, 729, 730, 730, 731, 731, 731, 732, + 733, 733, 733, 733, 734, 734, 734, 735, 735, 736, + 736, 737, 737, 738, 738, 738, 738, 738, 738, 738, + 738, 739, 739, 740, 740, 741, 741, 741, 741, 742, + 742, 743, 743, 743, 743, 743, 743, 743, 743, 743, + 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, + 743, 743, 743, 743, 743, 743, 743, 743, 743, 743, + 744, 744, 745, 745, 745, 745, 746, 746, 747, 748, + 748, 748, 749, 749, 750, 750, 751, 751, 751, 751, + 752, 752, 752, 752, 752, 752, 752, 752, 753, 753, + 754, 754, 755, 755, 755, 756, 756, 757, 757, 757, + 757, 757, 757, 758, 758, 759, 760, 760, 760, 760, + 760, 761, 761, 761, 761, 762, 762, 762, 762, 762, + 762, 762, 762, 762, 763, 764, 765, 765, 765, 765, + 765, 766, 766, 767, 767, 767, 767, 768, 769, 769, + 770, 770, 771, 771, 771, 771, 771, 771, 771, 771, + 772, 772, 773, 774, 774, 774, 774, 775, 775, 775, + 775, 776, 777, 777, 777, 778, 779, 779, 779, 779, + 779, 779, 780, 781, 781, 782, 782, 783, 784, 784, + 784, 785, 785, 786, 786, 787, 787, 787, 788, 789, + 789, 790, 790, 791, 792, 792, 792, 792, 793, 793, + 794, 794, 795, 795, 795, 796, 796, 796, 796, 796, + 796, 797, 797, 798, 798, 798, 798, 799, 800, 800, + 800, 800, 800, 800, 800, 800, 801, 801, 802, 802, + 802, 802, 802, 802, 802, 802, 802, 802, 802, 802, + 802, 803, 803, 804, 804, 804, 804, 804, 804, 804, + 804, 805, 805, 805, 805, 805, 805, 805, 805, 805, + 805, 805, 805, 805, 805, 805, 805, 806, 806, 806, + 806, 806, 806, 806, 807, 807, 808, 808, 808, 809, + 809, 809, 810, 810, 811, 811, 811, 812, 812, 813, + 814, 814, 814, 814, 814, 815, 815, 816, 816, 816, + 817, 817, 818, 819, 819, 820, 820, 820, 821, 821, + 821, 822, 822, 823, 823, 824, 824, 825, 825, 826, + 826, 827, 827, 828, 828, 829, 829, 830, 830, 831, + 832, 832, 832, 833, 833, 834, 834, 835, 836, 837, + 837, 837, 837, 838, 838, 839, 839, 839, 840, 840, + 840, 840, 840, 841, 841, 841, 842, 842, 843, 843, + 844, 844, 845, 845, 845, 845, 846, 847, 847, 848, + 848, 849, 849, 850, 850, 851, 851, 852, 852, 852, + 853, 853, 853, 853, 854, 854, 854, 854, 854, 854, + 854, 854, 854, 854, 854, 854, 854, 854, 855, 855, + 856, 856, 856, 857, 857, 857, 857, 857, 857, 858, + 859, 859, 860, 860, 861, 861, 861, 861, 862, 862, + 862, 862, 863, 863, 863, 863, 864, 864, 865, 865, + 865, 865, 865, 865, 865, 866, 866, 867, 867, 868, + 869, 869, 870, 870, 871, 871, 872, 872, 873, 873, + 874, 874, 875, 876, 876, 877, 877, 878, 878, 879, + 879, 880, 880, 881, 881, 882, 882, 883, 883, 884, + 884, 884, 884, 884, 885, 886, 886, 887, 887, 888, + 888, 889, 889, 889, 889, 889, 889, 889, 889, 889, + 889, 889, 889, 889, 889, 890, 891, 891, 891, 892, + 892, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 893, 893, 893, + 893, 893, 893, 893, 893, 893, 893, 894, 894, 894, + 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, + 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, + 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, + 894, 894, 894, 894, 894, 894, 894, 894, 894, 894, + 894, 894, 894, 894, 894, 894, 894, 894, 894, 895, + 895, 895, 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 895, 895, 895, 895, 895, + 895, 895, 895, 895, 895, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, + 896, 896, 896, 896, 896, 896, 896, 896, 896, 896, + 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + 897, 897, 897, 897, 897, 897, 897, 897, 897, 897, + 897, 897, 898, 898, 898, 898, 898, 898, 898, 898, + 898, 898, 898, 898, 898, 898, 898, 898, 898, 898, + 898, 898, 898, 898, 898, 898, 898, 898, 898, 899, + 899, 899, 899, 899, 899, 899, 899, 899, 899, 899, + 899, 899, 899, 899, 899, 899, 899, 899, 899, 899, + 899, 899, 899, 899, 899, 899, 899, 899, 899, 899, + 899, 899, 899, 899, 899, 899, 899, 899, 899, 899, + 899, 899, 899, 899, 899, 899, 899, 899, 899, 899, + 899, 899, 899, 899, 899, 899, 899, 899, 899, 899, + 899, 899, 899, 899, 899, 899, 899, 899, 899, 899, + 899, 899, 899, 899, 899, 899, 899 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -233466,46 +244446,9 @@ static const yytype_uint8 yyr2[] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 4, 6, 4, 6, 4, 6, 4, 6, 1, 2, - 3, 2, 1, 3, 2, 3, 1, 3, 2, 5, - 3, 6, 4, 6, 6, 6, 5, 5, 6, 9, - 4, 5, 7, 6, 4, 8, 4, 2, 4, 3, - 6, 4, 2, 2, 2, 2, 1, 2, 0, 1, - 2, 2, 2, 1, 3, 4, 2, 1, 0, 2, - 3, 2, 3, 8, 1, 0, 1, 3, 6, 6, - 8, 6, 8, 6, 8, 6, 8, 8, 10, 8, - 10, 1, 0, 7, 1, 4, 4, 7, 2, 1, - 3, 4, 3, 0, 1, 0, 2, 3, 5, 8, - 5, 0, 5, 5, 7, 2, 0, 1, 1, 1, - 3, 2, 0, 1, 0, 1, 3, 1, 3, 1, - 3, 2, 2, 4, 5, 5, 8, 1, 0, 3, - 9, 12, 3, 0, 4, 6, 1, 2, 1, 1, - 0, 1, 2, 2, 1, 2, 2, 1, 2, 3, - 2, 2, 2, 2, 3, 3, 3, 1, 3, 1, - 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, - 1, 1, 0, 9, 12, 11, 0, 2, 1, 1, - 1, 1, 1, 1, 3, 0, 1, 2, 1, 1, - 2, 2, 3, 1, 1, 2, 2, 1, 2, 3, - 5, 3, 2, 5, 5, 2, 3, 1, 1, 2, - 2, 0, 4, 0, 3, 4, 4, 0, 3, 2, - 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 3, 3, 1, 2, 2, 2, 2, 2, - 2, 0, 3, 3, 3, 0, 1, 2, 1, 2, - 2, 2, 2, 4, 1, 3, 1, 3, 1, 1, - 1, 1, 3, 1, 2, 0, 1, 0, 1, 3, - 0, 2, 0, 3, 3, 1, 5, 3, 1, 3, - 1, 4, 5, 5, 6, 3, 7, 4, 11, 1, - 3, 2, 2, 2, 0, 3, 1, 1, 2, 2, - 2, 2, 1, 0, 1, 2, 6, 4, 6, 4, - 6, 8, 4, 6, 1, 1, 1, 1, 1, 2, - 1, 2, 1, 1, 1, 3, 3, 3, 3, 2, - 2, 1, 3, 1, 1, 1, 1, 3, 1, 1, - 0, 1, 1, 1, 1, 3, 6, 1, 1, 2, - 3, 8, 11, 9, 1, 1, 3, 0, 1, 3, - 1, 0, 1, 0, 1, 0, 1, 3, 1, 1, - 1, 3, 0, 2, 2, 0, 2, 0, 1, 0, - 1, 1, 1, 3, 3, 1, 1, 3, 3, 3, - 3, 4, 3, 2, 1, 1, 1, 1, 1, 3, + 7, 1, 2, 3, 2, 0, 2, 0, 7, 10, + 9, 2, 3, 0, 4, 9, 11, 12, 14, 3, + 4, 4, 0, 5, 3, 0, 1, 1, 1, 1, 1, 1, 3, 3, 1, 2, 4, 4, 2, 3, 5, 5, 1, 1, 11, 11, 1, 2, 4, 4, 4, 2, 2, 3, 1, 3, 6, 2, 0, 3, @@ -233517,76 +244460,116 @@ static const yytype_uint8 yyr2[] = 2, 1, 2, 3, 0, 1, 0, 5, 1, 4, 6, 2, 1, 0, 4, 0, 1, 1, 2, 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, - 1, 3, 3, 3, 0, 1, 3, 1, 1, 1, - 1, 1, 2, 4, 4, 5, 1, 1, 2, 0, - 2, 0, 1, 3, 1, 0, 1, 2, 3, 2, - 4, 2, 3, 2, 0, 1, 2, 0, 4, 5, - 2, 0, 1, 3, 3, 3, 3, 3, 3, 1, - 4, 3, 4, 5, 4, 5, 4, 5, 2, 4, - 1, 1, 0, 1, 4, 5, 4, 0, 2, 2, - 2, 1, 1, 0, 4, 2, 1, 2, 2, 4, - 2, 6, 2, 1, 3, 4, 0, 2, 0, 2, - 0, 1, 3, 3, 2, 0, 2, 4, 1, 1, - 2, 3, 5, 6, 2, 3, 5, 5, 3, 4, - 0, 1, 1, 1, 1, 1, 2, 4, 1, 1, - 1, 1, 2, 3, 0, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 1, 3, 0, 1, 1, - 1, 1, 5, 2, 1, 1, 1, 1, 4, 1, - 2, 2, 1, 3, 3, 2, 1, 0, 5, 2, - 5, 2, 1, 3, 3, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 3, 3, 3, 3, 3, 3, 0, 1, 3, - 3, 5, 2, 2, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, - 3, 2, 2, 3, 3, 5, 4, 6, 3, 5, - 4, 6, 4, 6, 5, 7, 3, 2, 4, 3, - 2, 1, 3, 3, 3, 3, 3, 3, 4, 3, - 4, 3, 4, 5, 6, 6, 7, 6, 7, 6, - 7, 3, 4, 4, 6, 1, 4, 1, 3, 2, - 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 2, 2, 5, 6, 6, 7, - 1, 1, 2, 2, 2, 4, 1, 2, 1, 2, - 2, 4, 3, 6, 7, 9, 7, 7, 4, 4, - 1, 1, 1, 5, 1, 1, 4, 1, 4, 1, - 4, 1, 4, 1, 1, 1, 1, 1, 1, 6, - 6, 4, 4, 4, 4, 6, 5, 5, 5, 4, - 6, 4, 5, 0, 5, 0, 2, 0, 1, 3, - 3, 2, 2, 0, 6, 1, 0, 3, 0, 2, - 2, 0, 1, 4, 2, 2, 2, 2, 2, 4, - 3, 1, 5, 3, 1, 3, 1, 1, 1, 1, + 1, 3, 3, 3, 0, 1, 3, 1, 2, 1, + 1, 1, 1, 1, 2, 4, 4, 5, 1, 1, + 2, 0, 2, 0, 1, 3, 1, 0, 1, 2, + 3, 2, 4, 2, 3, 2, 0, 1, 2, 0, + 4, 5, 1, 2, 2, 0, 1, 3, 1, 2, + 3, 3, 3, 3, 3, 1, 4, 3, 4, 5, + 4, 5, 4, 5, 2, 4, 1, 1, 0, 1, + 4, 5, 4, 0, 2, 2, 2, 1, 1, 0, + 4, 2, 1, 2, 2, 4, 2, 6, 2, 1, + 3, 4, 0, 2, 0, 2, 0, 1, 3, 3, + 2, 0, 2, 4, 1, 1, 2, 3, 5, 6, + 2, 3, 5, 5, 3, 4, 0, 1, 1, 1, + 1, 1, 2, 4, 1, 1, 1, 1, 2, 3, + 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, + 2, 1, 3, 0, 1, 1, 1, 1, 5, 2, + 1, 1, 1, 1, 4, 1, 2, 2, 1, 3, + 3, 2, 1, 0, 5, 2, 5, 2, 1, 3, + 3, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 4, 1, 4, 1, 4, 1, - 2, 1, 2, 1, 2, 1, 3, 1, 3, 1, - 0, 1, 3, 1, 3, 3, 1, 3, 3, 0, + 1, 1, 1, 1, 1, 1, 3, 3, 3, 3, + 3, 3, 3, 0, 1, 3, 3, 5, 2, 2, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 2, 2, 3, 3, 2, 2, 3, + 3, 5, 4, 6, 3, 5, 4, 6, 4, 6, + 5, 7, 3, 2, 4, 3, 2, 1, 3, 3, + 3, 3, 3, 4, 3, 4, 3, 4, 5, 6, + 6, 7, 6, 7, 6, 7, 3, 4, 4, 6, + 1, 4, 1, 3, 2, 2, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, + 2, 5, 6, 6, 7, 1, 1, 2, 2, 2, + 4, 1, 2, 1, 2, 2, 4, 3, 6, 7, + 9, 7, 7, 4, 5, 1, 1, 1, 5, 1, + 1, 4, 1, 4, 1, 4, 1, 4, 1, 1, + 1, 1, 1, 1, 6, 6, 4, 4, 4, 4, + 6, 5, 5, 5, 4, 6, 4, 5, 0, 5, + 0, 1, 0, 2, 0, 1, 3, 3, 2, 2, + 0, 6, 1, 0, 3, 0, 2, 2, 0, 1, + 4, 2, 2, 2, 2, 2, 4, 3, 1, 5, + 3, 1, 3, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 4, 3, 2, 3, 0, 3, 3, 2, 2, 1, - 0, 2, 2, 3, 2, 1, 1, 3, 5, 1, - 2, 4, 2, 0, 1, 0, 1, 2, 2, 3, - 5, 1, 0, 1, 2, 0, 2, 1, 0, 1, - 0, 1, 3, 3, 2, 1, 3, 5, 4, 2, - 1, 0, 3, 1, 3, 4, 2, 0, 1, 3, - 1, 2, 1, 3, 1, 1, 1, 2, 1, 1, - 2, 1, 1, 2, 7, 2, 5, 3, 3, 1, + 1, 1, 1, 4, 1, 4, 1, 4, 1, 2, + 1, 2, 1, 2, 1, 3, 1, 3, 1, 2, + 1, 0, 1, 3, 1, 3, 3, 1, 3, 3, + 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 4, 3, 2, 3, 0, 3, 3, 2, 2, + 1, 0, 2, 2, 3, 2, 1, 1, 3, 5, + 1, 2, 4, 2, 0, 1, 0, 1, 2, 2, + 3, 5, 1, 0, 1, 2, 0, 2, 1, 0, + 1, 0, 1, 3, 1, 2, 3, 2, 1, 3, + 5, 4, 2, 1, 0, 3, 1, 3, 1, 2, + 4, 2, 0, 1, 3, 1, 2, 1, 3, 1, + 2, 1, 1, 1, 2, 1, 1, 2, 1, 1, + 2, 7, 2, 5, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, - 2, 3, 3, 0, 1, 1, 1, 1, 1, 1, - 1, 5, 3, 0, 1, 1, 1, 1, 4, 7, - 2, 0, 1, 1, 1, 1, 13, 16, 1, 2, - 0, 1, 0, 1, 0, 2, 0, 1, 0, 6, - 8, 6, 8, 6, 8, 2, 1, 4, 3, 2, + 1, 1, 1, 1, 1, 1, 2, 2, 3, 3, + 0, 1, 1, 1, 1, 1, 1, 1, 4, 5, + 5, 4, 6, 1, 1, 1, 1, 1, 1, 0, + 1, 3, 1, 0, 2, 2, 2, 2, 2, 2, + 1, 1, 0, 2, 1, 1, 1, 2, 3, 8, + 2, 3, 2, 3, 2, 4, 5, 8, 7, 1, + 1, 2, 3, 4, 6, 4, 6, 4, 6, 4, + 6, 1, 2, 3, 2, 1, 3, 2, 3, 1, + 3, 2, 5, 3, 6, 4, 6, 6, 6, 5, + 5, 6, 9, 4, 5, 7, 6, 4, 8, 4, + 2, 4, 3, 6, 4, 2, 2, 2, 2, 1, + 2, 0, 1, 2, 2, 2, 1, 3, 4, 2, + 1, 0, 4, 7, 2, 0, 1, 1, 1, 1, + 2, 2, 2, 2, 3, 4, 2, 1, 1, 1, + 1, 3, 9, 12, 11, 0, 2, 1, 1, 1, + 1, 1, 1, 3, 0, 1, 2, 1, 1, 2, + 2, 3, 1, 1, 2, 2, 1, 2, 3, 5, + 3, 2, 5, 5, 2, 3, 1, 1, 2, 2, + 0, 4, 0, 3, 4, 4, 0, 3, 2, 0, + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 3, 3, 1, 2, 2, 2, 2, 2, 2, + 0, 3, 3, 3, 0, 1, 2, 1, 2, 2, + 2, 2, 4, 1, 3, 1, 3, 1, 1, 1, + 1, 3, 1, 2, 0, 1, 2, 0, 1, 3, + 0, 2, 0, 3, 3, 1, 5, 3, 1, 3, + 1, 2, 1, 4, 5, 5, 6, 3, 7, 4, + 11, 1, 3, 2, 2, 2, 0, 3, 1, 1, + 2, 2, 2, 2, 1, 0, 1, 2, 6, 6, + 8, 6, 8, 6, 8, 6, 8, 8, 10, 8, + 10, 1, 0, 6, 4, 6, 4, 6, 8, 4, + 6, 1, 1, 1, 1, 2, 1, 2, 1, 2, + 1, 1, 1, 3, 3, 3, 3, 2, 2, 1, + 3, 1, 1, 1, 1, 3, 1, 1, 0, 1, + 1, 1, 1, 3, 2, 2, 3, 1, 1, 7, + 1, 4, 4, 7, 2, 1, 3, 4, 3, 0, + 1, 0, 2, 3, 5, 8, 5, 0, 5, 5, + 7, 2, 0, 1, 1, 1, 3, 2, 0, 1, + 0, 1, 3, 1, 3, 1, 2, 1, 3, 2, + 3, 9, 12, 3, 0, 2, 4, 4, 3, 2, 4, 3, 5, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, - 1, 1, 1, 1, 1, 1, 2, 1, 1, 2, - 3, 3, 3, 1, 3, 3, 2, 3, 3, 3, - 3, 1, 1, 1, 1, 3, 5, 1, 1, 1, - 1, 3, 2, 2, 3, 1, 1, 4, 5, 5, - 4, 6, 1, 1, 1, 1, 1, 1, 0, 1, - 3, 1, 0, 7, 1, 2, 3, 2, 0, 2, - 0, 2, 4, 2, 1, 1, 1, 2, 3, 2, - 2, 2, 2, 3, 4, 2, 1, 1, 1, 3, - 2, 9, 11, 12, 14, 3, 4, 4, 0, 7, - 10, 2, 3, 0, 4, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 2, 1, 1, 5, + 8, 1, 0, 4, 6, 1, 2, 1, 1, 0, + 1, 2, 2, 1, 2, 2, 1, 2, 3, 2, + 2, 2, 2, 3, 3, 3, 1, 3, 1, 0, + 1, 2, 2, 6, 8, 6, 8, 6, 8, 8, + 1, 0, 1, 3, 2, 3, 3, 3, 1, 3, + 3, 2, 3, 3, 3, 3, 1, 1, 1, 1, + 3, 5, 1, 1, 1, 1, 3, 13, 16, 1, + 2, 0, 1, 0, 1, 0, 2, 0, 1, 0, + 2, 1, 2, 11, 9, 1, 1, 3, 0, 1, + 3, 1, 0, 1, 0, 1, 0, 1, 3, 1, + 1, 1, 3, 0, 2, 2, 0, 2, 0, 1, + 0, 1, 1, 1, 3, 3, 1, 1, 3, 3, + 3, 3, 4, 3, 2, 1, 1, 1, 1, 1, + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -233642,7 +244625,7 @@ static const yytype_uint8 yyr2[] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1 + 1, 1, 1, 1, 1, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -233650,6861 +244633,7199 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 135, 212, 0, 1151, 1150, 212, 0, 1126, 212, 419, - 343, 0, 1227, 0, 212, 0, 135, 0, 0, 0, - 0, 0, 0, 0, 0, 212, 486, 0, 1226, 212, - 0, 0, 1198, 0, 0, 0, 0, 0, 2, 4, - 7, 18, 13, 30, 26, 0, 28, 16, 21, 6, - 32, 17, 20, 14, 33, 11, 31, 453, 440, 491, - 452, 134, 456, 29, 15, 25, 5, 10, 23, 24, - 22, 1134, 36, 27, 34, 19, 8, 35, 37, 0, - 9, 38, 12, 211, 210, 204, 0, 0, 0, 0, - 0, 205, 1064, 1245, 1246, 1247, 1248, 1249, 1250, 1251, - 1252, 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, 1601, - 1261, 1262, 1263, 1549, 1550, 1602, 1551, 1552, 1264, 1265, - 1266, 1267, 1268, 1269, 1270, 1271, 1553, 1554, 1272, 1273, - 1274, 1275, 1276, 1555, 1603, 1277, 1278, 1279, 1280, 1281, - 1282, 1604, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1290, - 1291, 1605, 1292, 1293, 1294, 1606, 1295, 1296, 1297, 1298, - 1299, 1300, 1301, 1556, 1557, 1302, 1303, 1304, 1305, 1306, - 1307, 1308, 1309, 1310, 1311, 1312, 1313, 1314, 1315, 1316, - 1317, 1318, 1319, 1320, 1321, 1322, 1323, 1324, 1325, 1326, - 1327, 1328, 1329, 1558, 1330, 1331, 1332, 1333, 1559, 1334, - 1335, 1336, 1560, 1337, 1338, 1339, 1607, 1608, 1340, 1341, - 1342, 1609, 1343, 1344, 1561, 1562, 1345, 1346, 1347, 1348, - 1349, 1350, 1351, 1352, 1610, 1353, 1354, 1355, 1356, 1357, - 1358, 1359, 1360, 1361, 1362, 1363, 1611, 1563, 1364, 1365, - 1366, 1367, 1368, 1564, 1565, 1566, 1369, 1612, 1613, 1370, - 1614, 1371, 1372, 1373, 1374, 1375, 1376, 1615, 1377, 1616, - 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1567, 1386, - 1387, 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, 1396, - 1397, 1398, 1399, 1400, 1401, 1402, 1403, 1568, 1618, 1569, - 1404, 1405, 1406, 1570, 1407, 1408, 1619, 1409, 1571, 1410, - 1572, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1419, - 1573, 1620, 1420, 1621, 1574, 1421, 1422, 1423, 1424, 1425, - 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1575, 1433, 1434, - 1576, 1435, 1436, 1437, 1438, 1439, 1440, 1441, 1442, 1443, - 1444, 1445, 1446, 1577, 1447, 1448, 1449, 1450, 1451, 1452, - 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, 1462, - 1463, 1464, 1465, 1622, 1466, 1467, 1468, 1578, 1469, 1470, - 1471, 1472, 1473, 1474, 1475, 1476, 1477, 1478, 1479, 1480, - 1481, 1482, 1483, 1484, 1485, 1579, 1486, 1487, 1488, 1623, - 1489, 1490, 1580, 1491, 1492, 1493, 1494, 1495, 1496, 1497, - 1498, 1499, 1500, 1501, 1502, 1581, 1503, 1582, 1504, 1505, - 1506, 1507, 1625, 1508, 1509, 1510, 1511, 1512, 1583, 1584, - 1513, 1514, 1585, 1515, 1586, 1516, 1517, 1587, 1518, 1519, - 1520, 1521, 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, - 1530, 1531, 1532, 1588, 1589, 1533, 1626, 1534, 1535, 1536, - 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1590, 1591, - 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1545, - 1546, 1547, 1548, 1230, 0, 0, 1046, 1065, 1066, 1074, - 207, 418, 135, 0, 387, 0, 0, 388, 0, 0, - 337, 336, 0, 1117, 342, 0, 0, 0, 1064, 101, - 1567, 1435, 1581, 99, 1044, 1065, 0, 362, 363, 0, - 371, 0, 356, 360, 357, 0, 381, 373, 382, 374, - 355, 375, 364, 354, 0, 383, 0, 358, 0, 0, - 0, 208, 173, 343, 135, 0, 1139, 1140, 1138, 1129, - 1134, 1141, 1142, 0, 1125, 0, 0, 1063, 1185, 1186, - 1183, 1182, 162, 1093, 1215, 1583, 1513, 1228, 1216, 1213, - 1214, 209, 485, 483, 0, 1020, 1343, 1380, 1473, 1484, - 1583, 1159, 1163, 0, 206, 1588, 1220, 0, 1221, 1068, - 0, 457, 626, 1067, 1040, 1197, 0, 1202, 0, 1449, - 461, 464, 1083, 462, 453, 0, 1, 135, 0, 0, - 0, 482, 482, 0, 482, 0, 445, 453, 448, 452, - 0, 1133, 1211, 1225, 1583, 1513, 1219, 1222, 1351, 0, - 0, 1351, 0, 1351, 0, 1351, 0, 0, 1012, 0, - 1013, 1047, 1095, 1096, 1094, 0, 1097, 310, 341, 340, - 339, 338, 343, 1351, 1101, 1078, 0, 0, 0, 0, - 0, 0, 1112, 102, 100, 369, 370, 0, 361, 359, - 0, 1075, 1627, 678, 1628, 707, 685, 707, 707, 1629, - 1630, 1631, 1632, 674, 674, 1317, 687, 1633, 1634, 1635, - 1351, 1636, 1637, 675, 676, 712, 1638, 1639, 1640, 1641, - 1642, 0, 0, 1643, 707, 1644, 674, 1645, 1646, 679, - 1647, 648, 0, 1648, 677, 649, 1649, 715, 715, 1650, - 702, 1651, 380, 0, 384, 660, 661, 662, 663, 688, - 689, 664, 694, 695, 699, 665, 747, 674, 1076, 1077, - 1351, 380, 376, 1351, 380, 1042, 1351, 0, 0, 169, - 0, 1131, 1143, 1652, 1653, 1654, 1655, 1657, 1656, 1658, - 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1669, 1667, - 1668, 1670, 1671, 1672, 1673, 1674, 1675, 1676, 1677, 1678, - 1679, 1680, 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, - 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, 1698, - 1699, 1700, 1701, 1702, 1703, 1157, 0, 1158, 1148, 1137, - 1144, 1145, 135, 417, 1184, 1128, 0, 0, 0, 0, - 1217, 0, 0, 0, 1049, 1051, 1052, 943, 1062, 1015, - 0, 1550, 1551, 1552, 1005, 0, 1553, 1554, 1555, 1603, - 877, 864, 873, 878, 865, 867, 874, 1556, 1557, 815, - 1558, 1559, 1060, 1560, 1561, 1562, 1564, 1565, 1566, 869, - 871, 1568, 1569, 0, 1061, 1571, 1572, 1416, 1574, 1575, - 1577, 1578, 875, 1580, 1582, 1583, 1584, 1585, 1586, 1059, - 1587, 876, 1589, 0, 0, 0, 1031, 960, 0, 0, - 0, 1015, 848, 0, 0, 668, 669, 690, 691, 670, - 696, 697, 671, 0, 1025, 748, 893, 1015, 860, 921, - 791, 0, 846, 840, 468, 1021, 0, 841, 1048, 1015, - 1006, 468, 1019, 1162, 1160, 1166, 1161, 0, 0, 0, - 0, 0, 628, 627, 1041, 1196, 1194, 1195, 1193, 1192, - 1199, 0, 1201, 1134, 957, 0, 1006, 463, 0, 0, - 0, 443, 442, 3, 0, 0, 1204, 0, 480, 481, - 0, 0, 0, 0, 0, 0, 0, 0, 575, 507, - 508, 510, 572, 576, 584, 0, 449, 0, 1083, 1223, - 0, 0, 0, 122, 122, 0, 0, 0, 0, 0, - 93, 42, 86, 0, 0, 0, 0, 187, 200, 0, - 0, 0, 0, 0, 197, 0, 0, 180, 44, 174, - 176, 0, 122, 0, 40, 0, 0, 0, 46, 1064, - 0, 1601, 1602, 1603, 1604, 1605, 878, 0, 1607, 1608, - 1609, 1610, 1611, 1612, 1613, 1614, 1615, 1616, 1567, 1618, - 1619, 1620, 1621, 1622, 1623, 1581, 1625, 1587, 0, 1626, - 0, 852, 963, 491, 961, 1084, 0, 1065, 1071, 1011, - 0, 1085, 1731, 1732, 1733, 1734, 1735, 1736, 1737, 1738, - 1739, 1740, 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, - 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1758, - 1759, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, - 1769, 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, - 1779, 1780, 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788, - 1789, 1790, 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, - 1799, 1800, 1801, 1802, 1803, 1691, 1804, 1805, 1806, 1807, - 1808, 1008, 1045, 1087, 1086, 1088, 1014, 0, 0, 415, - 0, 0, 1098, 0, 1079, 0, 0, 1351, 168, 1351, - 310, 0, 310, 0, 0, 1111, 1114, 372, 368, 366, - 365, 367, 706, 693, 701, 700, 0, 683, 682, 681, - 0, 680, 0, 0, 707, 707, 705, 684, 660, 0, - 0, 0, 711, 0, 709, 378, 379, 0, 352, 0, - 654, 650, 0, 720, 721, 722, 723, 730, 731, 728, - 729, 724, 725, 718, 719, 726, 727, 716, 717, 0, - 732, 733, 734, 735, 736, 737, 738, 739, 666, 672, - 0, 0, 347, 0, 0, 349, 0, 0, 0, 0, - 135, 0, 181, 1153, 1154, 1152, 0, 0, 1136, 184, - 201, 1147, 1156, 1146, 1155, 1135, 1130, 0, 1127, 406, - 1172, 1171, 1180, 163, 0, 966, 0, 135, 1218, 1229, - 0, 844, 960, 1004, 0, 0, 0, 0, 0, 0, - 850, 969, 0, 0, 771, 0, 0, 0, 984, 0, - 990, 0, 0, 0, 772, 752, 753, 0, 1030, 1037, - 959, 0, 848, 957, 0, 924, 0, 1067, 0, 842, - 843, 849, 0, 1055, 0, 747, 747, 1024, 943, 0, - 940, 941, 942, 0, 0, 0, 1018, 0, 951, 953, - 0, 0, 787, 949, 0, 790, 0, 0, 0, 0, - 937, 938, 939, 931, 932, 933, 934, 935, 936, 947, - 930, 768, 0, 0, 895, 847, 0, 0, 767, 0, - 0, 0, 591, 0, 1053, 1050, 0, 1007, 591, 1174, - 1178, 1179, 1177, 0, 1173, 1165, 1164, 1169, 1167, 1170, - 1168, 0, 1190, 0, 1187, 588, 0, 465, 0, 0, - 1210, 0, 129, 0, 1205, 0, 460, 459, 501, 501, - 492, 495, 501, 458, 549, 550, 0, 0, 0, 0, - 581, 579, 1049, 1062, 537, 511, 536, 0, 0, 515, - 0, 541, 748, 574, 447, 505, 506, 509, 446, 0, - 577, 0, 587, 575, 510, 0, 1212, 1224, 0, 0, - 0, 0, 0, 1351, 0, 0, 77, 58, 262, 0, - 121, 0, 0, 0, 0, 0, 0, 0, 85, 82, - 83, 84, 0, 0, 0, 0, 185, 186, 199, 0, - 190, 191, 188, 192, 193, 0, 0, 178, 179, 0, - 0, 0, 0, 177, 0, 0, 0, 0, 0, 0, - 0, 0, 491, 491, 491, 858, 0, 489, 490, 0, - 0, 1009, 1012, 405, 318, 0, 308, 0, 0, 0, - 0, 0, 0, 343, 1104, 1102, 1100, 1103, 1105, 1080, - 0, 0, 0, 0, 165, 167, 0, 307, 281, 0, - 1116, 389, 0, 0, 1351, 1113, 298, 0, 0, 0, - 0, 380, 0, 704, 703, 655, 651, 0, 0, 0, - 0, 385, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 380, 377, 380, 1043, 0, 380, 172, 1351, - 310, 0, 1132, 1149, 182, 202, 183, 203, 438, 0, - 412, 420, 425, 403, 0, 403, 0, 422, 426, 403, - 421, 403, 416, 0, 164, 0, 1092, 0, 1091, 0, - 1016, 0, 0, 1003, 999, 0, 0, 0, 0, 0, - 970, 971, 972, 973, 974, 975, 976, 977, 978, 0, - 0, 979, 0, 0, 0, 929, 940, 941, 942, 937, - 938, 939, 931, 932, 933, 934, 935, 936, 955, 0, - 0, 0, 0, 0, 0, 0, 0, 817, 0, 0, - 840, 920, 0, 957, 989, 0, 0, 0, 0, 0, - 0, 957, 995, 0, 0, 0, 1029, 0, 1026, 793, - 1015, 0, 0, 792, 0, 0, 0, 1057, 1058, 749, - 763, 764, 765, 769, 1090, 1089, 1023, 0, 1017, 0, - 0, 750, 773, 778, 0, 996, 811, 0, 799, 0, - 786, 0, 797, 801, 774, 789, 0, 770, 0, 1018, - 952, 954, 0, 950, 0, 760, 761, 762, 754, 755, - 756, 757, 758, 759, 766, 928, 926, 927, 0, 0, - 0, 903, 794, 0, 0, 796, 795, 1343, 1380, 0, - 479, 479, 479, 467, 477, 1022, 0, 640, 491, 1031, - 640, 0, 747, 629, 1083, 1200, 1188, 1189, 958, 1082, - 135, 0, 1208, 0, 0, 0, 141, 124, 0, 1206, - 0, 157, 591, 0, 1015, 499, 500, 504, 504, 0, - 0, 504, 1578, 1469, 0, 0, 0, 0, 542, 582, - 0, 573, 539, 540, 0, 538, 1049, 543, 1048, 544, - 547, 548, 516, 583, 1038, 585, 0, 578, 451, 450, - 589, 0, 43, 0, 1351, 60, 0, 0, 0, 0, - 0, 0, 216, 253, 216, 98, 1351, 380, 1351, 380, - 1249, 1318, 1485, 0, 56, 89, 0, 286, 115, 0, - 271, 315, 79, 94, 108, 0, 0, 45, 175, 189, - 194, 111, 198, 195, 1121, 196, 122, 0, 41, 0, - 109, 0, 1119, 0, 0, 47, 113, 1123, 489, 489, - 489, 0, 962, 0, 0, 0, 964, 965, 1011, 0, - 404, 0, 309, 0, 414, 394, 395, 405, 0, 0, - 310, 1101, 0, 1081, 105, 0, 0, 0, 0, 301, - 299, 329, 0, 306, 300, 308, 0, 0, 257, 0, - 1243, 0, 0, 390, 386, 0, 0, 0, 673, 686, - 353, 660, 0, 714, 713, 715, 715, 660, 0, 646, - 0, 658, 0, 698, 667, 740, 741, 742, 743, 744, - 745, 746, 346, 348, 0, 350, 0, 0, 407, 0, - 410, 0, 409, 413, 408, 402, 0, 433, 0, 0, - 0, 0, 0, 0, 1181, 967, 484, 816, 0, 0, - 1000, 0, 0, 891, 0, 866, 868, 881, 0, 870, - 872, 0, 944, 0, 0, 0, 882, 819, 820, 0, + 1071, 762, 0, 1131, 1130, 762, 0, 1221, 762, 1250, + 995, 0, 859, 0, 762, 0, 1071, 0, 0, 0, + 0, 0, 0, 0, 0, 762, 116, 0, 858, 762, + 0, 0, 749, 0, 0, 0, 0, 0, 2, 4, + 19, 12, 38, 29, 31, 83, 70, 121, 82, 1070, + 222, 86, 34, 32, 35, 33, 18, 28, 14, 7, + 15, 37, 857, 17, 30, 20, 27, 26, 0, 21, + 8, 23, 24, 22, 1114, 16, 6, 5, 13, 36, + 25, 10, 9, 11, 761, 760, 754, 0, 0, 0, + 0, 0, 755, 711, 1271, 1272, 1273, 1274, 1275, 1276, + 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, + 1629, 1287, 1288, 1289, 1577, 1578, 1630, 1579, 1580, 1290, + 1291, 1292, 1293, 1294, 1295, 1296, 1297, 1581, 1582, 1298, + 1299, 1300, 1301, 1302, 1583, 1631, 1303, 1304, 1305, 1306, + 1307, 1308, 1632, 1309, 1310, 1311, 1312, 1313, 1314, 1315, + 1316, 1317, 1633, 1318, 1319, 1320, 1634, 1321, 1322, 1323, + 1324, 1325, 1326, 1327, 1584, 1585, 1328, 1329, 1330, 1331, + 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340, 1341, + 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, + 1352, 1353, 1354, 1355, 1586, 1356, 1357, 1358, 1359, 1360, + 1587, 1361, 1362, 1363, 1588, 1364, 1365, 1366, 1635, 1636, + 1367, 1368, 1369, 1637, 1370, 1371, 1589, 1590, 1372, 1373, + 1374, 1375, 1376, 1377, 1378, 1379, 1638, 1380, 1381, 1382, + 1383, 1384, 1385, 1386, 1387, 1388, 1389, 1390, 1639, 1591, + 1391, 1392, 1393, 1394, 1395, 1592, 1593, 1594, 1396, 1640, + 1641, 1397, 1642, 1398, 1399, 1400, 1401, 1402, 1403, 1404, + 1643, 1405, 1644, 1406, 1407, 1408, 1409, 1410, 1411, 1412, + 1413, 1595, 1414, 1415, 1416, 1417, 1418, 1419, 1420, 1421, + 1422, 1423, 1424, 1425, 1426, 1427, 1428, 1429, 1430, 1431, + 1596, 1646, 1597, 1432, 1433, 1434, 1598, 1435, 1436, 1647, + 1437, 1599, 1438, 1600, 1439, 1440, 1441, 1442, 1443, 1444, + 1445, 1446, 1447, 1601, 1648, 1448, 1649, 1602, 1449, 1450, + 1451, 1452, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1460, + 1603, 1461, 1462, 1604, 1463, 1464, 1465, 1466, 1467, 1468, + 1469, 1470, 1471, 1472, 1473, 1474, 1605, 1475, 1476, 1477, + 1478, 1479, 1480, 1481, 1482, 1483, 1484, 1485, 1486, 1487, + 1488, 1489, 1490, 1491, 1492, 1493, 1650, 1494, 1495, 1496, + 1606, 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, 1505, + 1506, 1507, 1508, 1509, 1510, 1511, 1512, 1513, 1607, 1514, + 1515, 1516, 1651, 1517, 1518, 1608, 1519, 1520, 1521, 1522, + 1523, 1524, 1525, 1526, 1527, 1528, 1529, 1530, 1609, 1531, + 1610, 1532, 1533, 1534, 1535, 1653, 1536, 1537, 1538, 1539, + 1540, 1611, 1612, 1541, 1542, 1613, 1543, 1614, 1544, 1545, + 1615, 1546, 1547, 1548, 1549, 1550, 1551, 1552, 1553, 1554, + 1555, 1556, 1557, 1558, 1559, 1560, 1616, 1617, 1561, 1654, + 1562, 1563, 1564, 1565, 1566, 1567, 1568, 1569, 1570, 1571, + 1572, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1626, + 1627, 1628, 1573, 1574, 1575, 1576, 1222, 0, 0, 693, + 712, 713, 721, 757, 1249, 1071, 0, 0, 0, 0, + 0, 989, 988, 0, 1218, 994, 0, 0, 711, 772, + 1595, 1463, 1609, 770, 691, 712, 0, 1030, 1031, 0, + 1039, 0, 1023, 1028, 1024, 0, 1049, 1041, 1050, 1042, + 1022, 1043, 1032, 1021, 0, 1051, 0, 1026, 0, 0, + 0, 758, 1104, 995, 1071, 0, 1121, 1122, 1118, 1120, + 1119, 1109, 1114, 0, 1220, 0, 0, 710, 1057, 1058, + 1055, 1054, 774, 65, 765, 1611, 1541, 860, 766, 763, + 764, 759, 115, 113, 0, 661, 1370, 1408, 1501, 1512, + 1611, 0, 1184, 1188, 756, 1616, 851, 0, 852, 715, + 0, 87, 262, 714, 685, 748, 0, 753, 0, 1477, + 91, 94, 730, 92, 83, 0, 1, 1071, 112, 112, + 0, 112, 0, 75, 83, 78, 82, 223, 856, 1611, + 1541, 850, 853, 0, 0, 0, 1113, 1105, 1378, 0, + 0, 1378, 0, 1378, 0, 1378, 0, 0, 653, 0, + 654, 694, 69, 0, 66, 68, 67, 960, 993, 992, + 991, 990, 995, 1378, 845, 725, 0, 779, 780, 0, + 0, 0, 0, 0, 1213, 773, 771, 1037, 1038, 0, + 1029, 1025, 1027, 0, 722, 1655, 314, 1656, 343, 321, + 343, 343, 1657, 1658, 1659, 1660, 310, 310, 1343, 323, + 1661, 1662, 1663, 1378, 1664, 1665, 311, 312, 348, 1666, + 1667, 1668, 1669, 1670, 0, 0, 1671, 343, 1672, 310, + 1673, 1674, 315, 1675, 284, 0, 1676, 313, 285, 1677, + 351, 351, 1678, 338, 1679, 0, 1052, 296, 297, 298, + 299, 324, 325, 300, 330, 331, 335, 301, 383, 310, + 1048, 723, 724, 1378, 1044, 1048, 1378, 1048, 687, 1378, + 0, 0, 1100, 0, 0, 1111, 1123, 1680, 1681, 1682, + 1683, 1685, 1684, 1686, 1687, 1688, 1689, 1690, 1691, 1692, + 1693, 1694, 1697, 1695, 1696, 1698, 1699, 1700, 1701, 1702, + 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1712, + 1713, 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, 1722, + 1723, 1724, 1725, 1726, 1727, 1728, 1729, 1730, 1731, 1137, + 0, 1138, 1128, 1117, 1124, 1125, 1071, 1248, 1056, 1108, + 0, 0, 0, 0, 767, 0, 0, 0, 696, 698, + 699, 582, 709, 656, 0, 1578, 1579, 1580, 646, 0, + 1581, 1582, 1583, 1631, 512, 499, 508, 513, 500, 502, + 509, 1584, 1585, 450, 1586, 1587, 707, 1588, 1589, 1590, + 1592, 1593, 1594, 504, 506, 1596, 1597, 0, 708, 1599, + 1600, 1444, 1602, 1603, 1605, 1606, 510, 1608, 1610, 1611, + 1612, 1613, 1614, 706, 1615, 511, 1617, 0, 0, 0, + 674, 601, 0, 0, 0, 656, 483, 0, 0, 304, + 305, 326, 327, 306, 332, 333, 307, 0, 668, 384, + 528, 656, 495, 558, 427, 0, 481, 475, 664, 98, + 662, 0, 476, 695, 656, 647, 98, 660, 1187, 1185, + 1191, 1186, 0, 0, 0, 0, 0, 264, 263, 686, + 747, 745, 746, 744, 750, 0, 743, 752, 1114, 596, + 598, 0, 647, 93, 0, 0, 0, 73, 72, 3, + 110, 111, 0, 0, 0, 0, 0, 0, 0, 0, + 207, 137, 138, 140, 204, 208, 216, 0, 79, 0, + 854, 0, 0, 0, 0, 41, 730, 0, 0, 1012, + 1012, 0, 0, 0, 0, 0, 836, 785, 829, 0, + 0, 0, 0, 1156, 1169, 0, 0, 0, 0, 0, + 1166, 0, 0, 1149, 787, 1143, 1145, 0, 1012, 0, + 783, 0, 0, 0, 789, 711, 0, 1629, 1630, 1631, + 1632, 1633, 513, 0, 1635, 1636, 1637, 1638, 1639, 1640, + 1641, 1642, 1643, 1644, 1595, 1646, 1647, 1648, 1649, 1650, + 1651, 1609, 1653, 1615, 0, 1654, 0, 487, 604, 121, + 602, 731, 0, 712, 718, 652, 0, 732, 1759, 1760, + 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, + 1771, 1772, 1773, 1774, 1775, 1776, 1777, 1778, 1779, 1780, + 1781, 1782, 1783, 1784, 1785, 1786, 1787, 1788, 1789, 1790, + 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, + 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1808, 1809, 1810, + 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1818, 1819, 1820, + 1821, 1822, 1823, 1824, 1825, 1826, 1827, 1828, 1829, 1830, + 1831, 1719, 1832, 1833, 1834, 1835, 1836, 649, 692, 734, + 733, 735, 655, 0, 0, 1246, 0, 0, 842, 0, + 726, 0, 0, 1378, 1142, 1378, 0, 960, 960, 0, + 1212, 1215, 1040, 1036, 1034, 1033, 1035, 342, 329, 337, + 336, 0, 319, 318, 317, 0, 316, 0, 0, 343, + 343, 341, 320, 296, 0, 0, 0, 347, 0, 345, + 0, 290, 286, 0, 356, 357, 358, 359, 366, 367, + 364, 365, 360, 361, 354, 355, 362, 363, 352, 353, + 0, 368, 369, 370, 371, 372, 373, 374, 375, 302, + 308, 1046, 1047, 0, 1019, 0, 0, 1014, 0, 0, + 1016, 0, 0, 0, 995, 0, 1071, 0, 1150, 1133, + 1134, 1132, 0, 0, 1170, 1127, 1136, 1126, 1135, 1115, + 1116, 1153, 1110, 0, 1107, 1237, 1196, 1197, 1205, 775, + 0, 607, 0, 1071, 768, 861, 0, 479, 601, 645, + 0, 0, 0, 0, 0, 0, 485, 610, 0, 0, + 407, 0, 0, 0, 625, 0, 631, 0, 0, 0, + 408, 388, 389, 0, 673, 682, 600, 0, 483, 596, + 0, 561, 563, 0, 714, 0, 477, 478, 484, 0, + 702, 0, 383, 383, 667, 582, 0, 0, 579, 580, + 581, 0, 0, 0, 659, 0, 590, 592, 0, 0, + 423, 588, 0, 426, 0, 0, 0, 0, 576, 577, + 578, 570, 571, 572, 573, 574, 575, 586, 569, 404, + 0, 0, 530, 482, 0, 403, 665, 0, 225, 0, + 700, 697, 0, 648, 225, 1199, 1203, 1204, 0, 1198, + 1202, 1190, 1189, 1194, 1192, 1195, 1193, 0, 741, 0, + 738, 599, 220, 95, 0, 0, 90, 89, 131, 131, + 122, 125, 131, 88, 179, 180, 0, 0, 0, 0, + 213, 211, 696, 709, 167, 141, 166, 0, 0, 145, + 0, 171, 384, 206, 77, 135, 136, 139, 76, 0, + 209, 0, 219, 207, 140, 0, 855, 47, 1065, 0, + 0, 0, 42, 1106, 0, 0, 0, 0, 0, 1378, + 0, 0, 0, 820, 801, 911, 1011, 0, 0, 0, + 0, 0, 0, 0, 828, 825, 826, 827, 0, 0, + 0, 0, 1154, 1155, 1168, 0, 1159, 1160, 1157, 1161, + 1162, 0, 0, 1147, 1148, 0, 0, 0, 0, 1146, + 0, 0, 0, 0, 0, 0, 0, 0, 121, 121, + 121, 493, 0, 119, 120, 0, 0, 650, 653, 1236, + 958, 968, 0, 0, 0, 0, 0, 0, 0, 995, + 849, 844, 846, 848, 847, 727, 0, 0, 0, 0, + 1139, 1141, 0, 0, 957, 930, 1217, 0, 0, 1378, + 947, 1214, 0, 0, 0, 0, 1048, 0, 340, 339, + 291, 287, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1053, 1048, 1045, 1048, + 688, 0, 1048, 1103, 0, 1378, 0, 960, 1112, 1129, + 1151, 1171, 1152, 1172, 1243, 1269, 0, 1251, 1256, 1234, + 0, 1234, 0, 1253, 1257, 1234, 1252, 1234, 1247, 0, + 776, 0, 64, 0, 63, 0, 657, 0, 0, 644, + 640, 0, 0, 0, 0, 0, 611, 612, 613, 614, + 615, 616, 617, 618, 619, 0, 0, 620, 0, 0, + 0, 568, 579, 580, 581, 576, 577, 578, 570, 571, + 572, 573, 574, 575, 594, 0, 0, 0, 0, 0, + 0, 0, 0, 452, 0, 0, 557, 0, 596, 630, + 0, 0, 0, 0, 0, 0, 596, 636, 0, 0, + 0, 672, 0, 669, 429, 656, 0, 564, 428, 0, + 0, 0, 704, 705, 385, 430, 399, 400, 401, 405, + 737, 736, 666, 0, 658, 0, 0, 386, 409, 414, + 0, 637, 446, 0, 434, 0, 422, 0, 432, 436, + 410, 425, 0, 406, 0, 659, 591, 593, 0, 589, + 0, 396, 397, 398, 390, 391, 392, 393, 394, 395, + 402, 567, 565, 566, 0, 0, 0, 532, 0, 0, + 431, 663, 1370, 1408, 0, 109, 109, 109, 97, 107, + 0, 276, 121, 674, 276, 0, 383, 265, 730, 751, + 739, 740, 597, 729, 1071, 129, 130, 134, 134, 0, + 0, 134, 1606, 1497, 0, 0, 0, 0, 172, 214, + 0, 205, 169, 170, 0, 168, 696, 173, 695, 174, + 177, 178, 146, 215, 683, 217, 0, 210, 81, 80, + 221, 0, 45, 0, 0, 0, 0, 1060, 1077, 0, + 656, 1093, 1095, 225, 0, 43, 0, 786, 0, 1378, + 803, 0, 0, 0, 0, 0, 0, 865, 902, 865, + 841, 1378, 1048, 1378, 1048, 1275, 1344, 1513, 935, 0, + 799, 832, 0, 1005, 965, 0, 920, 822, 837, 998, + 0, 0, 788, 1144, 1158, 1163, 1001, 1167, 1164, 1175, + 1165, 1012, 0, 784, 0, 999, 0, 1173, 0, 0, + 790, 1003, 1177, 119, 119, 119, 0, 603, 0, 0, + 0, 605, 606, 652, 0, 1235, 0, 959, 0, 1245, + 1225, 1226, 1236, 0, 0, 960, 960, 845, 0, 0, + 728, 1181, 0, 0, 0, 0, 53, 0, 958, 950, + 948, 981, 0, 955, 949, 0, 0, 906, 0, 0, + 781, 0, 0, 0, 0, 0, 309, 322, 1020, 296, + 0, 350, 349, 351, 351, 296, 0, 282, 0, 294, + 0, 334, 303, 376, 377, 378, 379, 380, 381, 382, + 1013, 1015, 0, 1017, 0, 0, 0, 1241, 0, 1239, + 1240, 1244, 1238, 0, 1233, 0, 1264, 0, 0, 0, + 0, 0, 0, 1206, 608, 114, 451, 0, 0, 641, + 0, 0, 526, 0, 501, 503, 516, 0, 505, 507, + 0, 583, 0, 0, 0, 517, 454, 455, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 835, 834, 883, 919, - 0, 0, 987, 988, 884, 0, 0, 994, 0, 0, - 0, 889, 0, 0, 0, 0, 1036, 845, 958, 925, - 923, 851, 747, 0, 0, 0, 0, 0, 0, 0, - 800, 788, 0, 798, 802, 0, 0, 0, 782, 0, - 0, 780, 812, 776, 0, 0, 813, 0, 0, 0, - 859, 479, 479, 479, 479, 476, 478, 0, 0, 0, - 0, 1469, 0, 612, 590, 592, 599, 612, 617, 861, - 638, 862, 1067, 0, 554, 489, 1037, 554, 0, 1175, - 1191, 0, 1209, 0, 146, 128, 148, 147, 0, 155, - 0, 1015, 0, 146, 130, 0, 149, 0, 1208, 0, - 161, 0, 493, 494, 496, 0, 945, 504, 498, 546, - 545, 0, 514, 580, 512, 0, 586, 0, 0, 0, - 261, 0, 0, 0, 216, 0, 0, 325, 0, 312, - 78, 0, 0, 0, 52, 97, 70, 62, 48, 76, - 0, 0, 81, 0, 74, 91, 92, 90, 95, 0, - 245, 226, 258, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 491, - 487, 488, 853, 1010, 436, 437, 180, 435, 319, 0, - 0, 307, 1116, 1099, 0, 0, 104, 106, 0, 168, - 310, 0, 285, 281, 0, 279, 278, 280, 0, 1244, - 173, 0, 1239, 1115, 0, 0, 1110, 692, 657, 0, - 710, 708, 656, 0, 652, 659, 380, 0, 439, 0, - 398, 434, 423, 428, 0, 432, 430, 429, 424, 427, - 0, 1002, 998, 0, 863, 968, 0, 956, 982, 981, - 818, 830, 831, 832, 983, 0, 0, 0, 827, 828, - 829, 821, 822, 823, 824, 825, 826, 833, 992, 991, - 985, 986, 0, 886, 887, 888, 993, 0, 1028, 957, - 1033, 0, 0, 922, 1056, 751, 0, 0, 779, 997, - 803, 0, 0, 0, 775, 944, 0, 0, 0, 0, - 0, 784, 0, 0, 0, 906, 901, 902, 0, 0, - 0, 0, 470, 469, 475, 612, 617, 0, 453, 0, - 599, 0, 611, 533, 610, 0, 0, 623, 621, 0, - 623, 0, 623, 0, 533, 0, 613, 533, 610, 0, - 630, 1041, 639, 0, 569, 0, 1027, 569, 0, 466, - 1207, 0, 1203, 0, 0, 0, 136, 133, 123, 0, - 0, 158, 146, 137, 502, 503, 0, 497, 513, 1039, - 116, 216, 0, 0, 59, 0, 327, 273, 305, 288, - 0, 0, 0, 217, 0, 293, 0, 51, 71, 0, - 67, 0, 96, 0, 0, 0, 0, 0, 54, 66, - 0, 49, 0, 380, 380, 57, 272, 1075, 1627, 1628, - 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, - 1639, 1640, 1641, 1642, 1720, 1643, 223, 1644, 1416, 1645, - 1646, 1647, 0, 1648, 649, 1649, 1650, 1651, 931, 932, - 221, 314, 218, 320, 220, 222, 0, 1076, 219, 317, - 112, 1122, 0, 110, 0, 1120, 119, 117, 114, 1124, - 856, 857, 854, 489, 417, 397, 0, 0, 0, 1351, - 0, 103, 0, 1116, 166, 307, 0, 335, 257, 330, - 0, 1243, 1241, 0, 1238, 0, 0, 0, 653, 647, - 351, 0, 411, 0, 431, 1001, 879, 890, 980, 0, - 0, 0, 0, 885, 880, 1035, 0, 1032, 809, 807, - 804, 0, 805, 783, 0, 0, 781, 777, 0, 814, - 892, 0, 908, 905, 474, 473, 472, 471, 598, 596, - 0, 601, 1067, 608, 526, 532, 597, 0, 593, 0, - 622, 618, 0, 619, 0, 0, 620, 0, 594, 0, - 1067, 595, 0, 637, 0, 0, 897, 853, 897, 1176, - 145, 125, 0, 126, 156, 0, 0, 0, 0, 150, - 391, 0, 323, 61, 0, 305, 0, 216, 290, 289, - 292, 287, 291, 294, 0, 0, 0, 0, 0, 274, - 0, 0, 0, 237, 0, 0, 305, 0, 311, 233, - 234, 344, 0, 0, 0, 63, 53, 50, 55, 64, - 0, 0, 65, 68, 645, 80, 73, 1720, 1727, 0, - 0, 0, 0, 0, 0, 393, 400, 180, 0, 0, - 281, 0, 0, 307, 107, 0, 0, 0, 1243, 0, - 0, 213, 0, 254, 0, 170, 1242, 0, 1231, 0, - 1108, 1109, 0, 0, 399, 836, 0, 0, 0, 1034, - 806, 810, 808, 785, 894, 0, 491, 633, 0, 636, - 600, 0, 0, 521, 528, 0, 531, 525, 0, 602, - 0, 0, 604, 606, 0, 0, 0, 641, 0, 0, - 0, 1044, 552, 1293, 1561, 1468, 553, 0, 551, 555, - 558, 560, 559, 561, 557, 568, 0, 571, 1054, 571, - 0, 0, 0, 159, 0, 152, 152, 0, 138, 946, - 0, 216, 0, 304, 324, 252, 0, 0, 235, 0, - 242, 0, 276, 277, 275, 236, 305, 310, 238, 0, - 345, 0, 72, 0, 88, 0, 0, 316, 120, 118, - 855, 417, 0, 1116, 257, 1238, 0, 0, 281, 173, - 1240, 270, 263, 264, 265, 266, 267, 268, 269, 284, - 283, 255, 256, 0, 0, 0, 1110, 0, 837, 0, - 838, 0, 911, 638, 0, 0, 632, 0, 519, 517, - 520, 522, 518, 0, 0, 609, 625, 0, 605, 603, - 614, 0, 645, 0, 616, 0, 0, 0, 562, 0, - 896, 898, 0, 0, 524, 524, 0, 132, 0, 640, - 0, 0, 154, 154, 140, 0, 310, 326, 0, 296, - 303, 295, 0, 0, 232, 0, 239, 334, 241, 225, - 644, 0, 75, 0, 321, 392, 396, 0, 215, 1232, - 0, 1238, 257, 1243, 0, 1235, 0, 0, 1116, 839, - 907, 0, 0, 0, 631, 634, 0, 607, 0, 0, - 0, 642, 643, 615, 0, 0, 0, 556, 0, 0, - 570, 0, 455, 454, 127, 152, 131, 160, 151, 501, - 153, 501, 0, 334, 282, 0, 0, 260, 225, 0, - 251, 0, 69, 87, 322, 0, 307, 1233, 214, 171, - 1236, 1237, 0, 640, 1549, 1294, 1520, 0, 909, 912, - 910, 904, 0, 529, 0, 535, 624, 564, 0, 563, - 899, 900, 526, 154, 504, 504, 640, 251, 297, 302, - 0, 240, 243, 331, 332, 333, 0, 247, 244, 248, - 0, 1238, 0, 1106, 0, 916, 915, 914, 918, 917, - 635, 0, 0, 527, 565, 523, 501, 143, 142, 139, - 216, 259, 0, 0, 0, 249, 0, 250, 224, 1234, - 1116, 0, 530, 0, 504, 328, 229, 0, 228, 0, - 313, 246, 640, 913, 0, 144, 227, 231, 230, 1107, - 534 + 0, 0, 0, 0, 0, 470, 469, 518, 556, 0, + 0, 628, 629, 0, 519, 0, 0, 635, 0, 0, + 0, 524, 0, 689, 0, 0, 0, 681, 480, 597, + 562, 560, 486, 383, 0, 0, 0, 0, 0, 0, + 0, 435, 424, 0, 433, 437, 0, 0, 0, 418, + 0, 0, 416, 447, 412, 0, 0, 448, 0, 0, + 531, 540, 109, 109, 109, 109, 106, 108, 0, 0, + 0, 0, 1497, 0, 248, 228, 224, 226, 235, 248, + 253, 496, 274, 497, 714, 0, 184, 119, 682, 184, + 0, 1200, 742, 0, 0, 123, 124, 126, 0, 584, + 134, 128, 176, 175, 0, 144, 212, 142, 0, 218, + 46, 0, 1082, 1066, 1064, 1084, 1083, 0, 656, 1091, + 0, 0, 1082, 0, 1085, 1099, 1096, 45, 0, 0, + 0, 0, 910, 0, 0, 0, 865, 0, 970, 0, + 977, 0, 962, 821, 0, 0, 0, 795, 840, 813, + 805, 791, 819, 0, 0, 824, 0, 817, 834, 835, + 833, 838, 0, 875, 894, 0, 0, 907, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 121, 117, 118, 488, 651, 1267, 1268, 1266, + 1149, 969, 0, 0, 0, 957, 1217, 843, 995, 0, + 1182, 0, 1180, 0, 1142, 0, 960, 1104, 0, 48, + 934, 930, 956, 928, 927, 929, 0, 54, 1216, 0, + 782, 0, 778, 0, 1211, 328, 293, 0, 346, 344, + 292, 0, 288, 295, 1048, 0, 1265, 0, 1229, 1270, + 1254, 1259, 0, 1263, 1261, 1260, 1255, 1258, 0, 643, + 639, 0, 498, 609, 0, 595, 623, 622, 453, 465, + 466, 467, 624, 0, 0, 0, 462, 463, 464, 456, + 457, 458, 459, 460, 461, 468, 633, 632, 626, 627, + 0, 521, 522, 523, 634, 0, 690, 671, 596, 676, + 678, 0, 0, 559, 703, 387, 0, 0, 415, 638, + 438, 0, 0, 0, 411, 583, 0, 0, 0, 0, + 0, 420, 0, 0, 0, 0, 494, 0, 0, 0, + 0, 100, 99, 105, 248, 253, 0, 83, 0, 235, + 0, 247, 163, 246, 229, 0, 259, 257, 0, 259, + 0, 259, 0, 163, 0, 249, 163, 246, 0, 266, + 686, 275, 0, 201, 0, 670, 201, 0, 96, 132, + 133, 0, 127, 143, 684, 44, 0, 40, 0, 1072, + 0, 0, 1069, 1059, 0, 0, 1094, 1082, 1073, 1006, + 865, 0, 0, 802, 0, 979, 922, 971, 954, 937, + 0, 0, 0, 866, 0, 942, 0, 794, 814, 0, + 810, 0, 839, 0, 0, 0, 0, 0, 809, 797, + 0, 792, 0, 1048, 1048, 800, 722, 1655, 1656, 1657, + 1658, 1659, 1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, + 1668, 1669, 1670, 1748, 1671, 872, 1672, 1444, 1673, 1674, + 1675, 0, 1676, 285, 1677, 1678, 1679, 570, 571, 972, + 869, 871, 0, 964, 867, 870, 723, 868, 967, 921, + 1002, 1176, 0, 1000, 0, 1174, 1009, 1007, 1004, 1178, + 491, 492, 489, 119, 1248, 1228, 0, 53, 0, 0, + 0, 1378, 0, 1179, 0, 1217, 1140, 0, 957, 53, + 51, 0, 987, 906, 982, 0, 62, 777, 0, 0, + 0, 289, 283, 1018, 0, 1242, 0, 1262, 642, 514, + 525, 621, 0, 0, 0, 0, 520, 515, 679, 680, + 675, 444, 442, 439, 0, 440, 419, 0, 0, 417, + 413, 0, 449, 527, 0, 543, 538, 539, 104, 103, + 102, 101, 234, 232, 0, 237, 714, 244, 156, 162, + 233, 0, 227, 0, 258, 254, 0, 255, 0, 0, + 256, 0, 230, 0, 714, 231, 0, 273, 0, 0, + 534, 488, 534, 1201, 0, 1081, 1061, 0, 1062, 1092, + 0, 0, 0, 0, 1086, 769, 975, 804, 0, 954, + 0, 865, 939, 938, 941, 936, 940, 943, 0, 0, + 0, 0, 0, 923, 0, 0, 0, 886, 0, 0, + 954, 0, 961, 882, 883, 996, 0, 0, 0, 806, + 796, 793, 798, 807, 0, 0, 808, 811, 281, 823, + 816, 1748, 1755, 0, 0, 0, 0, 0, 0, 1224, + 1231, 1149, 0, 0, 50, 930, 0, 0, 0, 957, + 1183, 0, 0, 53, 0, 1101, 52, 0, 0, 862, + 0, 903, 0, 0, 55, 0, 1209, 1210, 0, 0, + 1230, 471, 0, 0, 0, 677, 441, 445, 443, 421, + 529, 545, 542, 269, 0, 272, 236, 0, 0, 151, + 158, 0, 161, 155, 0, 238, 0, 0, 240, 242, + 0, 0, 0, 277, 0, 0, 0, 691, 182, 1319, + 1589, 1496, 183, 0, 187, 181, 185, 190, 192, 191, + 193, 189, 200, 0, 203, 701, 203, 585, 0, 0, + 0, 0, 1088, 1088, 1097, 0, 0, 1074, 0, 865, + 0, 953, 976, 901, 0, 0, 884, 0, 891, 0, + 925, 926, 924, 885, 954, 960, 887, 0, 997, 0, + 815, 0, 831, 0, 0, 966, 1010, 1008, 490, 1248, + 0, 1217, 906, 62, 0, 0, 0, 1104, 49, 930, + 919, 912, 913, 914, 915, 916, 917, 918, 933, 932, + 904, 905, 0, 0, 0, 1211, 0, 472, 0, 473, + 0, 121, 274, 0, 0, 268, 0, 149, 147, 150, + 152, 148, 0, 0, 245, 261, 0, 241, 239, 250, + 0, 281, 0, 252, 0, 0, 0, 194, 188, 533, + 535, 0, 0, 154, 154, 0, 1068, 0, 0, 1090, + 1090, 276, 0, 1076, 0, 960, 978, 952, 0, 945, + 944, 0, 0, 881, 0, 888, 986, 890, 874, 280, + 0, 818, 0, 973, 1223, 1227, 0, 864, 56, 957, + 0, 62, 53, 906, 0, 59, 0, 0, 1217, 474, + 0, 548, 267, 270, 0, 243, 0, 0, 0, 278, + 279, 251, 0, 0, 0, 186, 0, 0, 202, 0, + 85, 84, 1063, 1088, 1087, 1089, 131, 131, 1067, 1098, + 0, 986, 0, 931, 0, 909, 874, 0, 900, 0, + 812, 830, 974, 0, 957, 57, 1102, 863, 60, 61, + 0, 276, 544, 0, 0, 0, 0, 159, 0, 165, + 260, 196, 0, 195, 536, 537, 156, 1090, 134, 134, + 276, 900, 951, 946, 0, 889, 892, 983, 984, 985, + 0, 896, 893, 897, 0, 62, 0, 1207, 1577, 1320, + 1548, 0, 546, 549, 547, 541, 271, 0, 0, 157, + 197, 153, 131, 1079, 1078, 1075, 865, 908, 0, 0, + 0, 898, 0, 899, 873, 58, 1217, 0, 553, 552, + 551, 555, 554, 160, 0, 134, 980, 878, 0, 877, + 0, 963, 895, 276, 0, 0, 1080, 876, 880, 879, + 1208, 550, 164 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 37, 38, 39, 40, 2136, 2137, 2138, 1823, 980, - 2832, 1824, 981, 982, 2140, 41, 42, 2185, 2186, 43, - 1442, 536, 1756, 1381, 2557, 45, 2089, 1761, 2093, 2703, - 2342, 2088, 2095, 2812, 2879, 2090, 1762, 2704, 1763, 46, - 47, 1514, 48, 739, 49, 1515, 1469, 1250, 1000, 1459, - 1239, 50, 85, 51, 2127, 2431, 2892, 2150, 2980, 2588, - 2589, 1825, 2937, 2938, 2129, 2199, 1451, 2931, 1889, 2759, - 1829, 1812, 2590, 1898, 2713, 2467, 1826, 2373, 1890, 2574, - 2818, 1525, 1891, 2819, 2567, 1892, 1494, 1518, 2375, 2939, - 1830, 1495, 2432, 1438, 1893, 2890, 1894, 495, 2593, 52, - 528, 529, 731, 1188, 530, 712, 53, 496, 1154, 537, - 55, 1877, 2617, 2219, 2618, 1946, 1871, 1248, 1943, 1568, - 1498, 1249, 483, 1582, 2220, 2176, 1569, 538, 882, 58, - 59, 60, 577, 590, 591, 1352, 1733, 2057, 950, 564, - 565, 1865, 605, 1488, 1390, 1391, 1767, 2102, 1417, 1418, - 959, 960, 2664, 2872, 2665, 2666, 2525, 2526, 2953, 1405, - 1409, 1410, 1787, 1777, 1396, 2334, 2688, 2689, 2690, 2691, - 2692, 2693, 883, 2546, 2804, 1413, 1414, 962, 963, 964, - 1422, 1797, 62, 1737, 2064, 2065, 2066, 2312, 2313, 2327, - 2323, 2531, 2672, 2067, 2068, 2657, 2658, 2776, 2330, 2074, - 2676, 2677, 2734, 1542, 713, 1255, 1191, 715, 884, 716, - 1167, 885, 1171, 718, 886, 887, 888, 721, 889, 890, - 891, 724, 1163, 892, 893, 1182, 1210, 1211, 1212, 1213, - 1214, 1215, 1216, 1217, 1218, 934, 1636, 895, 896, 897, - 2070, 898, 1344, 1721, 2697, 2800, 2801, 2050, 2296, 2512, - 2656, 2853, 2908, 2909, 899, 900, 1295, 1296, 1718, 1339, - 1340, 901, 2434, 1342, 1629, 1294, 1291, 1043, 1044, 1256, - 1609, 1610, 1632, 1975, 1639, 1645, 2002, 2003, 1653, 1686, - 902, 1593, 1594, 1961, 1264, 903, 630, 1050, 631, 1261, - 1680, 911, 904, 905, 1288, 1289, 2016, 2271, 1658, 1793, - 582, 2668, 735, 1131, 906, 907, 908, 909, 936, 584, - 1045, 476, 727, 2880, 1144, 940, 1046, 1827, 1676, 63, - 809, 635, 64, 1142, 1506, 65, 2641, 2477, 1156, 1527, - 1902, 497, 66, 67, 68, 69, 70, 612, 1242, 539, - 1243, 1244, 796, 71, 1251, 798, 799, 72, 571, 572, - 1252, 1365, 1253, 73, 550, 74, 930, 587, 931, 933, - 541, 947, 2084, 1752, 76, 77, 558, 559, 78, 79, - 573, 80, 81, 2638, 542, 2202, 1151, 505, 478, 479, - 729, 1134, 1048, 1135 + -1, 37, 38, 39, 536, 974, 2112, 1792, 537, 2209, + 1884, 42, 2664, 43, 813, 633, 538, 886, 46, 47, + 48, 577, 590, 591, 1358, 1738, 2068, 952, 564, 565, + 1870, 602, 1494, 1390, 1391, 1757, 2095, 1417, 1418, 961, + 962, 2690, 2900, 2691, 2692, 2549, 2550, 2979, 1405, 1409, + 1410, 1777, 1767, 1396, 2353, 2714, 2715, 2716, 2717, 2718, + 2719, 2720, 887, 2570, 2833, 1413, 1414, 964, 965, 966, + 1422, 1787, 50, 51, 1741, 2075, 2076, 2077, 2078, 2331, + 2332, 2346, 2342, 2555, 2698, 2079, 2080, 2683, 2684, 2805, + 2349, 2086, 2702, 2703, 2762, 1546, 715, 1261, 1192, 717, + 888, 718, 1172, 889, 1176, 720, 890, 891, 892, 723, + 893, 894, 895, 726, 1168, 896, 897, 1187, 1211, 1212, + 1213, 1214, 1215, 1216, 1217, 1218, 1219, 939, 1642, 899, + 900, 901, 2082, 902, 1352, 1727, 2061, 2724, 2829, 2830, + 2316, 2536, 2681, 2801, 2935, 2972, 2973, 903, 904, 1301, + 1302, 1303, 1724, 1347, 1348, 905, 2450, 1350, 1635, 940, + 1657, 1297, 1049, 1050, 1262, 1615, 1616, 1638, 1984, 1645, + 1650, 2011, 2012, 1658, 1692, 906, 1599, 1600, 1970, 1270, + 907, 630, 1056, 631, 1267, 1686, 916, 908, 909, 910, + 1294, 1295, 2027, 2290, 2291, 1663, 1783, 582, 2023, 2694, + 738, 1137, 911, 912, 913, 914, 942, 584, 1051, 479, + 729, 2905, 1150, 946, 1052, 1828, 1682, 52, 934, 587, + 935, 938, 53, 86, 54, 558, 559, 539, 56, 57, + 58, 653, 1528, 59, 2149, 2150, 2151, 1829, 986, 2861, + 1830, 987, 988, 2153, 60, 1148, 1511, 61, 62, 571, + 63, 2140, 2453, 2920, 2164, 3011, 2612, 2613, 1831, 2961, + 2962, 2142, 2217, 1457, 2955, 1899, 2788, 1835, 1817, 2614, + 1907, 2741, 2492, 1832, 2393, 1900, 2598, 2848, 1531, 1901, + 2849, 2591, 1902, 1501, 1525, 2395, 2963, 1836, 1502, 2139, + 2454, 1445, 1903, 2918, 1904, 496, 2617, 64, 1448, 65, + 528, 529, 735, 1224, 530, 730, 66, 550, 540, 1798, + 1429, 2582, 68, 2119, 1801, 2122, 2734, 2367, 2117, 2123, + 2839, 2906, 2120, 1802, 1803, 2735, 1804, 69, 742, 70, + 71, 72, 73, 617, 1246, 541, 1247, 1248, 800, 74, + 1256, 802, 803, 75, 1520, 76, 1521, 1475, 1257, 1006, + 1465, 1251, 77, 78, 2201, 2202, 79, 572, 573, 1258, + 1371, 1259, 80, 2667, 2500, 1161, 1532, 1909, 497, 81, + 82, 83, 1882, 2641, 2237, 2642, 1955, 1876, 1254, 1951, + 1575, 1504, 1255, 486, 1588, 2238, 2190, 1576, 505, 481, + 482, 732, 1140, 1054, 1141 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -2632 +#define YYPACT_NINF -2569 static const int yypact[] = { - 4820, -127, 708, -2632, -2632, -127, 34140, -2632, -127, 56, - 2404, 38880, -2632, 4957, -127, 45516, 900, 161, 185, 195, - 39354, 39354, 45516, 45516, 39828, -127, 230, 45990, -2632, -127, - 23678, 36510, 14, -138, 46464, 45516, 1311, 343, 110, -2632, - -2632, -2632, -2632, -2632, -2632, 77, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, 91, -2632, 144, - 101, -32, 67, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, 170, -2632, -2632, -2632, -2632, -2632, -2632, -2632, 23203, - -2632, -2632, -2632, -2632, -2632, -2632, 40302, 45516, 40776, 36984, - 41250, -2632, 103, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, 116, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, 120, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, 238, 316, -2632, 126, -2632, -2632, - -2632, -2632, 1311, 41724, -2632, -13, 602, -2632, 304, 46938, - -2632, -2632, 45516, -2632, -2632, -16, 41724, 550, -2632, -2632, - -2632, 42198, -2632, -2632, -2632, -2632, 513, -2632, -2632, 359, - -2632, 51, -2632, -2632, -2632, 383, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, 482, -2632, 52152, -2632, 47412, 47886, - 48360, -2632, 357, 493, 932, 22728, -2632, -2632, -2632, -2632, - 170, -2632, -2632, 877, -2632, 39354, 877, -2632, -2632, -2632, - -2632, -2632, -152, 380, -2632, 425, 691, -2632, -2632, -2632, - 431, -2632, -2632, 651, 10426, 10426, 48834, 48834, 877, 48834, - 481, -2632, -2632, 7, -2632, -138, -2632, -32, 431, -2632, - 24153, -2632, 484, 316, -2632, -2632, 199, 814, 13420, 45516, - 489, -2632, 509, 489, 514, 521, -2632, 4820, 852, 825, - 36510, 614, 614, 997, 614, 696, 749, -2632, 1543, -2632, - 562, -2632, 41724, -2632, 583, 865, -2632, 431, 920, 847, - 758, 952, 2317, 957, 977, 1004, 1066, 6933, 13420, 32718, - -2632, 316, -2632, -2632, -2632, 633, -2632, 687, -2632, -2632, - -2632, -2632, 493, 918, -2632, 689, 1154, 754, 42672, 43146, - 41724, 712, 1125, -2632, -2632, -2632, -2632, 750, -2632, -2632, - 121, -2632, -2632, -2632, -2632, 777, -2632, 777, 777, -2632, - -2632, -2632, -2632, 722, 722, 912, 738, -2632, -2632, -2632, - 1067, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, 760, 927, -2632, 777, -2632, 722, -2632, -2632, -2632, - -2632, -2632, 53529, -2632, -2632, -2632, -2632, 331, 508, -2632, - -2632, -2632, 68, 769, -2632, 1212, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, 775, -2632, 2828, 722, -2632, -2632, - 1131, 153, -2632, 1152, 159, -2632, 1160, 1012, 13420, -2632, - 915, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -138, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, 328, -2632, -2632, 30251, - -2632, -2632, 932, 829, -2632, -2632, 30251, 13919, 52611, 1298, - -2632, 1115, 45516, 859, -2632, -2632, -2632, -2632, -2632, -2632, - 873, 1351, 88, 1364, 13420, 891, 88, 88, 896, 1219, - -2632, -2632, -2632, 135, 922, 924, -2632, 136, 136, -2632, - 926, 935, -2632, 139, 951, 994, 1400, 1404, 98, 1002, - 1015, 927, 88, 13420, -2632, 1046, 136, 1070, 1083, 1097, - 1444, 1127, -2632, 1463, 1137, 87, 90, 1140, 1143, -2632, - 1163, -2632, 140, 13420, 13420, 13420, 1328, 13420, 7931, 41724, - 1497, -2632, 316, 1166, 877, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, 100, 5131, -2632, 1089, -2632, -2632, -2632, - 203, 13420, -2632, 1537, -61, -2632, 142, -2632, -2632, -2632, - 442, 1346, 1091, -2632, -2632, -2632, -2632, 164, 1564, 29303, - 29777, 41724, -2632, -2632, 316, -2632, -2632, -2632, -2632, -2632, - -2632, 409, -2632, 170, 31439, 480, 316, 489, 45516, 45516, - 1628, -2632, -2632, -2632, 36510, 41724, 49308, 1297, -2632, -2632, - -32, -32, 9428, -32, 137, 8, 10925, 14418, 1505, 1392, - 151, 603, 1512, -2632, 1399, 696, 749, 13420, 509, -2632, - 1450, 41724, 34614, 599, 612, 1190, 1273, 1194, 305, 1607, - -2632, 1199, -2632, 1279, 41724, 53529, 167, -2632, 1645, 167, - 167, 155, 1646, 1290, 184, 1445, 259, -150, 1199, 2007, - -2632, 36510, 80, 454, 1199, 41724, 1293, 530, 1199, 97, - 13919, 905, 1032, 249, 1145, 1181, 99, 13919, 1244, 1286, - 1324, 1363, 1384, 1442, 1480, 1500, 1507, 1515, 115, 1561, - 1581, 1583, 1587, 1591, 1598, 119, 1601, 147, 13919, 1603, - 1214, -2632, 31439, -56, -2632, -2632, 1605, 122, -2632, 27880, - 1207, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, 1299, 45516, 1258, - -48, 1565, 1626, 32718, 1226, 1590, 41724, 1461, 2007, 1467, - 1245, 1704, 687, 11424, 1711, -2632, 49782, -2632, -2632, -2632, - -2632, -2632, -2632, 1256, -2632, -2632, 13420, -2632, -2632, -2632, - 1741, -2632, 52611, 52611, 777, 777, -2632, -2632, 1716, 1342, - 1352, 1741, -2632, 1741, -2632, -2632, -2632, 52611, -2632, 45516, - 1265, 1274, 1741, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, 1741, - 1355, -2632, 1358, 1370, 1374, -2632, -2632, -2632, -2632, -2632, - 45516, 45516, -2632, 45516, 45516, -2632, 45516, 45516, 527, 43620, - 932, 37458, -2632, -2632, -2632, -2632, 319, 686, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, 32718, -2632, 1686, - -2632, -2632, -2632, 1267, 533, -2632, 553, 1311, -2632, -2632, - 13420, 316, 13420, 31439, 1325, 13420, 13420, 1282, 1741, 1741, - -2632, 4360, 1741, 1741, 31773, 13420, 27006, 13420, 17911, 11923, - 13420, 13420, 8430, 13420, 31773, 1776, 1776, 25103, -2632, 1448, - 1292, 1300, 772, 5796, 1301, -2632, 566, -2632, 1291, -2632, - 316, 316, 13420, -2632, 13420, 3440, 3440, -2632, 186, 52611, - 13420, 13420, 13420, 13420, 32244, 1385, 132, 45516, 13420, 13420, - 1303, 1153, -2632, 13420, 1521, -2632, 1308, 13420, 1390, 173, - 13420, 13420, 13420, 13420, 13420, 13420, 13420, 13420, 13420, -2632, - -2632, 19394, 188, 1629, 1650, 316, 13420, 258, 231, 13420, - 37932, 10426, 1637, 6933, -2632, 316, 28355, 93, 1637, -2632, - -2632, -2632, -2632, 143, -2632, -2632, -2632, -2632, 1267, -2632, - 1267, 1314, 41724, 199, 36036, -2632, 13420, -2632, 563, 1317, - 1376, 555, 1781, 45516, -2632, 25578, 1606, -2632, 256, 256, - 1322, -2632, 30721, 1606, -2632, -2632, 18396, 1446, 1600, 1538, - -2632, -2632, 1519, 1525, -2632, 1329, 31672, 14917, 14917, -2632, - 1128, 31439, 1269, -2632, -2632, -2632, -2632, -2632, -2632, 477, - -2632, 41724, -14, 1505, 603, 590, -2632, -2632, 1076, 1338, - 50256, 45516, 1613, 1566, 1616, -161, -2632, -2632, -2632, 52611, - -2632, 45516, 45516, 50730, 51204, 33192, 45516, 32718, -2632, -2632, - -2632, -2632, 45516, 1052, 45516, 5461, -2632, -2632, -2632, 167, - -2632, -2632, -2632, -2632, -2632, 45516, 45516, -2632, -2632, 167, - 45516, 45516, 167, -2632, 1120, 45516, 45516, 45516, 45516, 1344, - 45516, 45516, -44, -44, 1548, -2632, 12422, 95, -2632, 13420, - 13420, -2632, 13420, 1518, -2632, 604, -2632, 1560, 96, 1394, - 41724, 41724, 45516, 1406, -2632, -2632, -2632, -2632, -2632, -2632, - 32718, 1353, 1354, 1694, -2632, 2007, 1695, 35088, 622, 543, - 1393, -2632, 606, 13420, 1584, -2632, -2632, 1568, 13420, 623, - 1360, 68, 625, -2632, -2632, 1365, 1274, 1381, 1382, 1366, - 1367, -2632, 627, 52611, 1741, 106, 1368, 1372, 1369, 1318, - 42, 1283, 153, -2632, 159, -2632, 1580, 138, -2632, 1596, - 687, 1834, -2632, -2632, -2632, -2632, -2632, -2632, -2632, 635, - 22253, -2632, -2632, 1836, 877, 1836, 387, -2632, -2632, 1836, - -2632, 1836, -2632, 30251, -2632, 13919, -2632, 52611, -2632, 642, - -2632, 1383, 13420, 109, -2632, 30787, 644, 13420, 1379, 1391, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, 1397, - 1708, -2632, 1398, 1401, 5043, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, 1402, - 1389, 30870, 1403, 17911, 17911, 7931, 1649, -2632, 17911, 1408, - -2632, -2632, 654, 30739, 1292, 1413, 31049, 12921, 13420, 12921, - 12921, 31113, 1292, 1416, 31280, 45516, -2632, 15416, -2632, -2632, - -2632, 13420, 41724, -2632, 13420, 719, 6145, -2632, -2632, -2632, - 6287, 6287, 6287, 31773, -2632, -2632, -2632, 1410, -2632, 17911, - 17911, -2632, 4177, 805, 7931, -2632, -2632, 1710, -2632, 780, - -2632, 1386, -2632, -2632, 2165, -2632, 27006, 31633, 13420, 150, - -2632, 13420, 1303, 13420, 1475, 6287, 6287, 6287, 194, 194, - 89, 89, 89, 297, 231, -2632, -2632, -2632, 1405, 1407, - 1418, 1619, 31439, 1127, 13420, -2632, 31439, 664, 706, 41724, - 2889, 3003, 3272, -2632, -2632, -2632, 20828, 1441, -56, 1328, - 1441, 1741, 3440, -2632, 509, -2632, -2632, -2632, 31439, -2632, - 1311, 20828, 1462, 1471, -110, 23678, 1634, -2632, 45516, -2632, - 45516, -2632, -12, 1436, -2632, -2632, -2632, 1458, 1458, 13420, - 1443, 1458, 1635, 1642, 724, 724, 1128, 1653, -2632, -2632, - 1487, -2632, -2632, -2632, 13420, 8929, 1294, -2632, 1296, -2632, - -2632, -2632, -2632, 1447, -2632, -2632, 1699, -2632, -2632, -2632, - -2632, 1527, 1199, 13420, 1672, -2632, 113, 1449, 1793, -134, - 1748, 45516, -2632, 1659, -2632, 781, 1797, 138, 1798, 138, - 32718, 32718, 32718, 746, -2632, -2632, 877, -2632, -2632, 755, - -2632, -171, -2632, -2632, -2632, 1539, 580, 1199, 2007, -2632, - -2632, -2632, -2632, -2632, -2632, -2632, 124, 587, 1199, 1540, - -2632, 1545, -2632, 1546, 617, 1199, -2632, -2632, 95, 95, - 95, 13919, -2632, 1674, 1680, 1466, 31439, 31439, 31439, 1469, - -2632, 149, -2632, 45516, -2632, -2632, -2632, 1518, 41724, 1470, - 687, -2632, 630, -2632, 877, 45516, 41724, 41724, 41724, -2632, - -2632, -2632, 1472, 1473, -2632, 52611, -62, 1683, 1689, 45516, - 1514, 1194, 1943, -2632, 31439, 1823, 41724, 791, -2632, -2632, - -2632, -2632, 1741, -2632, -2632, 251, 251, -2632, 45516, -2632, - 1488, -2632, 1501, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, 45516, -2632, 1846, 1311, -2632, 32718, - -2632, 35562, -2632, -2632, -2632, -2632, 877, -2632, 877, 1724, - 45516, 28829, 877, 877, -2632, -2632, -2632, -2632, 31394, 13420, - -2632, 1857, 52611, -2632, 6164, -2632, -2632, -2632, 13420, -2632, - -2632, 13420, -2632, 27006, 13420, 1832, -2632, 1991, 1991, 5796, - 52611, 17911, 17911, 17911, 17911, 472, 1070, 17911, 17911, 17911, - 17911, 17911, 17911, 17911, 17911, 17911, 18895, 353, -2632, -2632, - 13420, 13420, 1842, 1832, -2632, 52611, 1513, 1292, 1524, 1530, - 13420, -2632, 52611, 817, 7931, 31355, -2632, 316, 6190, -2632, - 31439, -2632, 3440, 13420, 1706, 3271, 13420, 826, 13420, 1847, - -2632, -2632, 1526, -2632, -2632, 52611, 13420, 1531, 2249, 17911, - 17911, 3402, -2632, 3801, 13420, 7931, -2632, 1548, 1574, 26053, - -2632, 1630, 1630, 1630, 1630, -2632, -2632, 41724, 41724, 41724, - 21303, 1864, 20353, 44094, 1544, 1541, -2632, 44094, 44568, -2632, - 1556, -2632, 316, 13420, 1860, 95, 1448, 1860, 1550, -2632, - -2632, 1551, 1544, 13420, 1700, -2632, -2632, -2632, 1610, -2632, - 854, -2632, 1963, 1700, -2632, 863, -2632, 25578, 1462, 13420, - 316, 125, -2632, -2632, -2632, 1559, -2632, 1458, -2632, -2632, - -2632, 1774, -2632, -2632, -2632, 41724, -2632, 45516, 27488, 1909, - -2632, 45516, 45516, 45516, -2632, 45516, 864, 631, 1567, -2632, - 631, 1889, 192, 1194, 184, 2873, -27, -2632, -2632, -2632, - 1640, 45516, -2632, 45516, -2632, -2632, -2632, -2632, -2632, 33192, - -2632, -2632, -2632, 32718, 26531, 32718, 45516, 45516, 45516, 45516, - 45516, 45516, 45516, 45516, 45516, 45516, 1570, 1575, 1576, 1548, - -2632, -2632, -2632, -2632, -2632, -2632, -150, -2632, -2632, 149, - 1578, 35088, 1393, 1626, 45042, 1579, 1577, -2632, 868, 2007, - 1582, 2036, -2632, 622, 35088, -2632, -2632, -2632, 1997, -2632, - 357, 131, -2632, -2632, 1311, 45516, 1643, -2632, 1274, 1586, - -2632, -2632, 1274, 52611, -2632, -2632, 138, 41724, -2632, 881, - -2632, -2632, -2632, -2632, 45516, 1593, -2632, 1593, -2632, -2632, - 13420, 31439, -2632, 1589, -2632, 31439, 27506, -2632, 31439, 1842, - -2632, 748, 748, 748, 2232, 1912, 444, 1588, 748, 748, - 748, 405, 405, 105, 105, 105, 1991, 353, 31439, 31439, - -2632, -2632, 1594, -2632, -2632, -2632, 1292, 1604, -2632, 5410, - -2632, 889, 45516, -2632, -2632, 281, 13420, 13420, 4177, -2632, - 4993, 13420, 52611, 894, 4177, 189, 13420, 3289, 4244, 13420, - 13420, 3895, 27535, 1611, 13420, 51678, -2632, -2632, 41724, 41724, - 41724, 41724, -2632, -2632, -2632, 44094, 44568, 1602, 19877, 1541, - 1612, 41724, -2632, 1696, 1614, 20828, 1878, 1812, -2632, 20828, - 1812, 107, 1812, 1891, 1696, 24628, -2632, 1696, 1615, 1821, - -2632, 547, 31439, 2058, 1933, 1621, -2632, 1933, 877, -2632, - 31439, 10426, -2632, 1311, 1306, 45516, 316, -47, -2632, 1636, - 45516, -2632, 1700, 31439, -2632, -2632, 27006, -2632, -2632, -2632, - -2632, -2632, 45516, 902, -2632, 909, 631, -2632, 1661, -2632, - 181, 1918, 57, -2632, 32718, 1452, 607, -2632, 1932, 1848, - -2632, 167, -2632, 13420, 607, 1849, 169, 45516, -2632, -2632, - 2046, -2632, 52611, 138, 138, -2632, -2632, 1631, 1632, 1633, - 1647, 1651, 1655, 1656, 1658, 1660, 1663, 1664, 1665, 1666, - 1667, 1670, 1676, 1677, 760, 1679, -2632, 1682, 1559, 1685, - 1687, 1688, 53070, 1690, 1701, 1703, 1705, 1707, 319, 686, - -2632, -2632, -2632, -2632, -2632, -2632, 689, 1709, -2632, 1641, - -2632, -2632, 1712, -2632, 1713, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, 95, 829, 127, 45516, 1662, 2104, 1873, - 1652, -2632, 877, 1393, -2632, 35088, 1069, 168, 1689, -2632, - 112, 1514, -2632, 2037, 1720, 1871, 45516, 1691, -2632, -2632, - -2632, 2131, -2632, 35562, 1593, 31439, -2632, -2632, -2632, 17911, - 2010, 1718, 52611, -2632, -2632, -2632, 13420, -2632, 4177, 4177, - 4993, 916, -2632, 4177, 13420, 13420, 4177, 4177, 13420, -2632, - -2632, 27554, 1887, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - 33666, 44094, 1719, -2632, 38406, -2632, -2632, 45516, 1541, 20828, - -2632, -2632, 506, -2632, 20828, 1986, -2632, 20828, -2632, 45516, - 1721, -2632, 45516, -2632, 9927, 13420, 1755, 877, 1755, -2632, - 1091, -2632, -110, -2632, -2632, 2130, 21778, 2086, 13420, -2632, - -2632, 1725, 631, -2632, 1888, 1661, 1728, -2632, -2632, -2632, - -2632, -2632, -2632, -2632, 933, 1729, 45516, 45516, 17911, -2632, - 607, 198, 133, -2632, 2003, 41724, 1661, 2145, -2632, -2632, - -2632, -2632, 2113, 2193, 2081, -2632, -2632, 31439, -2632, -2632, - 1741, 1741, -2632, -2632, 2157, -2632, -2632, -2632, -2632, 689, - 183, 26531, 45516, 45516, 1738, -2632, -2632, -150, 2112, 938, - 622, 1311, 2083, 35088, -2632, 2199, 1742, 45516, 1514, 676, - 676, -2632, 1883, -2632, 1890, -2632, -2632, 221, -2632, 41724, - -2632, -2632, 21778, 1311, -2632, 2714, 17911, 52611, 943, -2632, - -2632, 4177, 4177, 4177, -2632, 2191, 1548, -2632, 948, 2210, - -2632, 45516, -80, -34, 1754, 1759, -2632, -2632, 949, -2632, - 13420, 1761, -2632, -2632, 20828, 506, 956, -2632, 52611, 45516, - 969, 52611, -2632, 1762, -106, 1763, -2632, 7432, 1765, -2632, - -2632, -2632, -2632, -2632, 31439, 31439, 45516, 1935, -2632, 1935, - 1818, 45516, 13420, -2632, 970, 2190, 66, -35, 31439, -2632, - 41724, -2632, 32718, -2632, 631, -2632, 32718, 13420, -2632, 1305, - 2232, 2230, -2632, -2632, -2632, -2632, 1661, 687, -2632, 45516, - -2632, 2082, -2632, 45516, 1833, 333, 1854, -2632, -2632, -2632, - -2632, 829, 877, 1393, 1689, 1720, 41724, 1311, 622, 357, - -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, -2632, - -2632, -2632, -2632, 2211, 1993, 2214, 1643, 975, 2714, 979, - -2632, 13420, 334, 1556, 33666, 1789, -2632, 981, -2632, -2632, - -2632, -2632, -2632, 45516, 840, -2632, 31439, 45516, -2632, -2632, - -2632, 45516, 2157, 1013, -2632, 13420, 1792, 13420, -2632, 15915, - 1790, -2632, 2250, 13420, 1853, 1853, 1311, -2632, 27637, 1441, - 21778, 45516, 45516, 45516, -2632, 1919, 687, 631, 1033, -2632, - 1811, -2632, 27655, 2022, -2632, 2110, -2632, 2054, -2632, 1806, - -2632, 13420, -2632, 1879, -2632, -2632, -2632, 2265, -2632, -2632, - 1810, 1720, 1689, 1514, 2019, -2632, 2020, 1814, 1393, -2632, - 1292, 16414, 16414, 1817, -2632, -2632, 45516, -2632, 1039, 1822, - 1059, -2632, -2632, -2632, 1064, 15915, 1071, -2632, 45516, 1824, - 31439, 1959, -2632, -2632, -2632, 2190, -2632, -2632, -2632, 256, - -2632, 256, 25578, 2054, -2632, 32718, 26531, 2052, 1806, 71, - 2040, 2007, -2632, 31439, -2632, 1311, 35088, -2632, -2632, -2632, - -2632, -2632, 21778, 1441, 17412, 1966, 104, 30768, -2632, -2632, - -2632, -2632, 1088, -2632, 2311, 1985, -2632, -2632, 1090, -2632, - -2632, -2632, 38406, 45516, 1458, 1458, -140, 2040, -2632, -2632, - 2127, -2632, -2632, -2632, -2632, -2632, 117, 2045, -2632, 2047, - 860, 1720, 1095, -2632, 2298, -2632, -2632, -2632, -2632, -2632, - -2632, 1839, 1841, -2632, -2632, -2632, 256, -2632, -2632, -2632, - -2632, -2632, 156, 156, 2216, -2632, 1903, -2632, -2632, -2632, - 1393, 16913, -2632, 2330, 1458, 631, -2632, 2319, -2632, 145, - -2632, -2632, 1441, -2632, 1850, -2632, -2632, -2632, -2632, -2632, - -2632 + 3110, -73, 1095, -2569, -2569, -73, 34774, -2569, -73, 73, + 2450, 39534, -2569, 6470, -73, 46198, 749, 229, 186, 237, + 40010, 40010, 46198, 46198, 40486, -73, 241, 46674, -2569, -73, + 24320, 37154, -1, -212, 47150, 46198, 476, 388, -93, -2569, + -2569, -2569, -2569, -2569, -2569, 118, -2569, 653, 143, 493, + -42, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, 23843, -2569, -2569, -2569, -2569, -2569, 63, -2569, + -2569, -2569, -2569, -2569, 36, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, 40962, 46198, 41438, + 37630, 41914, -2569, 141, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, 160, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, 161, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, 236, 182, -2569, + 162, -2569, -2569, -2569, -2569, 476, 42390, 403, 447, 346, + 47626, -2569, -2569, 46198, -2569, -2569, 594, 540, -2569, -2569, + -2569, 42866, -2569, -2569, -2569, -2569, 518, -2569, -2569, 354, + -2569, 130, -2569, -2569, 422, 383, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, 519, -2569, 52862, -2569, 48102, 48578, + 49054, -2569, 405, 776, 33, 23366, -2569, -2569, -2569, -2569, + -2569, -2569, 36, 954, -2569, 40010, 954, -2569, -2569, -2569, + -2569, -2569, 111, 477, -2569, 502, 767, -2569, -2569, -2569, + 514, -2569, -2569, 733, 10513, 10513, 49530, 49530, 954, 49530, + 568, -33, -2569, -2569, -2569, -212, -2569, 493, 514, -2569, + 24797, -2569, 572, 182, -2569, -2569, 126, 857, 14020, 46198, + 570, -2569, 591, 570, 595, 646, -2569, 3110, 264, 264, + 1100, 264, 974, 986, -2569, 1282, -2569, 666, -2569, 695, + 959, -2569, 514, 1019, 979, 37154, -2569, 42390, 1050, 779, + 871, 1092, 4206, 1101, 788, 1109, 795, 7006, 14020, 33346, + -2569, 182, -2569, 778, -2569, -2569, -2569, 796, -2569, -2569, + -2569, -2569, 680, 1025, -2569, 849, 1266, -2569, -2569, 911, + 43342, 43818, 42390, 42390, 1290, -2569, -2569, -2569, -2569, 915, + -2569, -2569, -2569, 133, -2569, -2569, -2569, -2569, 952, -2569, + 952, 952, -2569, -2569, -2569, -2569, 949, 949, 1134, 964, + -2569, -2569, -2569, 1317, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, 1007, 844, -2569, 952, -2569, 949, + -2569, -2569, -2569, -2569, -2569, 54245, -2569, -2569, -2569, -2569, + 320, 469, -2569, -2569, -2569, 1041, -2569, 1439, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, 1052, -2569, 3855, 949, + 70, -2569, -2569, 1405, -2569, 84, 1417, 86, -2569, 1421, + 1299, 14020, -2569, 1246, 1188, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -212, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -129, -2569, -2569, 30948, -2569, -2569, 33, 1098, -2569, -2569, + 30948, 14521, 53323, 1554, -2569, 1363, 46198, 1104, -2569, -2569, + -2569, -2569, -2569, -2569, 1102, 1591, 92, 1596, 14020, 1107, + 92, 92, 1110, 1448, -2569, -2569, -2569, 163, 1115, 1119, + -2569, 167, 167, -2569, 1120, 1122, -2569, 168, 1126, 1127, + 1618, 1621, 108, 1132, 1133, 844, 92, 14020, -2569, 1136, + 167, 1141, 1142, 1145, 1624, 1146, -2569, 1625, 1147, 120, + 151, 1149, 1150, -2569, 1155, -2569, 170, 14020, 14020, 14020, + 1507, 14020, 8008, 42390, 1642, -2569, 182, 1162, 954, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, 150, 5224, -2569, + 1200, -2569, -2569, -2569, 1366, 14020, -2569, -2569, 1160, 1449, + -2569, 171, -2569, -2569, -2569, 251, 1449, -2569, -2569, -2569, + -2569, -2569, 194, 1568, 29996, 30472, 42390, -2569, -2569, 182, + -2569, -2569, -2569, -2569, -2569, 50, -2569, -2569, 36, 32095, + 1167, 1171, 182, 570, 46198, 46198, 1632, -2569, -2569, -2569, + -2569, -2569, 493, 493, 9511, 493, 97, 6, 11014, 15022, + 1511, 1395, 114, 91, 1514, -2569, 1389, 974, 986, 14020, + -2569, 1450, 37154, 42390, 1311, 50006, 591, 42390, 35250, 827, + 860, 1192, 1274, 1194, 335, 1605, -2569, 1193, -2569, 1279, + 42390, 54245, 183, -2569, 1641, 183, 183, 461, 1643, 1285, + 211, 1435, 434, 193, 1193, 1446, -2569, 37154, 65, 547, + 1193, 42390, 1286, 561, 1193, 107, 14521, 929, 953, 312, + 1060, 1067, 134, 14521, 1116, 1224, 1250, 1294, 1304, 1314, + 1351, 1398, 1437, 1443, 140, 1467, 1470, 1474, 1486, 1491, + 1500, 147, 1503, 166, 14521, 1505, 1208, -2569, 32095, -43, + -2569, -2569, 1510, 157, -2569, 5878, 1203, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, 1291, 46198, 1252, 489, 1561, 1622, 33346, + 1219, 1579, 42390, 1452, 1446, 1454, 1689, 1231, 796, 1232, + -2569, 50482, -2569, -2569, -2569, -2569, -2569, -2569, 1233, -2569, + -2569, 14020, -2569, -2569, -2569, 1720, -2569, 53323, 53323, 952, + 952, -2569, -2569, 1695, 1319, 1320, 1720, -2569, 1720, -2569, + 46198, 1240, 1247, 1720, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + 1720, 1325, -2569, 1327, 1328, 1329, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, 53323, -2569, 46198, 46198, -2569, 46198, 46198, + -2569, 46198, 46198, 1248, 680, 44294, 33, 38106, -2569, -2569, + -2569, -2569, 327, 674, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, 33346, -2569, 2440, -2569, -2569, -2569, 1249, + 625, -2569, 648, 476, -2569, -2569, 14020, 182, 14020, 32095, + 1293, 14020, 14020, 1255, 1720, 1720, -2569, 3597, 1720, 1720, + 2192, 14020, 27662, 14020, 18529, 11515, 14020, 14020, 8509, 14020, + 2192, 1736, 1736, 25751, -2569, 1409, -2569, 1258, 1944, 5099, + 1257, -2569, 1260, 1253, -2569, 1259, -2569, 182, 182, 14020, + -2569, 14020, 4108, 4108, -2569, 159, 53323, 14020, 14020, 14020, + 14020, 14020, 32870, 1349, 101, 46198, 14020, 14020, 1270, 48, + -2569, 14020, 1492, -2569, 1275, 14020, 1357, 272, 14020, 14020, + 14020, 14020, 14020, 14020, 14020, 14020, 14020, -2569, -2569, 20018, + 196, 1602, 1614, 182, -94, 234, 10513, 38582, 1612, 7006, + -2569, 182, 29044, 93, 1612, -2569, -2569, -2569, 172, -2569, + -2569, -2569, -2569, -2569, 1249, -2569, 1249, 1288, 42390, 126, + 36678, 14020, -2569, -2569, 706, 1287, 1574, -2569, 232, 232, + 1289, -2569, 6515, 1574, -2569, -2569, 19016, 1412, 1569, 1504, + -2569, -2569, 1487, 1488, -2569, 1297, 32378, 15523, 15523, -2569, + 1170, 32095, 1178, -2569, -2569, -2569, -2569, -2569, -2569, 12, + -2569, 42390, -12, 1511, 91, 1301, -2569, 1355, 1762, 723, + 26228, 46198, -2569, -2569, 932, 1305, 50958, 46198, 1577, 1531, + 1581, -132, 53323, -2569, -2569, -2569, -2569, 46198, 46198, 51434, + 51910, 33822, 46198, 33346, -2569, -2569, -2569, -2569, 46198, 1035, + 46198, 4242, -2569, -2569, -2569, 183, -2569, -2569, -2569, -2569, + -2569, 46198, 46198, -2569, -2569, 183, 46198, 46198, 183, -2569, + 1135, 46198, 46198, 46198, 46198, 1163, 46198, 46198, -39, -39, + 1513, -2569, 12016, 123, -2569, 14020, 14020, -2569, 14020, 1482, + -2569, -2569, 713, 1523, 45, 1358, 42390, 42390, 46198, 1172, + -2569, -2569, -2569, -2569, -2569, -2569, 33346, 1312, 1315, 1662, + -2569, 1446, 1663, 1091, 35726, 689, 1359, 12517, 1779, 1547, + -2569, -2569, 1533, 14020, 1326, 1330, 70, 727, -2569, -2569, + 1331, 1247, 1345, 1347, 1332, 1334, 729, 53323, 1720, 90, + 1335, 1336, 1281, 643, 686, 1201, -2569, 84, -2569, 86, + -2569, 1542, 188, -2569, 1430, 1565, 1800, 796, -2569, -2569, + -2569, -2569, -2569, -2569, 22889, -2569, 756, -2569, -2569, 1801, + 954, 1801, 520, -2569, -2569, 1801, -2569, 1801, -2569, 30948, + -2569, 14521, -2569, 53323, -2569, 1342, -2569, 1348, 14020, 52, + -2569, 31468, 1343, 14020, 1350, 1352, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, 1354, 1672, -2569, 1356, 1367, + 4980, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, 1374, 1362, 31481, 1375, 18529, + 18529, 8008, 270, -2569, 18529, 1376, -2569, 1383, 31421, 1381, + 1388, 31555, 13018, 14020, 13018, 13018, 31815, -2569, 1397, 31975, + 46198, -2569, 16024, -2569, -2569, -2569, 14020, 42390, -2569, 14020, + 1401, 5992, -2569, -2569, -2569, 234, 6211, 6211, 6211, 2192, + -2569, -2569, -2569, 1373, -2569, 18529, 18529, -2569, 1387, 3464, + 8008, -2569, -2569, 1675, -2569, 704, -2569, 1396, -2569, -2569, + 3601, -2569, 27662, 32397, 14020, 142, -2569, 14020, 1270, 14020, + 1480, 6211, 6211, 6211, 238, 238, 180, 180, 180, 254, + 234, -2569, -2569, -2569, 1400, 1403, 1404, 1700, 1146, 14020, + -2569, -2569, 780, 789, 42390, 2871, 3237, 4638, -2569, -2569, + 21458, 1408, -43, 1507, 1408, 1720, 4108, -2569, 591, -2569, + -2569, -2569, 32095, -2569, 476, -2569, -2569, 1420, 1420, 14020, + 1943, 1420, 1615, 1616, 865, 865, 1170, 1617, -2569, -2569, + 1468, -2569, -2569, -2569, 14020, 9010, 1187, -2569, 1204, -2569, + -2569, -2569, -2569, 1410, -2569, -2569, 1666, -2569, -2569, -2569, + -2569, 21458, 1456, 46198, 1464, -99, 24320, -2569, 1626, 46198, + -2569, -2569, 1413, 1612, 1431, -2569, 1502, 1193, 14020, 1644, + -2569, 135, 1422, 1768, -121, 1722, 46198, -2569, 1637, -2569, + 537, 1777, 188, 1778, 188, 33346, 33346, 33346, -2569, 762, + -2569, -2569, 954, -2569, -149, 791, -2569, -2569, -2569, -2569, + 1515, 567, 1193, 1446, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, 99, 636, 1193, 1516, -2569, 1517, -2569, 1518, 885, + 1193, -2569, -2569, 123, 123, 123, 14521, -2569, 1656, 1657, + 1440, 32095, 32095, 32095, 1441, -2569, 119, -2569, 46198, -2569, + -2569, -2569, 1482, 42390, 1901, 1444, 796, -2569, 1598, 672, + -2569, 954, 46198, 42390, 42390, 46198, 1481, 42390, 53323, -2569, + -2569, -2569, 1445, 1447, -2569, -61, 1660, 1659, 1194, 1909, + -2569, 798, 13519, 1799, 42390, 1459, -2569, -2569, -2569, -2569, + 1720, -2569, -2569, -137, -137, -2569, 46198, -2569, 1458, -2569, + 1462, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, 46198, -2569, 42390, 1808, 476, -2569, 36202, -2569, + -2569, -2569, -2569, 33346, -2569, 954, -2569, 954, 1688, 46198, + 29520, 954, 954, -2569, -2569, -2569, -2569, 32041, 14020, -2569, + 1809, 53323, -2569, 6026, -2569, -2569, -2569, 14020, -2569, -2569, + 14020, -2569, 27662, 14020, 1795, -2569, 1955, 1955, 5099, 53323, + 18529, 18529, 18529, 18529, 652, 1141, 18529, 18529, 18529, 18529, + 18529, 18529, 18529, 18529, 18529, 19517, 215, -2569, -2569, 14020, + 14020, 1803, 1795, 14020, -2569, 53323, 1472, -2569, 1473, 1477, + 14020, -2569, 53323, 1471, 1485, 8008, 32060, -2569, 182, 28146, + -2569, 32095, -2569, 4108, 14020, 545, 982, 14020, 1506, 14020, + 1813, -2569, -2569, 1493, -2569, -2569, 53323, 14020, 1509, 5367, + 18529, 18529, 5498, -2569, 5858, 14020, 8008, -2569, 1513, 1546, + -2569, 1706, 1608, 1608, 1608, 1608, -2569, -2569, 42390, 42390, + 42390, 21935, 1843, 20981, 44770, 1519, -2569, 971, -2569, 44770, + 45246, -2569, 1532, -2569, 182, 14020, 1837, 123, 1409, 1837, + 1524, -2569, -2569, 1525, 129, -2569, -2569, -2569, 1528, -2569, + 1420, -2569, -2569, -2569, 1738, -2569, -2569, -2569, 42390, -2569, + -2569, 14020, 1677, -2569, -2569, -2569, -2569, 1583, -2569, -2569, + 800, 1946, 1677, 805, -2569, 182, 26228, 1456, 14020, 46198, + 28165, 1877, -2569, 46198, 46198, 46198, -2569, 46198, 1535, 1536, + 787, 1540, -2569, 787, 1864, 367, 1194, 211, 3489, -13, + -2569, -2569, -2569, 1623, 46198, -2569, 46198, -2569, -2569, -2569, + -2569, -2569, 33822, -2569, -2569, 27185, 33346, -2569, 33346, 46198, + 46198, 46198, 46198, 46198, 46198, 46198, 46198, 46198, 46198, 1550, + 1551, 1555, 1513, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + 193, -2569, 119, 1557, 476, 35726, 1359, 1622, 680, 45722, + -2569, 1558, 1556, 845, 1446, 2017, 1562, 405, 136, -2569, + -2569, 689, 35726, -2569, -2569, -2569, 1980, -2569, -2569, 476, + -2569, 476, 32095, 46198, 1631, -2569, 1247, 1567, -2569, -2569, + 1247, 53323, -2569, -2569, 188, 42390, -2569, 846, -2569, -2569, + -2569, -2569, 46198, 1563, -2569, 1563, -2569, -2569, 14020, 32095, + -2569, 1575, -2569, 32095, 28194, -2569, 32095, 1803, -2569, 1702, + 1702, 1702, 2456, 1895, 178, 1578, 1702, 1702, 1702, 287, + 287, 100, 100, 100, 1955, 215, 32095, 32095, -2569, -2569, + 1576, -2569, -2569, -2569, -2569, 1580, 46198, -2569, 5963, -2569, + 1564, 1582, 46198, -2569, -2569, 289, 14020, 14020, 1387, -2569, + 5145, 14020, 53323, 852, 1387, 197, 14020, 1399, 2130, 14020, + 14020, 6396, 28213, 1584, 14020, 26705, -2569, 42390, 42390, 42390, + 42390, -2569, -2569, -2569, 44770, 45246, 1586, 20503, 971, 1587, + 42390, -2569, 1665, 1589, 21458, 1854, 1781, -2569, 21458, 1781, + 1004, 1781, 1857, 1665, 25274, -2569, 1665, 1590, 1790, -2569, + 552, 32095, 2032, 1905, 1594, -2569, 1905, 954, -2569, -2569, + -2569, 27662, -2569, -2569, -2569, 32095, 10513, -2569, 476, 182, + 1195, 46198, -45, -2569, 1610, 46198, -2569, 1677, 32095, -2569, + -2569, 46198, 1599, -2569, 1600, 787, -2569, 46198, 1635, -2569, + 148, 1897, 77, -2569, 33346, 2434, 656, -2569, 1910, 1824, + -2569, 183, -2569, 14020, 656, 1826, 106, 46198, -2569, -2569, + 2462, -2569, 53323, 188, 188, -2569, 1607, 1609, 1613, 1619, + 1620, 1628, 1629, 1630, 1633, 1634, 1636, 1638, 1639, 1646, + 1647, 1648, 1652, 1007, 1653, -2569, 1654, 1528, 1655, 1658, + 1661, 53784, 1667, 1668, 1669, 1670, 1671, 327, 674, -2569, + -2569, -2569, 849, -2569, -2569, -2569, 1678, -2569, 1645, -2569, + -2569, -2569, 1693, -2569, 1698, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, 123, 1098, 78, 46198, 1481, 1606, 2073, + 850, 1844, 1674, -2569, 954, 1359, -2569, 1094, 35726, 1481, + -2569, 2006, 158, 1659, -2569, 122, 1664, -2569, 1830, 46198, + 1679, -2569, -2569, -2569, 2083, -2569, 36202, 1563, 32095, -2569, + -2569, -2569, 18529, 1951, 1683, 53323, -2569, -2569, 14020, -2569, + -2569, 1387, 1387, 5145, 853, -2569, 1387, 14020, 14020, 1387, + 1387, 14020, -2569, -2569, 28280, 52386, -2569, -2569, -2569, -2569, + -2569, -2569, -2569, -2569, 34298, 44770, 1686, -2569, 39058, -2569, + -2569, 46198, 971, 21458, -2569, -2569, 112, -2569, 21458, 1908, + -2569, 21458, -2569, 46198, 1687, -2569, 46198, -2569, 10012, 14020, + 1676, 954, 1676, -2569, 1691, 1640, -2569, -99, -2569, -2569, + 2048, 22412, 2009, 14020, -2569, -2569, 787, -2569, 1819, 1635, + 1699, -2569, -2569, -2569, -2569, -2569, -2569, -2569, 858, 1701, + 46198, 46198, 18529, -2569, 656, 175, 121, -2569, 1932, 42390, + 1635, 2102, -2569, -2569, -2569, -2569, 2080, 2161, 2051, -2569, + -2569, 32095, -2569, -2569, 1720, 1720, -2569, -2569, 2125, -2569, + -2569, -2569, -2569, 849, 448, 27185, 46198, 46198, 1708, -2569, + -2569, 193, 2084, 864, -2569, 689, 476, 42390, 2057, 35726, + -2569, 2179, 46198, 1481, 1721, -2569, -2569, 154, 154, -2569, + 1860, -2569, 1862, 301, -2569, 42390, -2569, -2569, 22412, 476, + -2569, 3435, 18529, 53323, 870, -2569, -2569, 1387, 1387, 1387, + -2569, 1915, -2569, -2569, 875, 2184, -2569, 46198, -52, 326, + 1726, 1727, -2569, -2569, 1728, -2569, 14020, 1733, -2569, -2569, + 21458, 112, 882, -2569, 53323, 46198, 886, 53323, -2569, 1737, + -120, 1739, -2569, 7507, 1724, -2569, -2569, -2569, -2569, -2569, + -2569, 32095, 32095, 46198, 1906, -2569, 1906, -2569, 10513, 1794, + 46198, 14020, 2165, 41, -2569, 888, -4, 32095, 42390, -2569, + 33346, -2569, 787, -2569, 33346, 14020, -2569, 640, 2456, 2203, + -2569, -2569, -2569, -2569, 1635, 796, -2569, 46198, -2569, 2054, + -2569, 46198, 1805, 457, 1825, -2569, -2569, -2569, -2569, 1098, + 954, 1359, 1659, 1664, 1749, 42390, 476, 405, -2569, 689, + -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, -2569, + -2569, -2569, 2185, 1963, 2186, 1631, 890, 3435, 892, -2569, + 2200, 1513, 1532, 34298, 1760, -2569, 1761, -2569, -2569, -2569, + -2569, -2569, 46198, 956, -2569, 32095, 46198, -2569, -2569, -2569, + 46198, 2125, 897, -2569, 14020, 1763, 14020, -2569, 16525, 1757, + -2569, 2224, 14020, 1823, 1823, 476, -2569, 28515, 46198, 46198, + 46198, 1408, 22412, -2569, 1888, 796, 787, 1780, 901, -2569, + -2569, 28566, 1988, -2569, 2081, -2569, 2021, -2569, 1774, -2569, + 14020, -2569, 1845, -2569, -2569, -2569, 2235, -2569, -2569, 35726, + 1782, 1664, 1481, 1659, 1986, -2569, 1987, 1784, 1359, -2569, + 14020, 284, -2569, -2569, 46198, -2569, 924, 1786, 1787, -2569, + -2569, -2569, 1788, 16525, 1789, -2569, 46198, 1785, 32095, 1930, + -2569, -2569, -2569, 2165, -2569, -2569, 232, 232, -2569, -2569, + 26228, 2021, 27185, -2569, 33346, 2025, 1774, 74, 2012, 1446, + -2569, 32095, -2569, 476, 35726, -2569, -2569, -2569, -2569, -2569, + 22412, 1408, 1381, 17026, 17026, 1798, 930, -2569, 2289, 1961, + -2569, -2569, 1811, -2569, -2569, -2569, 39058, 46198, 1420, 1420, + 1408, 2012, -2569, -2569, 2105, -2569, -2569, -2569, -2569, -2569, + 109, 2024, -2569, 2029, 1186, 1664, 934, -2569, 18028, 1962, + 239, 31434, -2569, -2569, -2569, -2569, -2569, 1822, 1827, -2569, + -2569, -2569, 232, -2569, -2569, -2569, -2569, -2569, 177, 177, + 2199, -2569, 1885, -2569, -2569, -2569, 1359, 2290, -2569, -2569, + -2569, -2569, -2569, -2569, 2316, 1420, 787, -2569, 2304, -2569, + 132, -2569, -2569, 1408, 17527, 1835, -2569, -2569, -2569, -2569, + -2569, -2569, -2569 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -2632, -2632, -2632, 1745, -2632, -2632, -2632, 209, -2632, 897, - -2632, 200, -551, 540, -2632, -2632, -2632, -2632, -2632, -2632, - -924, 23, -2632, -2632, -2632, -2632, 11, 260, -2632, -452, - -1864, -192, -2632, -2455, -2527, -2632, -520, -2418, -1688, -2632, - -1101, 174, -2632, -2111, -2632, -619, -979, -783, -990, -2632, - -21, -2632, 1198, -1098, -1772, -2460, -524, -2632, -597, -2632, - -352, -1767, -569, -552, -2632, -2349, -937, -2632, 1409, -254, - -2632, 569, -2632, -2106, -2632, -2632, 558, -2632, -939, -2632, - -2632, -1866, 190, -505, -1881, -2121, 510, -635, -2632, -555, - 236, -1742, -2632, 585, -2632, -489, -2632, -485, -2130, -2632, - -2632, -2632, 1176, -667, -2632, 1225, -2632, -2632, -2632, 27, - -2632, -2632, -2632, -2632, -2632, -776, 523, -2254, -2632, 462, - -2632, -2632, -2632, -2632, -81, 224, -2632, 4, 165, -22, - -10, 2, 21, 41, 1476, 1493, -2632, -553, 538, -2632, - -2632, -1774, -603, -46, -2632, 636, -1363, -1732, -459, 982, - 1451, 1454, -377, -397, -2632, -513, -2632, -1681, -2632, -2632, - 626, 1019, -1256, -1233, -2632, 340, -447, -380, -2632, -2632, - -2632, -2632, -2632, 83, -278, -455, 1001, -2632, 1464, -2632, - -2632, -2632, -2632, -1221, 674, -1997, 365, -1969, -1875, 123, - 114, -1176, -247, 25, 370, -343, -2632, -2632, -340, -1712, - -2303, -357, -356, -2632, -2632, -515, -1120, -685, -2632, -2632, - -431, 1921, -2632, -2632, -2632, 1937, 2080, -2632, -2632, 2151, - 2614, -2632, -571, 2671, 855, -677, 1168, -1084, 1169, -1059, - -1092, -885, 1173, 1174, -1226, 3155, -1516, -819, -5, -2632, - -2329, -1566, -2632, -2632, -111, -2632, -422, -2632, -420, -2632, - -2632, -2632, -401, -2631, -2632, 1106, 792, -2632, -2632, -1252, - -2632, 4058, 685, -2632, -1615, -556, 1195, -719, -986, -1151, - -2632, -2632, -2632, -2632, -2632, -2632, -1614, -1804, -784, 759, - -2632, -2632, 867, -2632, -2632, -1210, -588, 964, -563, -843, - 763, -2632, -550, 1116, -2632, 729, -1920, -2632, 393, -2632, - 2111, -522, 428, -984, 6, -2632, 3528, 1468, 1520, -854, - -2080, -2632, -2632, -482, -2195, -911, -2632, -621, -2632, -2632, - -2632, -1175, -2632, 591, -2632, -1097, -2632, -295, -2632, -2632, - -2112, -2632, -2632, -2632, -2632, -2632, -2632, -398, -2632, -475, - -473, -2632, -2632, 19, -780, 1242, -2632, -2632, 447, -2632, - 892, -2632, 770, -2632, 69, -2632, 1101, -2632, -2632, -2632, - 30, 1532, 384, -2632, 1104, -2632, -2632, -2632, -2632, -2632, - 965, -2632, -1095, -2493, 61, -2322, -1180, -6, -2632, -2632, - -2632, -529, -2632, -2077 + -2569, -2569, -2569, 1740, 10, 1364, 203, -2569, 76, -2340, + -627, -1105, -2522, -2569, -2569, -1158, 8, 1023, -17, 61, + 67, 21, 59, 1390, 1423, -2569, -1215, 820, -2569, -2569, + -1777, -602, -41, -2569, 579, -1357, -1716, -471, 916, 1379, + 1382, -469, -492, -2569, -601, -2569, -1020, -2569, -2569, 574, + 950, -1273, -1226, -2569, 261, -2569, -541, -475, -2569, -2569, + -2569, -2569, -2569, 0, -369, -464, 936, -2569, 1406, -2569, + -2569, -2569, -2569, -2569, -1231, -2569, 576, -1988, 288, -1974, + -1854, 40, 28, -935, -332, 19, 300, -431, -2569, -2569, + -429, -1704, -2403, -445, -444, -2569, -2569, -459, -1126, -692, + -2569, -2569, 353, 190, -2569, -2569, -2569, 1894, 2089, -2569, + -2569, 2177, 2383, -2569, -567, 2872, -493, -675, 1103, -1081, + 1106, -1044, -956, -840, 1108, 1112, -1249, 3370, -1578, -894, + -5, -2569, -2354, -1691, -2569, -2569, -2569, -191, -2569, -512, + -2569, -511, -2569, -2569, -2569, -543, -2562, -2569, 1036, 725, + -2569, -2569, -2569, -1241, -2569, 4121, 633, -2569, -1610, -870, + -577, 1128, -731, -961, -1153, -2569, -2569, -2569, -2569, -2569, + -2569, -1627, -1802, -537, 687, -2569, -2569, 803, -2569, -2569, + -2569, -614, 896, -556, -830, 699, -2569, 39, 1842, -1325, + -2569, 665, -1929, -2569, -2569, 323, -2569, 1520, -460, -1626, + 829, -1027, 20, -2569, 3146, 81, 1834, -853, -2112, -2569, + -2569, -489, -2193, -929, -2569, -622, -2569, -2569, 1033, -2569, + -2569, -2569, -2569, 758, -2569, -2569, -2569, 22, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, 266, -2569, 957, -2569, + 256, -549, 593, -2569, -2569, 535, -2569, -2569, -2569, 815, + -1104, -1771, -2434, -488, -2569, -553, -2569, -308, -1769, -521, + -508, -2569, -2361, -932, -2569, 1466, -213, -2569, 634, -2569, + -2120, -2569, -2569, 621, -2569, -950, -2569, -2569, -1779, 242, + -458, -2313, -2136, -1783, -632, -2569, -506, 282, -1742, -695, + -2569, 647, -2569, -454, -2569, -515, -2194, -2569, -926, -2569, + -2569, -2569, 1234, -656, -2569, 1283, -2569, 72, 23, -2569, + -2569, -2569, -2569, 95, 337, -2569, -381, -1903, -109, -2569, + -2494, -2568, -2569, -2569, -441, -2455, -1721, -2569, -2117, 1090, + -2569, -2569, -2569, -423, -2569, -466, -463, -2569, -2569, 13, + -789, 1238, -2569, -1102, 267, -2569, -620, -987, -788, -985, + -2569, 71, -2569, -2569, -2569, -2569, -2569, 610, -2569, 887, + -2569, 645, -1096, -2569, -317, -2569, -2569, -2107, -2569, -2569, + -2569, -2569, -2569, -2569, -2569, -2569, -544, 598, -2286, -2569, + 528, -2569, -2569, -2569, -2569, -24, 291, -2569, -6, -2569, + -2569, -2569, -526, -2569, -2105 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -1731 +#define YYTABLE_NINF -1759 static const yytype_int16 yytable[] = { - 477, 473, 1139, 999, 56, 965, 801, 734, 1132, 1473, - 646, 714, 474, 606, 595, 912, 1238, 1178, 1472, 1245, - 924, 61, 1532, 44, 1628, 1298, 1768, 54, 2077, 1771, - 75, 1184, 935, 1437, 576, 540, 2103, 61, 1300, 2108, - 1448, 1504, 2130, 1136, 1505, 1507, 732, 1508, 740, 1561, - 1444, 608, 1484, 2145, 1345, 2147, 581, 1426, 1536, 741, - 2457, 82, 795, 609, 1222, 2309, 1355, 1225, 1640, 2126, - 2458, 998, 2096, 1004, 2436, 1008, 593, 2438, 1477, 1667, - 1668, 2037, 1588, 616, 2166, 2167, 2168, 2468, 1254, 2471, - 551, -441, -715, -707, 2270, -715, 1164, 1165, -1047, 2326, - 1309, -444, -1072, -712, -1606, 547, 481, -712, -1072, 818, - -1069, -1069, -1709, -1709, 624, 818, 1980, 1977, 1978, 2631, - -1617, -1617, 1997, 1176, -1624, -1624, 1185, -1073, -1720, -1720, - 1315, -1073, -1727, -1727, 1362, -1070, -1070, 1740, 1412, 2811, - -1606, -674, 802, 2188, -687, -702, 958, 547, 547, 2635, - 961, 2737, 1789, 1350, 547, 1440, 1736, 1140, 657, 1509, - -1729, -1729, 1317, 2024, 2025, 57, 1475, 1359, 1232, 547, - 2071, 1232, 1678, 818, 2571, 918, 818, 1792, 818, 1605, - 1429, 57, 1228, 585, -441, 2071, 1640, 1602, -180, 1184, - 1678, 2659, 2324, -180, -444, 57, 1185, 598, 2260, 1440, - 2615, 594, 925, 1457, 1158, 1309, 1460, 1461, 2225, 2227, - 2158, 1185, 1604, -929, 2976, 1715, -948, 1185, 1346, 2195, - -929, 1699, 1716, -948, 2767, 2778, 607, 2705, 1397, 2348, - 3, 4, 2632, 603, 2814, 1315, 2555, 2962, 2472, 2680, - 2933, 2610, 1309, 1168, 57, 603, 1959, 2633, 1159, -401, - 2724, 2813, 2839, 544, 2598, 1164, 1165, 562, 1795, 2367, - 2987, 1462, -1706, -1706, 1875, 1177, 2946, 1317, 2796, 543, - 801, 2780, 1315, 2944, 1398, 1810, 2317, 801, 1432, 1360, - 2763, 1176, 1499, 1863, 599, 2354, 2881, 83, 2764, 601, - 2086, 1482, 1309, 1765, 1201, 1202, 1219, 1394, 1483, 2568, - 1456, 2335, 1810, 546, 1317, 1467, 2750, 2377, 1309, 954, - 2318, 2154, 2073, 2705, 647, 2629, 2722, 2134, 2528, 1301, - 2781, 1290, 2532, 1564, 2155, 2087, 2534, 1246, 818, 1468, - 806, 84, 1811, 26, 1399, 2320, 1136, 2326, 1315, 2475, - 2983, 807, 2609, 596, 2626, 2390, 1700, 1357, 2897, 2355, - 648, 2625, 2366, 1500, 1317, 588, 602, 2097, 2237, 2123, - 563, 2239, 1701, 2630, 1980, 1796, 926, 1702, 927, 31, - 1317, 2569, 2934, 1357, -441, 2357, 2793, 685, 2378, 2363, - 1766, 2365, 956, 1400, -444, 649, 1606, -566, 2723, 2261, - 801, 801, 638, 545, 639, 2838, 2956, 2473, 1361, 2815, - 1501, 1463, 1395, 1703, 1205, 1206, 2725, 1168, 2779, 1464, - 33, 1425, 1267, 1186, 2735, 2947, 1980, 1378, 2988, 919, - 2923, 1160, 2977, 1640, 1640, 1177, 2929, 2634, 1640, 1434, - 2518, 1447, 650, 603, 1522, 2488, 1351, -441, 1864, 503, - 1487, 1486, 1401, 532, 1628, 2659, 2556, -444, 2969, 2935, - 2721, 553, 658, 1585, 2782, 2765, 2322, 1927, 1929, 1637, - 2379, 36, 592, 592, 1925, 2241, 2242, 2243, 2244, 1640, - 1640, 2248, 2249, 2250, 2251, 2252, 2253, 2254, 2255, 2256, - 2257, 2705, 2484, 1186, 2942, 2097, 634, 2835, 2560, 920, - 1926, 1805, 1476, 2898, 2071, 2572, 2071, 1347, 1186, 1449, - 1862, 2978, 812, 61, 1186, 632, 1423, 586, 1876, 633, - 1424, 600, 636, 595, 2744, 620, 2079, 1520, 2106, 1789, - 728, 2899, 1132, 2287, 2288, 1473, 1883, 1161, 2979, 800, - 1679, 2436, 2669, 1162, 2438, 1374, 2159, 2673, 2174, 2175, - 2675, 2098, 1435, 2111, 1179, 1449, -441, 1179, 2039, 482, - 1704, 2963, 2660, 2912, 797, 61, -444, 628, 477, 477, - 1592, 629, 966, 2616, 610, 1187, 1180, 608, -929, 1180, - 1717, -948, 604, 2705, 2490, 2081, 2649, 1778, 1338, 609, - 1181, -707, 477, 1183, 628, -441, -1047, -441, 629, 2562, - -1072, -712, -1606, 1304, 1995, -444, -1072, -444, 1921, 1862, - 2316, 56, 2245, 1533, 1534, 929, 597, 2573, -1617, -1617, - 1529, 1723, -1624, -1624, 804, -1073, 611, 1471, 61, -1073, - 44, 1047, 477, 1133, 54, 946, 1570, 75, -1606, 1166, - 937, 2837, 1170, -702, 1738, 1353, 1741, 2591, 2843, 1467, - 1283, 948, 2842, 2538, 642, 928, 2541, 57, 1236, 1237, - 1221, 1236, 1237, 2600, 2601, 1949, 1224, 714, 82, 2851, - 1950, 2592, 2559, 1468, 1928, 1930, 1931, 485, -180, -180, - 1753, 2736, 1541, 1590, 1440, 2317, 1839, 2788, 1510, 2614, - 1335, 1336, 1337, 1338, 2711, 1441, 1842, 1440, 2852, 1845, - 1566, 1450, 1899, 1675, 1449, 818, 728, 1397, 1443, 57, - 594, 1554, 801, 2751, 1589, 2728, 1290, 2191, 1179, 2318, - 1596, 1951, 1590, 1136, 2619, 1333, 1334, 1335, 1336, 1337, - 1338, 1628, 2491, 1642, 1644, 2319, 1652, 486, 2109, 1301, - 1180, 627, 477, 818, 2320, 1132, 2903, 1450, 732, 1553, - 2246, 2561, 607, 1398, 949, 1557, 1665, 652, 2369, 2071, - 2247, 1724, 1447, 2071, 2752, 1562, 817, 1590, 795, 1980, - 655, 954, 57, 2753, -1731, -1731, -1731, 1590, 2321, 1136, - 1449, 1640, 1640, 1640, 1640, 2626, 656, 1640, 1640, 1640, - 1640, 1640, 1640, 1640, 1640, 1640, 1640, 1942, 1179, 2670, - 1944, 2208, 2754, 800, 1669, 2714, 2274, 2212, 1447, 1948, - 800, 1047, 728, 1952, 2131, 1953, 2436, 628, 1298, 2438, - 1180, 629, 1478, 1308, 1637, 1637, 1309, 2017, 477, 1637, - 1449, 2833, 1230, 61, 1181, 1231, 1831, 1449, 1510, 1640, - 1640, 659, 2370, 2080, 956, 1681, 1838, 1990, 1991, 1992, - 1993, 1994, 1995, 660, 2662, 2826, 1315, 477, 1473, 2663, - 738, 1754, 1400, -1731, 954, 2322, 595, 1449, 2982, 955, - 1637, 1637, 2755, 2006, 1910, 2008, 2009, 477, 477, 477, - 972, 477, 477, 808, 2756, 2169, 973, 1802, 1317, 1858, - 1859, 1860, 547, 957, 2283, 1932, 1450, 1933, 1481, 1132, - 1935, 1992, 1993, 1994, 1995, 477, 985, 2371, 490, 2372, - 491, 810, 2106, 1372, 1837, 86, 1373, -490, 26, 811, - 2029, 1401, -490, 800, 800, 986, 2132, -453, -1704, -1704, - 26, 2100, 2160, 1848, 1813, 494, 812, 956, 1855, 654, - -453, 3, 4, 628, 813, -453, 2030, 1356, 2157, 2817, - 1386, 1387, 2671, 1393, 31, 2161, 477, 1447, 2026, 2821, - 477, 477, 609, 609, 2071, 609, 31, 917, 737, 2196, - 647, 477, 1450, 2071, 2203, 1179, 987, 57, 2071, 946, - 923, 2071, 1907, 2645, 1375, 2165, 957, 1376, -1731, 728, - -490, 932, 974, 1840, -453, 33, 938, 1180, 1843, 560, - 2071, 1174, 1175, 533, -1731, 578, 648, 33, 34, -1731, - 972, 1183, 939, -453, 1047, 1270, 973, 640, 941, 641, - 34, 1047, 1450, 913, 914, 942, 916, 592, 1882, 1450, - 944, 1558, 35, 1447, 1376, 533, 1474, 1584, 1919, -490, - 1585, 2184, 1047, 1986, 35, -1731, 36, 2481, 628, 945, - -1047, 801, 629, 1292, 617, -1705, -1705, 1586, 1755, 1450, - 1587, 952, -453, 2031, 801, 967, 988, 1749, 2032, 969, - 1224, -453, 2720, 1662, 2757, 1663, 87, 2758, 975, 2051, - 971, 2052, 1955, 1447, 88, 972, 2071, 1896, 650, 1897, - 1447, 973, 1504, 970, 1800, 1505, 1507, 1376, 1508, 972, - 1326, 1652, 2007, 1652, 1652, 973, 983, 2876, 1872, 972, - 1903, 1873, 984, 1585, 1628, 973, 989, 1001, 2071, 89, - 1447, 2053, 974, 2054, 990, 607, 607, 1908, 607, 1911, - 1376, 1917, 1587, 2133, 1918, 2134, 991, 1137, 2027, 1938, - 2768, 2501, 1939, 2013, 975, 2075, 1956, 1133, 1963, 1376, - 951, 1376, 953, 972, 2533, 2388, 2536, 1047, 1999, 973, - 2142, 1376, 2144, 2135, 1005, 2381, 90, 992, -1707, -1707, - 477, 2221, 1637, 1637, 1637, 1637, 728, 728, 1637, 1637, - 1637, 1637, 1637, 1637, 1637, 1637, 1637, 1637, 2058, 2059, - 1138, 728, -1731, 2364, 1143, 976, 1141, 974, 2975, 977, - 1145, 2943, 2957, 2958, -1708, -1708, 2380, 2454, 2389, 2033, - -453, 974, 1146, 91, 994, 1153, 480, 1155, 2071, 1157, - 2034, 974, 531, 2021, 2959, 1166, 1376, 1172, 2627, 978, - 1637, 1637, 1162, 561, 1169, 800, 995, 574, -1731, -1731, - -1731, 1170, 1990, 1991, 1992, 1993, 1994, 1995, 2210, 2211, - 2148, 1133, 2985, 2149, 2071, 2182, 997, 1190, 2346, 2152, - 797, 61, 2153, 1173, 477, 974, 477, -1710, -1710, 477, - 477, 634, 1189, 628, 975, 26, 941, 629, 1192, 477, - 2989, 477, 477, 477, 477, 477, 477, 477, 61, 1640, - 632, 1220, -1731, 1687, 633, 2207, 979, 636, 1376, 1333, - 1334, 1335, 1336, 1337, 1338, 1227, 477, 26, 477, -1711, - -1711, 31, 1223, 728, 477, 477, 477, 477, 1133, 1688, - 1226, 2268, 477, 477, 1224, 1002, 1229, 477, 1570, 977, - 2279, 477, 1247, 1376, 477, 477, 477, 477, 477, 477, - 477, 477, 477, 31, 1257, 477, 2071, -1712, -1712, 975, - 477, 2648, 33, 477, 1258, 477, 534, 1047, 2344, 1003, - 1133, 2345, 1260, 975, 2968, 34, -678, 2349, 2368, 2106, - 2350, 1873, 2463, 975, 1262, 1873, 592, 972, 1640, -685, - 477, 2430, 2575, 973, 33, 2482, -1713, -1713, 2483, 35, - 1813, 726, 1267, 2495, 1265, 1757, 2496, 34, 2502, 1266, - 477, 1587, 929, 535, 977, 57, 2564, -1714, -1714, 1873, - 2388, 477, 477, 2565, 1006, -675, 1873, 975, 977, -676, - 2650, 35, 801, 1587, 1801, 1268, 979, 1269, 977, 36, - 2578, 1689, 57, 2563, 978, 36, 1690, 2715, 1271, 1590, - 2716, 1691, 2743, 728, 26, 1873, 1640, 2770, 1007, 1133, - 1587, 1133, 2773, 2785, -566, 2774, 1224, 2233, 978, -679, - 2790, 1615, 2216, 2791, 2266, -1715, -1715, 2523, 1846, 1616, - 1617, 1618, 977, 2794, 2809, 2240, 2791, 2810, -677, 2848, - 31, 2523, 2810, 2849, 1287, 2857, 1587, 2580, 1224, 974, - 1047, 1790, 1791, 477, 477, 1685, 477, -567, 548, 548, - 2262, 979, 1847, -1716, -1716, 1272, 2769, 2267, 2298, 2299, - 2300, 2301, 1195, 1196, 1133, 979, 1299, 2863, 1273, 2331, - 2791, 33, 1590, -1717, -1717, 979, 2924, 477, 2925, 2575, - -1718, -1718, 477, 1900, 34, 2576, 475, 2884, -1719, -1719, - 2885, 504, 1831, 2913, 2439, 504, 2914, 728, 2577, 1275, - 549, 549, 552, 504, 557, 1343, 57, 557, 35, 2480, - 557, 583, 1349, 2916, 504, 504, 1224, 726, 2917, 979, - 1350, 1376, 36, 1276, 800, 2919, 2453, 2578, 1376, 2579, - 1201, 1202, 1692, 2823, -1721, -1721, 1277, 800, 2583, 1047, - 485, 728, 2950, 1693, 2954, 2791, 477, 2799, 1351, 2970, - 1278, 477, 2810, 2974, -1722, -1722, -1723, -1723, 2596, 557, - -1724, -1724, 2552, -1118, -1725, -1725, 583, 504, 583, 583, - 583, -1726, -1726, 595, -1728, -1728, -1730, -1730, 1489, 1490, - 1279, 2584, -542, -542, 2580, 1203, 1204, 477, 477, 477, - 1280, 975, 477, 1281, 2106, 2316, 1282, 2585, 2741, 2433, - 486, 477, 477, 477, 477, 1205, 1206, -546, -546, -545, - -545, 477, 1555, 2581, 1556, 477, 1283, 817, 477, 1302, - 1980, 1366, 595, 726, 1379, 1981, 1982, 1983, 955, 1385, - 1637, 26, 957, 477, 477, 1419, 26, 1421, 477, 1427, - 1205, 1206, 1853, 1445, 57, 1446, 977, 1447, 601, 1368, - 1370, 1454, 477, 1452, 488, 477, 1453, 477, 2479, 1458, - 1465, -491, 1466, 2221, 1470, 1480, -491, 31, 1485, 1492, - 2317, 1493, 31, 1497, 817, 1502, 1854, 1980, 477, 1503, - 2582, 1510, 1981, 1982, 1983, 2583, 2605, 2606, 2105, 1513, - 477, 2069, 1511, 595, 2586, 1516, 1571, 1178, 1517, 2276, - 1519, 2587, 474, 1136, 2318, 477, 2069, 1523, 33, 1528, - 818, 1535, 1537, 33, 634, 602, 1544, 474, 1590, 1637, - 2319, 34, 1538, 477, 1583, 1545, 34, 1548, 2584, 2320, - 1549, 61, 1363, 632, -491, 1597, 1592, 633, 477, 477, - 636, 1572, 1550, 979, 2585, 35, 1551, 1309, 1657, 1376, - 35, 2550, 1659, 1664, 1695, 1677, 1684, 477, 1661, 36, - 1292, 1696, 1698, 2321, 36, 1736, 1719, 1573, 1743, 1720, - 1750, 490, 1751, 491, 1133, 1133, 1133, 1758, 602, 1769, - 1780, 1779, 1781, -491, 1782, 1574, 1784, 1637, 2430, 1575, - 1783, 1803, 603, 1807, 1808, 493, 1809, 603, 494, 1870, - 726, 1874, 1878, 1984, 1886, 1887, 1884, 1885, 1901, 1292, - 1576, 1906, 1905, 1577, 1909, 1047, 1912, 1913, 1914, 1806, - 1915, 1916, 1923, 1934, 1936, 1985, 1924, 1685, 1578, 1814, - 1937, 1817, 1945, 1965, 1828, 1957, 1968, 2604, 2028, 2035, - 1832, 2586, 1834, 2046, 1973, 1966, 2023, 2044, 2587, 728, - 2322, 1967, 1969, 2073, 1841, 1970, 1972, 1976, 2045, 1844, - 2047, 2063, 1998, 1849, 1850, 1851, 1852, 2004, 1856, 1857, - 2011, 2048, 2049, 2085, 2083, 57, 2063, 2092, 2099, -547, - 594, 2113, 1985, 1619, 1620, 1621, -548, 1622, 1623, 1624, - 1625, 1626, 1627, 1133, 1986, 800, 2101, 2112, 2116, 2117, - 2119, 1900, 2121, 2122, 2115, 2125, 2128, 2141, 2143, 2170, - 1473, 2156, 2162, 477, 801, 2171, 728, 2163, 2164, 1579, - 2172, 2173, 477, 2181, 2197, 477, 2193, 1580, 477, 2201, - 2194, 604, 2198, 2205, 728, 477, 477, 477, 477, 2204, - 2214, 477, 477, 477, 477, 477, 477, 477, 477, 477, - 477, 1986, 595, 2215, 477, 477, 2217, 2224, 2232, 728, - 2001, 2293, 1980, 583, 477, 2000, 728, 2263, 477, 644, - 1581, 803, 645, 548, 805, 2281, 583, 477, 2264, 2282, - 477, 504, 477, 595, 2265, 2285, 2294, 726, 726, 728, - 477, 2056, 2307, 477, 477, 2329, 915, 2333, 477, 477, - 595, 2315, 726, 985, 2338, 2339, 2341, 2347, 645, 504, - 504, 2343, 2356, 2772, 477, 2069, 477, 2069, 2358, 2362, - 2374, 2376, 986, 2392, 2450, 549, 474, 477, 474, 2451, - 2452, 2456, 2466, 2461, 2462, 2465, 2470, 477, 2478, 2476, - 2489, 2492, 985, 2486, 910, 910, 557, 557, 2493, 557, - 1873, 2820, 2827, 477, 2718, 2520, 2433, 2529, 2494, 2524, - 583, 986, 57, 2430, 2530, 2510, 2521, 2527, 2542, 504, - 2537, 2543, 2544, 987, 2545, 2547, 2566, 2570, 2558, 2594, - 583, 2595, 2599, 2611, 2612, 2613, -1069, -1704, -1705, 1987, - 1988, 1989, 583, 1990, 1991, 1992, 1993, 1994, 1995, 2777, - 2621, 2622, -1706, 1133, 2636, 2623, -1707, 1133, 2437, 1133, - -1708, -1709, 987, -1710, 2639, -1711, 2620, 2777, -1712, -1713, - -1714, -1715, -1716, 2792, 726, -1717, 2792, 2643, 583, 583, - 583, -1718, -1719, 1308, -1721, 2637, 1309, -1722, 2646, 1292, - -1723, 2883, -1724, -1725, 2642, -1726, 1987, 1988, 1989, 2655, - 1990, 1991, 1992, 1993, 1994, 1995, -1727, 619, -1728, 622, - -1729, 626, -1730, 988, -1070, 2674, 1315, 728, 2474, 2696, - 1292, 2647, 2661, -1731, 2679, 2850, 2701, 2707, 2384, 2709, - 2710, 2712, 2717, 2726, 477, 2305, 2729, 2308, 2730, 2731, - 2733, 2732, 2740, 2746, 2742, 2747, 2748, 2761, 1317, 2864, - 817, 2866, 988, 1980, 2762, 2771, 2775, 2783, 1981, 1982, - 1983, 2830, 2784, 989, 2787, 2795, 2797, 1308, 2803, 2806, - 1309, 990, 2799, 2811, 2820, 2860, 2825, 1241, 2829, 2831, - 477, 477, 2940, 991, 1241, 477, 728, 2834, 2844, 2845, - 477, 2846, 2856, 477, 477, 2865, 2869, 2868, 477, 2871, - 1315, 2882, 989, 2886, 726, 2725, 2888, -1731, 2889, 2891, - 990, 2895, 2894, 2896, 992, 2900, 2901, 2902, 2036, 477, - 2069, 2911, 991, 477, 2069, 2922, 2915, 2295, 2930, 2945, - 2951, 474, 1317, 2936, 2952, 474, 2961, 2200, 2964, 2878, - 2966, 2971, 1259, 2972, 2973, 477, 2962, 2963, -1731, 2984, - 972, 2986, 943, 992, 2990, 2391, 973, 2551, 2553, 2395, - 1833, 994, 1303, 985, -1731, 2139, 2554, 2351, 2877, -1731, - 2700, 1306, 2926, 2464, 2932, 2602, 2981, 2824, 1133, 57, - 2967, 2433, 986, 995, 1354, 2960, 2760, 477, 2124, 2146, - 2928, 1436, 2965, 2178, 2469, 1364, 728, 1241, 1241, 2396, - 994, 2120, 2286, 997, 2927, -1731, 1552, 1531, 726, 1297, - 2179, 2218, 2644, 2455, 1358, 2104, 1799, 2859, 2873, 2955, - 2114, 1416, 995, 1415, 1377, 1776, 2437, 2337, 2918, 2867, - 2548, 2805, -1731, 987, 1798, 2082, 1420, 2310, 2789, 2519, - 2306, 2855, 997, 2854, 2861, 2535, 2862, 2699, -1731, 1601, - 1603, 583, 726, -1731, 1607, 1608, 2920, 717, 1985, 2921, - 1326, 2910, 974, 1725, 2019, 2107, 1869, 1591, 504, 504, - 1960, 2042, 2040, 719, 583, 583, 1384, 1735, 2076, 2336, - 2628, 2847, 2183, 1563, 1745, 1954, 1380, 800, 1747, -1731, - 2063, 0, 2352, 477, 2063, 0, 728, 0, 0, 0, - 477, 583, 1439, 0, 0, 0, 0, 0, 477, 477, - 0, 0, 477, 0, 583, 0, 0, 0, 57, 57, - 0, 0, 0, 988, 477, 2069, 0, 1986, 0, 0, - 0, 583, 0, 477, 2069, 583, 474, 0, 477, 2069, - 0, 477, 2069, 0, 1326, 474, 0, 0, 477, 477, - 474, 0, -1731, 474, 0, 2360, 0, 0, 0, 0, - 477, 2069, 477, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 474, 989, 0, 0, 0, 0, 0, 2393, - 0, 990, 477, 0, 484, 0, 0, 0, 485, 0, - 0, 0, 0, 991, 2440, 2441, 2442, 2443, 2444, 2445, - 2446, 2447, 2448, 2449, 637, 0, 0, 0, 0, 0, - 0, -1118, 0, 0, 975, 2437, 720, 651, 0, 0, - 0, 0, 0, 0, 992, 0, 0, 0, 0, 0, - 0, 0, 0, 717, 0, 2745, -1731, 0, 0, 0, - 0, 57, 0, 0, 0, 0, 477, 2069, 486, 719, - 477, 728, -1731, 0, 0, 487, 0, 2628, 474, 1333, - 1334, 1335, 1336, 1337, 1338, 993, 0, 0, 1496, 977, - 0, 994, 0, 0, 477, 595, 583, 0, 477, 2069, - 0, 0, 728, 0, 0, 728, 1526, 722, 0, 0, - 474, 477, 0, 995, 0, 0, 0, 0, 0, 996, - 0, 922, 488, 0, 2063, 0, 477, 0, 0, 2063, - 0, 0, 2063, 997, 0, 0, 1133, 0, 0, 1543, - 1133, 477, 1987, 1988, 1989, 0, 1990, 1991, 1992, 1993, - 1994, 1995, 817, 968, 0, 1980, -1731, 0, 0, 717, - 1981, 1982, 1983, 1333, 1334, 1335, 1336, 1337, 1338, 1611, - 645, 645, 0, 504, 504, 719, 504, 645, 0, 583, - 726, 2841, 0, 0, 0, 0, 979, 0, 0, 1148, - 1150, 1152, 489, 0, 0, 477, 0, 0, 477, 2069, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 474, 0, 720, 0, 0, 0, 57, 0, 0, 477, - 0, 477, 0, 477, 0, 0, 1630, 477, 0, 0, - 0, 0, 0, 0, 477, 2069, 0, 1656, 57, 490, - 2874, 491, 0, 0, 0, 0, 474, 726, 0, 0, - 0, 0, 0, 0, 0, 477, 0, 492, 0, 0, - 0, 1742, 0, 493, 0, 726, 494, 645, 0, 2063, - 0, 0, 0, 0, 0, 477, 477, 0, 0, 0, - 0, 0, 1292, 722, 0, 0, 0, 0, 0, 477, - 726, 0, 0, 0, 0, 0, 0, 726, 0, 0, - 583, 910, 0, 0, 0, 0, 0, 0, 0, 1133, - 2437, 0, 0, 0, 0, 0, 0, 0, 720, -1509, - 726, 0, 583, 0, 583, 0, 477, 2069, 477, 2941, - 0, 0, 0, 1759, 0, 1764, 717, 0, 474, 985, - 0, 0, 57, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 719, 0, 0, 0, 0, 0, 986, 0, - -1731, 0, 0, 0, 0, 0, 0, 1193, 1194, 0, - 0, 583, 0, 0, 0, 0, 0, 0, 0, 0, - 1439, 504, 0, 0, 0, 0, 0, 0, 0, 722, - 0, 504, 1815, 504, 1819, 477, 504, 0, 0, 0, - 0, 57, 504, 0, 504, 0, 0, 0, 0, 987, - 2382, 0, -1509, 0, 0, 645, 504, 0, 2383, 0, - 645, 504, 0, 0, 0, 504, 504, 504, 504, 1986, - 504, 504, 0, -1511, 0, 2719, 0, 0, 0, 726, - 0, 0, 1195, 1196, 0, 0, 0, 0, 0, 0, - 583, 583, 1881, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1371, 0, -1509, 0, 0, 1895, 1241, 0, - 2738, 2739, 1947, 0, 0, 2384, 0, -1509, 0, 0, - 0, 1241, -1509, 0, 0, 2749, 1382, -1509, 0, 0, - 57, 0, 0, 0, 0, 720, -1509, 0, 726, 988, - -1509, 0, 0, 0, 0, 0, 1197, 1198, 1199, 1200, - 1201, 1202, 1428, 0, 1203, 1204, 0, 0, 0, 0, - 0, 0, 0, 717, 717, 1455, -1511, 0, 0, 0, - 0, -1509, 0, 0, 0, 0, 0, 0, 717, 719, - 719, 0, 0, 0, 0, 0, 1479, 0, 0, 989, - -1509, 0, 0, 0, 719, 0, 0, 990, 0, 2807, - 0, 0, 0, 0, 0, 0, 722, 726, 0, 991, - 723, 2385, 0, 0, 0, 0, 0, 0, -1511, 0, - 0, 0, 0, 0, 0, 0, 0, 2828, 0, 0, - 0, -1511, 0, 0, 0, 0, -1511, 0, 0, -1509, - 992, -1511, -1509, 0, 0, 504, 0, 0, -1509, 0, - -1511, 0, 1297, 0, -1511, 0, 0, 0, 0, 0, - 1205, 1206, 0, 0, 1987, 1988, 1989, 725, 1990, 1991, - 1992, 1993, 1994, 1995, 0, 0, 0, 0, 0, 0, - 0, 0, -1509, 0, 0, -1511, 1630, 994, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 717, 0, 0, 0, -1511, -1509, 0, 0, 0, 995, - 0, 0, 0, 0, 0, 0, 719, 726, 0, 583, - 0, 0, 720, 720, 0, 0, 2072, 1512, 0, 997, - 0, 2386, 0, 0, 2387, 0, 0, 720, 0, 0, - 0, 2072, -1525, 0, 0, 2091, 0, 726, 2094, 817, - 1764, 0, 1980, -1511, 0, 0, -1511, 1981, 1982, 1983, - 2056, 0, -1511, 0, 2151, 0, 0, 817, 0, 0, - 1980, 1207, 1208, 0, 2277, 1981, 1982, 1983, 0, 0, - 0, 0, 0, 0, 0, 0, 723, -1509, 0, 0, - 0, 1209, 2504, 722, 722, -1509, -1511, 0, 0, 0, - 0, 1496, 0, 0, 0, 0, 0, 0, 722, 2177, - 1560, -1509, 0, -1509, -1509, 0, 0, 726, 0, -1511, - 0, 0, 2187, 0, 0, 0, 0, 0, 0, 0, - 717, 0, 0, 0, 0, -1525, 1447, 0, 0, 0, - 0, 0, 0, 725, 0, 0, 719, 0, 0, 0, - -1509, 0, 0, -1509, -1509, -1509, 0, 0, 0, 720, - 0, 0, 0, 1496, 0, 0, 0, 0, 583, 0, - 0, 0, 0, 0, 2056, 1496, 583, 583, 583, 1241, - 1308, 0, 0, 1309, 2222, 0, 2223, -1525, 0, 504, - 2228, 2229, 723, 0, 0, 0, 583, 0, 0, 0, - -1525, -1511, 0, 0, 0, -1525, 0, 0, 2213, -1511, - -1525, 0, 0, 1315, 0, 0, 0, 0, 0, -1525, - -1731, 0, 0, -1525, 645, -1511, 0, -1511, -1511, 0, - 722, 1734, 0, 0, 717, 0, 726, 0, 0, 0, - 1496, 1496, 0, 0, 0, 1317, 0, 0, 0, 725, - 719, 0, 0, 1744, -1525, 1746, 0, 1985, 0, 0, - 0, 0, 0, 1630, -1511, 0, 0, -1511, -1511, -1511, - 0, 0, 726, -1525, 0, 1985, 0, 0, 717, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 720, - 0, 0, 0, 0, 719, 0, 0, 0, 0, 0, - 0, 0, 1794, 726, 0, 0, 726, 0, 0, 0, - 0, 0, 0, 0, 0, 2289, 0, 0, 0, 1193, - 1194, 0, -1525, 0, 0, -1525, 1986, 0, 0, 0, - 0, -1525, 0, 0, 0, 0, 0, 0, 0, 2297, - 0, 0, 0, 0, 1986, -1731, 0, 583, 583, 583, - 475, 0, 2072, 2314, 0, 0, 0, 2314, 2328, 0, - 722, -1731, 0, 0, 0, -1525, -1731, 0, 0, 723, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1879, 1880, 0, 0, 0, 0, 1764, -1525, 0, - 0, 0, 2435, 720, 1195, 1196, 0, 0, 0, 0, - 0, 0, -1731, 0, 0, 583, 0, 504, 0, 0, - 0, 1496, 1439, 1496, 0, 1526, 0, 2177, 0, 0, - 0, 0, 0, 0, 0, 0, 725, 0, 0, 0, - 0, 504, 0, 2394, 0, 0, 0, 720, 0, 0, - 0, 0, 0, 2056, 0, 0, 504, 504, 504, 504, - 504, 504, 504, 504, 504, 504, 0, 1326, 1197, 1198, - 1199, 1200, 1201, 1202, 722, 0, 1203, 1204, 0, 0, - -1525, 1439, 0, 0, 583, 0, 0, 0, -1525, 0, - 0, 0, 0, 0, 1439, 0, 0, 0, 0, 894, - 894, 0, 0, 0, -1525, 1526, -1525, -1525, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 583, 722, 0, - 0, 726, 0, 0, 1496, 0, 0, 0, 0, 0, - 0, 1987, 1988, 1989, 0, 1990, 1991, 1992, 1993, 1994, - 1995, 0, 0, -1525, 0, 0, -1525, -1525, -1525, 1987, - 1988, 1989, 0, 1990, 1991, 1992, 1993, 1994, 1995, -1731, - 0, 0, 1042, 1049, 0, 0, 723, 723, 0, 0, - 0, 0, 2497, 0, 0, 0, 0, 0, 0, 0, - 0, 723, 1205, 1206, 0, 0, 2549, 0, 0, 1308, - 0, 0, 1309, 0, 0, 2513, 717, 0, 583, 583, - 583, 583, 0, 0, 0, 2314, 2328, 0, 2314, 0, - 0, 2522, 719, 0, 0, 2072, 0, 0, 0, 2072, - 2055, 0, 1315, 725, 725, 2540, 0, 0, 0, -1731, - 0, 0, 0, 0, 0, 0, 0, 0, 725, 0, - 0, 910, 0, 0, 0, 2091, 0, 0, 0, 0, - 1764, 0, 0, 0, 1317, 0, 1630, 0, 0, -1731, - 0, 0, 1439, 717, 0, 0, 1333, 1334, 1335, 1336, - 1337, 1338, 0, 0, 0, 0, 0, 0, 0, 719, - 0, 717, 0, 1308, 0, 0, 1309, 2603, 0, 0, - 0, 0, 0, 1207, 1208, 0, 0, 719, 0, 0, - 0, 0, 0, 723, 0, 0, 717, 0, 0, 0, - 2624, 0, 0, 717, 0, 0, 1315, 0, 0, 0, - 0, 0, 719, -1731, 2290, 0, 0, 0, 0, 719, - 0, 1241, 0, 0, 0, 0, 717, 0, 0, 0, - 0, 0, 1042, 0, 0, 0, 0, 0, 1317, 0, - 0, 0, 719, 0, -1731, 720, 1496, 0, 0, 1263, - 725, 0, 0, 0, 0, 1895, 0, 0, 0, 2180, - -1731, 0, 0, 0, 0, -1731, 2640, 2189, 2190, 2192, - 0, 0, 0, 0, 0, 0, 0, 0, 1274, 0, - 0, 0, 0, 0, 0, 2698, 0, 2206, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1284, 1285, - 1286, -1731, 0, 1293, 0, 0, 0, 0, 2508, 0, - 475, 2314, 720, 0, 2667, 0, 722, 504, 0, 2072, - 0, 0, 0, 723, 2072, 0, 1348, 2072, 0, 2678, - 720, 0, 2681, 0, 0, 0, 0, 0, -1731, 0, - 0, 0, 0, 0, 0, 717, 2706, 0, 0, 2435, - 0, 0, 0, 0, -1731, 720, 1326, 0, 0, -1731, - 0, 719, 720, 0, 0, 0, 645, 504, 0, 0, - 0, 0, 0, 0, 0, 583, 0, 1392, 0, 0, - 725, 1406, 1411, 722, 0, 720, 0, 0, 0, 0, - 0, 0, 0, 0, 0, -1731, 0, 0, 0, 0, - 0, 722, 504, 504, 717, 0, 0, 0, 0, 0, - 0, 0, 0, 1439, 0, 0, 0, 504, 0, 0, - 719, 0, 0, 0, 0, 0, 722, 723, 0, 583, - 0, 0, 2706, 722, 0, 1042, 0, 0, 2302, 2303, - 2304, 0, 1042, 0, 0, 0, 0, 0, -1731, 0, - 1326, 504, 0, 0, 0, 1308, 722, 0, 1309, 0, - 0, 0, 0, 1042, 2072, 0, 0, 0, 0, 2681, - 0, 723, 0, 717, 0, 0, 0, 0, 0, 0, - 2836, 0, 0, 0, 725, 0, 2802, 0, 1315, 719, - 0, 504, 0, 0, 0, -1731, 2359, 0, 0, 0, - 583, 0, 0, 0, 720, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 504, - 1317, 0, 817, 645, 0, 1980, 0, 0, 725, 0, - 1981, 1982, 1983, 0, 0, 0, 583, 0, 0, 0, - 0, 0, -1731, 0, 0, 0, 0, 2505, -1731, 0, - 0, 0, 0, 0, 0, 1333, 1334, 1335, 1336, 1337, - 1338, 0, 0, 720, 475, 2460, 0, 0, 0, 0, - 0, 0, 0, 2858, 0, 722, 0, 504, 1042, 0, - 0, 2678, 0, 717, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1240, 1560, 719, - 2706, 645, 645, 645, 1240, 0, 0, 0, 0, 0, - 0, 0, 0, 717, 0, 0, 0, 0, 0, 0, - -1731, 0, 0, 0, 2435, 0, 0, 0, 0, 719, - 0, 0, 720, 1600, 722, 547, -1731, 0, 0, 0, - 0, -1731, -1731, 0, 0, 0, 2678, 0, 0, 1333, - 1334, 1335, 1336, 1337, 1338, 0, 0, 0, 2802, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1764, 0, 0, 0, 0, -1731, 0, 2514, - 2515, 2516, 2517, 717, 0, 0, 1439, 0, 0, 0, - 1595, 1305, 2706, 0, 0, 0, 0, 0, 0, 719, - 1614, 0, 1631, 722, 0, 1643, 1646, 1651, 1654, 0, - 0, 0, 2667, 645, 0, 1240, 0, 1240, 1240, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1666, - 1985, 0, 1326, 0, 0, 1670, 1671, 1672, 1673, 1193, - 1194, 0, 720, 1682, 1683, 0, 0, 0, 1694, 0, - 0, 0, 1697, 0, 0, 1705, 1706, 1707, 1708, 1709, - 1710, 1711, 1712, 1713, 0, 0, 1714, 0, 0, 0, - 0, 1722, 720, 0, 1726, 0, 894, 0, 1042, 723, - 0, 0, 0, 0, 1240, 0, 0, 1240, 1240, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1986, - 0, 1748, 717, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 722, 1195, 1196, 0, 0, 719, 0, - 0, 0, 0, 0, -1731, 0, 0, 0, 0, 0, - 0, 0, 1285, 1286, 0, 0, 725, 0, 717, 0, - 0, 0, 720, 722, 0, 0, 723, 0, 0, 0, - 0, 0, 0, 0, 719, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 723, 0, 0, 0, 0, 717, - 0, 0, 717, 0, 0, 0, 0, 0, 1197, 1198, - 1199, 1200, 1201, 1202, 0, 719, 1203, 1204, 719, 723, - 0, 0, 0, 0, 0, 0, 723, 0, 0, 0, - 0, 0, 0, 725, 0, 0, 0, 0, 0, 0, - 0, 1042, 0, 722, 1866, 1867, 0, 1868, 0, 723, - 0, 725, 0, 0, -1731, 0, 0, 0, 0, 0, - 0, 1333, 1334, 1335, 1336, 1337, 1338, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 725, 0, 1904, 0, - 0, 0, 0, 725, 0, 0, 0, 0, 0, 0, - 0, 720, 0, 0, 0, 0, 2727, 0, 1530, 0, - 0, 0, 0, 0, 0, 0, 725, 0, 0, 1539, - 0, 1540, 0, 0, 0, 0, 0, 0, 0, 0, - 1546, 0, 1205, 1206, 1987, 1988, 1989, 720, 1990, 1991, - 1992, 1993, 1994, 1995, 0, 0, 0, 1547, 0, 0, - 1042, 0, 0, 0, 0, 0, 0, 1958, 0, 0, - 2766, 0, 1964, 0, 0, 0, 0, 0, 720, 0, - 0, 720, 722, 0, 1565, 1567, 0, 0, 723, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 480, 476, 1005, 967, 646, 1145, 603, 1138, 44, 805, + 40, 941, 1300, 1183, 1249, 1250, 1478, 1142, 744, 595, + 1479, 49, 55, 67, 1156, 1537, 477, 929, 1444, 542, + 1305, 1731, 1758, 728, 2024, 1761, 1189, 49, 576, 734, + 2089, 1634, 2096, 1510, 1512, 2101, 1513, 1433, 2143, 2083, + 581, 1454, 1514, 2452, 1450, 1307, 2158, 1541, 2160, 2478, + 2457, 1986, 1987, 1672, 1673, 1412, 2006, 716, 745, 737, + 611, 1353, 799, 1004, 2138, 1010, 41, 1014, 2124, 1227, + 1260, 1230, 1483, 1490, 1361, 2328, 2179, 2180, 2181, 2479, + 2489, 2493, 2048, 551, 593, 2191, 2289, -343, -694, 822, + 2083, 548, 548, 1169, 1170, 1594, 2345, 2035, 2036, 624, + 605, 1989, -719, -348, 2838, 822, 606, -348, -71, 806, + -716, -716, 1515, 484, 547, -351, 533, 1146, 1221, 930, + 1181, 960, 2659, 1744, 1370, 1779, 923, 2644, 963, -1634, + 1446, 1684, 1221, -74, 1221, -1645, -719, -1737, -1737, 2655, + 2203, 1481, -1652, -1748, -1748, 547, -351, 3, 4, 822, + -1755, -1755, -720, 2706, 1233, -1645, -1652, -720, -1634, 585, + -717, -717, -310, -323, 1446, -338, 547, 547, 1693, -1757, + -1757, 2780, 1684, 613, 1782, 2171, -568, 1238, 2639, 1968, + 2685, 1316, 822, -568, 2595, 1189, 1608, 1365, 1238, 547, + -1232, 2765, 1435, 822, 1463, 1694, 2335, 1466, 1467, 2278, + 2622, -71, 728, 2796, 1880, -1149, 1163, 2243, 2245, 2373, + -1149, 1323, 2213, 1721, -587, 2343, 1989, 2732, 1397, 2988, + 1722, -587, 2781, 1610, 1397, 3007, -74, 659, 2752, 2840, + 2580, 2782, 2660, 2490, 2957, 1316, 1221, 3018, 600, 1316, + 956, 2868, 600, 1325, 544, 2807, 2825, 2661, 1394, 2634, + 1164, 1728, 1785, 1169, 1170, 1316, 2592, 2843, 562, 1755, + 2783, 614, 2907, 956, 1398, 1323, 2739, 805, 821, 1323, + 1398, 1989, 2336, 588, 805, 1488, 1990, 1991, 1992, 1181, + 2359, 950, 1489, 2750, 931, 1323, 932, 2756, 1989, 1462, + 1316, 1438, 2822, 2115, 1296, 2657, 1815, 1325, 2513, 1366, + 2354, 1325, 1868, 2778, 2732, 1142, 2337, 1815, 1695, 728, + 1705, 1611, 1184, 1696, 958, -1734, -1734, 1325, 1697, 2633, + 1308, 1570, 2338, 2147, 1399, 2165, 822, 543, 2116, 2593, + 1252, 2784, 2339, 84, 1185, 546, 2552, 958, 2166, 2925, + 2556, 2345, 2654, 2785, 2658, 2360, 1756, 2257, 2386, 1363, + 2792, 2410, 1325, 1816, 1395, 2385, 2751, 1236, 2793, 1786, + 1237, 563, 2255, 959, 2135, -198, 2340, 2958, 2651, 2982, + 2083, 924, 2083, 1400, 2362, 2279, 1363, 85, 596, 1400, + 1643, 2138, 1425, 2138, 951, 545, 2753, 2696, 805, 805, + 26, 1729, 2999, -71, 2491, 597, 2997, 3019, 688, 2947, + 2749, 2867, 2259, 2260, 2261, 2262, 1649, 1222, 2266, 2267, + 2268, 2269, 2270, 2271, 2272, 2273, 2274, 2275, -74, 1368, + 1367, 1222, 2844, 1222, 1453, 1165, 31, 1612, 2808, 2662, + 2763, 2855, 1401, 2995, 2498, 3008, 1706, 1493, 1401, 2685, + 2581, 925, 3021, 1440, 2959, 2511, 1492, 607, 2514, 1881, + 1591, 1634, 1707, 2341, 816, 1993, -71, 1708, 1869, 1698, + 2542, 1933, 2307, 2308, 2585, 2966, 1273, 33, 2952, 1482, + 1699, 2936, 2397, 2864, 616, 1384, 1810, 1994, 2732, 1890, + 34, -74, 1779, 634, 586, 632, 1423, 2091, 728, 615, + 2507, 1685, 1768, 1424, 1709, 1598, 49, 635, 636, 1934, + 2187, 2188, 2927, 2172, 35, 1380, 2640, 2596, 595, 2099, + 731, 2069, 2070, 2452, 3009, 2772, 1526, 1138, 36, 804, + 2457, 1867, 2926, 660, 628, 1222, 1479, 2794, 629, 1167, + 2104, 1166, 2050, -568, 2786, 2989, 1378, 2787, 801, 1379, + 2697, 3010, 3000, 821, 2398, 49, 1989, 1995, 480, 480, + 2144, 1990, 1991, 1992, 968, 2695, 1441, 1468, 485, 1223, + 2699, 2686, 2127, 2701, 933, -71, 2732, 1455, 2296, 1184, + 1723, -587, 480, 1226, 1929, 1229, 628, -343, -694, 2675, + 629, 2004, 2624, 2625, 1534, 810, 2093, 1935, 1937, 936, + -74, 1185, -719, -348, 2191, 44, 811, 40, 1566, 2586, + 1184, 2933, 1538, 1539, -71, 1186, -71, 808, 49, 55, + 67, 1053, 480, 1139, 807, 2597, 548, 809, 1742, -1634, + 1867, 1574, 1185, 2809, 975, -1645, -719, 2399, 605, -74, + 2934, -74, -1652, 2083, 606, 1311, 1188, 2083, 943, 920, + 1473, 1710, -720, 1596, 2584, -1645, -1652, -720, -1634, 2873, + 2872, 1289, 1171, 1175, 2866, -338, 1359, 1745, 1473, 1242, + 1243, 1346, 2145, 41, 1474, 628, 1455, 1844, 1572, 629, + 1242, 1243, 2810, 822, 728, 728, 2615, 1847, 642, 1595, + 1850, 1296, 1474, 1596, 1142, 1602, 2638, -1149, -1149, 731, + 1681, 1999, 2000, 2001, 2002, 2003, 2004, 2599, 1647, 1469, + 2616, 805, 2817, 1936, 1938, 1939, 719, 1470, 716, 1564, + 1341, 1342, 1343, 1344, 1345, 1346, 1343, 1344, 1345, 1346, + 728, 627, 1670, 2478, 2643, 480, 734, 1558, 654, 1596, + 1138, 1634, 1308, 1562, 628, 1643, 1643, 1596, 1362, 1142, + 1643, 2574, 1996, 1997, 1998, 2602, 1999, 2000, 2001, 2002, + 2003, 2004, 1994, 92, 1556, 647, 483, 657, 1559, 1456, + 1568, 2931, 531, 658, 799, 2001, 2002, 2003, 2004, 1184, + 3, 4, 2263, 561, 2294, 1949, 1950, 574, 2654, 1455, + 1958, 1643, 1643, 2226, 1477, 1959, 1911, 804, 598, 2230, + 2452, 1185, 978, 1455, 804, 1053, 731, 2457, 979, 1455, + 638, 978, 639, 2604, 1305, 1186, 2811, 979, 978, 2092, + 2742, 1505, 480, 728, 979, 661, 981, 49, 1196, 1197, + 1453, 1834, 1995, 662, 2040, 2028, 1687, 648, 1794, 560, + 503, 1843, 533, 26, 532, 578, 1960, 2317, 2318, 2319, + 2320, 480, 553, 2083, 640, 487, 641, 1674, 1479, 1300, + 26, 2041, 2083, 592, 592, 595, 599, 2083, 1456, 2102, + 2083, 480, 480, 480, 822, 480, 480, 612, 1455, 31, + 1918, 2146, 663, 2147, 1245, 1807, 1863, 1864, 1865, 3013, + 2083, 1245, 1506, 2303, 1138, 719, 31, 1202, 1203, 480, + 741, 1940, 1446, 1941, 2389, 2182, 1943, 1484, 1179, 1180, + 2852, 2148, 1842, 1447, 980, 2607, 488, 620, 804, 804, + 33, 1487, 2264, 980, 2099, 2173, 649, 2170, 1184, 1453, + 980, 1853, 2265, 34, 2671, 1446, 1860, 33, 2764, 1507, + 1202, 1203, -1732, -1732, 600, 1516, 1449, 2862, 480, 728, + 1185, 487, 480, 480, 1516, 978, 1915, 35, 2608, 547, + 2688, 979, 650, 480, 1188, 2689, -1733, -1733, 2846, 1310, + 2125, 36, 812, 2214, 2609, 2850, 2218, 2083, 1313, 2042, + 814, 1456, 1845, 1818, 2043, 731, 815, 1848, 36, 2390, + 821, 975, 1360, 1989, 1889, 1456, 2174, 651, 1990, 1991, + 1992, 1456, 719, 1369, 649, 1245, 1245, 1206, 1207, 2083, + 1053, 816, 488, 1386, 1387, 2297, 1393, 1053, 817, 606, + 606, 1795, 606, 45, 2748, 937, 1480, 1996, 1997, 1998, + 1173, 1999, 2000, 2001, 2002, 2003, 2004, 1957, 1053, 45, + 650, 1961, 1453, 1962, 652, 628, 922, -694, 805, 629, + 1206, 1207, 1182, 45, 728, 2391, 1453, 2392, 978, 594, + 928, 2806, 1453, 805, 979, 2335, 743, 980, 981, 944, + 1456, 2610, 604, -1735, -1735, 2199, 2017, 981, 2611, 2806, + -1736, -1736, 1220, 601, 981, 45, 945, 491, 1927, 492, + 26, 947, 1510, 1512, 2797, 1513, 1643, 1643, 1643, 1643, + 728, 1514, 1643, 1643, 1643, 1643, 1643, 1643, 1643, 1643, + 1643, 1643, 2083, 2038, 495, 2016, 26, 2018, 2019, 982, + 1634, 1590, 652, 983, 1591, 2044, 31, 1455, 1008, -1738, + -1738, 1453, 983, 956, 1964, 1012, 2045, 2908, 957, 983, + 2087, 2336, 948, 1139, 1592, -120, 1905, 1593, 1906, 2524, + -120, 2083, 31, 984, 954, 1300, 1643, 1643, 978, 2236, + 2401, 969, 1009, 2409, 979, 480, 2155, 33, 2157, 1013, + 980, 731, 731, 970, 2336, 2337, 918, 919, 971, 921, + 34, 719, 1505, 491, 2383, 492, 978, 2062, 972, 2063, + 2888, 2338, 979, 33, 973, 1173, 2064, 534, 2065, 1994, + 977, 2339, 1753, 2474, 35, 1229, 34, 958, 2337, 1877, + 495, 989, 1878, 1182, 2400, 3006, 2408, 731, 1796, -120, + 985, 981, 991, 1919, 2558, 1925, 1593, 2967, 1926, 985, + 35, 804, 2983, 2984, 2339, 2340, 985, -1739, -1739, 2083, + 1895, 992, 990, 2652, 535, 2178, 2985, 1139, 2228, 2229, + 801, 1007, 1952, 2647, 2196, 1953, 959, 49, 2161, 1011, + 480, 2162, 480, -1740, -1740, 480, 480, 2205, -120, 1995, + 980, 634, 1806, 632, 1143, 480, 983, 480, 480, 480, + 480, 480, 480, 480, 49, 635, 636, 2167, 2369, 3016, + 2168, 1144, 993, 87, 2220, 1147, 2370, 1591, 980, 2371, + 1507, 2374, 1151, 480, 2375, 480, 984, -1741, -1741, 3020, + 731, 480, 480, 480, 480, 480, 1139, -1742, -1742, 1456, + 480, 480, 2341, 2562, 981, 480, 2565, -1743, -1743, 480, + 656, 1574, 480, 480, 480, 480, 480, 480, 480, 480, + 480, 2485, 2505, 480, 1878, 2506, 1149, 487, 2525, 2676, + 480, 1593, 1593, 1053, 2743, 2341, 1139, 2744, 1617, 740, + 2771, 1152, 2674, 1878, -1744, -1744, 2799, 719, 719, 1593, + -1219, 2802, 1160, 985, 2803, 480, 1162, 2455, 2819, 983, + 1453, 2820, 2823, 994, 2841, 2820, 2878, 2842, 2879, 2842, + 480, 1593, 936, 2891, 2099, 1315, 2820, 2913, 1316, 1167, + 2914, 480, 480, 1731, 2557, 728, 2560, 821, 488, 984, + 1989, -1745, -1745, 719, 1596, 1990, 1991, 1992, 592, 953, + 2937, 955, 805, 2938, 981, 2409, 2976, 598, 1323, 2820, + 2996, 2587, 2527, 2842, 995, -1759, 731, 1797, 2382, 1818, + 2384, -121, 996, 2284, 1171, 1139, -121, 1139, 1174, 1746, + -1746, -1746, 981, 2234, 997, 88, -1747, -1747, 26, 1175, + 1325, 26, 1888, 89, 1996, 1997, 1998, 1177, 1999, 2000, + 2001, 2002, 2003, 2004, 1191, 1851, 985, 2547, 728, 983, + -1749, -1749, 991, -1750, -1750, 998, 1053, -1751, -1751, 480, + 480, 2547, 480, 2577, 31, 599, 728, 31, 90, -1752, + -1752, 992, 1178, 1858, -1753, -1753, 719, 983, 45, 1852, + 1139, 1596, 2251, -1754, -1754, -121, -1756, -1756, -1758, -1758, + 2798, 1053, 728, 1495, 1496, 1780, 1781, 480, 2350, 728, + 2258, 1896, 1000, -172, -172, 33, 1190, 1859, 33, 1204, + 1205, 731, -176, -176, 2458, 91, 1834, 1193, 34, 2948, + 2949, 34, 993, 728, 1001, 1225, 2280, 45, 594, -175, + -175, -1759, 26, 2285, -121, 1206, 1207, 1228, 804, 1374, + 1376, 1231, 35, 600, 1003, 35, 985, -1759, 2503, 491, + 2473, 492, -1759, 804, 1232, 1053, 36, 731, 1234, 36, + 1263, 1235, 480, 1253, 1264, 1268, -314, 480, 31, 1266, + 604, -321, 1271, 494, 985, 1272, 495, 619, 2504, 622, + 1274, 626, 1273, 2620, 1275, 36, 1994, 1277, 1643, -1759, + 45, -198, -199, -311, 595, 3005, -312, 1278, 1279, -315, + -313, 1281, 719, 480, 480, 480, 1282, 1283, 480, 33, + 1284, 1285, 1286, 994, 1287, 1288, 480, 480, 480, 480, + 1289, 1306, 34, 1293, 2769, 1245, 480, 1309, 1351, 1356, + 480, 1956, 1354, 480, 1357, 1372, 1381, 1382, 1385, 1421, + 1245, 2099, 728, 595, 1334, 957, 35, 959, 1419, 480, + 480, 1426, 2994, 2480, 480, 1430, 1995, 1451, 1452, 1453, + 36, 1458, 1459, 1460, 995, 1464, 1476, 1471, 480, 1472, + 1486, 480, 996, 480, 1491, 1499, 2449, 1498, 1643, 1503, + 821, 1508, 601, 1989, 997, 1509, 1516, 2236, -1759, -1759, + -1759, 1517, 1519, 480, 1522, 1523, 1524, 1527, 1533, 822, + 1540, 1542, 1543, 1548, 480, 2081, 1142, 719, 728, 1552, + 1549, 1553, 1554, 1555, 1563, 998, 1598, 1316, 1589, 1183, + 1603, 1662, 1664, 480, 1668, 1596, 1666, 2629, 2630, 1667, + 477, 1683, 634, 1669, 632, 1690, -1759, 1701, 480, 480, + 1702, 1704, 2502, 592, 1726, 49, 635, 636, 1643, 595, + 1725, 1740, 1754, 719, 1747, 480, 2081, 599, 1759, 1769, + 1771, 1770, 1000, 1791, 1772, 1773, 1774, 1790, 1793, 1812, + 1808, 1813, 480, 1814, 600, 1875, 1879, 1891, 1883, 728, + 1892, 477, 1893, 1894, 1001, 1912, 1908, 1913, 1914, 1139, + 1139, 1139, 1916, 1921, 1920, 1922, 1917, 1942, 1923, 45, + 1924, 1931, 1932, 1944, 1003, 1945, 1946, 1954, 1965, 1972, + 478, 1977, 1966, 1300, 2039, 504, 1974, 2455, 1975, 504, + 1976, 2034, 1978, 2060, 549, 549, 552, 504, 557, 1982, + 1053, 557, 2085, 1979, 557, 583, -1759, 1276, 504, 504, + 1981, 1985, 2007, 1341, 1342, 1343, 1344, 1345, 1346, 2008, + 2013, 1996, 1997, 1998, 2014, 1999, 2000, 2001, 2002, 2003, + 2004, 2046, 731, 2021, 2055, 2056, 557, 2032, 2058, 2059, + 2094, -177, -178, 2105, 2106, 1298, 480, 2109, 2114, 2108, + 2111, 2121, 2126, 2163, 2131, 2128, 2129, 2133, 2134, 728, + 2137, 583, 504, 583, 583, 583, 2141, 2154, 2156, 2169, + 2175, 2176, 2177, 2183, 2184, 2186, 2185, 2194, 2208, 2195, + 2198, 2211, 804, 2215, 2216, 2219, 2212, 1139, 728, 2223, + 2250, 1621, 2232, 2628, 1896, 2225, 2233, 2189, 2235, 1622, + 1623, 1624, 480, 2242, 2010, 731, 1989, 2009, 2281, 2282, + 2286, 480, 2200, 2283, 480, 604, 604, 480, 604, 1479, + 805, 2287, 2301, 731, 480, 480, 480, 480, 2302, 1995, + 480, 480, 480, 480, 480, 480, 480, 480, 480, 480, + 2314, 2315, 2299, 480, 480, 2305, 637, 480, 595, 731, + 2932, 2067, 2326, 2348, 480, 2352, 731, 2313, 2334, 480, + 2357, 2358, 728, 2361, 2363, 2366, 2368, 2381, 480, 1245, + 2372, 480, 2388, 480, 2387, 2394, 2240, 2396, 2241, 595, + 731, 480, 2246, 2247, 480, 480, 2470, 2471, 2412, 480, + 480, 2472, 2476, 2487, 2483, 2484, 595, 2488, 1560, 2495, + 1561, 2501, 1878, 2518, 2512, 480, 2081, 480, 2081, 2499, + 2548, 2509, 2516, 2515, 2553, 2554, 2517, 2561, 2519, 480, + 2533, 2544, 2567, 2545, 2551, 2566, 2568, 2569, 719, -83, + 2571, 477, 2590, 477, 2583, 2588, 2589, 2594, 2618, 2619, + 927, 2623, 2645, -83, -716, 480, -1732, 2636, -83, 2646, + -1733, 2746, 2637, 2656, 2648, 2665, -1734, -1735, 2847, 2669, + 2672, 2663, 480, 2856, 2455, -1736, -1737, -1738, 2700, 2635, + -1739, -1740, 2723, -1741, 2730, -1742, -1743, 976, 821, 2728, + 2736, 1989, 728, -1744, -1745, -1746, 1990, 1991, 1992, -1747, + -1749, -1750, -1751, 2738, 2754, -1752, 1139, -83, -1753, 2456, + 1139, 719, 1139, 2528, -1754, -1755, -1756, -1757, -1758, 2649, + 1154, 1157, 1158, 1159, 2668, -717, 2449, -83, 2673, 719, + 728, 2687, 2705, 2757, -1759, -1759, -1759, 2727, 1999, 2000, + 2001, 2002, 2003, 2004, 2740, 2758, 2745, 2759, 2761, 2881, + 1315, 2760, 2477, 1316, 2768, 719, 2770, 2775, 1318, 1319, + 1320, 728, 719, 2911, 728, 2776, 2790, 2779, 2791, 2800, + 2804, 2812, 2813, 2828, 2814, 731, -83, 2496, 2816, 2497, + 2098, 2832, 2824, 1323, 2826, -83, 719, 2835, 2838, 2854, + 1324, 2858, 480, 2860, 2869, 2821, 2451, 2892, 2821, 2894, + 2863, 2875, 2874, 2876, 2880, 2884, 2896, 2885, 2893, 45, + 2897, 2899, 2910, 2753, 2912, 1325, 1811, 2917, 2916, 2919, + 2922, 2923, 2859, 2189, 2928, 2929, 1819, 2924, 1822, 2930, + 2535, 1833, 2939, 2940, 2941, 2943, 45, 1837, 2946, 1839, + 480, 480, 2847, 2954, 2975, 480, 731, 2960, 2977, 2964, + 480, 1846, 2978, 480, 480, 2987, 1849, 2980, 480, 2990, + 1854, 1855, 1856, 1857, 2992, 1861, 1862, 2998, 3003, 2988, + 583, 2989, 3004, 3014, 644, 3015, 3017, 645, 480, 2081, + 2377, 3022, 480, 2081, 1383, 504, 1427, 949, 2097, 1364, + 1789, 1416, 2901, 1415, 2887, 2981, 1766, 1994, 2107, 2904, + 2356, 1691, 2942, 2895, 477, 719, 2572, 2834, 477, 1788, + 480, 2329, 645, 504, 504, 2543, 1326, 2110, 2559, 2818, + 1420, 2325, 2883, 2882, -83, 2889, 2576, 2890, 2578, 549, + 1607, 2726, 1327, 1609, 2944, 1613, 2945, 1328, 1139, 1614, + 1730, 2974, 2030, 2100, 1874, 2053, 1597, 480, 915, 915, + 557, 557, 1969, 557, 2051, 2575, 731, 917, 2088, 1329, + 1330, 2355, 1749, 2152, 583, 2411, 1838, 1995, 2415, 728, + 721, 719, 2197, 504, 1331, 1625, 1626, 1627, 2956, 1628, + 1629, 1630, 1631, 1632, 1633, 2456, 3012, 628, 2573, 2853, + 947, 629, 2993, 2986, 1443, 2789, 1377, 2159, 2136, 583, + 2459, 583, 45, 2449, 2494, 2991, 2953, 2951, 2132, 1557, + 1536, 2909, 1332, 2376, 821, 1333, 2579, 1989, 2729, 2950, + 1751, 2486, 1990, 1991, 1992, 1569, 1963, 2626, 2877, 1334, + 2192, 2239, 2670, 2475, 583, 583, 583, 583, 0, 0, + 1577, 0, 719, 1428, 0, 2653, 0, 1434, 991, 0, + 804, 2599, 0, 0, 0, 0, 480, 2600, 0, 731, + 1461, 0, 480, 0, 0, 0, 0, 992, 0, 0, + 2601, 480, 480, 0, 0, 480, 0, 0, 0, 0, + 0, 1485, 0, 0, 0, 1578, 0, 0, 480, 2081, + 0, 0, 0, 0, 0, 0, 45, 480, 2081, 2602, + 0, 2603, 480, 2081, 0, 480, 2081, 0, 0, 0, + 0, 1579, 480, 480, 477, 2650, 0, 0, 993, 0, + 0, 1336, 0, 477, 0, 480, 2081, 480, 477, 1580, + 0, 477, 0, 1581, 0, 0, 0, 1245, 0, 0, + 0, 0, 0, 0, 0, 0, 480, 0, 0, 721, + 0, 477, 719, 0, 0, 1582, 0, 2604, 1583, 0, + 0, 0, 1996, 1997, 1998, 722, 1999, 2000, 2001, 2002, + 2003, 2004, 0, 1584, 0, 487, 0, 0, 0, 2456, + 0, 719, 0, 0, 0, 2404, 2605, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, -1219, 0, + 1265, 0, 2725, 0, 2773, 0, 0, 0, 0, 994, + 0, 0, 480, 2081, 1298, 0, 480, 731, 0, 0, + 0, 1337, 1518, 1994, 1338, 1339, 1340, 2653, 1341, 1342, + 1343, 1344, 1345, 1346, 0, 0, 488, 0, 477, 0, + 480, 0, 0, 0, 480, 2081, 595, 0, 731, 0, + 0, 731, 0, 724, 2606, 719, 721, 480, 0, 2607, + 995, 0, 0, 1298, 0, 1585, 2451, 1304, 996, 0, + 477, 0, 480, 1586, 2207, 480, 0, 0, 0, 0, + 997, 1691, 0, 0, 1139, 0, 0, 0, 1139, 480, + 489, 0, 0, 1995, 0, 0, 0, 2057, 0, 0, + 0, 0, 2608, 0, 0, 1567, 0, 0, 0, 0, + 583, 998, 0, 2074, 0, 0, 1587, 0, 2609, 0, + 0, 0, 0, 0, 0, 0, 0, 45, 504, 504, + 0, 0, 0, 0, 2871, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 722, 0, 0, 480, 2081, 0, + 0, 0, 0, 0, 0, 0, 583, 583, 1000, 1432, + 490, 583, 1442, 0, 2074, 0, 0, 0, 480, 594, + 480, 0, 480, 477, 583, 719, 480, 0, 0, 0, + 1001, 0, 0, 0, 0, 0, 480, 2081, 0, 0, + 0, 583, 0, 2902, 0, 583, 0, 0, 0, 0, + 1003, 2865, 0, 0, 480, 0, 0, 491, 0, 492, + 0, 0, 477, 719, 0, 2610, 0, 0, 0, 0, + 0, -1537, 2611, 0, 480, 493, 0, 1739, 0, 0, + 0, 494, 724, 0, 495, 721, 0, 480, 0, 0, + 0, 0, 0, 0, 719, 0, 0, 719, 1748, 0, + 1750, 722, 0, 0, 0, 0, 2456, 0, 1139, 725, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1979, 0, 0, 0, 0, 0, 1598, 1599, 722, 0, - 1612, 1613, 1651, 0, 1651, 1651, 0, 717, 0, 0, - 0, 0, 2015, 0, 0, 0, 2018, 0, 0, 2020, - -39, 2816, 0, 719, 0, 725, 0, 723, 0, 722, - 0, 0, 722, 1207, 1208, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 480, 2081, 0, 480, 480, 0, + 0, 2965, 0, 0, 0, 0, 0, 0, 1996, 1997, + 1998, 1784, 1999, 2000, 2001, 2002, 2003, 2004, 0, 0, + 477, 0, 0, 0, 0, 0, 0, 0, 2379, 0, + 0, 0, 480, 0, -1537, 0, 0, 0, 0, 45, + 0, 0, 0, 0, 0, 0, 0, 0, 1500, 0, + 0, 0, 0, 2413, 0, 0, 583, 0, 0, 724, + 0, 0, 0, 2451, 0, 1530, 0, 0, 2460, 2461, + 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469, 480, 0, + 0, 0, 0, 0, 0, 0, -1537, 0, 0, 0, + 0, 0, 0, 0, 1547, 0, 1885, 1886, 0, 0, + -1537, 0, 0, 0, 0, -1537, 0, 0, 0, 0, + -1537, 0, 0, 0, 0, 0, 0, 0, 1298, -1537, + 0, 0, 0, -1537, 0, 0, 0, 0, 0, 645, + 645, 0, 504, 504, 0, 504, 645, 0, 0, 583, + 0, 721, 721, 0, 0, 0, 0, 0, 0, 1298, + 722, 0, 0, 0, -1537, 0, 0, 0, 725, 0, + 0, 0, 0, 0, 2324, 0, 2327, 0, 0, 0, + 0, 0, 719, 0, -1537, 0, 0, 0, 0, 0, + -39, 0, 0, 0, 0, 1560, 1636, 721, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1661, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, - 0, 3, 4, 2038, 0, 0, 2041, 2840, 2043, 0, - 0, 0, 0, 0, 0, 0, 0, 5, 0, 0, - 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, - 0, 0, 0, 0, 725, 0, 0, 0, 7, 0, - 0, 0, 0, 0, 0, 0, 723, 0, 0, 8, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 3, 4, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, -1537, 0, 0, -1537, 5, 0, 645, + 0, 0, -1537, 0, 0, 0, 6, 0, 724, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, + 915, 583, 0, 0, 0, 725, -1537, 0, 0, 0, 0, 9, 0, 10, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1392, 0, 0, 0, 0, 0, - 0, 11, 0, 0, 0, 1788, 1788, 0, 0, 1411, - 1712, 0, 0, 0, 0, 12, 0, 0, 0, 0, - 0, 0, 1341, 725, 0, 13, 0, 0, 2118, 0, - 0, 14, 0, 0, 0, 0, 720, 0, 0, 15, - 0, 16, 17, 0, 0, 0, 0, 0, 506, 0, - 0, 0, 0, 0, 18, 0, 0, 1240, 0, 0, - 0, 0, 1341, 0, 0, 0, 0, 1240, 0, 0, - 1240, 1308, 0, 0, 1309, 0, 723, 0, 0, 1310, - 1311, 1312, 0, 19, 0, 0, 1042, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, - 0, 507, 0, 0, 1315, 0, 723, 722, 0, 0, - 0, 1316, 0, 0, 0, 0, 0, 508, 0, 0, - 0, 1308, 0, 21, 1309, 0, 0, 0, 0, 1310, - 1311, 1312, 0, 725, 0, 0, 1317, 0, 0, 0, - 0, 0, 1920, 1922, 0, 0, 1313, 0, 0, 0, - 0, 0, 0, 0, 1315, 0, 0, 0, 0, 0, - 0, 1316, 0, 725, 0, 0, 0, 0, 1240, 0, - 1341, 509, 0, 0, 0, 0, 723, 1341, 0, 0, - 510, 1240, 0, 0, 2231, 0, 1317, 0, 0, 0, - 0, 0, 511, 2235, 0, 0, 2236, 512, 0, 2238, - 22, 0, 0, 23, 1307, 0, 0, 0, 0, 1308, - 0, 0, 1309, 0, 0, 0, 0, 1310, 1311, 1312, - 0, 0, 0, 0, 513, 2258, 2259, 0, 0, 0, - 0, 0, 24, 725, 1313, 0, 1318, 1314, 0, 2269, - 0, 25, 1315, 0, 0, 0, 0, 0, 2275, 1316, - 0, 2278, 1319, 2280, 0, 26, 0, 1320, 0, 0, - 0, 2284, 27, 0, 0, 0, 28, 0, 514, 2291, - 2292, 0, 515, 0, 1317, 0, 29, 0, 0, -1731, - -1731, 0, 0, 0, 0, 0, 1318, 30, 0, 0, - 0, 31, 0, 1323, 0, 723, 0, 0, 2332, 0, - 0, 0, 1319, 0, 0, 0, 0, 1320, 2340, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2353, 0, 0, 32, 0, 1321, - 1322, 723, 33, 0, -1731, 516, 0, 0, 0, 2078, - 0, 0, 0, 1323, 0, 34, 0, 0, 1326, 517, - 0, 0, 725, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 723, 0, 0, 723, 0, 0, 0, 35, - 0, 0, 2110, 2110, 1318, 0, 0, 0, 0, 0, - 0, 1324, 518, 36, 1325, 519, -39, 0, 725, 0, - 1319, 1341, 0, 520, 0, 1320, 521, 0, 1326, 0, - 0, 1327, 1341, 0, 0, 0, 1638, 0, 0, 0, - 0, 0, 1341, 1341, 1341, 522, 0, 1321, 1322, 725, - 0, 1341, 725, 0, 0, 0, 0, 0, 523, 0, - 0, 1323, 0, 0, 0, 524, 0, 0, 0, 0, - 1328, 0, 0, 0, 525, 0, 0, 0, 0, 0, - 526, 0, 0, 0, 0, 2485, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1324, - 0, 0, 1325, 0, 0, 527, 1341, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1326, 0, 1308, 1327, - 1328, 1309, 0, 0, 0, 0, 1310, 1311, 1312, 0, - 0, 2498, 2499, 0, 0, 0, 2500, 0, 0, 0, - 2209, 2503, 0, 1313, 2506, 2507, 2272, 0, 0, 2511, - 1341, 1315, 0, 0, 0, 0, 0, 0, 1316, 0, - 0, 0, 0, 0, 1341, 0, 0, 0, 0, 1341, - 1329, 0, 0, 1330, 1331, 1332, 0, 1333, 1334, 1335, - 1336, 1337, 1338, 1317, 972, 0, 0, 0, 0, 0, - 973, 0, 0, 0, 0, 0, 894, 985, 0, 0, - 723, 0, 0, 0, 0, 0, 0, 0, 1328, 0, - 0, 0, 0, 0, 0, 0, 986, 0, 0, 0, - 1329, 0, 0, 1330, 1331, 1332, 0, 1333, 1334, 1335, - 1336, 1337, 1338, 0, 0, 0, 0, 0, 2597, 0, - 1971, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 725, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 987, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1318, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 974, 0, 0, 1319, - 0, 0, 0, 0, 1320, 0, 0, 0, 1329, 0, - 0, 1330, 1331, 1332, 0, 1333, 1334, 1335, 1336, 1337, - 1338, 0, 0, 0, 0, 0, 1321, 1322, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1323, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2015, 0, 1341, 0, 0, 0, 988, 0, 2651, - 2652, 0, 0, 2653, 0, 0, 0, 0, 0, 0, - 0, 0, 1341, 0, 0, 0, 0, 0, 1324, 0, - 0, 1325, 1240, 0, 0, 0, 0, 0, 0, 1341, - 0, 1638, 1638, 0, 1996, 1326, 1638, 0, 1327, 2694, - 2695, 1341, 0, 0, 1341, 0, 0, 989, 0, 1341, - 0, 0, 1341, 2708, 0, 990, 0, 0, 0, 0, - 0, 0, 0, 0, 1341, 0, 0, 991, 1341, 1341, - 1341, 1341, 0, 0, 0, 0, 0, 1638, 1638, 0, - 1341, 1341, 0, 0, 0, 0, 0, 0, 975, 0, - 0, 0, 1341, 0, 0, 1341, 0, 0, 992, 0, - 0, 0, 0, 1341, 1341, 1341, 1341, 1341, 1341, 1341, - 1341, 1341, 1341, 0, 0, 0, 0, 0, 0, 0, - 1341, 0, 0, 0, 1341, 0, 0, 1328, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1835, - 0, 0, 0, 977, 1308, 994, 1341, 1309, 0, 0, - 0, 0, 1310, 1311, 1312, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 2786, 0, 995, 0, 1313, - 0, 0, 0, 1836, 0, 0, 0, 1315, 0, 0, - 0, 0, 1293, 0, 1316, 0, 0, 997, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 2808, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1317, - 0, 0, 2822, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1329, 0, 0, - 1330, 1331, 1332, 0, 1333, 1334, 1335, 1336, 1337, 1338, - 979, 0, 0, 0, 1660, 0, 0, 0, 0, 1240, - 0, 0, 0, 0, 1240, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1341, 1341, 1341, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2694, 0, 1565, 1567, 2870, 0, - 0, 0, 1341, 0, 0, 0, 0, 0, 0, 1318, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1319, 2893, 0, 0, 0, - 1320, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 2907, 2907, 0, 0, - 0, 0, 1321, 1322, 0, 0, 1341, 0, 0, 0, - 2694, 0, 1341, 0, 0, 0, 1323, 0, 0, 0, - 0, 0, 0, 0, 0, 1996, 1996, 1341, 0, 1638, - 1638, 1638, 1638, 0, 0, 1638, 1638, 1638, 1638, 1638, - 1638, 1638, 1638, 1638, 1638, 1996, 0, 0, 0, 2907, - 0, 0, 0, 0, 1324, 0, 0, 1325, 0, 0, - 0, 0, 0, 1341, 0, 0, 1341, 0, 1341, 0, - 0, 1326, 1996, 1996, 1327, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1341, 1638, 1638, 1341, - 0, 1341, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 2907, 0, 1565, 1567, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1240, + 721, 0, 583, 0, 583, 0, 0, 45, 0, -1537, + 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 12, 0, -1539, 0, 0, + 0, 0, 45, 0, 45, 13, 0, 0, 0, 0, + 0, 14, 0, 0, 2066, 583, 0, 0, 0, 15, + 0, 16, 17, 0, 1800, 1805, 722, 722, 0, 0, + 1442, 504, 0, 0, 2067, 18, 0, 0, 0, 0, + 0, 504, 1820, 504, 1824, 0, 504, 0, 0, 0, + 0, 0, 504, 0, 504, 0, 0, 0, 0, 0, + 0, -1537, 0, 0, 19, 645, 504, 0, 0, -1537, + 645, 504, 722, 0, 0, 504, 504, 504, 504, 20, + 504, 504, 0, 0, 0, -1537, 0, -1537, -1537, 0, + -1539, 0, 0, 0, 0, 0, 721, 0, 0, 0, + 583, 583, 1887, 0, 0, 21, 0, 0, 0, 0, + 0, 0, 0, 0, 724, 724, 0, 2074, 1898, 0, + 0, 2074, 0, 0, -1537, 0, 0, -1537, -1537, -1537, + 0, 0, 0, 0, 725, 0, 0, 0, 0, 0, + 0, 0, -1539, 0, 0, 0, 0, 0, 0, 0, + 0, 45, 0, 45, 0, 0, -1539, 0, 727, 0, + 724, -1539, 0, 2193, 0, 722, -1539, 0, 0, 0, + 0, 0, 0, 2204, 2206, -1539, 0, 2210, 0, -1539, + 0, 0, 22, 0, 0, 23, 0, 0, 0, 0, + 2747, 0, 0, 0, 2224, 0, 0, 0, 0, 0, + 0, 721, 0, 821, 0, 0, 1989, 0, 0, 0, + -1539, 1990, 1991, 1992, 24, 0, 0, 0, 0, 0, + 0, 0, 0, 25, 1567, 2766, 2767, 0, 0, 0, + -1539, 0, 1315, 0, 0, 1316, 0, 26, 0, 0, + 0, 2777, 0, 0, 27, 0, 0, 721, 28, 0, + 0, 0, 0, 724, 504, 0, 0, 0, 29, 0, + 0, 1304, 0, 0, 0, 1323, 0, 0, 0, 30, + 45, 0, -1759, 31, 0, 0, 0, 0, 0, -1539, + 0, 0, -1539, 0, 0, 991, 0, 0, -1539, 0, + 0, 722, 0, 0, 0, 0, 1636, 1325, 0, 0, + 0, 0, 0, 0, 992, 0, 0, 0, 0, 32, + 0, 0, 0, 0, 33, 0, 0, 0, 0, 2836, + 725, 725, -1539, 0, 0, 0, 0, 34, 583, 0, + 0, 0, 0, 0, 2084, 0, 2074, 727, 0, 0, + 0, 2074, 0, 0, 2074, -1539, 2857, 0, 2321, 2322, + 2323, 35, 0, 0, 0, 993, 2402, 0, 0, 0, + 1606, 0, 547, 0, 2403, 36, 725, 2037, -39, 1315, + 0, 0, 1316, 0, 0, 0, 0, 0, 0, 724, + 0, 0, 0, 0, 0, 2084, 0, 2113, 2364, 0, + 2118, 0, 0, 1800, 0, 0, 722, 0, -1759, 0, + 2067, 0, 1323, 0, 0, 0, 0, 0, 0, -1759, + 1500, 0, -1759, 0, -1759, 0, 0, 0, 0, -1759, + 0, 0, 2404, 0, 0, 0, 0, -1539, 0, 45, + 0, 0, 0, 0, 1325, -1539, 0, 0, 0, 0, + 0, 0, 722, 0, 727, 0, 994, 0, 0, 0, + 0, -1539, 45, -1539, -1539, 0, -1759, 0, 0, 725, + 0, 0, 0, 0, 0, 0, 1194, 1195, 0, 0, + 0, 0, 1500, 0, 0, 0, 0, 583, 0, 2482, + 0, 0, 1995, 2074, 724, 0, 1500, 583, 583, 504, + -1539, 583, 0, -1539, -1539, -1539, 1298, 995, 0, 0, + 0, 0, 0, 0, 2047, 996, 0, 0, 583, 0, + 0, 1334, 0, 0, 0, 1567, 0, 997, 0, 2405, + 2231, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 724, 0, 0, 0, 0, -1759, 645, 0, 583, 0, + 0, 0, 1196, 1197, 0, 0, 0, 0, 998, 0, + 0, -1759, 721, 1500, 1500, 0, -1759, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1308, 0, 0, 1309, 0, 0, 0, - 0, 1310, 1311, 1312, 0, 0, 0, 0, 0, 0, - 0, 0, 1308, 1328, 0, 1309, 1341, 0, 1313, 0, - 1310, 1311, 1312, 0, 0, 0, 1315, 0, 0, 0, - 0, 0, 0, 1316, 0, 0, 0, 1313, 1308, 0, - 0, 1309, 0, 0, 0, 1315, 1310, 1311, 1312, 0, - 0, 0, 1316, 0, 0, 0, 0, 0, 1317, 0, - 0, 0, 0, 1313, 0, 0, 0, 0, 0, 0, - 0, 1315, 0, 0, 0, 0, 0, 1317, 1316, 0, + 0, 0, 0, 0, 0, 0, 1636, 0, 0, 0, + 0, 0, 0, 0, 0, 725, 0, 0, 0, 0, + 0, 0, 0, -1759, 0, 1000, 0, 2538, 2539, 2540, + 2541, 0, 0, -1759, 0, 0, 0, 1198, 1199, 1200, + 1201, 1202, 1203, 0, 0, 1204, 1205, 1001, 45, 0, + 0, 0, 0, 727, 0, 721, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1003, 0, 2406, + 0, 0, 2407, 721, 0, 0, 0, 0, 1334, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 583, 583, 583, 478, 0, 2084, 2333, 721, + 0, 0, 0, 2333, 2347, 0, 721, 1996, 1997, 1998, + 0, 1999, 2000, 2001, 2002, 2003, 2004, 0, 0, 0, + 725, 0, 0, 0, 898, 898, 0, 0, 0, 0, + 721, 0, 583, -1759, 0, 0, 45, 0, 0, 1244, + 1341, 1342, 1343, 1344, 1345, 1346, 1244, 0, 0, 0, + 1800, 1206, 1207, 504, 1194, 1195, 0, 1500, 1442, 1500, + 0, 1530, 0, 0, 0, 0, 725, 0, 0, 0, + -1759, 0, 0, 0, 1453, 0, 0, 722, 504, 0, + 2414, 0, 0, 0, 0, 0, 0, 1048, 1055, 0, + 0, 0, 0, 504, 504, 504, 504, 504, 504, 504, + 504, 504, 504, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1898, + 0, 0, 0, 583, 0, 0, 0, 0, 0, 0, + 1196, 1197, 0, 1312, 0, 0, 1442, 0, 0, 727, + 727, 0, 0, 0, 0, 0, 0, 1530, 0, 721, + 722, 0, 0, 0, 0, 0, 0, 0, 1244, 583, + 1244, 1244, 1208, 1209, 0, 724, 1500, 0, 722, 0, + -1759, 0, 0, 0, 0, 0, 0, 1341, 1342, 1343, + 1344, 1345, 1346, 0, 0, 727, 0, 0, 0, 0, + 0, 0, 0, 0, 722, 1198, 1199, 1200, 1201, 1202, + 1203, 722, 0, 1204, 1205, 0, 0, 0, 0, 0, + 504, 0, 0, 0, 0, 721, 2520, 0, 0, 2755, + 0, 0, 0, 0, 0, 722, 0, 0, 1244, 0, + 0, 1244, 1244, 0, 0, 0, 0, 0, 724, 2537, + 0, 583, 583, 583, 583, 0, 0, 0, 2333, 2347, + 0, 2333, 0, 0, 2546, 0, 724, 2774, 2084, 0, + 0, 0, 2084, 0, 0, 0, 0, 0, 2564, 0, + 0, 1048, 0, 0, 0, 2795, 0, 0, 727, 0, + 0, 0, 724, 0, 0, 1636, 721, 0, 1269, 724, + 915, 0, 0, 0, 0, 2118, 0, 0, 0, 1800, + 0, 0, 0, 0, 0, 1442, 0, 1194, 1195, 1206, + 1207, 1500, 0, 724, 0, 0, 0, 1280, 0, 978, + 0, 0, 0, 0, 0, 979, 0, 0, 0, 0, + 0, 2627, 991, 0, 0, 0, 0, 1290, 1291, 1292, + 0, 0, 1299, 0, 722, 0, 0, 0, 2845, 0, + 0, 992, 0, 0, 0, 978, 0, 0, 0, 0, + 0, 979, 0, 0, 0, 1355, 0, 0, 991, 0, + 0, 725, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1196, 1197, 2870, 0, 992, 0, 0, + 0, 0, 0, 0, 0, 0, 721, 0, 0, 0, + 1500, 0, 993, 0, 727, 0, 0, 0, 0, 0, + 722, 1535, 1898, 0, 1392, 0, 0, 0, 1406, 1411, + 1208, 1209, 1544, 2666, 1545, 721, 0, 0, 0, 1550, + 0, 980, 724, 0, 0, 0, 0, 0, 993, 0, + 1210, 0, 0, 0, 725, 0, 1551, 0, 1198, 1199, + 1200, 1201, 1202, 1203, 0, 0, 1204, 1205, 0, 2682, + 0, 0, 725, 0, 0, 0, 0, 980, 478, 2333, + 0, 0, 2693, 0, 0, 504, 1048, 2084, 1571, 1573, + 0, 722, 2084, 1048, 0, 2084, 0, 2704, 725, 0, + 2707, 0, 0, 994, 0, 725, 0, 0, 724, 721, + 0, 0, 0, 0, 1048, 2733, 0, 0, 0, 727, + 1604, 1605, 0, 0, 1618, 1619, 0, 0, 0, 725, + 0, 0, 0, 0, 645, 504, 0, 0, 0, 994, + 0, 0, 0, 583, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 995, 0, 0, 0, 0, 0, + 0, 0, 996, 0, 0, 727, 0, 0, 0, 0, + 504, 504, 1206, 1207, 997, 0, 0, 0, 0, 724, + 0, 583, 0, 1442, 0, 0, 504, 0, 0, 0, + 995, 0, 0, 0, 0, 981, 0, 0, 996, 583, + 0, 722, 2733, 0, 0, 998, 0, 0, 0, 0, + 997, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 504, 0, 0, 0, 0, 0, 0, 0, 721, + 722, 981, 0, 0, 2084, 0, 0, 0, 0, 2707, + 0, 998, 0, 0, 0, 0, 999, 0, 725, 0, + 983, 0, 1000, 1778, 1778, 0, 0, 2831, 0, 0, + 0, 0, 915, 0, 504, 0, 0, 721, 0, 0, + 0, 0, 583, 0, 1001, 0, 0, 0, 0, 0, + 1002, 0, 1840, 1208, 1209, 0, 983, 0, 1000, 724, + 0, 504, 0, 0, 1003, 645, 0, 0, 721, 0, + 0, 721, 0, 0, 722, 0, 0, 0, 0, 583, + 1001, 1244, 0, 0, 725, 0, 1841, 0, 724, 0, + 0, 1244, 0, 0, 1244, 0, 0, 0, 0, 0, + 1003, 0, 0, 0, 0, 0, 0, 478, -1553, 0, + 0, 1601, 0, 0, 0, 0, 2886, 985, 0, 0, + 504, 1620, 0, 1637, 2704, 0, 1648, 1651, 1656, 1659, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1317, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1329, 0, 0, 1330, 1331, 1332, 0, - 1333, 1334, 1335, 1336, 1337, 1338, 0, 0, 0, 1341, - 1660, 0, 0, 1341, 1341, 1308, 1341, 0, 1309, 1996, - 1996, 1996, 1996, -1731, -1731, -1731, 1996, 1996, 1996, 1996, - 1996, 1996, 1996, 1996, 1996, 1996, 1341, 1341, 1318, 0, - 0, 0, 0, 0, 0, 0, 0, 1341, 1315, 0, - 0, 0, 0, 1341, 1319, 1316, 1341, 1318, 1341, 1320, - 0, 0, 1341, 0, 0, 1996, 1996, 0, 0, 1341, - 1341, 0, 0, 1319, 0, 0, 0, 0, 1320, 0, - 1317, 1321, 1322, 1318, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1323, 0, 0, 0, 1319, - 1321, 1322, 0, 0, 1320, 0, 0, 0, 0, 0, - 1341, 0, 0, 0, 1323, 0, 0, 0, 1341, 0, - 0, 0, 0, 0, 0, 0, 1321, 1322, 0, 0, - 0, 1341, 0, 1324, 1240, 0, 1325, 0, 0, 0, - 1323, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1326, 0, 1324, 1327, 0, 1325, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1326, - 0, 0, 1327, 0, 0, 0, 0, 0, 1324, 0, - 1318, 1325, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1326, 1319, 0, 1327, 0, - 0, 1320, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 645, 645, 645, 0, 2733, 0, 0, 0, + 0, 1671, 0, 985, 0, 725, 0, 1675, 1676, 1677, + 1678, 1679, 724, 0, 1928, 1930, 1688, 1689, 0, 0, + 0, 1700, 0, 1442, 0, 1703, 0, 0, 1711, 1712, + 1713, 1714, 1715, 1716, 1717, 1718, 1719, 0, 2704, 1720, + 1244, 0, 0, 0, 722, 0, 898, 0, 0, 1048, + 2831, -1553, 0, 0, 0, 1244, 0, 0, 0, 0, + 0, 0, 0, 0, 1800, 0, 0, 0, 0, 0, + 0, 1752, 0, 0, 0, 0, 0, 0, 1442, 0, + 0, 0, 722, 0, 2733, 0, 0, 0, 0, 0, + 727, 0, 0, 0, 0, 0, 0, 1291, 1292, 0, + 2693, 645, 0, -1553, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 722, 0, 725, 722, -1553, 0, 0, + 0, 0, -1553, 0, 0, 0, 721, -1553, 0, 0, + 0, 0, 724, 0, 0, 0, -1553, 0, 0, 0, + -1553, 0, 0, 0, 725, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 727, 0, 0, 0, 0, 0, 0, + 724, -1553, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 727, 1048, 0, 0, 1871, 1872, 0, 1873, 0, + 0, -1553, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 724, 0, 0, 724, 0, 0, 727, 0, 0, + 0, 2090, 0, 0, 727, 0, 0, 1048, 725, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1323, 0, 0, - 0, 0, 1328, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1328, 0, 1341, 0, 0, 0, 1638, 0, 0, - 0, 0, 0, 0, 0, 0, 1341, 1341, 1341, 0, - 0, 1341, 0, 0, 1341, 1341, 0, 1328, 0, 1341, - 0, 0, 1326, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1329, 0, 0, 1330, 1331, 1332, 0, 1333, - 1334, 1335, 1336, 1337, 1338, 0, 1638, 0, 0, 2022, - 0, 1329, 0, 0, 1330, 1331, 1332, 0, 1333, 1334, - 1335, 1336, 1337, 1338, 0, 1341, 0, 0, 2234, 0, - 0, 0, 0, 0, 1328, 0, 0, 1329, 0, 0, - 1330, 1331, 1332, 0, 1333, 1334, 1335, 1336, 1337, 1338, - 0, 0, 0, 0, 2273, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1996, 1638, 0, 0, 0, 0, 1341, - 1341, 1341, 0, 0, 0, 0, 0, 0, 0, 0, + 2103, 2103, 0, 0, 0, 0, 0, 0, 727, 0, + -1553, 0, 0, -1553, 0, 0, 0, 0, 0, -1553, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1341, 1341, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1329, 0, 1341, -1731, -1731, -1731, - 0, 1333, 1334, 1335, 1336, 1337, 1338, 0, 1996, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1996, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1341, 0, 0, 0, 0, 0, + 0, 1048, 0, -1553, 0, 0, 0, 0, 1967, 0, + 0, 0, 0, 1973, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -1553, 0, 1315, 0, + 0, 1316, 0, 0, 0, 1317, 1318, 1319, 1320, 0, + 0, 722, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1988, 0, 1321, 0, 0, 0, 0, 725, 1349, + 0, 1323, 1656, 0, 1656, 1656, 0, 0, 1324, 0, + 0, 0, 2026, 0, 0, 0, 2029, 727, 0, 2031, + 0, 2067, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1325, 0, 0, 725, 0, 0, 0, + 1349, 0, 0, 0, 0, 0, 2227, 0, -1553, 0, + 0, 0, 0, 0, 2049, 0, -1553, 2052, 0, 2054, + 0, 0, 0, 0, 0, 0, 0, 725, 0, 724, + 725, 0, -1553, 0, -1553, -1553, 0, 0, 0, 0, + 0, 0, 0, 727, 0, 0, 0, 1315, 0, 0, + 1316, 0, 0, 0, 1317, 1318, 1319, 1320, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1392, + 0, -1553, 1321, 0, -1553, -1553, -1553, 0, 0, 0, + 1323, 0, 0, 0, 1411, 1718, 0, 1324, 0, 0, + 0, 0, 0, 1315, 1326, 0, 1316, 0, 0, 0, + 0, 1318, 1319, 1320, 0, 0, 0, 0, 0, 1349, + 1327, 0, 1325, 0, 727, 1328, 1349, 0, 2130, 0, + 0, 0, 0, 0, 0, 0, 1323, 0, 0, 0, + 0, 0, 0, 1324, 0, 0, 0, 1329, 1330, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1341, 0, 0, 0, + 0, 0, 1331, 0, 0, 0, 0, 0, 1325, 0, + 0, 0, 0, 0, 0, 0, 0, 1314, 0, 0, + 0, 0, 1315, 0, 0, 1316, 1048, 0, 0, 1317, + 1318, 1319, 1320, 0, 0, 0, 0, 0, 0, 0, + 1332, 0, 0, 1333, 0, 0, 0, 1321, 0, 0, + 1322, 0, 0, 0, 0, 1323, 0, 1334, 0, 0, + 1335, 0, 1324, 1326, 0, 0, 0, 0, 0, 0, + 0, 0, 2222, 0, 727, 0, 0, 0, 0, 1327, + 0, 0, 0, 0, 1328, 725, 0, 1325, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1341, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1244, 0, 727, 0, 0, 1329, 1330, 0, 1326, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1331, 0, 0, 0, 1327, 0, 0, 2249, 0, + 1328, 0, 0, 0, 0, 0, 0, 2253, 0, 0, + 2254, 0, 0, 2256, 0, 0, 0, 0, 0, 1336, + 0, 0, -1759, -1759, 0, 0, 0, 0, 0, 1332, + 0, 0, 1333, 0, 0, 1315, 0, 1331, 1316, 2276, + 2277, 0, 0, 1752, 0, 0, 1334, 727, 0, 1335, + 1349, 0, 0, 0, 0, 2288, 0, 0, 1326, 0, + 0, 1349, 0, 0, 2295, 1644, 0, 2298, 1323, 2300, + 0, 1349, 1349, 1349, 1327, -1759, 0, 2304, -1759, 1328, + 1349, 0, 0, 0, 0, 2311, 2312, 0, 0, 0, + 0, 0, 1334, 0, 0, 0, 0, 0, 0, 0, + 1325, 1329, 1330, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2351, 1331, 0, 0, 1337, + 0, 0, 1338, 1339, 1340, 0, 1341, 1342, 1343, 1344, + 1345, 1346, 0, 0, 0, 0, 1349, 0, 1336, 1980, + 0, 2365, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1332, 0, 0, 1333, 2378, 0, + 0, 0, 0, 0, 0, 0, 1315, 727, 0, 1316, + 2306, 1334, 0, 1349, 1335, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1336, 0, 0, 1349, 0, 0, + 0, 0, 1349, 0, 0, 0, 0, 0, 0, 1323, + 0, -1759, 0, 0, 0, 727, -1759, 1244, 0, 0, + 0, 0, 1244, 0, 0, 0, 0, -1759, 0, 0, + 0, 0, -1759, 0, 0, 0, 0, 0, 0, 0, + 0, 1325, 0, 0, 0, 0, 727, 0, 1337, 727, + 0, 1338, 1339, 1340, 0, 1341, 1342, 1343, 1344, 1345, + 1346, 0, 0, 1571, 1573, 1665, 0, 0, 0, -1759, + 0, 0, 0, 1336, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 2508, 0, + 0, 0, 0, 0, 1337, 0, 0, 1338, 1339, 1340, + 0, 1341, 1342, 1343, 1344, 1345, 1346, 0, 0, 0, + 0, 2309, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1334, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 2521, 2522, 0, 0, + 0, 2523, -1759, 0, 0, 0, 2526, 0, 0, 2529, + 2530, 0, 0, 0, 2534, 0, 0, 0, -1759, 0, + 0, 0, 0, -1759, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1337, 0, 0, 1338, 1339, 1340, 0, + 1341, 1342, 1343, 1344, 1345, 1346, 0, 0, 0, 0, + 0, 0, 1349, 0, 0, 0, 0, 0, 0, 0, + -1759, 0, 0, 0, 0, 0, 898, 0, 0, 0, + 0, 1349, 0, 0, 0, 0, -1759, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1349, 0, + 1644, 1644, 0, 2005, 0, 1644, 0, 0, 0, 1349, + 1571, 1573, 1349, 2621, 0, 0, 0, 1349, 0, 0, + 1349, 1244, 0, 0, 727, 1334, 0, 0, 0, 0, + 0, 0, 1349, 0, 0, 0, 1349, 1349, 1349, 1349, + 1349, 0, 0, 0, 0, 0, 1644, 1644, 0, 1349, + 1349, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1349, 0, 0, 1349, 0, 0, 0, 0, 0, + 0, 0, 1349, 1349, 1349, 1349, 1349, 1349, 1349, 1349, + 1349, 1349, 0, 0, 0, 0, -1759, 0, 0, 0, + 0, 0, 0, 1341, 1342, 1343, 1344, 1345, 1346, 0, + 0, 0, 0, 0, 0, 0, 1315, 0, 0, 1316, + 0, 0, 0, 1349, 0, 0, 0, -1759, 0, 0, + 0, 0, 0, 0, 0, 0, 1315, 0, 2026, 1316, + 0, 0, 0, 1317, 1318, 1319, 1320, 2677, 2678, 1323, + 0, 2679, 0, 0, 0, 0, -1759, 0, 0, 0, + 0, 1321, 0, 0, 0, 0, 0, 0, 0, 1323, + 0, 0, 0, 0, 0, 0, 1324, 0, 0, 0, + 0, 1325, 0, 0, 0, 0, 0, 0, 2721, 2722, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1325, 0, 2737, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1341, 0, - 0, 0, 0, 0, 0, 0, 1009, 814, 547, 815, - 816, 817, 818, 819, 0, 0, 0, 0, 0, 0, - 0, 1341, 93, 94, 95, 96, 97, 98, 99, 100, - 1010, 101, 102, 103, 0, 1341, 0, 0, 820, 0, - 0, 104, 105, 0, 106, 107, 108, 1011, 110, 111, - 112, 113, 821, 1012, 822, 823, 0, 118, 119, 120, - 121, 122, 123, 824, 825, 124, 125, 826, 827, 128, - 0, 129, 130, 131, 132, 828, 0, 1013, 0, 135, - 136, 137, 138, 139, 140, 1014, 142, 143, 144, 0, - 145, 146, 147, 148, 149, 150, 0, 1015, 152, 153, - 154, 830, 831, 832, 1016, 834, 835, 836, 156, 157, - 158, 159, 160, 161, 162, 837, 838, 165, 839, 166, - 0, 167, 168, 169, 170, 171, 172, 0, 173, 174, - 175, 176, 177, 1017, 0, 178, 179, 675, 181, 182, - 0, 183, 184, 185, 0, 186, 187, 188, 0, 189, - 190, 191, 192, 840, 194, 195, 196, 197, 841, 842, - 199, 0, 200, 201, 843, 203, 0, 204, 0, 205, - 1018, 0, 1019, 208, 209, 210, 1020, 212, 0, 213, - 0, 844, 845, 216, 0, 217, 218, 219, 220, 221, - 222, 223, 1021, 225, 226, 227, 228, 0, 229, 230, - 231, 232, 233, 234, 0, 235, 1022, 237, 238, 239, - 240, 241, 242, 846, 847, 0, 848, 0, 246, 1023, - 1024, 249, 1025, 251, 252, 253, 254, 255, 0, 0, - 256, 1026, 258, 1027, 0, 260, 261, 262, 849, 850, - 263, 264, 265, 266, 267, 1028, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 851, 1029, 852, 290, 291, 292, - 293, 853, 294, 295, 1030, 297, 854, 855, 299, 856, - 301, 302, 303, 0, 304, 305, 0, 0, 857, 307, - 308, 0, 0, 309, 310, 1031, 312, 1032, 858, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 0, - 325, 326, 859, 328, 329, 330, 331, 332, 333, 0, - 334, 335, 336, 337, 338, 339, 0, 340, 341, 342, - 860, 344, 345, 346, 347, 0, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 0, - 361, 362, 1033, 364, 365, 366, 861, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 0, 379, - 380, 381, 382, 383, 862, 384, 385, 386, 387, 388, - 1034, 390, 391, 863, 393, 0, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 1035, 406, 864, - 408, 0, 409, 410, 0, 411, 1036, 413, 414, 415, - 416, 417, 0, 865, 866, 0, 0, 420, 421, 867, - 423, 868, 869, 425, 426, 1037, 428, 429, 430, 431, - 432, 0, 0, 433, 434, 435, 436, 437, 871, 0, - 438, 439, 440, 441, 442, 443, 872, 1038, 445, 1039, - 447, 448, 449, 450, 0, 0, 451, 0, 0, 452, - 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, - 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 873, 0, 0, 0, 0, 0, 0, 874, 875, 1040, - 0, 0, 0, 0, 877, 0, 878, 1041, 0, 0, - 0, 879, 0, 880, 881, 92, 814, 547, 815, 816, - 817, 818, 819, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 94, 95, 96, 97, 98, 99, 100, 0, - 101, 102, 103, 0, 0, 0, 0, 820, 0, 0, - 104, 105, 0, 106, 107, 108, 109, 110, 111, 112, - 113, 821, 115, 822, 823, 0, 118, 119, 120, 121, - 122, 123, 824, 825, 124, 125, 826, 827, 128, 0, - 129, 130, 131, 132, 828, 0, 829, 0, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 0, 145, - 146, 147, 148, 149, 150, 0, 151, 152, 153, 154, - 830, 831, 832, 833, 834, 835, 836, 156, 157, 158, - 159, 160, 161, 162, 837, 838, 165, 839, 166, 0, - 167, 168, 169, 170, 171, 172, 0, 173, 174, 175, - 176, 177, 0, 0, 178, 179, 675, 181, 182, 0, - 183, 184, 185, 0, 186, 187, 188, 0, 189, 190, - 191, 192, 840, 194, 195, 196, 197, 841, 842, 199, - 0, 200, 201, 843, 203, 0, 204, 0, 205, 206, - 0, 207, 208, 209, 210, 211, 212, 0, 213, 0, - 844, 845, 216, 0, 217, 218, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 0, 229, 230, 231, - 232, 233, 234, 0, 235, 236, 237, 238, 239, 240, - 241, 242, 846, 847, 0, 848, 0, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 0, 0, 256, - 257, 258, 259, 0, 260, 261, 262, 849, 850, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 851, 288, 852, 290, 291, 292, 293, - 853, 294, 295, 296, 297, 854, 855, 299, 856, 301, - 302, 303, 0, 304, 305, 0, 0, 857, 307, 308, - 0, 0, 309, 310, 311, 312, 313, 858, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 0, 325, - 326, 859, 328, 329, 330, 331, 332, 333, 0, 334, - 335, 336, 337, 338, 339, 0, 340, 341, 342, 860, - 344, 345, 346, 347, 0, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 0, 361, - 362, 363, 364, 365, 366, 861, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 26, 379, 380, - 381, 382, 383, 862, 384, 385, 386, 387, 388, 389, - 390, 391, 863, 393, 0, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 405, 406, 864, 408, - 0, 409, 410, 31, 411, 412, 413, 414, 415, 416, - 417, 0, 865, 866, 0, 0, 420, 421, 867, 423, - 868, 869, 425, 426, 870, 428, 429, 430, 431, 432, - 0, 0, 433, 434, 435, 436, 437, 871, 0, 438, - 439, 440, 441, 442, 575, 872, 0, 445, 446, 447, - 448, 449, 450, 0, 0, 451, 0, 34, 452, 453, - 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 873, - 0, 35, 0, 0, 0, 0, 874, 875, 0, 0, - 0, 0, 0, 877, 0, 878, 2798, 0, 0, 0, - 879, 0, 880, 881, 92, 814, 547, 815, 816, 817, - 818, 819, 0, 0, 0, 0, 0, 0, 0, 0, - 93, 94, 95, 96, 97, 98, 99, 100, 0, 101, - 102, 103, 0, 0, 0, 0, 820, 0, 0, 104, - 105, 0, 106, 107, 108, 109, 110, 111, 112, 113, - 821, 115, 822, 823, 0, 118, 119, 120, 121, 122, - 123, 824, 825, 124, 125, 826, 827, 128, 0, 129, - 130, 131, 132, 828, 0, 829, 0, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 0, 145, 146, - 147, 148, 149, 150, 0, 151, 152, 153, 154, 830, - 831, 832, 833, 834, 835, 836, 156, 157, 158, 159, - 160, 161, 162, 837, 838, 165, 839, 166, 0, 167, - 168, 169, 170, 171, 172, 0, 173, 174, 175, 176, - 177, 0, 0, 178, 179, 675, 181, 182, 0, 183, - 184, 185, 0, 186, 187, 188, 0, 189, 190, 191, - 192, 840, 194, 195, 196, 197, 841, 842, 199, 0, - 200, 201, 843, 203, 0, 204, 0, 205, 206, 0, - 207, 208, 209, 210, 211, 212, 0, 213, 0, 844, - 845, 216, 0, 217, 218, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 228, 0, 229, 230, 231, 232, - 233, 234, 0, 235, 236, 237, 238, 239, 240, 241, - 242, 846, 847, 0, 848, 0, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 0, 0, 256, 257, - 258, 259, 0, 260, 261, 262, 849, 850, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 851, 288, 852, 290, 291, 292, 293, 853, - 294, 295, 296, 297, 854, 855, 299, 856, 301, 302, - 303, 0, 304, 305, 0, 0, 857, 307, 308, 0, - 0, 309, 310, 311, 312, 313, 858, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 0, 325, 326, - 859, 328, 329, 330, 331, 332, 333, 0, 334, 335, - 336, 337, 338, 339, 0, 340, 341, 342, 860, 344, - 345, 346, 347, 0, 348, 349, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 0, 361, 362, - 363, 364, 365, 366, 861, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 378, 26, 379, 380, 381, - 382, 383, 862, 384, 385, 386, 387, 388, 389, 390, - 391, 863, 393, 0, 394, 395, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 864, 408, 0, - 409, 410, 31, 411, 412, 413, 414, 415, 416, 417, - 0, 865, 866, 0, 0, 420, 421, 867, 423, 868, - 869, 425, 426, 870, 428, 429, 430, 431, 432, 0, - 0, 433, 434, 435, 436, 437, 871, 0, 438, 439, - 440, 441, 442, 575, 872, 0, 445, 446, 447, 448, - 449, 450, 0, 0, 451, 0, 34, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 873, 0, - 35, 0, 0, 0, 0, 874, 875, 0, 0, 0, - 0, 0, 877, 0, 878, 0, 0, 0, 0, 879, - 0, 880, 881, 92, 814, 547, 815, 816, 817, 818, - 819, 0, 0, 0, 0, 0, 0, 0, 0, 93, - 94, 95, 96, 97, 98, 99, 100, 0, 101, 102, - 103, 0, 0, 0, 0, 820, 0, 0, 104, 105, - 0, 106, 107, 108, 109, 110, 111, 112, 113, 821, - 115, 822, 823, 1647, 118, 119, 120, 121, 122, 123, - 824, 825, 124, 125, 826, 827, 128, 0, 129, 130, - 131, 132, 828, 0, 829, 0, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 0, 145, 146, 147, - 148, 149, 150, 0, 151, 152, 153, 154, 830, 831, - 832, 833, 834, 835, 836, 156, 157, 158, 159, 160, - 161, 162, 837, 838, 165, 839, 166, 0, 167, 168, - 169, 170, 171, 172, 0, 173, 174, 175, 176, 177, - 0, 0, 178, 179, 675, 181, 182, 0, 183, 184, - 185, 0, 186, 187, 188, 0, 189, 190, 191, 192, - 840, 194, 195, 196, 197, 841, 842, 199, 0, 200, - 201, 843, 203, 0, 204, 0, 205, 206, 1648, 207, - 208, 209, 210, 211, 212, 0, 213, 0, 844, 845, - 216, 0, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 0, 229, 230, 231, 232, 233, - 234, 0, 235, 236, 237, 238, 239, 240, 241, 242, - 846, 847, 0, 848, 0, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 0, 1649, 256, 257, 258, - 259, 0, 260, 261, 262, 849, 850, 263, 264, 265, - 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 851, 288, 852, 290, 291, 292, 293, 853, 294, - 295, 296, 297, 854, 855, 299, 856, 301, 302, 303, - 0, 304, 305, 0, 0, 857, 307, 308, 0, 0, - 309, 310, 311, 312, 313, 858, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 0, 325, 326, 859, - 328, 329, 330, 331, 332, 333, 0, 334, 335, 336, - 337, 338, 339, 0, 340, 341, 342, 860, 344, 345, - 346, 347, 0, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 0, 361, 362, 363, - 364, 365, 366, 861, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 0, 379, 380, 381, 382, - 383, 862, 384, 385, 386, 387, 388, 389, 390, 391, - 863, 393, 0, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 405, 406, 864, 408, 0, 409, - 410, 0, 411, 412, 413, 414, 415, 416, 417, 0, - 865, 866, 0, 1650, 420, 421, 867, 423, 868, 869, - 425, 426, 870, 428, 429, 430, 431, 432, 0, 0, - 433, 434, 435, 436, 437, 871, 0, 438, 439, 440, - 441, 442, 443, 872, 0, 445, 446, 447, 448, 449, - 450, 0, 0, 451, 0, 0, 452, 453, 454, 455, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 873, 0, 0, - 0, 0, 0, 0, 874, 875, 0, 0, 0, 0, - 0, 877, 0, 878, 0, 0, 0, 0, 879, 0, - 880, 881, 92, 814, 547, 815, 816, 817, 818, 819, - 0, 0, 0, 0, 0, 0, 0, 0, 93, 94, - 95, 96, 97, 98, 99, 100, -935, 101, 102, 103, - 0, 0, 0, -935, 820, 0, 0, 104, 105, 0, - 106, 107, 108, 109, 110, 111, 112, 113, 821, 115, - 822, 823, 0, 118, 119, 120, 121, 122, 123, 824, - 825, 124, 125, 826, 827, 128, 0, 129, 130, 131, - 132, 828, 0, 829, 0, 135, 136, 137, 138, 139, - 140, 141, 142, 143, 144, 0, 145, 146, 147, 148, - 149, 150, 0, 151, 152, 153, 154, 830, 831, 832, - 833, 834, 835, 836, 156, 157, 158, 159, 160, 161, - 162, 837, 838, 165, 839, 166, 0, 167, 168, 169, - 170, 171, 172, 0, 173, 174, 175, 176, 177, 0, - 0, 178, 179, 675, 181, 182, 0, 183, 184, 185, - 0, 186, 187, 188, 0, 189, 190, 191, 192, 840, - 194, 195, 196, 197, 841, 842, 199, 0, 200, 201, - 843, 203, 0, 204, 0, 205, 206, 0, 207, 208, - 209, 210, 211, 212, 0, 213, 0, 844, 845, 216, - 0, 217, 218, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 228, 0, 229, 230, 231, 232, 233, 234, - 0, 235, 236, 237, 238, 239, 240, 241, 242, 846, - 847, 0, 848, 0, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 0, 0, 256, 257, 258, 259, - 0, 260, 261, 262, 849, 850, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 851, 288, 852, 290, 291, 292, 293, 853, 294, 295, - 296, 297, 854, 855, 299, 856, 301, 302, 303, 0, - 304, 305, 0, 0, 857, 307, 308, 0, 0, 309, - 310, 311, 312, 313, 858, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 0, 325, 326, 859, 328, - 329, 330, 331, 332, 333, 0, 334, 335, 336, 337, - 338, 339, 0, 340, 341, 342, 860, 344, 345, 346, - 347, 0, 348, 349, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 0, 361, 362, 363, 364, - 365, 366, 861, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 0, 379, 380, 381, 382, 383, - 862, 384, 385, 386, 387, 388, 389, 390, 391, 863, - 393, -935, 394, 395, 396, 397, 398, 399, 400, 401, - 402, 403, 404, 405, 406, 864, 408, 0, 409, 410, - 0, 411, 412, 413, 414, 415, 416, 417, 0, 865, - 866, 0, 0, 420, 421, 867, 423, 868, 869, 425, - 426, 870, 428, 429, 430, 431, 432, 0, 0, 433, - 434, 435, 436, 437, 871, 0, 438, 439, 440, 441, - 442, 443, 872, 0, 445, 446, 447, 448, 449, 450, - 0, 0, 451, 0, 0, 452, 453, 454, 455, 456, - 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 472, 873, 0, 0, 0, - 0, 0, 0, 874, 875, 0, 0, 0, 0, 0, - 877, 0, 878, 0, 0, 0, 0, 879, 0, 880, - 881, 92, 814, 547, 815, 816, 817, 818, 819, 0, - 0, 0, 0, 0, 0, 0, 0, 93, 94, 95, - 96, 97, 98, 99, 100, 1388, 101, 102, 103, 0, - 0, 0, 0, 820, 0, 0, 104, 105, 0, 106, - 107, 108, 109, 110, 111, 112, 113, 821, 115, 822, - 823, 0, 118, 119, 120, 121, 122, 123, 824, 825, - 124, 125, 826, 827, 128, 0, 129, 130, 131, 132, - 828, 0, 829, 0, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 151, 152, 153, 154, 830, 831, 832, 833, - 834, 835, 836, 156, 157, 158, 159, 160, 161, 162, - 837, 838, 165, 839, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 675, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 840, 194, - 195, 196, 197, 841, 842, 199, 0, 200, 201, 843, - 203, 0, 204, 0, 205, 206, 0, 207, 208, 209, - 210, 211, 212, 0, 213, 0, 844, 845, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 236, 237, 238, 239, 240, 241, 242, 846, 847, - 0, 848, 0, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 0, 0, 256, 257, 258, 259, 0, - 260, 261, 262, 849, 850, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 851, - 288, 852, 290, 291, 292, 293, 853, 294, 295, 296, - 297, 854, 855, 299, 856, 301, 302, 303, 0, 304, - 305, 0, 0, 857, 307, 308, 0, 0, 309, 310, - 311, 312, 313, 858, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 859, 328, 329, - 330, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 860, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 363, 364, 365, - 366, 861, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 862, - 384, 385, 386, 387, 388, 389, 390, 391, 863, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 864, 408, 0, 409, 410, 0, - 411, 412, 413, 414, 415, 416, 417, 0, 865, 866, - 0, 0, 420, 421, 867, 423, 868, 869, 425, 426, - 870, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 871, 0, 438, 439, 440, 441, 442, - 443, 872, 0, 445, 446, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 873, 0, 0, 0, 0, - 0, 0, 874, 875, 1389, 0, 0, 0, 0, 877, - 0, 878, 0, 0, 0, 0, 879, 0, 880, 881, - 92, 814, 547, 815, 816, 817, 818, 819, 0, 0, - 0, 0, 0, 0, 0, 0, 93, 94, 95, 96, - 97, 98, 99, 100, 2682, 101, 102, 103, 0, 0, - 0, 0, 820, 0, 0, 104, 105, 0, 106, 107, - 108, 109, 110, 111, 112, 113, 821, 115, 822, 823, - 0, 118, 119, 120, 121, 122, 123, 824, 825, 124, - 125, 826, 827, 128, 0, 129, 130, 131, 132, 828, - 0, 829, 0, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 0, 145, 146, 147, 148, 149, 150, - 0, 151, 152, 2683, 154, 830, 831, 832, 833, 834, - 835, 836, 156, 157, 158, 159, 160, 161, 162, 837, - 838, 165, 839, 166, 0, 167, 168, 169, 170, 171, - 172, 0, 173, 174, 175, 176, 177, 0, 0, 178, - 179, 675, 181, 182, 0, 183, 184, 185, 0, 186, - 187, 188, 0, 189, 190, 191, 192, 840, 194, 195, - 196, 197, 841, 842, 199, 0, 200, 201, 843, 203, - 0, 204, 0, 205, 206, 0, 207, 208, 209, 210, - 211, 212, 0, 213, 0, 2684, 845, 216, 0, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 0, 229, 230, 231, 232, 233, 234, 0, 235, - 236, 237, 238, 239, 240, 241, 242, 846, 847, 0, - 848, 0, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 0, 0, 256, 257, 258, 259, 0, 260, - 261, 262, 849, 850, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, 851, 288, - 852, 290, 291, 292, 293, 853, 294, 295, 296, 297, - 854, 855, 299, 856, 301, 302, 303, 0, 304, 305, - 0, 0, 857, 307, 308, 0, 0, 309, 310, 311, - 312, 313, 858, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 0, 325, 326, 859, 328, 329, 330, - 331, 332, 333, 0, 334, 335, 336, 337, 338, 339, - 0, 340, 341, 342, 860, 344, 345, 346, 347, 0, - 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 0, 361, 362, 363, 364, 365, 2685, - 861, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 0, 379, 380, 381, 382, 383, 862, 384, - 385, 386, 387, 388, 389, 390, 391, 863, 393, 0, - 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, - 404, 405, 406, 864, 408, 0, 409, 410, 0, 411, - 412, 413, 414, 415, 416, 417, 0, 865, 866, 0, - 0, 420, 421, 867, 423, 868, 869, 425, 426, 870, - 428, 429, 430, 431, 432, 0, 0, 433, 434, 435, - 436, 437, 871, 0, 438, 439, 440, 441, 442, 443, - 872, 0, 445, 446, 447, 448, 449, 450, 0, 0, - 451, 0, 0, 452, 453, 454, 455, 456, 457, 458, - 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, - 469, 470, 471, 472, 873, 0, 0, 0, 0, 0, - 0, 874, 875, 2686, 0, 0, 0, 0, 877, 0, - 2687, 0, 0, 0, 0, 879, 0, 880, 881, 92, - 814, 547, 815, 816, 817, 818, 819, 0, 0, 0, - 0, 0, 0, 0, 0, 93, 94, 95, 96, 97, - 98, 99, 100, 0, 101, 102, 103, 0, 0, 0, - 0, 820, 0, 0, 104, 105, 0, 106, 107, 108, - 109, 110, 111, 112, 113, 821, 115, 822, 823, 0, - 118, 119, 120, 121, 122, 123, 824, 825, 124, 125, - 826, 827, 128, 0, 129, 130, 131, 132, 828, 0, - 829, 0, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 0, 145, 146, 147, 148, 149, 150, 0, - 151, 152, 153, 154, 830, 831, 832, 833, 834, 835, - 836, 156, 157, 158, 159, 160, 161, 162, 837, 838, - 165, 839, 166, 0, 167, 168, 169, 170, 171, 172, - 0, 173, 174, 175, 176, 177, 0, 0, 178, 179, - 675, 181, 182, 0, 183, 184, 185, 0, 186, 187, - 188, 0, 189, 190, 191, 192, 840, 194, 195, 196, - 197, 841, 842, 199, 0, 200, 201, 843, 203, 0, - 204, 0, 205, 206, 0, 207, 208, 209, 210, 211, - 212, 0, 213, 0, 844, 845, 216, 0, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 0, 229, 230, 231, 232, 233, 234, 0, 235, 236, - 237, 238, 239, 240, 241, 242, 846, 847, 0, 848, - 0, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 0, 0, 256, 257, 258, 259, 0, 260, 261, - 262, 849, 850, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 851, 288, 852, - 290, 291, 292, 293, 853, 294, 295, 296, 297, 854, - 855, 299, 856, 301, 302, 303, 0, 304, 305, 0, - 0, 857, 307, 308, 0, 0, 309, 310, 311, 312, - 313, 858, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 325, 326, 859, 328, 329, 330, 331, - 332, 333, 0, 334, 335, 336, 337, 338, 339, 0, - 340, 341, 342, 860, 344, 345, 346, 347, 0, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 0, 361, 362, 363, 364, 365, 366, 861, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 0, 379, 380, 381, 382, 383, 862, 384, 385, - 386, 387, 388, 389, 390, 391, 863, 393, 0, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 864, 408, 0, 409, 410, 0, 411, 412, - 413, 414, 415, 416, 417, 0, 865, 866, 0, 0, - 420, 421, 867, 423, 868, 869, 425, 426, 870, 428, - 429, 430, 431, 432, 0, 0, 433, 434, 435, 436, - 437, 871, 0, 438, 439, 440, 441, 442, 443, 872, - 0, 445, 446, 447, 448, 449, 450, 0, 0, 451, - 0, 0, 452, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 873, 0, 0, 0, 0, 0, 0, - 874, 875, 876, 0, 0, 0, 0, 877, 0, 878, - 0, 0, 0, 0, 879, 0, 880, 881, 92, 1402, - 547, 815, 816, 817, 1403, 819, 0, 0, 0, 0, - 0, 0, 0, 0, 93, 94, 95, 96, 97, 98, - 99, 100, 1404, 101, 102, 103, 0, 0, 0, 0, - 820, 0, 0, 104, 105, 0, 106, 107, 108, 109, - 110, 111, 112, 113, 821, 115, 822, 823, 0, 118, - 119, 120, 121, 122, 123, 824, 825, 124, 125, 826, - 827, 128, 0, 129, 130, 131, 132, 828, 0, 829, - 0, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 0, 145, 146, 147, 148, 149, 150, 0, 151, - 152, 153, 154, 830, 831, 832, 833, 834, 835, 836, - 156, 157, 158, 159, 160, 161, 162, 837, 838, 165, - 839, 166, 0, 167, 168, 169, 170, 171, 172, 0, - 173, 174, 175, 176, 177, 0, 0, 178, 179, 675, - 181, 182, 0, 183, 184, 185, 0, 186, 187, 188, - 0, 189, 190, 191, 192, 840, 194, 195, 196, 197, - 841, 842, 199, 0, 200, 201, 843, 203, 0, 204, - 0, 205, 206, 0, 207, 208, 209, 210, 211, 212, - 0, 213, 0, 844, 845, 216, 0, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 0, - 229, 230, 231, 232, 233, 234, 0, 235, 236, 237, - 238, 239, 240, 241, 242, 846, 847, 0, 848, 0, - 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 0, 0, 256, 257, 258, 259, 0, 260, 261, 262, - 849, 850, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 282, 283, 284, 285, 286, 851, 288, 852, 290, - 291, 292, 293, 853, 294, 295, 296, 297, 854, 855, - 299, 856, 301, 302, 303, 0, 304, 305, 0, 0, - 857, 307, 308, 0, 0, 309, 310, 311, 312, 313, - 858, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 0, 325, 326, 859, 328, 329, 330, 331, 332, - 333, 0, 334, 335, 336, 337, 338, 339, 0, 340, - 341, 342, 860, 344, 345, 346, 347, 0, 348, 349, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 0, 361, 362, 363, 364, 365, 366, 861, 368, - 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, - 0, 379, 380, 381, 382, 383, 862, 384, 385, 386, - 387, 388, 389, 390, 391, 863, 393, 0, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 864, 408, 0, 409, 410, 0, 411, 412, 413, - 414, 415, 416, 417, 0, 865, 866, 0, 0, 420, - 421, 867, 423, 868, 869, 425, 426, 870, 428, 429, - 430, 431, 432, 0, 0, 433, 434, 435, 436, 437, - 871, 0, 438, 439, 440, 441, 442, 443, 872, 0, - 445, 446, 447, 448, 449, 450, 0, 0, 451, 0, - 0, 452, 453, 454, 455, 456, 457, 458, 459, 460, - 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, - 471, 472, 873, 0, 0, 0, 0, 0, 0, 874, - 875, 0, 0, 0, 0, 0, 877, 0, 878, 0, - 0, 0, 0, 879, 0, 880, 881, 1009, 814, 547, - 815, 816, 817, 818, 819, 0, 0, 0, 0, 0, - 0, 0, 0, 93, 94, 95, 96, 97, 98, 99, - 100, 0, 101, 102, 103, 0, 0, 0, 0, 820, - 0, 0, 104, 105, 0, 106, 107, 108, 1011, 110, - 111, 112, 113, 821, 1012, 822, 823, 0, 118, 119, - 120, 121, 122, 123, 824, 825, 124, 125, 826, 827, - 128, 0, 129, 130, 131, 132, 828, 0, 1013, 0, - 135, 136, 137, 138, 139, 140, 1014, 142, 143, 144, - 0, 145, 146, 147, 148, 149, 150, 0, 1015, 152, - 153, 154, 830, 831, 832, 1016, 834, 835, 836, 156, - 157, 158, 159, 160, 161, 162, 837, 838, 165, 839, - 166, 0, 167, 168, 169, 170, 171, 172, 0, 173, - 174, 175, 176, 177, 0, 0, 178, 179, 675, 181, - 182, 0, 183, 184, 185, 0, 186, 187, 188, 0, - 189, 190, 191, 192, 840, 194, 195, 196, 197, 841, - 842, 199, 0, 200, 201, 843, 203, 0, 204, 0, - 205, 1018, 0, 1019, 208, 209, 210, 1020, 212, 0, - 213, 0, 844, 845, 216, 0, 217, 218, 219, 220, - 221, 222, 223, 1021, 225, 226, 227, 228, 0, 229, - 230, 231, 232, 233, 234, 0, 235, 1022, 237, 238, - 239, 240, 241, 242, 846, 847, 0, 848, 0, 246, - 1023, 1024, 249, 1025, 251, 252, 253, 254, 255, 0, - 0, 256, 1026, 258, 1027, 0, 260, 261, 262, 849, - 850, 263, 264, 265, 266, 267, 1028, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 851, 1029, 852, 290, 291, - 292, 293, 853, 294, 295, 1030, 297, 854, 855, 299, - 856, 301, 302, 303, 0, 304, 305, 0, 0, 857, - 307, 308, 0, 0, 309, 310, 1031, 312, 1032, 858, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 0, 325, 326, 859, 328, 329, 330, 331, 332, 333, - 0, 334, 335, 336, 337, 338, 339, 0, 340, 341, - 342, 860, 344, 345, 346, 347, 0, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 0, 361, 362, 1033, 364, 365, 366, 861, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 0, - 379, 380, 381, 382, 383, 862, 384, 385, 386, 387, - 388, 1034, 390, 391, 863, 393, 0, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 1035, 406, - 864, 408, 0, 409, 410, 0, 411, 1036, 413, 414, - 415, 416, 417, 0, 865, 866, 0, 0, 420, 421, - 867, 423, 868, 869, 425, 426, 1037, 428, 429, 430, - 431, 432, 0, 0, 433, 434, 435, 436, 437, 871, - 0, 438, 439, 440, 441, 442, 443, 872, 0, 445, - 1039, 447, 448, 449, 450, 0, 0, 451, 0, 0, - 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 873, 0, 0, 0, 0, 0, 0, 874, 875, - 0, 0, 0, 0, 0, 877, 0, 878, 1521, 0, - 0, 0, 879, 0, 880, 881, 92, 814, 547, 815, - 816, 817, 818, 819, 0, 0, 0, 0, 0, 0, - 0, 0, 93, 94, 95, 96, 97, 98, 99, 100, - 0, 101, 102, 103, 0, 0, 0, 0, 820, 0, - 0, 104, 105, 0, 106, 107, 108, 109, 110, 111, - 112, 113, 821, 115, 822, 823, 0, 118, 119, 120, - 121, 122, 123, 824, 825, 124, 125, 826, 827, 128, - 0, 129, 130, 131, 132, 828, 0, 829, 0, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 0, - 145, 146, 147, 148, 149, 150, 0, 151, 152, 153, - 154, 830, 831, 832, 833, 834, 835, 836, 156, 157, - 158, 159, 160, 161, 162, 837, 838, 165, 839, 166, - 0, 167, 168, 169, 170, 171, 172, 0, 173, 174, - 175, 176, 177, 0, 0, 178, 179, 675, 181, 182, - 0, 183, 184, 185, 0, 186, 187, 188, 0, 189, - 190, 191, 192, 840, 194, 195, 196, 197, 841, 842, - 199, 0, 200, 201, 843, 203, 0, 204, 0, 205, - 206, 0, 207, 208, 209, 210, 211, 212, 0, 213, - 0, 844, 845, 216, 0, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 228, 0, 229, 230, - 231, 232, 233, 234, 0, 235, 236, 237, 238, 239, - 240, 241, 242, 846, 847, 0, 848, 0, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 0, 0, - 256, 257, 258, 259, 0, 260, 261, 262, 849, 850, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 851, 288, 852, 290, 291, 292, - 293, 853, 294, 295, 296, 297, 854, 855, 299, 856, - 301, 302, 303, 0, 304, 305, 0, 0, 857, 307, - 308, 0, 0, 309, 310, 311, 312, 313, 858, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 0, - 325, 326, 859, 328, 329, 330, 331, 332, 333, 0, - 334, 335, 336, 337, 338, 339, 0, 340, 341, 342, - 860, 344, 345, 346, 347, 0, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 0, - 361, 362, 363, 364, 365, 366, 861, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 0, 379, - 380, 381, 382, 383, 862, 384, 385, 386, 387, 388, - 389, 390, 391, 863, 393, 0, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 405, 406, 864, - 408, 0, 409, 410, 0, 411, 412, 413, 414, 415, - 416, 417, 0, 865, 866, 0, 0, 420, 421, 867, - 423, 868, 869, 425, 426, 870, 428, 429, 430, 431, - 432, 0, 0, 433, 434, 435, 436, 437, 871, 0, - 438, 439, 440, 441, 442, 443, 872, 0, 445, 446, - 447, 448, 449, 450, 0, 0, 451, 0, 0, 452, - 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, - 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 873, 0, 0, 0, 0, 0, 0, 874, 875, 0, - 0, 0, 0, 0, 877, 0, 878, 1641, 0, 0, - 0, 879, 0, 880, 881, 1009, 814, 547, 815, 816, - 817, 818, 819, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 94, 95, 96, 97, 98, 99, 100, 0, - 101, 102, 103, 0, 0, 0, 0, 820, 0, 0, - 104, 105, 0, 106, 107, 108, 1011, 110, 111, 112, - 113, 821, 1012, 822, 823, 0, 118, 119, 120, 121, - 122, 123, 824, 825, 124, 125, 826, 827, 128, 0, - 129, 130, 131, 132, 828, 0, 1013, 0, 135, 136, - 137, 138, 139, 140, 1014, 142, 143, 144, 0, 145, - 146, 147, 148, 149, 150, 0, 1015, 152, 153, 154, - 830, 831, 832, 1016, 834, 835, 836, 156, 157, 158, - 159, 160, 161, 162, 837, 838, 165, 839, 166, 0, - 167, 168, 169, 170, 171, 172, 0, 173, 174, 175, - 176, 177, 0, 0, 178, 179, 675, 181, 182, 0, - 183, 184, 185, 0, 186, 187, 188, 0, 189, 190, - 191, 192, 840, 194, 195, 196, 197, 841, 842, 199, - 0, 200, 201, 843, 203, 0, 204, 0, 205, 1018, - 0, 1019, 208, 209, 210, 1020, 212, 0, 213, 0, - 844, 845, 216, 0, 217, 218, 219, 220, 221, 222, - 223, 1021, 225, 226, 227, 228, 0, 229, 230, 231, - 232, 233, 234, 0, 235, 1022, 237, 238, 239, 240, - 241, 242, 846, 847, 0, 848, 0, 246, 1023, 1024, - 249, 1025, 251, 252, 253, 254, 255, 0, 0, 256, - 1026, 258, 1027, 0, 260, 261, 262, 849, 850, 263, - 264, 265, 266, 267, 1028, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 851, 1029, 852, 290, 291, 292, 293, - 853, 294, 295, 1030, 297, 854, 855, 299, 856, 301, - 302, 303, 0, 304, 305, 0, 0, 857, 307, 308, - 0, 0, 309, 310, 1031, 312, 1032, 858, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 0, 325, - 326, 859, 328, 329, 330, 331, 332, 333, 0, 334, - 335, 336, 337, 338, 339, 0, 340, 341, 342, 860, - 344, 345, 346, 347, 0, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 0, 361, - 362, 1033, 364, 365, 366, 861, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 0, 379, 380, - 381, 382, 383, 862, 384, 385, 386, 387, 388, 1034, - 390, 391, 863, 393, 0, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 1035, 406, 864, 408, - 0, 409, 410, 0, 411, 1036, 413, 414, 415, 416, - 417, 0, 865, 866, 0, 0, 420, 421, 867, 423, - 868, 869, 425, 426, 1037, 428, 429, 430, 431, 432, - 0, 0, 433, 434, 435, 436, 437, 871, 0, 438, - 439, 440, 441, 442, 443, 872, 1861, 445, 1039, 447, - 448, 449, 450, 0, 0, 451, 0, 0, 452, 453, - 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 873, - 0, 0, 0, 0, 0, 0, 874, 875, 0, 0, - 0, 0, 0, 877, 0, 878, 0, 0, 0, 0, - 879, 0, 880, 881, 92, 814, 547, 815, 816, 817, - 818, 819, 0, 0, 0, 0, 0, 0, 0, 0, - 93, 94, 95, 96, 97, 98, 99, 100, 0, 101, - 102, 103, 0, 0, 0, 0, 820, 0, 0, 104, - 105, 0, 106, 107, 108, 109, 110, 111, 112, 113, - 821, 115, 822, 823, 0, 118, 119, 120, 121, 122, - 123, 824, 825, 124, 125, 826, 827, 128, 0, 129, - 130, 131, 132, 828, 0, 829, 0, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 0, 145, 146, - 147, 148, 149, 150, 0, 151, 152, 153, 154, 830, - 831, 832, 833, 834, 835, 836, 156, 157, 158, 159, - 160, 161, 162, 837, 838, 165, 839, 166, 0, 167, - 168, 169, 170, 171, 172, 0, 173, 174, 175, 176, - 177, 0, 0, 178, 179, 675, 181, 182, 0, 183, - 184, 185, 0, 186, 187, 188, 0, 189, 190, 191, - 192, 840, 194, 195, 196, 197, 841, 842, 199, 0, - 200, 201, 843, 203, 0, 204, 0, 205, 206, 1648, - 207, 208, 209, 210, 211, 212, 0, 213, 0, 844, - 845, 216, 0, 217, 218, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 228, 0, 229, 230, 231, 232, - 233, 234, 0, 235, 236, 237, 238, 239, 240, 241, - 242, 846, 847, 0, 848, 0, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 0, 0, 256, 257, - 258, 259, 0, 260, 261, 262, 849, 850, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 851, 288, 852, 290, 291, 292, 293, 853, - 294, 295, 296, 297, 854, 855, 299, 856, 301, 302, - 303, 0, 304, 305, 0, 0, 857, 307, 308, 0, - 0, 309, 310, 311, 312, 313, 858, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 0, 325, 326, - 859, 328, 329, 330, 331, 332, 333, 0, 334, 335, - 336, 337, 338, 339, 0, 340, 341, 342, 860, 344, - 345, 346, 347, 0, 348, 349, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 0, 361, 362, - 363, 364, 365, 366, 861, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 378, 0, 379, 380, 381, - 382, 383, 862, 384, 385, 386, 387, 388, 389, 390, - 391, 863, 393, 0, 394, 395, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 864, 408, 0, - 409, 410, 0, 411, 412, 413, 414, 415, 416, 417, - 0, 865, 866, 0, 0, 420, 421, 867, 423, 868, - 869, 425, 426, 870, 428, 429, 430, 431, 432, 0, - 0, 433, 434, 435, 436, 437, 871, 0, 438, 439, - 440, 441, 442, 443, 872, 0, 445, 446, 447, 448, - 449, 450, 0, 0, 451, 0, 0, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 873, 0, - 0, 0, 0, 0, 0, 874, 875, 0, 0, 0, - 0, 0, 877, 0, 878, 0, 0, 0, 0, 879, - 0, 880, 881, 92, 814, 547, 815, 816, 817, 818, - 819, 0, 0, 0, 0, 0, 0, 0, 0, 93, - 94, 95, 96, 97, 98, 99, 100, 0, 101, 102, - 103, 0, 0, 0, 0, 820, 0, 0, 104, 105, - 0, 106, 107, 108, 109, 110, 111, 112, 113, 821, - 115, 822, 823, 0, 118, 119, 120, 121, 122, 123, - 824, 825, 124, 125, 826, 827, 128, 0, 129, 130, - 131, 132, 828, 0, 829, 0, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 0, 145, 146, 147, - 148, 149, 150, 0, 151, 152, 153, 154, 830, 831, - 832, 833, 834, 835, 836, 156, 157, 158, 159, 160, - 161, 162, 837, 838, 165, 839, 166, 0, 167, 168, - 169, 170, 171, 172, 0, 173, 174, 175, 176, 177, - 0, 0, 178, 179, 675, 181, 182, 0, 183, 184, - 185, 0, 186, 187, 188, 0, 189, 190, 191, 192, - 840, 194, 195, 196, 197, 841, 842, 199, 0, 200, - 201, 843, 203, 0, 204, 0, 205, 206, 0, 207, - 208, 209, 210, 211, 212, 0, 213, 0, 844, 845, - 216, 0, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 0, 229, 230, 231, 232, 233, - 234, 0, 235, 236, 237, 238, 239, 240, 241, 242, - 846, 847, 0, 848, 0, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 0, 0, 256, 257, 258, - 259, 0, 260, 261, 262, 849, 850, 263, 264, 265, - 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 851, 288, 852, 290, 291, 292, 293, 853, 294, - 295, 296, 297, 854, 855, 299, 856, 301, 302, 303, - 0, 304, 305, 0, 0, 857, 307, 308, 0, 0, - 309, 310, 311, 312, 313, 858, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 0, 325, 326, 859, - 328, 329, 330, 331, 332, 333, 0, 334, 335, 336, - 337, 338, 339, 0, 340, 341, 342, 860, 344, 345, - 346, 347, 0, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 0, 361, 362, 363, - 364, 365, 366, 861, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 0, 379, 380, 381, 382, - 383, 862, 384, 385, 386, 387, 388, 389, 390, 391, - 863, 393, 0, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 405, 406, 864, 408, 0, 409, - 410, 0, 411, 412, 413, 414, 415, 416, 417, 0, - 865, 866, 0, 0, 420, 421, 867, 423, 868, 869, - 425, 426, 870, 428, 429, 430, 431, 432, 0, 0, - 433, 434, 435, 436, 437, 871, 0, 438, 439, 440, - 441, 442, 443, 872, 0, 445, 446, 447, 448, 449, - 450, 0, 0, 451, 0, 0, 452, 453, 454, 455, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 873, 0, 0, - 0, 0, 0, 0, 874, 875, 0, 0, 0, 0, - 0, 877, 0, 878, 0, 0, 0, 0, 879, 0, - 880, 881, 1009, 814, 547, 815, 816, 817, 818, 819, - 0, 0, 0, 0, 0, 0, 0, 0, 93, 94, - 95, 96, 97, 98, 99, 100, 0, 101, 102, 103, - 0, 0, 0, 0, 820, 0, 0, 104, 105, 0, - 106, 107, 108, 1011, 110, 111, 112, 113, 821, 1012, - 822, 823, 0, 118, 119, 120, 121, 122, 123, 824, - 825, 124, 125, 826, 827, 128, 0, 129, 130, 131, - 132, 828, 0, 1013, 0, 135, 136, 137, 138, 139, - 140, 1014, 142, 143, 144, 0, 145, 146, 147, 148, - 149, 150, 0, 1015, 152, 153, 154, 830, 831, 832, - 1016, 834, 835, 836, 156, 157, 158, 159, 160, 161, - 162, 837, 838, 165, 839, 166, 0, 167, 168, 169, - 170, 171, 172, 0, 173, 174, 175, 176, 177, 0, - 0, 178, 179, 675, 181, 182, 0, 183, 184, 185, - 0, 186, 187, 188, 0, 189, 190, 191, 192, 840, - 194, 195, 196, 197, 841, 842, 199, 0, 200, 201, - 843, 203, 0, 204, 0, 205, 1018, 0, 1019, 208, - 209, 210, 1020, 212, 0, 213, 0, 844, 845, 216, - 0, 217, 218, 219, 220, 221, 222, 223, 1021, 225, - 226, 227, 228, 0, 229, 230, 231, 232, 233, 234, - 0, 235, 1022, 237, 238, 239, 240, 241, 242, 846, - 847, 0, 848, 0, 246, 1023, 1024, 249, 1025, 251, - 252, 253, 254, 255, 0, 0, 256, 1026, 258, 1027, - 0, 260, 261, 262, 849, 850, 263, 264, 265, 266, - 267, 1028, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 851, 1029, 852, 290, 291, 292, 293, 853, 294, 295, - 1030, 297, 854, 855, 299, 856, 301, 302, 303, 0, - 304, 305, 0, 0, 857, 307, 308, 0, 0, 309, - 310, 1031, 312, 1032, 858, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 0, 325, 326, 859, 328, - 329, 330, 331, 332, 333, 0, 334, 335, 336, 337, - 338, 339, 0, 340, 341, 342, 860, 344, 345, 346, - 347, 0, 348, 349, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 0, 361, 362, 1033, 364, - 365, 366, 861, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 0, 379, 380, 381, 382, 383, - 862, 384, 385, 386, 387, 388, 1034, 390, 391, 863, - 393, 0, 394, 395, 396, 397, 398, 399, 400, 401, - 402, 403, 404, 1035, 406, 864, 408, 0, 409, 410, - 0, 411, 1036, 413, 414, 415, 416, 417, 0, 865, - 866, 0, 0, 420, 421, 867, 423, 868, 869, 425, - 426, 1037, 428, 429, 430, 431, 432, 0, 0, 433, - 434, 435, 436, 437, 871, 0, 438, 439, 440, 441, - 442, 443, 872, 0, 445, 1039, 447, 448, 449, 450, - 0, 0, 451, 0, 0, 452, 453, 454, 455, 456, - 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 472, 873, 0, 0, 0, - 0, 0, 0, 874, 875, 0, 0, 0, 0, 0, - 877, 0, 878, 0, 0, 0, 0, 879, 0, 880, - 881, 92, 814, 547, 815, 816, 817, 818, 819, 0, - 0, 0, 0, 0, 0, 0, 0, 93, 94, 95, - 96, 97, 98, 99, 100, 0, 101, 102, 103, 0, - 0, 0, 0, 820, 0, 0, 104, 105, 0, 106, - 107, 108, 109, 110, 111, 112, 113, 821, 115, 822, - 823, 0, 118, 119, 120, 121, 122, 123, 824, 825, - 124, 125, 826, 827, 128, 0, 129, 130, 131, 132, - 828, 0, 829, 0, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 151, 152, 153, 154, 830, 831, 832, 833, - 834, 835, 836, 156, 157, 158, 159, 160, 161, 162, - 837, 838, 165, 839, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 675, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 840, 194, - 195, 196, 197, 841, 842, 199, 0, 200, 201, 843, - 203, 0, 204, 0, 205, 206, 0, 207, 208, 209, - 210, 211, 212, 0, 213, 0, 844, 845, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 236, 237, 238, 239, 240, 241, 242, 846, 847, - 0, 848, 0, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 0, 0, 256, 257, 258, 259, 0, - 260, 261, 262, 849, 850, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 851, - 288, 852, 290, 291, 292, 293, 853, 294, 295, 296, - 297, 854, 855, 299, 856, 301, 302, 303, 0, 304, - 305, 0, 0, 857, 307, 308, 0, 0, 309, 310, - 311, 312, 313, 858, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 859, 328, 329, - 330, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 860, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 363, 364, 365, - 366, 861, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 862, - 384, 385, 386, 387, 388, 389, 390, 391, 863, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 864, 408, 0, 409, 410, 0, - 411, 412, 413, 414, 415, 416, 417, 0, 865, 866, - 0, 0, 420, 421, 867, 423, 868, 869, 425, 426, - 870, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 871, 0, 438, 439, 440, 441, 442, - 443, 872, 0, 445, 446, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 873, 0, 0, 0, 0, - 0, 0, 1407, 1408, 0, 0, 0, 0, 0, 877, - 0, 878, 0, 0, 0, 0, 879, 0, 880, 881, - 92, 1786, 547, 815, 816, 817, 818, 819, 0, 0, - 0, 0, 0, 0, 0, 0, 93, 94, 95, 96, - 97, 98, 99, 100, 0, 101, 102, 103, 0, 0, - 0, 0, 820, 0, 0, 104, 105, 0, 106, 107, - 108, 109, 110, 111, 112, 113, 821, 115, 822, 823, - 0, 118, 119, 120, 121, 122, 123, 824, 825, 124, - 125, 826, 827, 128, 0, 129, 130, 131, 132, 828, - 0, 829, 0, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 0, 145, 146, 147, 148, 149, 150, - 0, 151, 152, 153, 154, 830, 831, 832, 833, 834, - 835, 836, 156, 157, 158, 159, 160, 161, 162, 837, - 838, 165, 839, 166, 0, 167, 168, 169, 170, 171, - 172, 0, 173, 174, 175, 176, 177, 0, 0, 178, - 179, 675, 181, 182, 0, 183, 184, 185, 0, 186, - 187, 188, 0, 189, 190, 191, 192, 840, 194, 195, - 196, 197, 841, 842, 199, 0, 200, 201, 843, 203, - 0, 204, 0, 205, 206, 0, 207, 208, 209, 210, - 211, 212, 0, 213, 0, 844, 845, 216, 0, 217, - 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, - 228, 0, 229, 230, 231, 232, 233, 234, 0, 235, - 236, 237, 238, 239, 240, 241, 242, 846, 847, 0, - 848, 0, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 0, 0, 256, 257, 258, 259, 0, 260, - 261, 262, 849, 850, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, 851, 288, - 852, 290, 291, 292, 293, 853, 294, 295, 296, 297, - 854, 855, 299, 856, 301, 302, 303, 0, 304, 305, - 0, 0, 857, 307, 308, 0, 0, 309, 310, 311, - 312, 313, 858, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 0, 325, 326, 859, 328, 329, 330, - 331, 332, 333, 0, 334, 335, 336, 337, 338, 339, - 0, 340, 341, 342, 860, 344, 345, 346, 347, 0, - 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 0, 361, 362, 363, 364, 365, 366, - 861, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 0, 379, 380, 381, 382, 383, 862, 384, - 385, 386, 387, 388, 389, 390, 391, 863, 393, 0, - 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, - 404, 405, 406, 864, 408, 0, 409, 410, 0, 411, - 412, 413, 414, 415, 416, 417, 0, 865, 866, 0, - 0, 420, 421, 867, 423, 868, 869, 425, 426, 870, - 428, 429, 430, 431, 432, 0, 0, 433, 434, 435, - 436, 437, 871, 0, 438, 439, 440, 441, 442, 443, - 872, 0, 445, 446, 447, 448, 449, 450, 0, 0, - 451, 0, 0, 452, 453, 454, 455, 456, 457, 458, - 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, - 469, 470, 471, 472, 873, 0, 0, 0, 0, 0, - 0, 874, 875, 0, 0, 0, 0, 0, 877, 0, - 878, 0, 0, 0, 0, 879, 0, 880, 881, 92, - 814, 547, 815, 816, 817, 818, 819, 0, 0, 0, - 0, 0, 0, 0, 0, 93, 94, 95, 96, 97, - 98, 99, 100, 0, 101, 102, 103, 0, 0, 0, - 0, 820, 0, 0, 104, 105, 0, 106, 107, 108, - 109, 110, 111, 112, 113, 821, 115, 822, 823, 0, - 118, 119, 120, 121, 122, 123, 824, 825, 124, 125, - 826, 827, 128, 0, 129, 130, 131, 132, 828, 0, - 829, 0, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 0, 145, 146, 147, 148, 149, 150, 0, - 151, 152, 153, 154, 830, 831, 832, 833, 834, 835, - 836, 156, 157, 158, 159, 160, 161, 162, 837, 838, - 165, 839, 166, 0, 167, 168, 169, 170, 171, 172, - 0, 173, 174, 175, 176, 177, 0, 0, 178, 179, - 675, 181, 182, 0, 183, 184, 185, 0, 186, 187, - 188, 0, 189, 190, 191, 192, 840, 194, 195, 196, - 197, 841, 842, 199, 0, 200, 201, 843, 203, 0, - 204, 0, 205, 206, 0, 207, 208, 209, 210, 211, - 212, 0, 213, 0, 844, 845, 216, 0, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 0, 229, 230, 231, 232, 233, 234, 0, 235, 236, - 237, 238, 239, 240, 241, 242, 846, 847, 0, 848, - 0, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 0, 0, 256, 257, 258, 259, 0, 260, 261, - 262, 849, 850, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 851, 288, 852, - 290, 291, 292, 293, 853, 294, 295, 296, 297, 854, - 855, 299, 856, 301, 302, 303, 0, 304, 305, 0, - 0, 857, 307, 308, 0, 0, 309, 310, 311, 312, - 313, 858, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 325, 326, 859, 328, 329, 330, 331, - 332, 333, 0, 334, 335, 336, 337, 338, 339, 0, - 340, 341, 342, 860, 344, 345, 346, 347, 0, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 0, 361, 362, 363, 364, 365, 366, 861, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 0, 379, 380, 381, 382, 383, 862, 384, 385, - 386, 387, 388, 389, 390, 391, 863, 393, 0, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 864, 408, 0, 409, 410, 0, 411, 412, - 413, 414, 415, 416, 417, 0, 865, 866, 0, 0, - 420, 421, 867, 423, 868, 869, 425, 426, 870, 428, - 429, 430, 431, 432, 0, 0, 433, 434, 435, 436, - 437, 871, 0, 438, 439, 440, 441, 442, 443, 872, - 0, 445, 446, 447, 448, 449, 450, 0, 0, 451, - 0, 0, 452, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 873, 0, 0, 0, 0, 0, 0, - 874, 875, 0, 0, 0, 0, 0, 877, 0, 2014, - 0, 0, 0, 0, 879, 0, 880, 881, 92, 814, - 547, 815, 816, 817, 818, 819, 0, 0, 0, 0, - 0, 0, 0, 0, 93, 94, 95, 96, 97, 98, - 99, 100, 0, 101, 102, 103, 0, 0, 0, 0, - 820, 0, 0, 104, 105, 0, 106, 107, 108, 109, - 110, 111, 112, 113, 821, 115, 822, 823, 0, 118, - 119, 120, 121, 122, 123, 824, 825, 124, 125, 826, - 827, 128, 0, 129, 130, 131, 132, 828, 0, 829, - 0, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 0, 145, 146, 147, 148, 149, 150, 0, 151, - 152, 2683, 154, 830, 831, 832, 833, 834, 835, 836, - 156, 157, 158, 159, 160, 161, 162, 837, 838, 165, - 839, 166, 0, 167, 168, 169, 170, 171, 172, 0, - 173, 174, 175, 176, 177, 0, 0, 178, 179, 675, - 181, 182, 0, 183, 184, 185, 0, 186, 187, 188, - 0, 189, 190, 191, 192, 840, 194, 195, 196, 197, - 841, 842, 199, 0, 200, 201, 843, 203, 0, 204, - 0, 205, 206, 0, 207, 208, 209, 210, 211, 212, - 0, 213, 0, 2684, 845, 216, 0, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 0, - 229, 230, 231, 232, 233, 234, 0, 235, 236, 237, - 238, 239, 240, 241, 242, 846, 847, 0, 848, 0, - 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 0, 0, 256, 257, 258, 259, 0, 260, 261, 262, - 849, 850, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 282, 283, 284, 285, 286, 851, 288, 852, 290, - 291, 292, 293, 853, 294, 295, 296, 297, 854, 855, - 299, 856, 301, 302, 303, 0, 304, 305, 0, 0, - 857, 307, 308, 0, 0, 309, 310, 311, 312, 313, - 858, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 0, 325, 326, 859, 328, 329, 330, 331, 332, - 333, 0, 334, 335, 336, 337, 338, 339, 0, 340, - 341, 342, 860, 344, 345, 346, 347, 0, 348, 349, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 0, 361, 362, 363, 364, 365, 2685, 861, 368, - 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, - 0, 379, 380, 381, 382, 383, 862, 384, 385, 386, - 387, 388, 389, 390, 391, 863, 393, 0, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 864, 408, 0, 409, 410, 0, 411, 412, 413, - 414, 415, 416, 417, 0, 865, 866, 0, 0, 420, - 421, 867, 423, 868, 869, 425, 426, 870, 428, 429, - 430, 431, 432, 0, 0, 433, 434, 435, 436, 437, - 871, 0, 438, 439, 440, 441, 442, 443, 872, 0, - 445, 446, 447, 448, 449, 450, 0, 0, 451, 0, - 0, 452, 453, 454, 455, 456, 457, 458, 459, 460, - 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, - 471, 472, 873, 0, 0, 0, 0, 0, 0, 874, - 875, 0, 0, 0, 0, 0, 877, 0, 2687, 0, - 0, 0, 0, 879, 0, 880, 881, 92, 814, 547, - 815, 816, 817, 818, 819, 0, 0, 0, 0, 0, - 0, 0, 0, 93, 94, 95, 96, 97, 98, 99, - 100, 0, 101, 102, 103, 0, 0, 0, 0, 820, - 0, 0, 104, 105, 0, 106, 107, 108, 109, 110, - 111, 112, 2904, 821, 115, 822, 823, 0, 118, 119, - 120, 121, 122, 123, 824, 825, 124, 125, 826, 827, - 128, 0, 129, 130, 131, 132, 828, 0, 829, 0, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 0, 145, 146, 147, 148, 149, 150, 0, 151, 152, - 153, 2905, 830, 831, 832, 833, 834, 835, 836, 156, - 157, 158, 159, 160, 161, 162, 837, 838, 165, 839, - 166, 0, 167, 168, 169, 170, 171, 172, 0, 173, - 174, 175, 176, 177, 0, 0, 178, 179, 675, 181, - 182, 0, 183, 184, 185, 0, 186, 187, 188, 0, - 189, 190, 191, 192, 840, 194, 195, 196, 197, 841, - 842, 199, 0, 200, 201, 843, 203, 0, 204, 0, - 205, 206, 0, 207, 208, 209, 210, 211, 212, 0, - 213, 0, 844, 845, 216, 0, 217, 218, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 228, 0, 229, - 230, 231, 232, 233, 234, 0, 235, 236, 237, 238, - 239, 240, 241, 242, 846, 847, 0, 848, 0, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 0, - 0, 256, 257, 258, 259, 0, 260, 261, 262, 849, - 850, 263, 264, 265, 266, 267, 268, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 851, 288, 852, 290, 291, - 292, 293, 853, 294, 295, 296, 297, 854, 855, 299, - 856, 301, 302, 303, 0, 304, 305, 0, 0, 857, - 307, 308, 0, 0, 309, 310, 311, 312, 313, 858, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 0, 325, 326, 859, 328, 329, 330, 331, 332, 333, - 0, 334, 335, 336, 337, 338, 339, 0, 340, 341, - 342, 860, 344, 345, 346, 347, 0, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 0, 361, 362, 363, 364, 365, 366, 861, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 0, - 379, 380, 381, 382, 383, 862, 384, 385, 386, 387, - 388, 389, 390, 391, 863, 393, 0, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 864, 408, 0, 409, 410, 0, 411, 412, 413, 414, - 415, 416, 417, 0, 865, 866, 0, 0, 420, 421, - 867, 423, 868, 869, 425, 426, 870, 428, 429, 2906, - 431, 432, 0, 0, 433, 434, 435, 436, 437, 871, - 0, 438, 439, 440, 441, 442, 443, 872, 0, 445, - 446, 447, 448, 449, 450, 0, 0, 451, 0, 0, - 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 873, 0, 0, 0, 0, 0, 0, 874, 875, - 0, 0, 0, 0, 0, 877, 0, 878, 0, 0, - 0, 0, 879, 0, 880, 881, 92, 814, 547, 815, - 816, 817, 818, 819, 0, 0, 0, 0, 0, 0, - 0, 0, 93, 94, 95, 96, 97, 98, 99, 100, - 0, 101, 102, 103, 0, 0, 0, 0, 820, 0, - 0, 104, 105, 0, 106, 107, 108, 109, 110, 111, - 112, 113, 821, 115, 822, 823, 0, 118, 119, 120, - 121, 122, 123, 824, 825, 124, 125, 826, 827, 128, - 0, 129, 130, 131, 132, 828, 0, 829, 0, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 0, - 145, 146, 147, 148, 149, 150, 0, 151, 152, 153, - 2905, 830, 831, 832, 833, 834, 835, 836, 156, 157, - 158, 159, 160, 161, 162, 837, 838, 165, 839, 166, - 0, 167, 168, 169, 170, 171, 172, 0, 173, 174, - 175, 176, 177, 0, 0, 178, 179, 675, 181, 182, - 0, 183, 184, 185, 0, 186, 187, 188, 0, 189, - 190, 191, 192, 840, 194, 195, 196, 197, 841, 842, - 199, 0, 200, 201, 843, 203, 0, 204, 0, 205, - 206, 0, 207, 208, 209, 210, 211, 212, 0, 213, - 0, 844, 845, 216, 0, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 228, 0, 229, 230, - 231, 232, 233, 234, 0, 235, 236, 237, 238, 239, - 240, 241, 242, 846, 847, 0, 848, 0, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 0, 0, - 256, 257, 258, 259, 0, 260, 261, 262, 849, 850, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 851, 288, 852, 290, 291, 292, - 293, 853, 294, 295, 296, 297, 854, 855, 299, 856, - 301, 302, 303, 0, 304, 305, 0, 0, 857, 307, - 308, 0, 0, 309, 310, 311, 312, 313, 858, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 0, - 325, 326, 859, 328, 329, 330, 331, 332, 333, 0, - 334, 335, 336, 337, 338, 339, 0, 340, 341, 342, - 860, 344, 345, 346, 347, 0, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 0, - 361, 362, 363, 364, 365, 366, 861, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 0, 379, - 380, 381, 382, 383, 862, 384, 385, 386, 387, 388, - 389, 390, 391, 863, 393, 0, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 405, 406, 864, - 408, 0, 409, 410, 0, 411, 412, 413, 414, 415, - 416, 417, 0, 865, 866, 0, 0, 420, 421, 867, - 423, 868, 869, 425, 426, 870, 428, 429, 2906, 431, - 432, 0, 0, 433, 434, 435, 436, 437, 871, 0, - 438, 439, 440, 441, 442, 443, 872, 0, 445, 446, - 447, 448, 449, 450, 0, 0, 451, 0, 0, 452, - 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, - 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 873, 0, 0, 0, 0, 0, 0, 874, 875, 0, - 0, 0, 0, 0, 877, 0, 878, 0, 0, 0, - 0, 879, 0, 880, 881, 92, 814, 547, 815, 816, - 817, 818, 819, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 94, 95, 96, 97, 98, 99, 100, 0, - 101, 102, 103, 0, 0, 0, 0, 820, 0, 0, - 104, 105, 0, 106, 107, 108, 109, 110, 111, 112, - -1731, 821, 115, 822, 823, 0, 118, 119, 120, 121, - 122, 123, 824, 825, 124, 125, 826, 827, 128, 0, - 129, 130, 131, 132, 828, 0, 829, 0, 135, 136, - 137, 138, 139, 140, 141, 142, 143, 144, 0, 145, - 146, 147, 148, 149, 150, 0, 151, 152, 153, 2905, - 830, 831, 832, 833, 834, 835, 836, 156, 157, 158, - 159, 160, 161, 162, 837, 838, 165, 839, 166, 0, - 167, 168, 169, 170, 171, 172, 0, 173, 174, 175, - 176, 177, 0, 0, 178, 179, 675, 181, 182, 0, - 183, 184, 185, 0, 186, 187, 188, 0, 189, 190, - 191, 192, 840, 194, 195, 196, 197, 841, 842, 199, - 0, 200, 201, 843, 203, 0, 204, 0, 205, 206, - 0, 207, 208, 209, 210, -1731, 212, 0, 213, 0, - 844, 845, 216, 0, 217, 218, 219, 220, 221, 222, - 223, -1731, 225, 226, 227, 228, 0, 229, 230, 231, - 232, 233, 234, 0, 235, 236, 237, 238, 239, 240, - 241, 242, 846, 847, 0, 848, 0, 246, 0, 0, - 249, 250, 251, 252, 253, 254, 255, 0, 0, 256, - 257, 258, -1731, 0, 260, 261, 262, 849, 850, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 851, 288, 852, 290, 291, 292, 293, - 0, 294, 295, 0, 297, 854, 855, 299, 856, 301, - 302, 303, 0, 304, 305, 0, 0, 857, 307, 308, - 0, 0, 309, 310, 311, 312, 313, 858, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 0, 325, - 326, 859, 328, 329, 330, 331, 332, 333, 0, 334, - 335, 336, 337, 338, 339, 0, 340, 341, 342, 860, - 344, 345, 346, 347, 0, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 0, 361, - 362, 363, 364, 365, 366, 861, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 0, 379, 380, - 381, 382, 383, 862, 384, 385, 386, 387, 388, -1731, - 390, 391, 863, 393, 0, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 405, 406, 864, 408, - 0, 409, 410, 0, 411, 412, 413, 414, 415, 416, - 417, 0, 865, 866, 0, 0, 420, 421, 867, 423, - 868, 869, 425, 426, 870, 428, 429, 2906, 431, 432, - 0, 0, 433, 434, 435, 436, 437, 871, 0, 438, - 439, 440, 441, 442, 443, 872, 0, 445, 446, 447, - 448, 449, 450, 0, 0, 451, 0, 0, 452, 453, - 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, -1731, - 0, 0, 0, 0, 0, 0, 874, 875, 0, 0, - 0, 0, 0, 877, 0, 878, 0, 0, 0, 0, - 879, 0, 880, 881, 92, 814, 547, 815, 816, 817, - 818, 819, 0, 0, 0, 0, 0, 0, 0, 0, - 93, 94, 95, 96, 97, 98, 99, 100, 0, 101, - 102, 103, 0, 0, 0, 0, 0, 0, 0, 104, - 105, 0, 106, 107, 108, 109, 110, 111, 112, 113, - 821, 115, 822, 823, 0, 118, 119, 120, 121, 122, - 123, 824, 825, 124, 125, 826, 827, 128, 0, 129, - 130, 131, 132, 828, 0, 829, 0, 135, 136, 137, - 138, 139, 140, 141, 142, 143, 144, 0, 145, 146, - 147, 148, 149, 150, 0, 151, 152, 153, 154, 830, - 831, 832, 833, 834, 835, 836, 156, 157, 158, 159, - 160, 161, 162, 837, 838, 165, 0, 166, 0, 167, - 168, 169, 170, 171, 172, 0, 173, 174, 175, 176, - 177, 0, 0, 178, 179, 675, 181, 182, 0, 183, - 184, 185, 0, 186, 187, 188, 0, 189, 190, 191, - 192, 840, 194, 195, 196, 197, 841, 842, 199, 0, - 200, 201, 843, 203, 0, 204, 0, 205, 206, 0, - 207, 208, 209, 210, 211, 212, 0, 213, 0, 844, - 845, 216, 0, 217, 218, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 228, 0, 229, 230, 231, 232, - 233, 234, 0, 235, 236, 237, 238, 239, 240, 241, - 242, 846, 847, 0, 848, 0, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 0, 0, 256, 257, - 258, 259, 0, 260, 261, 262, 849, 850, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 851, 288, 852, 290, 291, 292, 293, 0, - 294, 295, 296, 297, 854, 855, 299, 856, 301, 302, - 303, 0, 304, 305, 0, 0, 857, 307, 308, 0, - 0, 309, 310, 311, 312, 313, 858, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 0, 325, 326, - 859, 328, 329, 330, 331, 332, 333, 0, 334, 335, - 336, 337, 338, 339, 0, 340, 341, 342, 860, 344, - 345, 346, 347, 0, 348, 349, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 0, 361, 362, - 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 378, 0, 379, 380, 381, - 382, 383, 862, 384, 385, 386, 387, 388, 389, 390, - 391, 863, 393, 0, 394, 395, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 405, 406, 864, 408, 0, - 409, 410, 0, 411, 412, 413, 414, 415, 416, 417, - 0, 865, 866, 0, 0, 420, 421, 867, 423, 868, - 869, 425, 426, 870, 428, 429, 430, 431, 432, 0, - 0, 433, 434, 435, 436, 437, 871, 0, 438, 439, - 440, 441, 442, 443, 872, 0, 445, 446, 447, 448, - 449, 450, 0, 0, 451, 0, 0, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 0, 0, - 0, 0, 0, 0, 0, 1633, 1634, 0, 0, 92, - 814, 547, 815, 816, 1635, 818, 819, 0, 0, 0, - 0, 880, 881, 0, 0, 93, 94, 95, 96, 97, - 98, 99, 100, 0, 101, 102, 103, 0, 0, 0, - 0, 0, 0, 0, 104, 105, 0, 106, 107, 108, - 109, 110, 111, 112, 113, 821, 115, 822, 823, 0, - 118, 119, 120, 121, 122, 123, 824, 825, 124, 125, - 826, 827, 128, 0, 129, 130, 131, 132, 828, 0, - 829, 0, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 0, 145, 146, 147, 148, 149, 150, 0, - 151, 152, 153, 154, 830, 831, 832, 833, 834, 835, - 836, 156, 157, 158, 159, 160, 161, 162, 837, 838, - 165, 0, 166, 0, 167, 168, 169, 170, 171, 172, - 0, 173, 174, 175, 176, 177, 0, 0, 178, 179, - 675, 181, 182, 0, 183, 184, 185, 0, 186, 187, - 188, 0, 189, 190, 191, 192, 840, 194, 195, 196, - 197, 841, 842, 199, 0, 200, 201, 843, 203, 0, - 204, 0, 205, 206, 0, 207, 208, 209, 210, 211, - 212, 0, 213, 0, 844, 845, 216, 0, 217, 218, + 0, 1315, 0, 0, 1316, 0, 0, -1759, 1317, 1318, + 1319, 1320, 0, 0, 1341, 1342, 1343, 1344, 1345, 1346, + 0, 0, 1349, 1349, 1349, 0, 1321, 0, 0, 2292, + 1315, 2310, 0, 1316, 1323, 0, 0, 1317, 1318, 1319, + 1320, 1324, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1321, 0, 0, 0, 0, + 0, 0, -1759, 1323, 1315, 0, 1325, 1316, 0, 0, + 1324, 1317, 1318, 1319, 1320, 0, 0, 0, -1759, 0, + 0, 0, 1326, -1759, 0, 0, 0, 0, 1244, 1321, + 0, 0, 0, 0, 0, 1325, 2815, 1323, 1327, 0, + 0, 0, 0, 1328, 1324, 0, 0, 0, 0, 0, + 0, 0, 0, 1299, 0, 0, 0, 0, 1349, 0, + -1759, 0, 0, 0, 1349, 1329, 1330, 0, 898, 1325, + 0, 2837, 0, 0, 0, 0, 0, 2005, 2005, 1349, + 1331, 1644, 1644, 1644, 1644, 2851, 0, 1644, 1644, 1644, + 1644, 1644, 1644, 1644, 1644, 1644, 1644, 2005, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1326, 0, 0, + 0, 0, 0, 0, 0, 1334, 0, 1349, 1332, 0, + 1349, 1333, 1349, 1327, 0, 0, 2005, 2005, 1328, 0, + 0, 0, 0, 0, 0, 1334, 1326, 0, 1335, 0, + 1349, 1644, 1644, 1349, 0, 1349, 0, 0, 0, 0, + 1329, 1330, 1327, 0, 0, 0, 0, 1328, 0, 0, + 0, 0, 0, 0, 0, 1331, 0, 0, 2721, 0, + 1326, 0, 2898, 0, 0, 0, 0, 0, 0, 1329, + 1330, 0, 0, 0, 0, 0, 1327, 0, 0, 1315, + 0, 1328, 1316, 0, 1331, 0, 0, -1759, -1759, -1759, + 2921, 0, 0, 1332, 0, 0, 1333, -1759, 0, 0, + 0, 0, 0, 1329, 1330, 0, 0, 0, 0, 0, + 1334, 1349, 1323, 1335, 0, 0, 0, 1336, 1331, 1324, + 0, 0, 1332, 2721, 0, 1333, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1334, + 0, 0, 1335, 0, 1325, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1332, 0, 0, 1333, + 0, 0, 0, 2971, 2971, 0, 0, 0, 0, 0, + 0, 0, 0, 1334, 0, 0, 1335, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, -1759, 2971, 0, + 0, 0, 1336, 1349, 1341, 1342, 1343, 1344, 1345, 1346, + 0, 0, 0, 0, 0, 0, 0, 1337, 0, 0, + 1338, 1339, 1340, 0, 1341, 1342, 1343, 1344, 1345, 1346, + 1349, 1336, 1497, 0, 1349, 1349, 0, 1349, 0, 0, + 2005, 2005, 2005, 2005, 2971, 1326, 0, 2005, 2005, 2005, + 2005, 2005, 2005, 2005, 2005, 2005, 2005, 1349, 1349, 0, + 0, 1327, 0, 0, 1315, 1336, 1328, 1316, 0, 1349, + 0, 0, 0, 0, 0, 0, 1349, 0, 0, 1349, + 0, 1349, 0, 0, 0, 1349, 0, 0, 2005, 2005, + 0, 0, 1349, 1349, 0, 0, 0, 1323, 0, 0, + 0, 0, 1337, 1331, -1759, 1338, 1339, 1340, 0, 1341, + 1342, 1343, 1344, 1345, 1346, 0, 0, 0, 0, 1665, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1325, + 0, 1337, 1349, 0, 1338, 1339, 1340, 0, 1341, 1342, + 1343, 1344, 1345, 1346, 0, 0, 1349, 0, 2033, 0, + 0, 506, 0, 0, 0, 0, 0, 0, 1334, 1349, + 0, 0, 0, 0, 0, 1337, 0, 0, 1338, 1339, + 1340, 0, 1341, 1342, 1343, 1344, 1345, 1346, 0, 0, + 0, 0, 2252, 1315, 0, 0, 1316, 0, 0, 0, + 1317, 1318, 1319, 1320, 0, 0, 0, 0, 0, 2531, + 0, 0, 0, 0, 507, 0, 0, 0, 1321, 0, + 0, 0, 1755, 0, 0, 0, 1323, 0, 0, 0, + 508, 0, 0, 1324, 0, 0, 0, 0, 0, 0, + -1759, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, -1759, 0, 1325, 0, + 1336, -1759, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 509, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 510, 0, 0, 0, -1759, 1349, + 0, 0, 0, 1644, 0, 0, 511, 0, 0, 1756, + 0, 512, 1349, 1349, 1349, 0, 0, 1349, 0, 0, + 1349, 1349, 0, 0, 0, 1349, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 513, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1334, 0, 0, 0, 0, 0, 1326, + 1337, 0, 0, -1759, -1759, -1759, 0, 1341, 1342, 1343, + 1344, 1345, 1346, 0, 0, 1327, 0, 0, 0, 0, + 1328, 0, 0, 514, 0, 0, 0, 515, 0, 0, + 0, 0, 0, 1644, 0, 0, 0, 0, 0, 0, + 0, 0, 1329, 1330, 0, 0, 0, 0, 0, 0, + 0, 0, 1349, 0, 0, 0, 0, 1331, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, -1759, 0, 0, 0, 0, + 516, 0, 0, 0, 0, 1332, 0, 0, 1333, 0, + 0, 0, 2005, 1644, 517, 0, 0, 0, 1349, 1349, + 1349, 0, 1334, 0, 0, 1335, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 518, 0, 0, + 519, 0, 0, 0, 0, 0, 0, 0, 520, 0, + 0, 521, 1349, 1349, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1349, 0, + 522, 0, 0, 0, 0, 0, 0, 0, 0, 2005, + 0, 0, 0, 523, 0, -1759, 0, 0, 0, 0, + 524, 0, 1341, 1342, 1343, 1344, 1345, 1346, 0, 525, + 0, 0, 0, 0, 1336, 526, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 2005, 0, + 527, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1349, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1760, 0, 0, 0, 0, 1349, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1349, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1337, 0, 0, 1338, 1339, 1340, + 0, 1341, 1342, 1343, 1344, 1345, 1346, 0, 0, 1015, + 818, 547, 819, 820, 821, 822, 823, 0, 0, 1349, + 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 1016, 102, 103, 104, 0, 0, 0, + 0, 824, 1349, 0, 105, 106, 0, 107, 108, 109, + 1017, 111, 112, 113, 114, 825, 1018, 826, 827, 0, + 119, 120, 121, 122, 123, 124, 828, 829, 125, 126, + 830, 831, 129, 0, 130, 131, 132, 133, 832, 0, + 1019, 0, 136, 137, 138, 139, 140, 141, 1020, 143, + 144, 145, 1349, 146, 147, 148, 149, 150, 151, 0, + 1021, 153, 154, 155, 834, 835, 836, 1022, 838, 839, + 840, 157, 158, 159, 160, 161, 162, 163, 841, 842, + 166, 843, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 1023, 0, 179, 180, + 678, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 844, 195, 196, 197, + 198, 199, 845, 846, 201, 0, 202, 203, 847, 205, + 0, 206, 0, 207, 1024, 0, 1025, 210, 211, 212, + 1026, 214, 0, 215, 0, 848, 849, 218, 0, 219, + 220, 221, 222, 223, 224, 225, 1027, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 1028, 239, 240, 241, 242, 243, 244, 850, 851, 0, + 852, 0, 248, 1029, 1030, 251, 1031, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 1032, 261, 1033, 0, + 263, 264, 265, 853, 854, 266, 267, 268, 269, 270, + 1034, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 855, + 1035, 856, 293, 294, 295, 296, 857, 297, 298, 1036, + 300, 858, 859, 302, 860, 304, 305, 306, 0, 307, + 308, 0, 0, 861, 310, 311, 0, 0, 312, 313, + 1037, 315, 1038, 862, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 0, 328, 329, 863, 331, 332, + 333, 334, 335, 336, 0, 337, 338, 339, 340, 341, + 342, 0, 343, 344, 345, 864, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 1039, 367, 368, + 369, 865, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 0, 382, 383, 384, 385, 386, 866, + 387, 388, 389, 390, 391, 1040, 393, 394, 867, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 1041, 409, 868, 411, 0, 412, 413, 0, + 414, 1042, 416, 417, 418, 419, 420, 0, 869, 870, + 0, 0, 423, 424, 871, 426, 872, 873, 428, 429, + 1043, 431, 432, 433, 434, 435, 0, 0, 436, 437, + 438, 439, 440, 875, 0, 441, 442, 443, 444, 445, + 446, 876, 1044, 448, 1045, 450, 451, 452, 453, 0, + 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 877, 0, 0, 0, 0, + 0, 0, 878, 879, 1046, 0, 0, 0, 0, 881, + 0, 882, 1047, 0, 0, 0, 883, 0, 884, 885, + 93, 818, 547, 819, 820, 821, 822, 823, 0, 0, + 0, 0, 0, 0, 0, 0, 94, 95, 96, 97, + 98, 99, 100, 101, 0, 102, 103, 104, 0, 0, + 0, 0, 824, 0, 0, 105, 106, 0, 107, 108, + 109, 110, 111, 112, 113, 114, 825, 116, 826, 827, + 0, 119, 120, 121, 122, 123, 124, 828, 829, 125, + 126, 830, 831, 129, 0, 130, 131, 132, 133, 832, + 0, 833, 0, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 0, 146, 147, 148, 149, 150, 151, + 0, 152, 153, 154, 155, 834, 835, 836, 837, 838, + 839, 840, 157, 158, 159, 160, 161, 162, 163, 841, + 842, 166, 843, 167, 0, 168, 169, 170, 171, 172, + 173, 0, 174, 175, 176, 177, 178, 0, 0, 179, + 180, 678, 182, 183, 0, 184, 185, 186, 0, 187, + 188, 189, 0, 190, 191, 192, 193, 844, 195, 196, + 197, 198, 199, 845, 846, 201, 0, 202, 203, 847, + 205, 0, 206, 0, 207, 208, 0, 209, 210, 211, + 212, 213, 214, 0, 215, 0, 848, 849, 218, 0, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 0, 229, 230, 231, 232, 233, 234, 0, 235, 236, - 237, 238, 239, 240, 241, 242, 846, 847, 0, 848, - 0, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 0, 0, 256, 257, 258, 259, 0, 260, 261, - 262, 849, 850, 263, 264, 265, 266, 267, 268, 269, + 229, 230, 0, 231, 232, 233, 234, 235, 236, 0, + 237, 238, 239, 240, 241, 242, 243, 244, 850, 851, + 0, 852, 0, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 0, 0, 259, 260, 261, 262, + 0, 263, 264, 265, 853, 854, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 851, 288, 852, - 290, 291, 292, 293, 0, 294, 295, 296, 297, 854, - 855, 299, 856, 301, 302, 303, 0, 304, 305, 0, - 0, 306, 307, 308, 0, 0, 309, 310, 311, 312, - 313, 858, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 325, 326, 859, 328, 329, 330, 331, - 332, 333, 0, 334, 335, 336, 337, 338, 339, 0, - 340, 341, 342, 860, 344, 345, 346, 347, 0, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 0, 361, 362, 363, 364, 365, 366, 1772, - 1773, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 0, 379, 380, 381, 382, 383, 862, 384, 385, - 386, 387, 388, 389, 390, 391, 863, 393, 0, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 864, 408, 0, 409, 410, 0, 411, 412, - 413, 414, 415, 416, 417, 0, 865, 866, 0, 0, - 420, 421, 867, 423, 868, 869, 425, 426, 870, 428, - 429, 430, 431, 432, 0, 0, 433, 434, 435, 436, - 437, 871, 0, 438, 439, 440, 441, 442, 443, 872, - 0, 445, 446, 447, 448, 449, 450, 0, 0, 451, - 0, 0, 452, 453, 454, 455, 456, 457, 458, 459, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 855, 291, 856, 293, 294, 295, 296, 857, 297, 298, + 299, 300, 858, 859, 302, 860, 304, 305, 306, 0, + 307, 308, 0, 0, 861, 310, 311, 0, 0, 312, + 313, 314, 315, 316, 862, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 0, 328, 329, 863, 331, + 332, 333, 334, 335, 336, 0, 337, 338, 339, 340, + 341, 342, 0, 343, 344, 345, 864, 347, 348, 349, + 350, 0, 351, 352, 353, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 0, 364, 365, 366, 367, + 368, 369, 865, 371, 372, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 26, 382, 383, 384, 385, 386, + 866, 387, 388, 389, 390, 391, 392, 393, 394, 867, + 396, 0, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 409, 868, 411, 0, 412, 413, + 31, 414, 415, 416, 417, 418, 419, 420, 0, 869, + 870, 0, 0, 423, 424, 871, 426, 872, 873, 428, + 429, 874, 431, 432, 433, 434, 435, 0, 0, 436, + 437, 438, 439, 440, 875, 0, 441, 442, 443, 444, + 445, 575, 876, 0, 448, 449, 450, 451, 452, 453, + 0, 0, 454, 0, 34, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 0, 0, 0, 0, 0, 0, 0, - 1774, 1775, 0, 0, 0, 0, 0, 0, 0, 1635, - 0, 0, 0, 0, 0, 0, 880, 881, 92, 814, - 547, 815, 816, 817, 818, 819, 0, 0, 0, 0, - 0, 0, 0, 0, 93, 94, 95, 96, 97, 98, - 99, 100, 0, 101, 102, 103, 0, 0, 0, 0, - 0, 0, 0, 104, 105, 0, 106, 107, 108, 109, - 110, 111, 112, 113, 821, 115, 822, 823, 0, 118, - 119, 120, 121, 122, 123, 824, 825, 124, 125, 826, - 827, 128, 0, 129, 130, 131, 132, 828, 0, 829, - 0, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 0, 145, 146, 147, 148, 149, 150, 0, 151, - 152, 153, 154, 830, 831, 832, 833, 834, 835, 836, - 156, 157, 158, 159, 160, 161, 162, 837, 838, 165, - 0, 166, 0, 167, 168, 169, 170, 171, 172, 0, - 173, 174, 175, 176, 177, 0, 0, 178, 179, 675, - 181, 182, 0, 183, 184, 185, 0, 186, 187, 188, - 0, 189, 190, 191, 192, 840, 194, 195, 196, 197, - 841, 842, 199, 0, 200, 201, 843, 203, 0, 204, - 0, 205, 206, 0, 207, 208, 209, 210, 211, 212, - 0, 213, 0, 844, 845, 216, 0, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, 228, 0, - 229, 230, 231, 232, 233, 234, 0, 235, 236, 237, - 238, 239, 240, 241, 242, 846, 847, 0, 848, 0, - 246, 0, 248, 249, 250, 251, 252, 253, 254, 255, - 0, 0, 256, 257, 258, 259, 0, 260, 261, 262, - 849, 850, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 282, 283, 284, 285, 286, 851, 288, 852, 290, - 291, 292, 293, 0, 294, 295, 296, 297, 854, 855, - 299, 856, 301, 302, 303, 0, 304, 305, 0, 0, - 857, 307, 308, 0, 0, 309, 310, 311, 312, 313, - 858, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 0, 325, 326, 859, 328, 329, 330, 331, 332, - 333, 0, 334, 335, 336, 337, 338, 339, 0, 340, - 341, 342, 860, 344, 345, 346, 347, 0, 348, 349, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 0, 361, 362, 363, 364, 365, 366, 367, 368, - 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, - 0, 379, 380, 381, 382, 383, 862, 384, 385, 386, - 387, 388, 389, 390, 391, 863, 393, 0, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, - 406, 864, 408, 0, 409, 410, 0, 411, 412, 413, - 414, 415, 416, 417, 0, 865, 866, 0, 0, 420, - 421, 867, 423, 868, 869, 425, 426, 870, 428, 429, - 430, 431, 432, 0, 0, 433, 434, 435, 436, 437, - 871, 0, 438, 439, 440, 441, 442, 443, 872, 0, - 445, 446, 447, 448, 449, 450, 0, 0, 451, 0, - 0, 452, 453, 454, 455, 456, 457, 458, 459, 460, - 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, - 471, 472, 0, 0, 0, 0, 0, 0, 0, 1633, - 1634, 0, 0, 0, 0, 0, 0, 0, 1635, 0, - 0, 0, 0, 0, 0, 880, 881, 92, 814, 547, - 815, 816, 817, 818, 819, 0, 0, 0, 0, 0, - 0, 0, 0, 93, 94, 95, 96, 97, 98, 99, - 100, 0, 101, 102, 103, 0, 0, 0, 0, 820, - 0, 0, 104, 105, 0, 106, 107, 108, 109, 110, - 111, 112, 0, 821, 115, 822, 823, 0, 118, 119, - 120, 121, 122, 123, 824, 825, 124, 125, 826, 827, - 128, 0, 129, 130, 131, 132, 828, 0, 829, 0, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 0, 145, 146, 147, 148, 149, 150, 0, 151, 152, - 153, 154, 830, 831, 832, 833, 834, 835, 836, 156, - 157, 158, 159, 160, 161, 162, 837, 838, 165, 839, - 166, 0, 167, 168, 169, 170, 171, 172, 0, 173, - 174, 175, 176, 177, 0, 0, 178, 179, 675, 181, - 182, 0, 183, 184, 185, 0, 186, 0, 188, 0, - 189, 190, 191, 192, 840, 194, 195, 196, 197, 841, - 842, 199, 0, 200, 201, 843, 203, 0, 204, 0, - 205, 206, 0, 207, 208, 209, 210, 0, 212, 0, - 213, 0, 844, 845, 216, 0, 217, 218, 219, 220, - 221, 222, 223, 0, 225, 226, 227, 228, 0, 229, - 230, 231, 232, 233, 234, 0, 235, 236, 237, 238, - 239, 240, 241, 242, 846, 847, 0, 848, 0, 246, - 0, 0, 249, 250, 251, 252, 253, 254, 255, 0, - 0, 256, 257, 258, 0, 0, 260, 261, 262, 849, - 850, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 470, 471, 472, 473, 474, 475, 877, 0, 35, 0, + 0, 0, 0, 878, 879, 0, 0, 0, 0, 0, + 881, 0, 882, 2827, 0, 0, 0, 883, 0, 884, + 885, 93, 818, 547, 819, 820, 821, 822, 823, 0, + 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 824, 0, 0, 105, 106, 0, 107, + 108, 109, 110, 111, 112, 113, 114, 825, 116, 826, + 827, 0, 119, 120, 121, 122, 123, 124, 828, 829, + 125, 126, 830, 831, 129, 0, 130, 131, 132, 133, + 832, 0, 833, 0, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 152, 153, 154, 155, 834, 835, 836, 837, + 838, 839, 840, 157, 158, 159, 160, 161, 162, 163, + 841, 842, 166, 843, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 678, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 844, 195, + 196, 197, 198, 199, 845, 846, 201, 0, 202, 203, + 847, 205, 0, 206, 0, 207, 208, 0, 209, 210, + 211, 212, 213, 214, 0, 215, 0, 848, 849, 218, + 0, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 238, 239, 240, 241, 242, 243, 244, 850, + 851, 0, 852, 0, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 260, 261, + 262, 0, 263, 264, 265, 853, 854, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 855, 291, 856, 293, 294, 295, 296, 857, 297, + 298, 299, 300, 858, 859, 302, 860, 304, 305, 306, + 0, 307, 308, 0, 0, 861, 310, 311, 0, 0, + 312, 313, 314, 315, 316, 862, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 863, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 864, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 366, + 367, 368, 369, 865, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 26, 382, 383, 384, 385, + 386, 866, 387, 388, 389, 390, 391, 392, 393, 394, + 867, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 868, 411, 0, 412, + 413, 31, 414, 415, 416, 417, 418, 419, 420, 0, + 869, 870, 0, 0, 423, 424, 871, 426, 872, 873, + 428, 429, 874, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 875, 0, 441, 442, 443, + 444, 445, 575, 876, 0, 448, 449, 450, 451, 452, + 453, 0, 0, 454, 0, 34, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 877, 0, 35, + 0, 0, 0, 0, 878, 879, 0, 0, 0, 0, + 0, 881, 0, 882, 0, 0, 0, 0, 883, 0, + 884, 885, 93, 818, 547, 819, 820, 821, 822, 823, + 0, 0, 0, 0, 0, 0, 0, 0, 94, 95, + 96, 97, 98, 99, 100, 101, 0, 102, 103, 104, + 0, 0, 0, 0, 824, 0, 0, 105, 106, 0, + 107, 108, 109, 110, 111, 112, 113, 114, 825, 116, + 826, 827, 1652, 119, 120, 121, 122, 123, 124, 828, + 829, 125, 126, 830, 831, 129, 0, 130, 131, 132, + 133, 832, 0, 833, 0, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 145, 0, 146, 147, 148, 149, + 150, 151, 0, 152, 153, 154, 155, 834, 835, 836, + 837, 838, 839, 840, 157, 158, 159, 160, 161, 162, + 163, 841, 842, 166, 843, 167, 0, 168, 169, 170, + 171, 172, 173, 0, 174, 175, 176, 177, 178, 0, + 0, 179, 180, 678, 182, 183, 0, 184, 185, 186, + 0, 187, 188, 189, 0, 190, 191, 192, 193, 844, + 195, 196, 197, 198, 199, 845, 846, 201, 0, 202, + 203, 847, 205, 0, 206, 0, 207, 208, 1653, 209, + 210, 211, 212, 213, 214, 0, 215, 0, 848, 849, + 218, 0, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 0, 231, 232, 233, 234, 235, + 236, 0, 237, 238, 239, 240, 241, 242, 243, 244, + 850, 851, 0, 852, 0, 248, 249, 250, 251, 252, + 253, 254, 255, 256, 257, 258, 0, 1654, 259, 260, + 261, 262, 0, 263, 264, 265, 853, 854, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, + 288, 289, 855, 291, 856, 293, 294, 295, 296, 857, + 297, 298, 299, 300, 858, 859, 302, 860, 304, 305, + 306, 0, 307, 308, 0, 0, 861, 310, 311, 0, + 0, 312, 313, 314, 315, 316, 862, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 0, 328, 329, + 863, 331, 332, 333, 334, 335, 336, 0, 337, 338, + 339, 340, 341, 342, 0, 343, 344, 345, 864, 347, + 348, 349, 350, 0, 351, 352, 353, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 0, 364, 365, + 366, 367, 368, 369, 865, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 0, 382, 383, 384, + 385, 386, 866, 387, 388, 389, 390, 391, 392, 393, + 394, 867, 396, 0, 397, 398, 399, 400, 401, 402, + 403, 404, 405, 406, 407, 408, 409, 868, 411, 0, + 412, 413, 0, 414, 415, 416, 417, 418, 419, 420, + 0, 869, 870, 0, 1655, 423, 424, 871, 426, 872, + 873, 428, 429, 874, 431, 432, 433, 434, 435, 0, + 0, 436, 437, 438, 439, 440, 875, 0, 441, 442, + 443, 444, 445, 446, 876, 0, 448, 449, 450, 451, + 452, 453, 0, 0, 454, 0, 0, 455, 456, 457, + 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, + 468, 469, 470, 471, 472, 473, 474, 475, 877, 0, + 0, 0, 0, 0, 0, 878, 879, 0, 0, 0, + 0, 0, 881, 0, 882, 0, 0, 0, 0, 883, + 0, 884, 885, 93, 818, 547, 819, 820, 821, 822, + 823, 0, 0, 0, 0, 0, 0, 0, 0, 94, + 95, 96, 97, 98, 99, 100, 101, -574, 102, 103, + 104, 0, 0, 0, -574, 824, 0, 0, 105, 106, + 0, 107, 108, 109, 110, 111, 112, 113, 114, 825, + 116, 826, 827, 0, 119, 120, 121, 122, 123, 124, + 828, 829, 125, 126, 830, 831, 129, 0, 130, 131, + 132, 133, 832, 0, 833, 0, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 0, 146, 147, 148, + 149, 150, 151, 0, 152, 153, 154, 155, 834, 835, + 836, 837, 838, 839, 840, 157, 158, 159, 160, 161, + 162, 163, 841, 842, 166, 843, 167, 0, 168, 169, + 170, 171, 172, 173, 0, 174, 175, 176, 177, 178, + 0, 0, 179, 180, 678, 182, 183, 0, 184, 185, + 186, 0, 187, 188, 189, 0, 190, 191, 192, 193, + 844, 195, 196, 197, 198, 199, 845, 846, 201, 0, + 202, 203, 847, 205, 0, 206, 0, 207, 208, 0, + 209, 210, 211, 212, 213, 214, 0, 215, 0, 848, + 849, 218, 0, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 0, 231, 232, 233, 234, + 235, 236, 0, 237, 238, 239, 240, 241, 242, 243, + 244, 850, 851, 0, 852, 0, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 0, 0, 259, + 260, 261, 262, 0, 263, 264, 265, 853, 854, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 855, 291, 856, 293, 294, 295, 296, + 857, 297, 298, 299, 300, 858, 859, 302, 860, 304, + 305, 306, 0, 307, 308, 0, 0, 861, 310, 311, + 0, 0, 312, 313, 314, 315, 316, 862, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 0, 328, + 329, 863, 331, 332, 333, 334, 335, 336, 0, 337, + 338, 339, 340, 341, 342, 0, 343, 344, 345, 864, + 347, 348, 349, 350, 0, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 0, 364, + 365, 366, 367, 368, 369, 865, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 0, 382, 383, + 384, 385, 386, 866, 387, 388, 389, 390, 391, 392, + 393, 394, 867, 396, -574, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 408, 409, 868, 411, + 0, 412, 413, 0, 414, 415, 416, 417, 418, 419, + 420, 0, 869, 870, 0, 0, 423, 424, 871, 426, + 872, 873, 428, 429, 874, 431, 432, 433, 434, 435, + 0, 0, 436, 437, 438, 439, 440, 875, 0, 441, + 442, 443, 444, 445, 446, 876, 0, 448, 449, 450, + 451, 452, 453, 0, 0, 454, 0, 0, 455, 456, + 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 467, 468, 469, 470, 471, 472, 473, 474, 475, 877, + 0, 0, 0, 0, 0, 0, 878, 879, 0, 0, + 0, 0, 0, 881, 0, 882, 0, 0, 0, 0, + 883, 0, 884, 885, 93, 818, 547, 819, 820, 821, + 822, 823, 0, 0, 0, 0, 0, 0, 0, 0, + 94, 95, 96, 97, 98, 99, 100, 101, 1388, 102, + 103, 104, 0, 0, 0, 0, 824, 0, 0, 105, + 106, 0, 107, 108, 109, 110, 111, 112, 113, 114, + 825, 116, 826, 827, 0, 119, 120, 121, 122, 123, + 124, 828, 829, 125, 126, 830, 831, 129, 0, 130, + 131, 132, 133, 832, 0, 833, 0, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 0, 146, 147, + 148, 149, 150, 151, 0, 152, 153, 154, 155, 834, + 835, 836, 837, 838, 839, 840, 157, 158, 159, 160, + 161, 162, 163, 841, 842, 166, 843, 167, 0, 168, + 169, 170, 171, 172, 173, 0, 174, 175, 176, 177, + 178, 0, 0, 179, 180, 678, 182, 183, 0, 184, + 185, 186, 0, 187, 188, 189, 0, 190, 191, 192, + 193, 844, 195, 196, 197, 198, 199, 845, 846, 201, + 0, 202, 203, 847, 205, 0, 206, 0, 207, 208, + 0, 209, 210, 211, 212, 213, 214, 0, 215, 0, + 848, 849, 218, 0, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 0, 231, 232, 233, + 234, 235, 236, 0, 237, 238, 239, 240, 241, 242, + 243, 244, 850, 851, 0, 852, 0, 248, 249, 250, + 251, 252, 253, 254, 255, 256, 257, 258, 0, 0, + 259, 260, 261, 262, 0, 263, 264, 265, 853, 854, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 855, 291, 856, 293, 294, 295, + 296, 857, 297, 298, 299, 300, 858, 859, 302, 860, + 304, 305, 306, 0, 307, 308, 0, 0, 861, 310, + 311, 0, 0, 312, 313, 314, 315, 316, 862, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 0, + 328, 329, 863, 331, 332, 333, 334, 335, 336, 0, + 337, 338, 339, 340, 341, 342, 0, 343, 344, 345, + 864, 347, 348, 349, 350, 0, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 0, + 364, 365, 366, 367, 368, 369, 865, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 0, 382, + 383, 384, 385, 386, 866, 387, 388, 389, 390, 391, + 392, 393, 394, 867, 396, 0, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 868, + 411, 0, 412, 413, 0, 414, 415, 416, 417, 418, + 419, 420, 0, 869, 870, 0, 0, 423, 424, 871, + 426, 872, 873, 428, 429, 874, 431, 432, 433, 434, + 435, 0, 0, 436, 437, 438, 439, 440, 875, 0, + 441, 442, 443, 444, 445, 446, 876, 0, 448, 449, + 450, 451, 452, 453, 0, 0, 454, 0, 0, 455, + 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 877, 0, 0, 0, 0, 0, 0, 878, 879, 1389, + 0, 0, 0, 0, 881, 0, 882, 0, 0, 0, + 0, 883, 0, 884, 885, 93, 818, 547, 819, 820, + 821, 822, 823, 0, 0, 0, 0, 0, 0, 0, + 0, 94, 95, 96, 97, 98, 99, 100, 101, 2708, + 102, 103, 104, 0, 0, 0, 0, 824, 0, 0, + 105, 106, 0, 107, 108, 109, 110, 111, 112, 113, + 114, 825, 116, 826, 827, 0, 119, 120, 121, 122, + 123, 124, 828, 829, 125, 126, 830, 831, 129, 0, + 130, 131, 132, 133, 832, 0, 833, 0, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 0, 152, 153, 2709, 155, + 834, 835, 836, 837, 838, 839, 840, 157, 158, 159, + 160, 161, 162, 163, 841, 842, 166, 843, 167, 0, + 168, 169, 170, 171, 172, 173, 0, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 678, 182, 183, 0, + 184, 185, 186, 0, 187, 188, 189, 0, 190, 191, + 192, 193, 844, 195, 196, 197, 198, 199, 845, 846, + 201, 0, 202, 203, 847, 205, 0, 206, 0, 207, + 208, 0, 209, 210, 211, 212, 213, 214, 0, 215, + 0, 2710, 849, 218, 0, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 0, 231, 232, + 233, 234, 235, 236, 0, 237, 238, 239, 240, 241, + 242, 243, 244, 850, 851, 0, 852, 0, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 0, + 0, 259, 260, 261, 262, 0, 263, 264, 265, 853, + 854, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 855, 291, 856, 293, 294, + 295, 296, 857, 297, 298, 299, 300, 858, 859, 302, + 860, 304, 305, 306, 0, 307, 308, 0, 0, 861, + 310, 311, 0, 0, 312, 313, 314, 315, 316, 862, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 0, 328, 329, 863, 331, 332, 333, 334, 335, 336, + 0, 337, 338, 339, 340, 341, 342, 0, 343, 344, + 345, 864, 347, 348, 349, 350, 0, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 0, 364, 365, 366, 367, 368, 2711, 865, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 0, + 382, 383, 384, 385, 386, 866, 387, 388, 389, 390, + 391, 392, 393, 394, 867, 396, 0, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, + 868, 411, 0, 412, 413, 0, 414, 415, 416, 417, + 418, 419, 420, 0, 869, 870, 0, 0, 423, 424, + 871, 426, 872, 873, 428, 429, 874, 431, 432, 433, + 434, 435, 0, 0, 436, 437, 438, 439, 440, 875, + 0, 441, 442, 443, 444, 445, 446, 876, 0, 448, + 449, 450, 451, 452, 453, 0, 0, 454, 0, 0, + 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 877, 0, 0, 0, 0, 0, 0, 878, 879, + 2712, 0, 0, 0, 0, 881, 0, 2713, 0, 0, + 0, 0, 883, 0, 884, 885, 93, 818, 547, 819, + 820, 821, 822, 823, 0, 0, 0, 0, 0, 0, + 0, 0, 94, 95, 96, 97, 98, 99, 100, 101, + 0, 102, 103, 104, 0, 0, 0, 0, 824, 0, + 0, 105, 106, 0, 107, 108, 109, 110, 111, 112, + 113, 114, 825, 116, 826, 827, 0, 119, 120, 121, + 122, 123, 124, 828, 829, 125, 126, 830, 831, 129, + 0, 130, 131, 132, 133, 832, 0, 833, 0, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 0, + 146, 147, 148, 149, 150, 151, 0, 152, 153, 154, + 155, 834, 835, 836, 837, 838, 839, 840, 157, 158, + 159, 160, 161, 162, 163, 841, 842, 166, 843, 167, + 0, 168, 169, 170, 171, 172, 173, 0, 174, 175, + 176, 177, 178, 0, 0, 179, 180, 678, 182, 183, + 0, 184, 185, 186, 0, 187, 188, 189, 0, 190, + 191, 192, 193, 844, 195, 196, 197, 198, 199, 845, + 846, 201, 0, 202, 203, 847, 205, 0, 206, 0, + 207, 208, 0, 209, 210, 211, 212, 213, 214, 0, + 215, 0, 848, 849, 218, 0, 219, 220, 221, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 0, 231, + 232, 233, 234, 235, 236, 0, 237, 238, 239, 240, + 241, 242, 243, 244, 850, 851, 0, 852, 0, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 0, 0, 259, 260, 261, 262, 0, 263, 264, 265, + 853, 854, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 855, 291, 856, 293, + 294, 295, 296, 857, 297, 298, 299, 300, 858, 859, + 302, 860, 304, 305, 306, 0, 307, 308, 0, 0, + 861, 310, 311, 0, 0, 312, 313, 314, 315, 316, + 862, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 0, 328, 329, 863, 331, 332, 333, 334, 335, + 336, 0, 337, 338, 339, 340, 341, 342, 0, 343, + 344, 345, 864, 347, 348, 349, 350, 0, 351, 352, + 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, + 363, 0, 364, 365, 366, 367, 368, 369, 865, 371, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 0, 382, 383, 384, 385, 386, 866, 387, 388, 389, + 390, 391, 392, 393, 394, 867, 396, 0, 397, 398, + 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, + 409, 868, 411, 0, 412, 413, 0, 414, 415, 416, + 417, 418, 419, 420, 0, 869, 870, 0, 0, 423, + 424, 871, 426, 872, 873, 428, 429, 874, 431, 432, + 433, 434, 435, 0, 0, 436, 437, 438, 439, 440, + 875, 0, 441, 442, 443, 444, 445, 446, 876, 0, + 448, 449, 450, 451, 452, 453, 0, 0, 454, 0, + 0, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 877, 0, 0, 0, 0, 0, 0, 878, + 879, 880, 0, 0, 0, 0, 881, 0, 882, 0, + 0, 0, 0, 883, 0, 884, 885, 93, 1402, 547, + 819, 820, 821, 1403, 823, 0, 0, 0, 0, 0, + 0, 0, 0, 94, 95, 96, 97, 98, 99, 100, + 101, 1404, 102, 103, 104, 0, 0, 0, 0, 824, + 0, 0, 105, 106, 0, 107, 108, 109, 110, 111, + 112, 113, 114, 825, 116, 826, 827, 0, 119, 120, + 121, 122, 123, 124, 828, 829, 125, 126, 830, 831, + 129, 0, 130, 131, 132, 133, 832, 0, 833, 0, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 0, 146, 147, 148, 149, 150, 151, 0, 152, 153, + 154, 155, 834, 835, 836, 837, 838, 839, 840, 157, + 158, 159, 160, 161, 162, 163, 841, 842, 166, 843, + 167, 0, 168, 169, 170, 171, 172, 173, 0, 174, + 175, 176, 177, 178, 0, 0, 179, 180, 678, 182, + 183, 0, 184, 185, 186, 0, 187, 188, 189, 0, + 190, 191, 192, 193, 844, 195, 196, 197, 198, 199, + 845, 846, 201, 0, 202, 203, 847, 205, 0, 206, + 0, 207, 208, 0, 209, 210, 211, 212, 213, 214, + 0, 215, 0, 848, 849, 218, 0, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 0, + 231, 232, 233, 234, 235, 236, 0, 237, 238, 239, + 240, 241, 242, 243, 244, 850, 851, 0, 852, 0, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 0, 0, 259, 260, 261, 262, 0, 263, 264, + 265, 853, 854, 266, 267, 268, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 855, 291, 856, + 293, 294, 295, 296, 857, 297, 298, 299, 300, 858, + 859, 302, 860, 304, 305, 306, 0, 307, 308, 0, + 0, 861, 310, 311, 0, 0, 312, 313, 314, 315, + 316, 862, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 0, 328, 329, 863, 331, 332, 333, 334, + 335, 336, 0, 337, 338, 339, 340, 341, 342, 0, + 343, 344, 345, 864, 347, 348, 349, 350, 0, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 0, 364, 365, 366, 367, 368, 369, 865, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 0, 382, 383, 384, 385, 386, 866, 387, 388, + 389, 390, 391, 392, 393, 394, 867, 396, 0, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 408, 409, 868, 411, 0, 412, 413, 0, 414, 415, + 416, 417, 418, 419, 420, 0, 869, 870, 0, 0, + 423, 424, 871, 426, 872, 873, 428, 429, 874, 431, + 432, 433, 434, 435, 0, 0, 436, 437, 438, 439, + 440, 875, 0, 441, 442, 443, 444, 445, 446, 876, + 0, 448, 449, 450, 451, 452, 453, 0, 0, 454, + 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 877, 0, 0, 0, 0, 0, 0, + 878, 879, 0, 0, 0, 0, 0, 881, 0, 882, + 0, 0, 0, 0, 883, 0, 884, 885, 93, 818, + 547, 819, 820, 821, 822, 823, 0, 0, 0, 0, + 0, 0, 0, 0, 94, 95, 96, 97, 98, 99, + 100, 101, 0, 102, 103, 104, 0, 0, 0, 0, + 824, 0, 0, 105, 106, 0, 107, 108, 109, 110, + 111, 112, 113, 114, 825, 116, 826, 827, 0, 119, + 120, 121, 122, 123, 124, 828, 829, 125, 126, 830, + 831, 129, 0, 130, 131, 132, 133, 832, 0, 833, + 0, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 0, 146, 147, 148, 149, 150, 151, 0, 152, + 153, 154, 155, 834, 835, 836, 837, 838, 839, 840, + 157, 158, 159, 160, 161, 162, 163, 841, 842, 166, + 843, 167, 0, 168, 169, 170, 171, 172, 173, 0, + 174, 175, 176, 177, 178, 0, 0, 179, 180, 678, + 182, 183, 0, 184, 185, 186, 0, 187, 188, 189, + 0, 190, 191, 192, 193, 844, 195, 196, 197, 198, + 199, 845, 846, 201, 0, 202, 203, 847, 205, 0, + 206, 0, 207, 208, 0, 209, 210, 211, 212, 213, + 214, 0, 215, 0, 848, 849, 218, 0, 219, 220, + 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, + 0, 231, 232, 233, 234, 235, 236, 0, 237, 238, + 239, 240, 241, 242, 243, 244, 850, 851, 0, 852, + 0, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 0, 0, 259, 260, 261, 262, 0, 263, + 264, 265, 853, 854, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 851, 288, 852, 290, 291, - 292, 293, 0, 294, 295, 0, 297, 854, 855, 299, - 856, 301, 302, 303, 0, 304, 305, 0, 0, 857, - 307, 308, 0, 0, 309, 310, 311, 312, 313, 858, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 0, 325, 326, 859, 328, 329, 330, 331, 332, 333, - 0, 334, 335, 336, 337, 338, 339, 0, 340, 341, - 342, 860, 344, 345, 346, 347, 0, 348, 349, 350, + 282, 283, 284, 285, 286, 287, 288, 289, 855, 291, + 856, 293, 294, 295, 296, 857, 297, 298, 299, 300, + 858, 859, 302, 860, 304, 305, 306, 0, 307, 308, + 0, 0, 861, 310, 311, 0, 0, 312, 313, 314, + 315, 316, 862, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 0, 328, 329, 863, 331, 332, 333, + 334, 335, 336, 0, 337, 338, 339, 340, 341, 342, + 0, 343, 344, 345, 864, 347, 348, 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 0, 361, 362, 363, 364, 365, 366, 861, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 0, - 379, 380, 381, 382, 383, 862, 384, 385, 386, 387, - 388, 0, 390, 391, 863, 393, 0, 394, 395, 396, + 361, 362, 363, 0, 364, 365, 366, 367, 368, 369, + 865, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 0, 382, 383, 384, 385, 386, 866, 387, + 388, 389, 390, 391, 392, 393, 394, 867, 396, 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, - 864, 408, 0, 409, 410, 0, 411, 412, 413, 414, - 415, 416, 417, 0, 865, 866, 0, 0, 420, 421, - 867, 423, 868, 869, 425, 426, 870, 428, 429, 430, - 431, 432, 0, 0, 433, 434, 435, 436, 437, 871, - 0, 438, 439, 440, 441, 442, 443, 872, 0, 445, - 446, 447, 448, 449, 450, 0, 0, 451, 0, 0, - 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, + 407, 408, 409, 868, 411, 0, 412, 413, 0, 414, + 415, 416, 417, 418, 419, 420, 0, 869, 870, 0, + 0, 423, 424, 871, 426, 872, 873, 428, 429, 874, + 431, 432, 433, 434, 435, 0, 0, 436, 437, 438, + 439, 440, 875, 0, 441, 442, 443, 444, 445, 446, + 876, 0, 448, 449, 450, 451, 452, 453, 0, 0, + 454, 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 0, 0, 0, 0, 0, 0, 0, 874, 875, - 498, 0, 0, 0, 0, 877, 0, 878, 0, 0, - 0, 0, 879, 0, 880, 881, 93, 94, 95, 96, - 97, 98, 99, 100, 0, 101, 102, 103, 0, 0, - 0, 0, 0, 2311, 0, 104, 105, 0, 106, 107, - 108, 0, 110, 111, 112, 113, 114, 0, 116, 117, - 0, 118, 119, 120, 121, 122, 123, 0, 0, 124, - 125, 126, 127, 128, 0, 129, 130, 131, 132, 133, - 0, 0, 0, 135, 136, 137, 138, 139, 140, 0, - 142, 143, 144, 0, 145, 146, 147, 148, 149, 150, - 0, -612, 152, 153, 154, 0, 0, 0, 0, 0, - 0, 0, 156, 157, 158, 159, 160, 161, 162, 163, - 164, 165, 0, 166, 0, 167, 168, 169, 170, 171, - 172, 0, 173, 174, 175, 176, 177, 0, 0, 178, - 179, 180, 181, 182, 0, 183, 184, 185, 0, 186, - 187, 188, 0, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 0, 199, 0, 200, 201, 202, 203, - 0, 204, 0, 205, 0, 0, -612, 208, 209, 210, - 0, 212, 0, 213, 0, 214, 215, 216, 0, 217, - 218, 219, 220, 221, 222, 223, 0, 225, 226, 227, - 228, 0, 229, 230, 231, 232, 233, 234, 0, 235, - -612, 237, 238, 239, 240, 241, 242, 243, 244, 0, - 245, 0, 246, 0, 0, 249, -612, 251, 252, 253, - 254, 255, 0, 0, 256, -612, 258, 0, 0, 260, - 261, 262, 0, 0, 263, 264, 265, 266, 267, 500, + 472, 473, 474, 475, 877, 0, 0, 0, 0, 0, + 0, 878, 879, 0, 0, 0, 0, 0, 881, 0, + 882, 1646, 0, 0, 0, 883, 0, 884, 885, 1015, + 818, 547, 819, 820, 821, 822, 823, 0, 0, 0, + 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 0, 102, 103, 104, 0, 0, 0, + 0, 824, 0, 0, 105, 106, 0, 107, 108, 109, + 1017, 111, 112, 113, 114, 825, 1018, 826, 827, 0, + 119, 120, 121, 122, 123, 124, 828, 829, 125, 126, + 830, 831, 129, 0, 130, 131, 132, 133, 832, 0, + 1019, 0, 136, 137, 138, 139, 140, 141, 1020, 143, + 144, 145, 0, 146, 147, 148, 149, 150, 151, 0, + 1021, 153, 154, 155, 834, 835, 836, 1022, 838, 839, + 840, 157, 158, 159, 160, 161, 162, 163, 841, 842, + 166, 843, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 0, 0, 179, 180, + 678, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 844, 195, 196, 197, + 198, 199, 845, 846, 201, 0, 202, 203, 847, 205, + 0, 206, 0, 207, 1024, 0, 1025, 210, 211, 212, + 1026, 214, 0, 215, 0, 848, 849, 218, 0, 219, + 220, 221, 222, 223, 224, 225, 1027, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 1028, 239, 240, 241, 242, 243, 244, 850, 851, 0, + 852, 0, 248, 1029, 1030, 251, 1031, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 1032, 261, 1033, 0, + 263, 264, 265, 853, 854, 266, 267, 268, 269, 270, + 1034, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 855, + 1035, 856, 293, 294, 295, 296, 857, 297, 298, 1036, + 300, 858, 859, 302, 860, 304, 305, 306, 0, 307, + 308, 0, 0, 861, 310, 311, 0, 0, 312, 313, + 1037, 315, 1038, 862, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 0, 328, 329, 863, 331, 332, + 333, 334, 335, 336, 0, 337, 338, 339, 340, 341, + 342, 0, 343, 344, 345, 864, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 1039, 367, 368, + 369, 865, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 0, 382, 383, 384, 385, 386, 866, + 387, 388, 389, 390, 391, 1040, 393, 394, 867, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 1041, 409, 868, 411, 0, 412, 413, 0, + 414, 1042, 416, 417, 418, 419, 420, 0, 869, 870, + 0, 0, 423, 424, 871, 426, 872, 873, 428, 429, + 1043, 431, 432, 433, 434, 435, 0, 0, 436, 437, + 438, 439, 440, 875, 0, 441, 442, 443, 444, 445, + 446, 876, 1866, 448, 1045, 450, 451, 452, 453, 0, + 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 877, 0, 0, 0, 0, + 0, 0, 878, 879, 0, 0, 0, 0, 0, 881, + 0, 882, 0, 0, 0, 0, 883, 0, 884, 885, + 1015, 818, 547, 819, 820, 821, 822, 823, 0, 0, + 0, 0, 0, 0, 0, 0, 94, 95, 96, 97, + 98, 99, 100, 101, 0, 102, 103, 104, 0, 0, + 0, 0, 824, 0, 0, 105, 106, 0, 107, 108, + 109, 1017, 111, 112, 113, 114, 825, 1018, 826, 827, + 0, 119, 120, 121, 122, 123, 124, 828, 829, 125, + 126, 830, 831, 129, 0, 130, 131, 132, 133, 832, + 0, 1019, 0, 136, 137, 138, 139, 140, 141, 1020, + 143, 144, 145, 0, 146, 147, 148, 149, 150, 151, + 0, 1021, 153, 154, 155, 834, 835, 836, 1022, 838, + 839, 840, 157, 158, 159, 160, 161, 162, 163, 841, + 842, 166, 843, 167, 0, 168, 169, 170, 171, 172, + 173, 0, 174, 175, 176, 177, 178, 0, 0, 179, + 180, 678, 182, 183, 0, 184, 185, 186, 0, 187, + 188, 189, 0, 190, 191, 192, 193, 844, 195, 196, + 197, 198, 199, 845, 846, 201, 0, 202, 203, 847, + 205, 0, 206, 0, 207, 1024, 0, 1025, 210, 211, + 212, 1026, 214, 0, 215, 0, 848, 849, 218, 0, + 219, 220, 221, 222, 223, 224, 225, 1027, 227, 228, + 229, 230, 0, 231, 232, 233, 234, 235, 236, 0, + 237, 1028, 239, 240, 241, 242, 243, 244, 850, 851, + 0, 852, 0, 248, 1029, 1030, 251, 1031, 253, 254, + 255, 256, 257, 258, 0, 0, 259, 1032, 261, 1033, + 0, 263, 264, 265, 853, 854, 266, 267, 268, 269, + 270, 1034, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 855, 1035, 856, 293, 294, 295, 296, 857, 297, 298, + 1036, 300, 858, 859, 302, 860, 304, 305, 306, 0, + 307, 308, 0, 0, 861, 310, 311, 0, 0, 312, + 313, 1037, 315, 1038, 862, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 0, 328, 329, 863, 331, + 332, 333, 334, 335, 336, 0, 337, 338, 339, 340, + 341, 342, 0, 343, 344, 345, 864, 347, 348, 349, + 350, 0, 351, 352, 353, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 0, 364, 365, 1039, 367, + 368, 369, 865, 371, 372, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 0, 382, 383, 384, 385, 386, + 866, 387, 388, 389, 390, 391, 1040, 393, 394, 867, + 396, 0, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 1041, 409, 868, 411, 0, 412, 413, + 0, 414, 1042, 416, 417, 418, 419, 420, 0, 869, + 870, 0, 0, 423, 424, 871, 426, 872, 873, 428, + 429, 1043, 431, 432, 433, 434, 435, 0, 0, 436, + 437, 438, 439, 440, 875, 0, 441, 442, 443, 444, + 445, 446, 876, 0, 448, 1045, 450, 451, 452, 453, + 0, 0, 454, 0, 0, 455, 456, 457, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 877, 0, 0, 0, + 0, 0, 0, 878, 879, 0, 0, 0, 0, 0, + 881, 0, 882, 1910, 0, 0, 0, 883, 0, 884, + 885, 93, 818, 547, 819, 820, 821, 822, 823, 0, + 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 824, 0, 0, 105, 106, 0, 107, + 108, 109, 110, 111, 112, 113, 114, 825, 116, 826, + 827, 0, 119, 120, 121, 122, 123, 124, 828, 829, + 125, 126, 830, 831, 129, 0, 130, 131, 132, 133, + 832, 0, 833, 0, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 152, 153, 154, 155, 834, 835, 836, 837, + 838, 839, 840, 157, 158, 159, 160, 161, 162, 163, + 841, 842, 166, 843, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 678, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 844, 195, + 196, 197, 198, 199, 845, 846, 201, 0, 202, 203, + 847, 205, 0, 206, 0, 207, 208, 1653, 209, 210, + 211, 212, 213, 214, 0, 215, 0, 848, 849, 218, + 0, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 238, 239, 240, 241, 242, 243, 244, 850, + 851, 0, 852, 0, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 260, 261, + 262, 0, 263, 264, 265, 853, 854, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, 287, -612, - 289, 290, 291, 292, 293, 0, 294, 295, 0, 297, - 0, 298, 299, 300, 301, 302, 303, 0, 304, 305, - 0, 0, 306, 307, 308, 0, 0, 309, 310, 0, - 312, 0, 314, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 0, 325, 326, 327, 328, 329, 330, - 331, 332, 333, 0, 334, 335, 336, 337, 338, 339, - 0, 340, 341, 342, 343, 344, 345, 346, 347, 0, - 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 0, 361, 362, -612, 364, 365, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 0, 379, 380, 381, 382, 383, 0, 384, - 385, 386, 387, 388, 0, 390, 391, 392, 393, 0, - 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, - 404, 502, 406, 407, 408, 0, 409, 410, 0, 411, - -612, 413, 414, 415, 416, 417, 0, 418, 419, 0, - 0, 420, 421, 422, 423, 424, 0, 425, 426, 427, - 428, 429, 430, 431, 432, 0, 0, 433, 434, 435, - 436, 437, 0, 0, 438, 439, 440, 441, 442, 443, - 444, 0, 445, 0, 447, 448, 449, 450, 0, 0, - 451, 0, 0, 452, 453, 454, 455, 456, 457, 458, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 855, 291, 856, 293, 294, 295, 296, 857, 297, + 298, 299, 300, 858, 859, 302, 860, 304, 305, 306, + 0, 307, 308, 0, 0, 861, 310, 311, 0, 0, + 312, 313, 314, 315, 316, 862, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 863, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 864, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 366, + 367, 368, 369, 865, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 866, 387, 388, 389, 390, 391, 392, 393, 394, + 867, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 868, 411, 0, 412, + 413, 0, 414, 415, 416, 417, 418, 419, 420, 0, + 869, 870, 0, 0, 423, 424, 871, 426, 872, 873, + 428, 429, 874, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 875, 0, 441, 442, 443, + 444, 445, 446, 876, 0, 448, 449, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, - 469, 470, 471, 472, 0, 0, 92, 0, 579, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 941, 93, 94, 95, 96, 97, 98, 99, 100, - 0, 101, 102, 103, 0, 0, 0, 0, 0, 0, - 0, 104, 105, 0, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 0, 118, 119, 120, - 121, 122, 123, 0, 825, 124, 125, 126, 127, 128, - 0, 129, 130, 131, 132, 828, 0, 829, 0, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 0, - 145, 146, 147, 148, 149, 150, 0, 151, 152, 153, - 154, 830, 831, 832, 833, 834, 835, 836, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 0, 166, - 0, 167, 168, 169, 170, 171, 172, 0, 173, 174, - 175, 176, 177, 0, 0, 178, 179, 180, 181, 182, - 0, 183, 184, 185, 0, 186, 187, 188, 0, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 841, 0, - 199, 0, 200, 201, 202, 203, 0, 204, 0, 205, - 206, 0, 207, 208, 209, 210, 211, 212, 0, 213, - 0, 214, 215, 216, 0, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 228, 0, 229, 230, - 231, 232, 233, 234, 0, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 0, 245, 0, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 2060, 0, - 256, 257, 258, 259, 0, 260, 261, 262, 849, 850, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 0, 294, 295, 296, 297, 0, 855, 299, 300, - 301, 302, 303, 0, 304, 305, 0, 580, 306, 307, - 308, 0, 0, 309, 310, 311, 312, 313, 858, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 0, - 325, 326, 859, 328, 329, 330, 331, 332, 333, 0, - 334, 335, 336, 337, 338, 339, 0, 340, 341, 342, - 343, 344, 345, 346, 347, 0, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 0, - 361, 362, 363, 364, 365, 366, 367, 2061, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 26, 379, - 380, 381, 382, 383, 862, 384, 385, 386, 387, 388, - 389, 390, 391, 392, 393, 0, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 405, 406, 864, - 408, 0, 409, 410, 31, 411, 412, 413, 414, 415, - 416, 417, 0, 418, 419, 0, 0, 420, 421, 867, - 423, 868, 0, 425, 426, 870, 428, 429, 430, 431, - 432, 0, 0, 433, 434, 435, 436, 437, 871, 0, - 438, 439, 440, 441, 442, 575, 444, 0, 445, 446, - 447, 448, 449, 450, 0, 0, 451, 0, 34, 452, - 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, - 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 0, 92, 35, 579, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 2062, 93, 94, 95, - 96, 97, 98, 99, 100, 0, 101, 102, 103, 0, - 0, 0, 0, 0, 0, 0, 104, 105, 0, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 0, 118, 119, 120, 121, 122, 123, 0, 825, - 124, 125, 126, 127, 128, 0, 129, 130, 131, 132, - 828, 0, 829, 0, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 151, 152, 153, 154, 830, 831, 832, 833, - 834, 835, 836, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 841, 0, 199, 0, 200, 201, 202, - 203, 0, 204, 0, 205, 206, 0, 207, 208, 209, - 210, 211, 212, 0, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 0, 245, 0, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 2060, 0, 256, 257, 258, 259, 0, - 260, 261, 262, 849, 850, 263, 264, 265, 266, 267, + 469, 470, 471, 472, 473, 474, 475, 877, 0, 0, + 0, 0, 0, 0, 878, 879, 0, 0, 0, 0, + 0, 881, 0, 882, 0, 0, 0, 0, 883, 0, + 884, 885, 93, 818, 547, 819, 820, 821, 822, 823, + 0, 0, 0, 0, 0, 0, 0, 0, 94, 95, + 96, 97, 98, 99, 100, 101, 0, 102, 103, 104, + 0, 0, 0, 0, 824, 0, 0, 105, 106, 0, + 107, 108, 109, 110, 111, 112, 113, 114, 825, 116, + 826, 827, 0, 119, 120, 121, 122, 123, 124, 828, + 829, 125, 126, 830, 831, 129, 0, 130, 131, 132, + 133, 832, 0, 833, 0, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 145, 0, 146, 147, 148, 149, + 150, 151, 0, 152, 153, 154, 155, 834, 835, 836, + 837, 838, 839, 840, 157, 158, 159, 160, 161, 162, + 163, 841, 842, 166, 843, 167, 0, 168, 169, 170, + 171, 172, 173, 0, 174, 175, 176, 177, 178, 0, + 0, 179, 180, 678, 182, 183, 0, 184, 185, 186, + 0, 187, 188, 189, 0, 190, 191, 192, 193, 844, + 195, 196, 197, 198, 199, 845, 846, 201, 0, 202, + 203, 847, 205, 0, 206, 0, 207, 208, 0, 209, + 210, 211, 212, 213, 214, 0, 215, 0, 848, 849, + 218, 0, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 0, 231, 232, 233, 234, 235, + 236, 0, 237, 238, 239, 240, 241, 242, 243, 244, + 850, 851, 0, 852, 0, 248, 249, 250, 251, 252, + 253, 254, 255, 256, 257, 258, 0, 0, 259, 260, + 261, 262, 0, 263, 264, 265, 853, 854, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 0, 294, 295, 296, - 297, 0, 855, 299, 300, 301, 302, 303, 0, 304, - 305, 0, 580, 306, 307, 308, 0, 0, 309, 310, - 311, 312, 313, 858, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 859, 328, 329, - 330, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 343, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 363, 364, 365, - 366, 367, 2061, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 862, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 864, 408, 0, 409, 410, 0, - 411, 412, 413, 414, 415, 416, 417, 0, 418, 419, - 0, 0, 420, 421, 867, 423, 868, 0, 425, 426, - 870, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 871, 0, 438, 439, 440, 441, 442, - 443, 444, 0, 445, 446, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, + 288, 289, 855, 291, 856, 293, 294, 295, 296, 857, + 297, 298, 299, 300, 858, 859, 302, 860, 304, 305, + 306, 0, 307, 308, 0, 0, 861, 310, 311, 0, + 0, 312, 313, 314, 315, 316, 862, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 0, 328, 329, + 863, 331, 332, 333, 334, 335, 336, 0, 337, 338, + 339, 340, 341, 342, 0, 343, 344, 345, 864, 347, + 348, 349, 350, 0, 351, 352, 353, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 0, 364, 365, + 366, 367, 368, 369, 865, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 0, 382, 383, 384, + 385, 386, 866, 387, 388, 389, 390, 391, 392, 393, + 394, 867, 396, 0, 397, 398, 399, 400, 401, 402, + 403, 404, 405, 406, 407, 408, 409, 868, 411, 0, + 412, 413, 2221, 414, 415, 416, 417, 418, 419, 420, + 0, 869, 870, 0, 0, 423, 424, 871, 426, 872, + 873, 428, 429, 874, 431, 432, 433, 434, 435, 0, + 0, 436, 437, 438, 439, 440, 875, 0, 441, 442, + 443, 444, 445, 446, 876, 0, 448, 449, 450, 451, + 452, 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 0, 92, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2062, 93, 94, 95, 96, 97, 98, 99, 100, - 0, 101, 102, 103, 0, 0, 0, 0, 0, 0, - 0, 104, 105, 0, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 0, 118, 119, 120, - 121, 122, 123, 0, 825, 124, 125, 126, 127, 128, - 0, 129, 130, 131, 132, 828, 0, 829, 0, 135, - 136, 137, 138, 139, 140, 141, 142, 143, 144, 0, - 145, 146, 147, 148, 149, 150, 0, 151, 152, 153, - 154, 830, 831, 832, 833, 834, 835, 836, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 0, 166, - 0, 167, 168, 169, 170, 171, 172, 0, 173, 174, - 175, 176, 177, 0, 0, 178, 179, 180, 181, 182, - 0, 183, 184, 185, 0, 186, 187, 188, 0, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 841, 0, - 199, 0, 200, 201, 202, 203, 0, 204, 0, 205, - 206, 0, 207, 208, 209, 210, 211, 212, 0, 213, - 0, 214, 215, 216, 0, 217, 218, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 228, 0, 229, 230, - 231, 232, 233, 234, 0, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 0, 245, 0, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 0, 0, - 256, 257, 258, 259, 0, 260, 261, 262, 849, 850, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, + 468, 469, 470, 471, 472, 473, 474, 475, 877, 0, + 0, 0, 0, 0, 0, 878, 879, 0, 0, 0, + 0, 0, 881, 0, 882, 0, 0, 0, 0, 883, + 0, 884, 885, 93, 818, 547, 819, 820, 821, 822, + 823, 0, 0, 0, 0, 0, 0, 0, 0, 94, + 95, 96, 97, 98, 99, 100, 101, 0, 102, 103, + 104, 0, 0, 0, 0, 824, 0, 0, 105, 106, + 0, 107, 108, 109, 110, 111, 112, 113, 114, 825, + 116, 826, 827, 0, 119, 120, 121, 122, 123, 124, + 828, 829, 125, 126, 830, 831, 129, 0, 130, 131, + 132, 133, 832, 0, 833, 0, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 0, 146, 147, 148, + 149, 150, 151, 0, 152, 153, 154, 155, 834, 835, + 836, 837, 838, 839, 840, 157, 158, 159, 160, 161, + 162, 163, 841, 842, 166, 843, 167, 0, 168, 169, + 170, 171, 172, 173, 0, 174, 175, 176, 177, 178, + 0, 0, 179, 180, 678, 182, 183, 0, 184, 185, + 186, 0, 187, 188, 189, 0, 190, 191, 192, 193, + 844, 195, 196, 197, 198, 199, 845, 846, 201, 0, + 202, 203, 847, 205, 0, 206, 0, 207, 208, 0, + 209, 210, 211, 212, 213, 214, 0, 215, 0, 848, + 849, 218, 0, 219, 220, 221, 222, 223, 224, 225, + 226, 227, 228, 229, 230, 0, 231, 232, 233, 234, + 235, 236, 0, 237, 238, 239, 240, 241, 242, 243, + 244, 850, 851, 0, 852, 0, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 0, 0, 259, + 260, 261, 262, 0, 263, 264, 265, 853, 854, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 855, 291, 856, 293, 294, 295, 296, + 857, 297, 298, 299, 300, 858, 859, 302, 860, 304, + 305, 306, 0, 307, 308, 0, 0, 861, 310, 311, + 0, 0, 312, 313, 314, 315, 316, 862, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 0, 328, + 329, 863, 331, 332, 333, 334, 335, 336, 0, 337, + 338, 339, 340, 341, 342, 0, 343, 344, 345, 864, + 347, 348, 349, 350, 0, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 0, 364, + 365, 366, 367, 368, 369, 865, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 0, 382, 383, + 384, 385, 386, 866, 387, 388, 389, 390, 391, 392, + 393, 394, 867, 396, 0, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 408, 409, 868, 411, + 0, 412, 413, 0, 414, 415, 416, 417, 418, 419, + 420, 0, 869, 870, 0, 0, 423, 424, 871, 426, + 872, 873, 428, 429, 874, 431, 432, 433, 434, 435, + 0, 0, 436, 437, 438, 439, 440, 875, 0, 441, + 442, 443, 444, 445, 446, 876, 0, 448, 449, 450, + 451, 452, 453, 0, 0, 454, 0, 0, 455, 456, + 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 467, 468, 469, 470, 471, 472, 473, 474, 475, 877, + 0, 0, 0, 0, 0, 0, 878, 879, 0, 0, + 0, 0, 0, 881, 0, 882, 0, 0, 0, 0, + 883, 0, 884, 885, 1015, 818, 547, 819, 820, 821, + 822, 823, 0, 0, 0, 0, 0, 0, 0, 0, + 94, 95, 96, 97, 98, 99, 100, 101, 0, 102, + 103, 104, 0, 0, 0, 0, 824, 0, 0, 105, + 106, 0, 107, 108, 109, 1017, 111, 112, 113, 114, + 825, 1018, 826, 827, 0, 119, 120, 121, 122, 123, + 124, 828, 829, 125, 126, 830, 831, 129, 0, 130, + 131, 132, 133, 832, 0, 1019, 0, 136, 137, 138, + 139, 140, 141, 1020, 143, 144, 145, 0, 146, 147, + 148, 149, 150, 151, 0, 1021, 153, 154, 155, 834, + 835, 836, 1022, 838, 839, 840, 157, 158, 159, 160, + 161, 162, 163, 841, 842, 166, 843, 167, 0, 168, + 169, 170, 171, 172, 173, 0, 174, 175, 176, 177, + 178, 0, 0, 179, 180, 678, 182, 183, 0, 184, + 185, 186, 0, 187, 188, 189, 0, 190, 191, 192, + 193, 844, 195, 196, 197, 198, 199, 845, 846, 201, + 0, 202, 203, 847, 205, 0, 206, 0, 207, 1024, + 0, 1025, 210, 211, 212, 1026, 214, 0, 215, 0, + 848, 849, 218, 0, 219, 220, 221, 222, 223, 224, + 225, 1027, 227, 228, 229, 230, 0, 231, 232, 233, + 234, 235, 236, 0, 237, 1028, 239, 240, 241, 242, + 243, 244, 850, 851, 0, 852, 0, 248, 1029, 1030, + 251, 1031, 253, 254, 255, 256, 257, 258, 0, 0, + 259, 1032, 261, 1033, 0, 263, 264, 265, 853, 854, + 266, 267, 268, 269, 270, 1034, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 855, 1035, 856, 293, 294, 295, + 296, 857, 297, 298, 1036, 300, 858, 859, 302, 860, + 304, 305, 306, 0, 307, 308, 0, 0, 861, 310, + 311, 0, 0, 312, 313, 1037, 315, 1038, 862, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 0, + 328, 329, 863, 331, 332, 333, 334, 335, 336, 0, + 337, 338, 339, 340, 341, 342, 0, 343, 344, 345, + 864, 347, 348, 349, 350, 0, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 0, + 364, 365, 1039, 367, 368, 369, 865, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 0, 382, + 383, 384, 385, 386, 866, 387, 388, 389, 390, 391, + 1040, 393, 394, 867, 396, 0, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 1041, 409, 868, + 411, 0, 412, 413, 0, 414, 1042, 416, 417, 418, + 419, 420, 0, 869, 870, 0, 0, 423, 424, 871, + 426, 872, 873, 428, 429, 1043, 431, 432, 433, 434, + 435, 0, 0, 436, 437, 438, 439, 440, 875, 0, + 441, 442, 443, 444, 445, 446, 876, 0, 448, 1045, + 450, 451, 452, 453, 0, 0, 454, 0, 0, 455, + 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 877, 0, 0, 0, 0, 0, 0, 878, 879, 0, + 0, 0, 0, 0, 881, 0, 882, 0, 0, 0, + 0, 883, 0, 884, 885, 93, 818, 547, 819, 820, + 821, 822, 823, 0, 0, 0, 0, 0, 0, 0, + 0, 94, 95, 96, 97, 98, 99, 100, 101, 0, + 102, 103, 104, 0, 0, 0, 0, 824, 0, 0, + 105, 106, 0, 107, 108, 109, 110, 111, 112, 113, + 114, 825, 116, 826, 827, 0, 119, 120, 121, 122, + 123, 124, 828, 829, 125, 126, 830, 831, 129, 0, + 130, 131, 132, 133, 832, 0, 833, 0, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 0, 152, 153, 154, 155, + 834, 835, 836, 837, 838, 839, 840, 157, 158, 159, + 160, 161, 162, 163, 841, 842, 166, 843, 167, 0, + 168, 169, 170, 171, 172, 173, 0, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 678, 182, 183, 0, + 184, 185, 186, 0, 187, 188, 189, 0, 190, 191, + 192, 193, 844, 195, 196, 197, 198, 199, 845, 846, + 201, 0, 202, 203, 847, 205, 0, 206, 0, 207, + 208, 0, 209, 210, 211, 212, 213, 214, 0, 215, + 0, 848, 849, 218, 0, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 0, 231, 232, + 233, 234, 235, 236, 0, 237, 238, 239, 240, 241, + 242, 243, 244, 850, 851, 0, 852, 0, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 0, + 0, 259, 260, 261, 262, 0, 263, 264, 265, 853, + 854, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 855, 291, 856, 293, 294, + 295, 296, 857, 297, 298, 299, 300, 858, 859, 302, + 860, 304, 305, 306, 0, 307, 308, 0, 0, 861, + 310, 311, 0, 0, 312, 313, 314, 315, 316, 862, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 0, 328, 329, 863, 331, 332, 333, 334, 335, 336, + 0, 337, 338, 339, 340, 341, 342, 0, 343, 344, + 345, 864, 347, 348, 349, 350, 0, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 0, 364, 365, 366, 367, 368, 369, 865, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 0, + 382, 383, 384, 385, 386, 866, 387, 388, 389, 390, + 391, 392, 393, 394, 867, 396, 0, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, + 868, 411, 0, 412, 413, 0, 414, 415, 416, 417, + 418, 419, 420, 0, 869, 870, 0, 0, 423, 424, + 871, 426, 872, 873, 428, 429, 874, 431, 432, 433, + 434, 435, 0, 0, 436, 437, 438, 439, 440, 875, + 0, 441, 442, 443, 444, 445, 446, 876, 0, 448, + 449, 450, 451, 452, 453, 0, 0, 454, 0, 0, + 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 877, 0, 0, 0, 0, 0, 0, 1407, 1408, + 0, 0, 0, 0, 0, 881, 0, 882, 0, 0, + 0, 0, 883, 0, 884, 885, 93, 1776, 547, 819, + 820, 821, 822, 823, 0, 0, 0, 0, 0, 0, + 0, 0, 94, 95, 96, 97, 98, 99, 100, 101, + 0, 102, 103, 104, 0, 0, 0, 0, 824, 0, + 0, 105, 106, 0, 107, 108, 109, 110, 111, 112, + 113, 114, 825, 116, 826, 827, 0, 119, 120, 121, + 122, 123, 124, 828, 829, 125, 126, 830, 831, 129, + 0, 130, 131, 132, 133, 832, 0, 833, 0, 136, + 137, 138, 139, 140, 141, 142, 143, 144, 145, 0, + 146, 147, 148, 149, 150, 151, 0, 152, 153, 154, + 155, 834, 835, 836, 837, 838, 839, 840, 157, 158, + 159, 160, 161, 162, 163, 841, 842, 166, 843, 167, + 0, 168, 169, 170, 171, 172, 173, 0, 174, 175, + 176, 177, 178, 0, 0, 179, 180, 678, 182, 183, + 0, 184, 185, 186, 0, 187, 188, 189, 0, 190, + 191, 192, 193, 844, 195, 196, 197, 198, 199, 845, + 846, 201, 0, 202, 203, 847, 205, 0, 206, 0, + 207, 208, 0, 209, 210, 211, 212, 213, 214, 0, + 215, 0, 848, 849, 218, 0, 219, 220, 221, 222, + 223, 224, 225, 226, 227, 228, 229, 230, 0, 231, + 232, 233, 234, 235, 236, 0, 237, 238, 239, 240, + 241, 242, 243, 244, 850, 851, 0, 852, 0, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 0, 0, 259, 260, 261, 262, 0, 263, 264, 265, + 853, 854, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 855, 291, 856, 293, + 294, 295, 296, 857, 297, 298, 299, 300, 858, 859, + 302, 860, 304, 305, 306, 0, 307, 308, 0, 0, + 861, 310, 311, 0, 0, 312, 313, 314, 315, 316, + 862, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 0, 328, 329, 863, 331, 332, 333, 334, 335, + 336, 0, 337, 338, 339, 340, 341, 342, 0, 343, + 344, 345, 864, 347, 348, 349, 350, 0, 351, 352, + 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, + 363, 0, 364, 365, 366, 367, 368, 369, 865, 371, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 0, 382, 383, 384, 385, 386, 866, 387, 388, 389, + 390, 391, 392, 393, 394, 867, 396, 0, 397, 398, + 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, + 409, 868, 411, 0, 412, 413, 0, 414, 415, 416, + 417, 418, 419, 420, 0, 869, 870, 0, 0, 423, + 424, 871, 426, 872, 873, 428, 429, 874, 431, 432, + 433, 434, 435, 0, 0, 436, 437, 438, 439, 440, + 875, 0, 441, 442, 443, 444, 445, 446, 876, 0, + 448, 449, 450, 451, 452, 453, 0, 0, 454, 0, + 0, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 877, 0, 0, 0, 0, 0, 0, 878, + 879, 0, 0, 0, 0, 0, 881, 0, 882, 0, + 0, 0, 0, 883, 0, 884, 885, 93, 818, 547, + 819, 820, 821, 822, 823, 0, 0, 0, 0, 0, + 0, 0, 0, 94, 95, 96, 97, 98, 99, 100, + 101, 0, 102, 103, 104, 0, 0, 0, 0, 824, + 0, 0, 105, 106, 0, 107, 108, 109, 110, 111, + 112, 113, 114, 825, 116, 826, 827, 0, 119, 120, + 121, 122, 123, 124, 828, 829, 125, 126, 830, 831, + 129, 0, 130, 131, 132, 133, 832, 0, 833, 0, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 0, 146, 147, 148, 149, 150, 151, 0, 152, 153, + 154, 155, 834, 835, 836, 837, 838, 839, 840, 157, + 158, 159, 160, 161, 162, 163, 841, 842, 166, 843, + 167, 0, 168, 169, 170, 171, 172, 173, 0, 174, + 175, 176, 177, 178, 0, 0, 179, 180, 678, 182, + 183, 0, 184, 185, 186, 0, 187, 188, 189, 0, + 190, 191, 192, 193, 844, 195, 196, 197, 198, 199, + 845, 846, 201, 0, 202, 203, 847, 205, 0, 206, + 0, 207, 208, 0, 209, 210, 211, 212, 213, 214, + 0, 215, 0, 848, 849, 218, 0, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 0, + 231, 232, 233, 234, 235, 236, 0, 237, 238, 239, + 240, 241, 242, 243, 244, 850, 851, 0, 852, 0, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 0, 0, 259, 260, 261, 262, 0, 263, 264, + 265, 853, 854, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, - 293, 0, 294, 295, 296, 297, 0, 855, 299, 300, - 301, 302, 303, 0, 304, 305, 0, 0, 306, 307, - 308, 0, 0, 309, 310, 311, 312, 313, 858, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 0, - 325, 326, 859, 328, 329, 330, 331, 332, 333, 0, - 334, 335, 336, 337, 338, 339, 0, 340, 341, 342, - 343, 344, 345, 346, 347, 0, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 0, - 361, 362, 363, 364, 365, 366, 367, 2061, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 0, 379, - 380, 381, 382, 383, 862, 384, 385, 386, 387, 388, - 389, 390, 391, 392, 393, 0, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 405, 406, 864, - 408, 0, 409, 410, 0, 411, 412, 413, 414, 415, - 416, 417, 0, 418, 419, 0, 0, 420, 421, 867, - 423, 868, 0, 425, 426, 870, 428, 429, 430, 431, - 432, 0, 0, 433, 434, 435, 436, 437, 871, 0, - 438, 439, 440, 441, 442, 443, 444, 0, 445, 446, - 447, 448, 449, 450, 0, 0, 451, 0, 0, 452, - 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, + 283, 284, 285, 286, 287, 288, 289, 855, 291, 856, + 293, 294, 295, 296, 857, 297, 298, 299, 300, 858, + 859, 302, 860, 304, 305, 306, 0, 307, 308, 0, + 0, 861, 310, 311, 0, 0, 312, 313, 314, 315, + 316, 862, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 0, 328, 329, 863, 331, 332, 333, 334, + 335, 336, 0, 337, 338, 339, 340, 341, 342, 0, + 343, 344, 345, 864, 347, 348, 349, 350, 0, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 0, 364, 365, 366, 367, 368, 369, 865, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 0, 382, 383, 384, 385, 386, 866, 387, 388, + 389, 390, 391, 392, 393, 394, 867, 396, 0, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 408, 409, 868, 411, 0, 412, 413, 0, 414, 415, + 416, 417, 418, 419, 420, 0, 869, 870, 0, 0, + 423, 424, 871, 426, 872, 873, 428, 429, 874, 431, + 432, 433, 434, 435, 0, 0, 436, 437, 438, 439, + 440, 875, 0, 441, 442, 443, 444, 445, 446, 876, + 0, 448, 449, 450, 451, 452, 453, 0, 0, 454, + 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 0, 92, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 36, 93, 94, 95, - 96, 97, 98, 99, 100, 0, 101, 102, 103, 0, - 0, 0, 0, 0, 0, 0, 104, 105, 0, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - 117, 0, 118, 119, 120, 121, 122, 123, 0, 825, - 124, 125, 126, 127, 128, 0, 129, 130, 131, 132, - 828, 0, 829, 0, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 151, 152, 153, 154, 830, 831, 832, 833, - 834, 835, 836, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 841, 0, 199, 0, 200, 201, 202, - 203, 0, 204, 0, 205, 206, 0, 207, 208, 209, - 210, 211, 212, 0, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 0, 245, 0, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 0, 0, 256, 257, 258, 259, 0, - 260, 261, 262, 849, 850, 263, 264, 265, 266, 267, + 473, 474, 475, 877, 0, 0, 0, 0, 0, 0, + 878, 879, 0, 0, 0, 0, 0, 881, 0, 2025, + 0, 0, 0, 0, 883, 0, 884, 885, 93, 818, + 547, 819, 820, 821, 822, 823, 0, 0, 0, 0, + 0, 0, 0, 0, 94, 95, 96, 97, 98, 99, + 100, 101, 0, 102, 103, 104, 0, 0, 0, 0, + 824, 0, 0, 105, 106, 0, 107, 108, 109, 110, + 111, 112, 113, 114, 825, 116, 826, 827, 0, 119, + 120, 121, 122, 123, 124, 828, 829, 125, 126, 830, + 831, 129, 0, 130, 131, 132, 133, 832, 0, 833, + 0, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 0, 146, 147, 148, 149, 150, 151, 0, 152, + 153, 2709, 155, 834, 835, 836, 837, 838, 839, 840, + 157, 158, 159, 160, 161, 162, 163, 841, 842, 166, + 843, 167, 0, 168, 169, 170, 171, 172, 173, 0, + 174, 175, 176, 177, 178, 0, 0, 179, 180, 678, + 182, 183, 0, 184, 185, 186, 0, 187, 188, 189, + 0, 190, 191, 192, 193, 844, 195, 196, 197, 198, + 199, 845, 846, 201, 0, 202, 203, 847, 205, 0, + 206, 0, 207, 208, 0, 209, 210, 211, 212, 213, + 214, 0, 215, 0, 2710, 849, 218, 0, 219, 220, + 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, + 0, 231, 232, 233, 234, 235, 236, 0, 237, 238, + 239, 240, 241, 242, 243, 244, 850, 851, 0, 852, + 0, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 0, 0, 259, 260, 261, 262, 0, 263, + 264, 265, 853, 854, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 855, 291, + 856, 293, 294, 295, 296, 857, 297, 298, 299, 300, + 858, 859, 302, 860, 304, 305, 306, 0, 307, 308, + 0, 0, 861, 310, 311, 0, 0, 312, 313, 314, + 315, 316, 862, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 0, 328, 329, 863, 331, 332, 333, + 334, 335, 336, 0, 337, 338, 339, 340, 341, 342, + 0, 343, 344, 345, 864, 347, 348, 349, 350, 0, + 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, + 361, 362, 363, 0, 364, 365, 366, 367, 368, 2711, + 865, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 0, 382, 383, 384, 385, 386, 866, 387, + 388, 389, 390, 391, 392, 393, 394, 867, 396, 0, + 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, + 407, 408, 409, 868, 411, 0, 412, 413, 0, 414, + 415, 416, 417, 418, 419, 420, 0, 869, 870, 0, + 0, 423, 424, 871, 426, 872, 873, 428, 429, 874, + 431, 432, 433, 434, 435, 0, 0, 436, 437, 438, + 439, 440, 875, 0, 441, 442, 443, 444, 445, 446, + 876, 0, 448, 449, 450, 451, 452, 453, 0, 0, + 454, 0, 0, 455, 456, 457, 458, 459, 460, 461, + 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + 472, 473, 474, 475, 877, 0, 0, 0, 0, 0, + 0, 878, 879, 0, 0, 0, 0, 0, 881, 0, + 2713, 0, 0, 0, 0, 883, 0, 884, 885, 93, + 818, 547, 819, 820, 821, 822, 823, 0, 0, 0, + 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 0, 102, 103, 104, 0, 0, 0, + 0, 824, 0, 0, 105, 106, 0, 107, 108, 109, + 110, 111, 112, 113, 2968, 825, 116, 826, 827, 0, + 119, 120, 121, 122, 123, 124, 828, 829, 125, 126, + 830, 831, 129, 0, 130, 131, 132, 133, 832, 0, + 833, 0, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 0, 146, 147, 148, 149, 150, 151, 0, + 152, 153, 154, 2969, 834, 835, 836, 837, 838, 839, + 840, 157, 158, 159, 160, 161, 162, 163, 841, 842, + 166, 843, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 0, 0, 179, 180, + 678, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 844, 195, 196, 197, + 198, 199, 845, 846, 201, 0, 202, 203, 847, 205, + 0, 206, 0, 207, 208, 0, 209, 210, 211, 212, + 213, 214, 0, 215, 0, 848, 849, 218, 0, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 238, 239, 240, 241, 242, 243, 244, 850, 851, 0, + 852, 0, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 260, 261, 262, 0, + 263, 264, 265, 853, 854, 266, 267, 268, 269, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 855, + 291, 856, 293, 294, 295, 296, 857, 297, 298, 299, + 300, 858, 859, 302, 860, 304, 305, 306, 0, 307, + 308, 0, 0, 861, 310, 311, 0, 0, 312, 313, + 314, 315, 316, 862, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 0, 328, 329, 863, 331, 332, + 333, 334, 335, 336, 0, 337, 338, 339, 340, 341, + 342, 0, 343, 344, 345, 864, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 366, 367, 368, + 369, 865, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 0, 382, 383, 384, 385, 386, 866, + 387, 388, 389, 390, 391, 392, 393, 394, 867, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 868, 411, 0, 412, 413, 0, + 414, 415, 416, 417, 418, 419, 420, 0, 869, 870, + 0, 0, 423, 424, 871, 426, 872, 873, 428, 429, + 874, 431, 432, 2970, 434, 435, 0, 0, 436, 437, + 438, 439, 440, 875, 0, 441, 442, 443, 444, 445, + 446, 876, 0, 448, 449, 450, 451, 452, 453, 0, + 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 877, 0, 0, 0, 0, + 0, 0, 878, 879, 0, 0, 0, 0, 0, 881, + 0, 882, 0, 0, 0, 0, 883, 0, 884, 885, + 93, 818, 547, 819, 820, 821, 822, 823, 0, 0, + 0, 0, 0, 0, 0, 0, 94, 95, 96, 97, + 98, 99, 100, 101, 0, 102, 103, 104, 0, 0, + 0, 0, 824, 0, 0, 105, 106, 0, 107, 108, + 109, 110, 111, 112, 113, 114, 825, 116, 826, 827, + 0, 119, 120, 121, 122, 123, 124, 828, 829, 125, + 126, 830, 831, 129, 0, 130, 131, 132, 133, 832, + 0, 833, 0, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 0, 146, 147, 148, 149, 150, 151, + 0, 152, 153, 154, 2969, 834, 835, 836, 837, 838, + 839, 840, 157, 158, 159, 160, 161, 162, 163, 841, + 842, 166, 843, 167, 0, 168, 169, 170, 171, 172, + 173, 0, 174, 175, 176, 177, 178, 0, 0, 179, + 180, 678, 182, 183, 0, 184, 185, 186, 0, 187, + 188, 189, 0, 190, 191, 192, 193, 844, 195, 196, + 197, 198, 199, 845, 846, 201, 0, 202, 203, 847, + 205, 0, 206, 0, 207, 208, 0, 209, 210, 211, + 212, 213, 214, 0, 215, 0, 848, 849, 218, 0, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 0, 231, 232, 233, 234, 235, 236, 0, + 237, 238, 239, 240, 241, 242, 243, 244, 850, 851, + 0, 852, 0, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 0, 0, 259, 260, 261, 262, + 0, 263, 264, 265, 853, 854, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 855, 291, 856, 293, 294, 295, 296, 857, 297, 298, + 299, 300, 858, 859, 302, 860, 304, 305, 306, 0, + 307, 308, 0, 0, 861, 310, 311, 0, 0, 312, + 313, 314, 315, 316, 862, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 0, 328, 329, 863, 331, + 332, 333, 334, 335, 336, 0, 337, 338, 339, 340, + 341, 342, 0, 343, 344, 345, 864, 347, 348, 349, + 350, 0, 351, 352, 353, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 0, 364, 365, 366, 367, + 368, 369, 865, 371, 372, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 0, 382, 383, 384, 385, 386, + 866, 387, 388, 389, 390, 391, 392, 393, 394, 867, + 396, 0, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 409, 868, 411, 0, 412, 413, + 0, 414, 415, 416, 417, 418, 419, 420, 0, 869, + 870, 0, 0, 423, 424, 871, 426, 872, 873, 428, + 429, 874, 431, 432, 2970, 434, 435, 0, 0, 436, + 437, 438, 439, 440, 875, 0, 441, 442, 443, 444, + 445, 446, 876, 0, 448, 449, 450, 451, 452, 453, + 0, 0, 454, 0, 0, 455, 456, 457, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 877, 0, 0, 0, + 0, 0, 0, 878, 879, 0, 0, 0, 0, 0, + 881, 0, 882, 0, 0, 0, 0, 883, 0, 884, + 885, 93, 818, 547, 819, 820, 821, 822, 823, 0, + 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 824, 0, 0, 105, 106, 0, 107, + 108, 109, 110, 111, 112, 113, -1759, 825, 116, 826, + 827, 0, 119, 120, 121, 122, 123, 124, 828, 829, + 125, 126, 830, 831, 129, 0, 130, 131, 132, 133, + 832, 0, 833, 0, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 152, 153, 154, 2969, 834, 835, 836, 837, + 838, 839, 840, 157, 158, 159, 160, 161, 162, 163, + 841, 842, 166, 843, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 678, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 844, 195, + 196, 197, 198, 199, 845, 846, 201, 0, 202, 203, + 847, 205, 0, 206, 0, 207, 208, 0, 209, 210, + 211, 212, -1759, 214, 0, 215, 0, 848, 849, 218, + 0, 219, 220, 221, 222, 223, 224, 225, -1759, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 238, 239, 240, 241, 242, 243, 244, 850, + 851, 0, 852, 0, 248, 0, 0, 251, 252, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 260, 261, + -1759, 0, 263, 264, 265, 853, 854, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 855, 291, 856, 293, 294, 295, 296, 0, 297, + 298, 0, 300, 858, 859, 302, 860, 304, 305, 306, + 0, 307, 308, 0, 0, 861, 310, 311, 0, 0, + 312, 313, 314, 315, 316, 862, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 863, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 864, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 366, + 367, 368, 369, 865, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 866, 387, 388, 389, 390, 391, -1759, 393, 394, + 867, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 868, 411, 0, 412, + 413, 0, 414, 415, 416, 417, 418, 419, 420, 0, + 869, 870, 0, 0, 423, 424, 871, 426, 872, 873, + 428, 429, 874, 431, 432, 2970, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 875, 0, 441, 442, 443, + 444, 445, 446, 876, 0, 448, 449, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, -1759, 0, 0, + 0, 0, 0, 0, 878, 879, 0, 0, 0, 0, + 0, 881, 0, 882, 0, 0, 0, 0, 883, 0, + 884, 885, 93, 818, 547, 819, 820, 821, 822, 823, + 0, 0, 0, 0, 0, 0, 0, 0, 94, 95, + 96, 97, 98, 99, 100, 101, 0, 102, 103, 104, + 0, 0, 0, 0, 0, 0, 0, 105, 106, 0, + 107, 108, 109, 110, 111, 112, 113, 114, 825, 116, + 826, 827, 0, 119, 120, 121, 122, 123, 124, 828, + 829, 125, 126, 830, 831, 129, 0, 130, 131, 132, + 133, 832, 0, 833, 0, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 145, 0, 146, 147, 148, 149, + 150, 151, 0, 152, 153, 154, 155, 834, 835, 836, + 837, 838, 839, 840, 157, 158, 159, 160, 161, 162, + 163, 841, 842, 166, 0, 167, 0, 168, 169, 170, + 171, 172, 173, 0, 174, 175, 176, 177, 178, 0, + 0, 179, 180, 678, 182, 183, 0, 184, 185, 186, + 0, 187, 188, 189, 0, 190, 191, 192, 193, 844, + 195, 196, 197, 198, 199, 845, 846, 201, 0, 202, + 203, 847, 205, 0, 206, 0, 207, 208, 0, 209, + 210, 211, 212, 213, 214, 0, 215, 0, 848, 849, + 218, 0, 219, 220, 221, 222, 223, 224, 225, 226, + 227, 228, 229, 230, 0, 231, 232, 233, 234, 235, + 236, 0, 237, 238, 239, 240, 241, 242, 243, 244, + 850, 851, 0, 852, 0, 248, 249, 250, 251, 252, + 253, 254, 255, 256, 257, 258, 0, 0, 259, 260, + 261, 262, 0, 263, 264, 265, 853, 854, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, 292, 293, 0, 294, 295, 296, - 297, 0, 855, 299, 300, 301, 302, 303, 0, 304, - 305, 0, 0, 306, 307, 308, 0, 0, 309, 310, - 311, 312, 313, 858, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 859, 328, 329, - 330, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 343, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 363, 364, 365, + 288, 289, 855, 291, 856, 293, 294, 295, 296, 0, + 297, 298, 299, 300, 858, 859, 302, 860, 304, 305, + 306, 0, 307, 308, 0, 0, 861, 310, 311, 0, + 0, 312, 313, 314, 315, 316, 862, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 0, 328, 329, + 863, 331, 332, 333, 334, 335, 336, 0, 337, 338, + 339, 340, 341, 342, 0, 343, 344, 345, 864, 347, + 348, 349, 350, 0, 351, 352, 353, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 0, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 862, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 405, 406, 864, 408, 0, 409, 410, 0, - 411, 412, 413, 414, 415, 416, 417, 0, 418, 419, - 0, 0, 420, 421, 867, 423, 868, 0, 425, 426, - 870, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 871, 0, 438, 439, 440, 441, 442, - 443, 444, 0, 445, 446, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, + 376, 377, 378, 379, 380, 381, 0, 382, 383, 384, + 385, 386, 866, 387, 388, 389, 390, 391, 392, 393, + 394, 867, 396, 0, 397, 398, 399, 400, 401, 402, + 403, 404, 405, 406, 407, 408, 409, 868, 411, 0, + 412, 413, 0, 414, 415, 416, 417, 418, 419, 420, + 0, 869, 870, 0, 0, 423, 424, 871, 426, 872, + 873, 428, 429, 874, 431, 432, 433, 434, 435, 0, + 0, 436, 437, 438, 439, 440, 875, 0, 441, 442, + 443, 444, 445, 446, 876, 0, 448, 449, 450, 451, + 452, 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 0, 742, 1232, 547, 0, - 0, 0, 818, 0, 0, 0, 0, 0, 0, 0, - 0, 2702, 93, 94, 95, 96, 97, 98, 99, 100, - 0, 101, 102, 103, 0, 0, 0, 0, 0, 0, - 0, 104, 105, 0, 106, 107, 108, 0, 110, 111, - 112, 743, 744, 0, 745, 746, 0, 118, 119, 120, - 121, 122, 123, 0, 0, 124, 125, 747, 748, 128, - 0, 129, 130, 131, 132, 749, 0, 0, 0, 135, - 136, 137, 138, 139, 140, 0, 142, 143, 144, 0, - 145, 146, 147, 148, 149, 150, 0, 0, 152, 153, - 154, 0, 0, 0, 0, 0, 0, 0, 156, 157, - 158, 159, 160, 161, 162, 750, 751, 165, 0, 166, - 0, 167, 168, 169, 170, 171, 172, 0, 173, 174, - 175, 176, 177, 0, 0, 178, 179, 180, 181, 182, - 0, 183, 184, 185, 0, 186, 187, 188, 0, 189, - 190, 191, 192, 752, 194, 195, 196, 197, 753, 1233, - 199, 0, 200, 201, 754, 203, 0, 204, 0, 205, - 0, 0, 0, 208, 209, 210, 0, 212, 0, 213, - 0, 755, 756, 216, 0, 217, 218, 219, 220, 221, - 222, 223, 0, 225, 226, 227, 228, 0, 229, 230, - 231, 232, 233, 234, 0, 235, 0, 757, 238, 239, - 240, 241, 242, 758, 759, 0, 760, 0, 246, 0, - 0, 249, 0, 251, 252, 253, 254, 255, 0, 0, - 256, 0, 258, 0, 0, 260, 261, 262, 0, 0, - 263, 264, 265, 266, 267, 761, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 762, 0, 763, 290, 291, 292, - 764, 0, 294, 295, 0, 297, 0, 765, 299, 766, - 301, 302, 303, 0, 304, 305, 1234, 0, 306, 307, - 308, 0, 0, 309, 767, 0, 312, 0, 768, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 0, - 325, 326, 769, 328, 329, 770, 331, 332, 333, 0, - 334, 335, 336, 337, 338, 339, 0, 340, 341, 342, - 771, 344, 345, 346, 347, 0, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 0, - 361, 362, 0, 364, 365, 366, 772, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 0, 379, - 380, 381, 382, 383, 0, 384, 773, 386, 387, 388, - 0, 390, 391, 774, 393, 0, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 775, 406, 776, - 408, 0, 409, 410, 0, 411, 0, 413, 414, 415, - 416, 417, 0, 777, 778, 0, 0, 420, 421, 779, - 423, 780, 1235, 425, 426, 781, 428, 429, 430, 431, - 432, 0, 0, 433, 434, 435, 436, 437, 0, 0, - 438, 439, 440, 441, 442, 1125, 783, 0, 445, 0, - 447, 448, 449, 450, 0, 0, 451, 0, 0, 452, - 453, 454, 455, 456, 457, 784, 785, 786, 787, 788, - 789, 790, 791, 792, 793, 794, 469, 470, 471, 472, - 0, 742, 0, 0, 0, 0, 0, 1236, 1237, 1940, - 0, 0, 0, 0, 0, 0, 1941, 93, 94, 95, - 96, 97, 98, 99, 100, 0, 101, 102, 103, 3, - 4, 0, 0, 0, 0, 0, 104, 105, 0, 106, - 107, 108, 0, 110, 111, 112, 743, 744, 0, 745, - 746, 0, 118, 119, 120, 121, 122, 123, 0, 0, - 124, 125, 747, 748, 128, 0, 129, 130, 131, 132, - 749, 0, 0, 0, 135, 136, 137, 138, 139, 140, - 0, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 0, 152, 153, 154, 0, 0, 0, 0, - 0, 0, 0, 156, 157, 158, 159, 160, 161, 162, - 750, 751, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 752, 194, - 195, 196, 197, 753, 0, 199, 0, 200, 201, 754, - 203, 0, 204, 0, 205, 0, 0, 0, 208, 209, - 210, 0, 212, 0, 213, 0, 755, 756, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 0, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 0, 757, 238, 239, 240, 241, 242, 758, 759, - 0, 760, 0, 246, 0, 0, 249, 0, 251, 252, - 253, 254, 255, 0, 0, 256, 0, 258, 0, 0, - 260, 261, 262, 0, 0, 263, 264, 265, 266, 267, - 761, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 762, - 0, 763, 290, 291, 292, 764, 0, 294, 295, 0, - 297, 0, 765, 299, 766, 301, 302, 303, 0, 304, - 305, 0, 0, 306, 307, 308, 0, 0, 309, 767, - 0, 312, 0, 768, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 769, 328, 329, - 770, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 771, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 0, 364, 365, - 366, 772, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 26, 379, 380, 381, 382, 383, 0, - 384, 773, 386, 387, 388, 0, 390, 391, 774, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 775, 406, 776, 408, 0, 409, 410, 31, - 411, 0, 413, 414, 415, 416, 417, 0, 777, 778, - 0, 0, 420, 421, 779, 423, 780, 0, 425, 426, - 781, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 0, 0, 438, 439, 440, 441, 442, - 782, 783, 0, 445, 0, 447, 448, 449, 450, 0, - 0, 451, 0, 34, 452, 453, 454, 455, 456, 457, - 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, - 794, 469, 470, 471, 472, 0, 498, 35, 0, 0, + 468, 469, 470, 471, 472, 473, 474, 475, 0, 0, + 0, 0, 0, 0, 0, 1639, 1640, 0, 0, 93, + 818, 547, 819, 820, 1641, 822, 823, 0, 0, 0, + 0, 884, 885, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 0, 102, 103, 104, 0, 0, 0, + 0, 0, 0, 0, 105, 106, 0, 107, 108, 109, + 110, 111, 112, 113, 114, 825, 116, 826, 827, 0, + 119, 120, 121, 122, 123, 124, 828, 829, 125, 126, + 830, 831, 129, 0, 130, 131, 132, 133, 832, 0, + 833, 0, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 0, 146, 147, 148, 149, 150, 151, 0, + 152, 153, 154, 155, 834, 835, 836, 837, 838, 839, + 840, 157, 158, 159, 160, 161, 162, 163, 841, 842, + 166, 0, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 0, 0, 179, 180, + 678, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 844, 195, 196, 197, + 198, 199, 845, 846, 201, 0, 202, 203, 847, 205, + 0, 206, 0, 207, 208, 0, 209, 210, 211, 212, + 213, 214, 0, 215, 0, 848, 849, 218, 0, 219, + 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 238, 239, 240, 241, 242, 243, 244, 850, 851, 0, + 852, 0, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 260, 261, 262, 0, + 263, 264, 265, 853, 854, 266, 267, 268, 269, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 855, + 291, 856, 293, 294, 295, 296, 0, 297, 298, 299, + 300, 858, 859, 302, 860, 304, 305, 306, 0, 307, + 308, 0, 0, 309, 310, 311, 0, 0, 312, 313, + 314, 315, 316, 862, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 0, 328, 329, 863, 331, 332, + 333, 334, 335, 336, 0, 337, 338, 339, 340, 341, + 342, 0, 343, 344, 345, 864, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 366, 367, 368, + 369, 1762, 1763, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 0, 382, 383, 384, 385, 386, 866, + 387, 388, 389, 390, 391, 392, 393, 394, 867, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 408, 409, 868, 411, 0, 412, 413, 0, + 414, 415, 416, 417, 418, 419, 420, 0, 869, 870, + 0, 0, 423, 424, 871, 426, 872, 873, 428, 429, + 874, 431, 432, 433, 434, 435, 0, 0, 436, 437, + 438, 439, 440, 875, 0, 441, 442, 443, 444, 445, + 446, 876, 0, 448, 449, 450, 451, 452, 453, 0, + 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 0, 0, 0, 0, 0, + 0, 0, 1764, 1765, 0, 0, 0, 0, 0, 0, + 0, 1641, 0, 0, 0, 0, 0, 0, 884, 885, + 93, 818, 547, 819, 820, 821, 822, 823, 0, 0, + 0, 0, 0, 0, 0, 0, 94, 95, 96, 97, + 98, 99, 100, 101, 0, 102, 103, 104, 0, 0, + 0, 0, 0, 0, 0, 105, 106, 0, 107, 108, + 109, 110, 111, 112, 113, 114, 825, 116, 826, 827, + 0, 119, 120, 121, 122, 123, 124, 828, 829, 125, + 126, 830, 831, 129, 0, 130, 131, 132, 133, 832, + 0, 833, 0, 136, 137, 138, 139, 140, 141, 142, + 143, 144, 145, 0, 146, 147, 148, 149, 150, 151, + 0, 152, 153, 154, 155, 834, 835, 836, 837, 838, + 839, 840, 157, 158, 159, 160, 161, 162, 163, 841, + 842, 166, 0, 167, 0, 168, 169, 170, 171, 172, + 173, 0, 174, 175, 176, 177, 178, 0, 0, 179, + 180, 678, 182, 183, 0, 184, 185, 186, 0, 187, + 188, 189, 0, 190, 191, 192, 193, 844, 195, 196, + 197, 198, 199, 845, 846, 201, 0, 202, 203, 847, + 205, 0, 206, 0, 207, 208, 0, 209, 210, 211, + 212, 213, 214, 0, 215, 0, 848, 849, 218, 0, + 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, + 229, 230, 0, 231, 232, 233, 234, 235, 236, 0, + 237, 238, 239, 240, 241, 242, 243, 244, 850, 851, + 0, 852, 0, 248, 0, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 0, 0, 259, 260, 261, 262, + 0, 263, 264, 265, 853, 854, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 855, 291, 856, 293, 294, 295, 296, 0, 297, 298, + 299, 300, 858, 859, 302, 860, 304, 305, 306, 0, + 307, 308, 0, 0, 861, 310, 311, 0, 0, 312, + 313, 314, 315, 316, 862, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 0, 328, 329, 863, 331, + 332, 333, 334, 335, 336, 0, 337, 338, 339, 340, + 341, 342, 0, 343, 344, 345, 864, 347, 348, 349, + 350, 0, 351, 352, 353, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 0, 364, 365, 366, 367, + 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 0, 382, 383, 384, 385, 386, + 866, 387, 388, 389, 390, 391, 392, 393, 394, 867, + 396, 0, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 409, 868, 411, 0, 412, 413, + 0, 414, 415, 416, 417, 418, 419, 420, 0, 869, + 870, 0, 0, 423, 424, 871, 426, 872, 873, 428, + 429, 874, 431, 432, 433, 434, 435, 0, 0, 436, + 437, 438, 439, 440, 875, 0, 441, 442, 443, 444, + 445, 446, 876, 0, 448, 449, 450, 451, 452, 453, + 0, 0, 454, 0, 0, 455, 456, 457, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 0, 0, 0, 0, + 0, 0, 0, 1639, 1640, 0, 0, 0, 0, 0, + 0, 0, 1641, 0, 0, 0, 0, 0, 0, 884, + 885, 93, 818, 547, 819, 820, 821, 822, 823, 0, + 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 824, 0, 0, 105, 106, 0, 107, + 108, 109, 110, 111, 112, 113, 0, 825, 116, 826, + 827, 0, 119, 120, 121, 122, 123, 124, 828, 829, + 125, 126, 830, 831, 129, 0, 130, 131, 132, 133, + 832, 0, 833, 0, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 152, 153, 154, 155, 834, 835, 836, 837, + 838, 839, 840, 157, 158, 159, 160, 161, 162, 163, + 841, 842, 166, 843, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 678, 182, 183, 0, 184, 185, 186, 0, + 187, 0, 189, 0, 190, 191, 192, 193, 844, 195, + 196, 197, 198, 199, 845, 846, 201, 0, 202, 203, + 847, 205, 0, 206, 0, 207, 208, 0, 209, 210, + 211, 212, 0, 214, 0, 215, 0, 848, 849, 218, + 0, 219, 220, 221, 222, 223, 224, 225, 0, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 238, 239, 240, 241, 242, 243, 244, 850, + 851, 0, 852, 0, 248, 0, 0, 251, 252, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 260, 261, + 0, 0, 263, 264, 265, 853, 854, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 855, 291, 856, 293, 294, 295, 296, 0, 297, + 298, 0, 300, 858, 859, 302, 860, 304, 305, 306, + 0, 307, 308, 0, 0, 861, 310, 311, 0, 0, + 312, 313, 314, 315, 316, 862, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 863, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 864, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 366, + 367, 368, 369, 865, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 866, 387, 388, 389, 390, 391, 0, 393, 394, + 867, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 868, 411, 0, 412, + 413, 0, 414, 415, 416, 417, 418, 419, 420, 0, + 869, 870, 0, 0, 423, 424, 871, 426, 872, 873, + 428, 429, 874, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 875, 0, 441, 442, 443, + 444, 445, 446, 876, 0, 448, 449, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 0, 0, 0, + 0, 0, 0, 0, 878, 879, 498, 0, 0, 0, + 0, 881, 0, 882, 0, 0, 0, 0, 883, 0, + 884, 885, 94, 95, 96, 97, 98, 99, 100, 101, + 0, 102, 103, 104, 0, 0, 0, 0, 0, 2330, + 0, 105, 106, 0, 107, 108, 109, 0, 111, 112, + 113, 114, 115, 0, 117, 118, 0, 119, 120, 121, + 122, 123, 124, 0, 0, 125, 126, 127, 128, 129, + 0, 130, 131, 132, 133, 134, 0, 0, 0, 136, + 137, 138, 139, 140, 141, 0, 143, 144, 145, 0, + 146, 147, 148, 149, 150, 151, 0, -248, 153, 154, + 155, 0, 0, 0, 0, 0, 0, 0, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 0, 167, + 0, 168, 169, 170, 171, 172, 173, 0, 174, 175, + 176, 177, 178, 0, 0, 179, 180, 181, 182, 183, + 0, 184, 185, 186, 0, 187, 188, 189, 0, 190, + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, + 0, 201, 0, 202, 203, 204, 205, 0, 206, 0, + 207, 0, 0, -248, 210, 211, 212, 0, 214, 0, + 215, 0, 216, 217, 218, 0, 219, 220, 221, 222, + 223, 224, 225, 0, 227, 228, 229, 230, 0, 231, + 232, 233, 234, 235, 236, 0, 237, -248, 239, 240, + 241, 242, 243, 244, 245, 246, 0, 247, 0, 248, + 0, 0, 251, -248, 253, 254, 255, 256, 257, 258, + 0, 0, 259, -248, 261, 0, 0, 263, 264, 265, + 0, 0, 266, 267, 268, 269, 270, 500, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, -248, 292, 293, + 294, 295, 296, 0, 297, 298, 0, 300, 0, 301, + 302, 303, 304, 305, 306, 0, 307, 308, 0, 0, + 309, 310, 311, 0, 0, 312, 313, 0, 315, 0, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 0, 328, 329, 330, 331, 332, 333, 334, 335, + 336, 0, 337, 338, 339, 340, 341, 342, 0, 343, + 344, 345, 346, 347, 348, 349, 350, 0, 351, 352, + 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, + 363, 0, 364, 365, -248, 367, 368, 369, 370, 371, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 0, 382, 383, 384, 385, 386, 0, 387, 388, 389, + 390, 391, 0, 393, 394, 395, 396, 0, 397, 398, + 399, 400, 401, 402, 403, 404, 405, 406, 407, 502, + 409, 410, 411, 0, 412, 413, 0, 414, -248, 416, + 417, 418, 419, 420, 0, 421, 422, 0, 0, 423, + 424, 425, 426, 427, 0, 428, 429, 430, 431, 432, + 433, 434, 435, 0, 0, 436, 437, 438, 439, 440, + 0, 0, 441, 442, 443, 444, 445, 446, 447, 0, + 448, 0, 450, 451, 452, 453, 0, 0, 454, 0, + 0, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 0, 0, 93, 0, 579, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 947, + 94, 95, 96, 97, 98, 99, 100, 101, 0, 102, + 103, 104, 0, 0, 0, 0, 0, 0, 0, 105, + 106, 0, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 0, 119, 120, 121, 122, 123, + 124, 0, 829, 125, 126, 127, 128, 129, 0, 130, + 131, 132, 133, 832, 0, 833, 0, 136, 137, 138, + 139, 140, 141, 142, 143, 144, 145, 0, 146, 147, + 148, 149, 150, 151, 0, 152, 153, 154, 155, 834, + 835, 836, 837, 838, 839, 840, 157, 158, 159, 160, + 161, 162, 163, 164, 165, 166, 0, 167, 0, 168, + 169, 170, 171, 172, 173, 0, 174, 175, 176, 177, + 178, 0, 0, 179, 180, 181, 182, 183, 0, 184, + 185, 186, 0, 187, 188, 189, 0, 190, 191, 192, + 193, 194, 195, 196, 197, 198, 199, 845, 0, 201, + 0, 202, 203, 204, 205, 0, 206, 0, 207, 208, + 0, 209, 210, 211, 212, 213, 214, 0, 215, 0, + 216, 217, 218, 0, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 0, 231, 232, 233, + 234, 235, 236, 0, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 0, 247, 0, 248, 249, 250, + 251, 252, 253, 254, 255, 256, 257, 258, 2071, 0, + 259, 260, 261, 262, 0, 263, 264, 265, 853, 854, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, + 296, 0, 297, 298, 299, 300, 0, 859, 302, 303, + 304, 305, 306, 0, 307, 308, 0, 580, 309, 310, + 311, 0, 0, 312, 313, 314, 315, 316, 862, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 0, + 328, 329, 863, 331, 332, 333, 334, 335, 336, 0, + 337, 338, 339, 340, 341, 342, 0, 343, 344, 345, + 346, 347, 348, 349, 350, 0, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 0, + 364, 365, 366, 367, 368, 369, 370, 2072, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 26, 382, + 383, 384, 385, 386, 866, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 0, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 868, + 411, 0, 412, 413, 31, 414, 415, 416, 417, 418, + 419, 420, 0, 421, 422, 0, 0, 423, 424, 871, + 426, 872, 0, 428, 429, 874, 431, 432, 433, 434, + 435, 0, 0, 436, 437, 438, 439, 440, 875, 0, + 441, 442, 443, 444, 445, 575, 447, 0, 448, 449, + 450, 451, 452, 453, 0, 0, 454, 0, 34, 455, + 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 0, 93, 35, 579, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 2073, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 0, 0, 0, 105, 106, 0, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 0, 119, 120, 121, 122, 123, 124, 0, 829, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 133, + 832, 0, 833, 0, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 152, 153, 154, 155, 834, 835, 836, 837, + 838, 839, 840, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 0, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 181, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 845, 0, 201, 0, 202, 203, + 204, 205, 0, 206, 0, 207, 208, 0, 209, 210, + 211, 212, 213, 214, 0, 215, 0, 216, 217, 218, + 0, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 0, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 2071, 0, 259, 260, 261, + 262, 0, 263, 264, 265, 853, 854, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 0, 297, + 298, 299, 300, 0, 859, 302, 303, 304, 305, 306, + 0, 307, 308, 0, 580, 309, 310, 311, 0, 0, + 312, 313, 314, 315, 316, 862, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 863, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 346, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 366, + 367, 368, 369, 370, 2072, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 866, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 868, 411, 0, 412, + 413, 0, 414, 415, 416, 417, 418, 419, 420, 0, + 421, 422, 0, 0, 423, 424, 871, 426, 872, 0, + 428, 429, 874, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 875, 0, 441, 442, 443, + 444, 445, 446, 447, 0, 448, 449, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 0, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 36, 93, 94, 95, 96, 97, 98, 99, 100, - 613, 101, 102, 103, 0, 0, 0, 0, 0, 0, - 0, 104, 105, 0, 106, 107, 108, 0, 110, 111, - 112, 113, 114, 0, 116, 117, 0, 118, 119, 120, - 121, 122, 123, 0, 0, 124, 125, 126, 127, 128, - 0, 129, 130, 131, 132, 133, 0, 0, 0, 135, - 136, 137, 138, 139, 140, 0, 142, 143, 144, 0, - 145, 146, 147, 148, 149, 150, 0, 0, 152, 153, - 154, 0, 0, 0, 0, 0, 0, 0, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 0, 166, - 0, 167, 168, 169, 170, 171, 172, 0, 173, 174, - 175, 176, 177, 0, 0, 178, 179, 180, 181, 182, - 0, 183, 184, 185, 0, 186, 187, 188, 0, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 0, - 199, 0, 200, 201, 202, 203, 0, 204, 0, 205, - 0, 0, 0, 208, 209, 210, 0, 212, 0, 213, - 0, 214, 215, 216, 0, 217, 218, 219, 220, 221, - 222, 223, 0, 225, 226, 227, 228, 0, 229, 230, - 231, 232, 233, 234, 0, 235, 0, 237, 238, 239, - 240, 241, 242, 243, 244, 0, 245, 0, 246, 0, - 0, 249, 0, 251, 252, 253, 254, 255, 0, 0, - 256, 0, 258, 0, 0, 260, 261, 262, 0, 0, - 263, 264, 265, 266, 267, 500, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 0, 289, 290, 291, 292, - 293, 0, 294, 295, 0, 297, 0, 298, 299, 300, - 301, 302, 303, 0, 304, 305, 0, 0, 306, 307, - 308, 0, 0, 309, 310, 0, 312, 0, 314, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 0, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 0, - 334, 335, 336, 337, 338, 339, 0, 340, 341, 342, - 343, 344, 345, 346, 347, 0, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 0, - 361, 362, 0, 364, 365, 366, 367, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 26, 379, - 380, 381, 382, 383, 0, 384, 385, 386, 387, 388, - 0, 390, 391, 392, 393, 0, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 502, 406, 407, - 408, 0, 409, 410, 31, 411, 0, 413, 414, 415, - 416, 417, 0, 614, 419, 0, 0, 615, 421, 422, - 423, 424, 0, 425, 426, 427, 428, 429, 430, 431, - 432, 0, 0, 433, 434, 435, 436, 437, 0, 0, - 438, 439, 440, 441, 442, 575, 444, 0, 445, 0, - 447, 448, 449, 450, 0, 0, 451, 0, 34, 452, - 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, - 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 0, 498, 35, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 36, 93, 94, 95, - 96, 97, 98, 99, 100, 0, 101, 102, 103, 0, - 0, 0, 0, 0, 0, 0, 104, 105, 0, 106, - 107, 108, 0, 110, 111, 112, 113, 114, 0, 116, - 117, 0, 118, 119, 120, 121, 122, 123, 0, 0, - 124, 125, 126, 127, 128, 0, 129, 130, 131, 132, - 133, 0, 0, 0, 135, 136, 137, 138, 139, 140, - 0, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 0, 152, 153, 154, 0, 0, 0, 0, - 0, 0, 0, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 0, 199, 0, 200, 201, 202, - 203, 0, 204, 0, 205, 0, 0, 0, 208, 209, - 210, 0, 212, 0, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 0, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 0, 237, 238, 239, 240, 241, 242, 243, 244, - 0, 245, 0, 246, 0, 0, 249, 0, 251, 252, - 253, 254, 255, 0, 0, 256, 0, 258, 0, 0, - 260, 261, 262, 0, 0, 263, 264, 265, 266, 267, - 500, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 0, 289, 290, 291, 292, 293, 0, 294, 295, 0, - 297, 0, 298, 299, 300, 301, 302, 303, 0, 304, - 305, 0, 0, 306, 307, 308, 0, 0, 309, 310, - 0, 312, 0, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 343, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 0, 364, 365, - 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 26, 379, 380, 381, 382, 383, 0, - 384, 385, 386, 387, 388, 0, 390, 391, 392, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 502, 406, 407, 408, 0, 409, 410, 31, - 411, 0, 413, 414, 415, 416, 417, 0, 418, 419, - 0, 0, 420, 421, 422, 423, 424, 0, 425, 426, - 427, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 0, 0, 438, 439, 440, 441, 442, - 575, 444, 0, 445, 0, 447, 448, 449, 450, 0, - 0, 451, 0, 34, 452, 453, 454, 455, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 0, 498, 35, 579, 0, + 0, 0, 0, 2073, 94, 95, 96, 97, 98, 99, + 100, 101, 0, 102, 103, 104, 0, 0, 0, 0, + 0, 0, 0, 105, 106, 0, 107, 108, 109, 110, + 111, 112, 113, 114, 115, 116, 117, 118, 0, 119, + 120, 121, 122, 123, 124, 0, 829, 125, 126, 127, + 128, 129, 0, 130, 131, 132, 133, 832, 0, 833, + 0, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 0, 146, 147, 148, 149, 150, 151, 0, 152, + 153, 154, 155, 834, 835, 836, 837, 838, 839, 840, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 0, 167, 0, 168, 169, 170, 171, 172, 173, 0, + 174, 175, 176, 177, 178, 0, 0, 179, 180, 181, + 182, 183, 0, 184, 185, 186, 0, 187, 188, 189, + 0, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 845, 0, 201, 0, 202, 203, 204, 205, 0, + 206, 0, 207, 208, 0, 209, 210, 211, 212, 213, + 214, 0, 215, 0, 216, 217, 218, 0, 219, 220, + 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, + 0, 231, 232, 233, 234, 235, 236, 0, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 0, 247, + 0, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 0, 0, 259, 260, 261, 262, 0, 263, + 264, 265, 853, 854, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, + 292, 293, 294, 295, 296, 0, 297, 298, 299, 300, + 0, 859, 302, 303, 304, 305, 306, 0, 307, 308, + 0, 0, 309, 310, 311, 0, 0, 312, 313, 314, + 315, 316, 862, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 0, 328, 329, 863, 331, 332, 333, + 334, 335, 336, 0, 337, 338, 339, 340, 341, 342, + 0, 343, 344, 345, 346, 347, 348, 349, 350, 0, + 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, + 361, 362, 363, 0, 364, 365, 366, 367, 368, 369, + 370, 2072, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 0, 382, 383, 384, 385, 386, 866, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 0, + 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, + 407, 408, 409, 868, 411, 0, 412, 413, 0, 414, + 415, 416, 417, 418, 419, 420, 0, 421, 422, 0, + 0, 423, 424, 871, 426, 872, 0, 428, 429, 874, + 431, 432, 433, 434, 435, 0, 0, 436, 437, 438, + 439, 440, 875, 0, 441, 442, 443, 444, 445, 446, + 447, 0, 448, 449, 450, 451, 452, 453, 0, 0, + 454, 0, 0, 455, 456, 457, 458, 459, 460, 461, + 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + 472, 473, 474, 475, 0, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 36, 93, 94, 95, 96, 97, 98, 99, 100, - 0, 101, 102, 103, 0, 0, 0, 0, 0, 0, - 0, 104, 105, 0, 106, 107, 108, 0, 110, 111, - 112, 113, 114, 0, 116, 117, 0, 118, 119, 120, - 121, 122, 123, 0, 0, 124, 125, 126, 127, 128, - 0, 129, 130, 131, 132, 133, 0, 0, 0, 135, - 136, 137, 138, 139, 140, 0, 142, 143, 144, 0, - 145, 146, 147, 148, 149, 150, 0, 0, 152, 153, - 154, 0, 0, 0, 0, 0, 0, 0, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 0, 166, - 0, 167, 168, 169, 170, 171, 172, 0, 173, 174, - 175, 176, 177, 0, 0, 178, 179, 180, 181, 182, - 0, 183, 184, 185, 0, 186, 187, 188, 0, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 0, - 199, 0, 200, 201, 202, 203, 0, 204, 0, 205, - 0, 0, 0, 208, 209, 210, 0, 212, 0, 213, - 0, 214, 215, 216, 0, 217, 218, 219, 220, 221, - 222, 223, 0, 225, 226, 227, 228, 0, 229, 230, - 231, 232, 233, 234, 0, 235, 0, 237, 238, 239, - 240, 241, 242, 243, 244, 0, 245, 0, 246, 0, - 0, 249, 0, 251, 252, 253, 254, 255, 0, 0, - 256, 0, 258, 0, 0, 260, 261, 262, 0, 0, - 263, 264, 265, 266, 267, 500, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 0, 289, 290, 291, 292, - 293, 0, 294, 295, 0, 297, 0, 298, 299, 300, - 301, 302, 303, 0, 304, 305, 0, 0, 306, 307, - 308, 0, 0, 309, 310, 0, 312, 0, 314, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 0, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 0, - 334, 335, 336, 337, 338, 339, 0, 340, 341, 342, - 343, 344, 345, 346, 347, 0, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 0, - 361, 362, 0, 364, 365, 366, 367, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 0, 379, - 380, 381, 382, 383, 0, 384, 385, 386, 387, 388, - 0, 390, 391, 392, 393, 0, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 502, 406, 407, - 408, 0, 409, 410, 0, 411, 0, 413, 414, 415, - 416, 417, 0, 418, 419, 0, 0, 420, 421, 422, - 423, 424, 0, 425, 426, 427, 428, 429, 430, 431, - 432, 0, 0, 433, 434, 435, 436, 437, 0, 0, - 438, 439, 440, 441, 442, 443, 444, 0, 445, 0, - 447, 448, 449, 450, 0, 0, 451, 0, 0, 452, - 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, - 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 0, 498, 0, 579, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 921, 93, 94, 95, - 96, 97, 98, 99, 100, 0, 101, 102, 103, 0, - 0, 0, 0, 0, 0, 0, 104, 105, 0, 106, - 107, 108, 0, 110, 111, 112, 113, 114, 0, 116, - 117, 0, 118, 119, 120, 121, 122, 123, 0, 0, - 124, 125, 126, 127, 128, 0, 129, 130, 131, 132, - 133, 0, 0, 0, 135, 136, 137, 138, 139, 140, - 0, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 0, 152, 153, 154, 0, 0, 0, 0, - 0, 0, 0, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 0, 199, 0, 200, 201, 202, - 203, 0, 204, 0, 205, 0, 0, 0, 208, 209, - 210, 0, 212, 0, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 0, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 0, 237, 238, 239, 240, 241, 242, 243, 244, - 0, 245, 0, 246, 0, 0, 249, 0, 251, 252, - 253, 254, 255, 0, 0, 256, 0, 258, 0, 0, - 260, 261, 262, 0, 0, 263, 264, 265, 266, 267, - 500, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 36, 94, 95, 96, 97, 98, 99, 100, 101, 0, + 102, 103, 104, 0, 0, 0, 0, 0, 0, 0, + 105, 106, 0, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 0, 119, 120, 121, 122, + 123, 124, 0, 829, 125, 126, 127, 128, 129, 0, + 130, 131, 132, 133, 832, 0, 833, 0, 136, 137, + 138, 139, 140, 141, 142, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 0, 152, 153, 154, 155, + 834, 835, 836, 837, 838, 839, 840, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 0, 167, 0, + 168, 169, 170, 171, 172, 173, 0, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 181, 182, 183, 0, + 184, 185, 186, 0, 187, 188, 189, 0, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 845, 0, + 201, 0, 202, 203, 204, 205, 0, 206, 0, 207, + 208, 0, 209, 210, 211, 212, 213, 214, 0, 215, + 0, 216, 217, 218, 0, 219, 220, 221, 222, 223, + 224, 225, 226, 227, 228, 229, 230, 0, 231, 232, + 233, 234, 235, 236, 0, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 0, 247, 0, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 0, + 0, 259, 260, 261, 262, 0, 263, 264, 265, 853, + 854, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, + 295, 296, 0, 297, 298, 299, 300, 0, 859, 302, + 303, 304, 305, 306, 0, 307, 308, 0, 0, 309, + 310, 311, 0, 0, 312, 313, 314, 315, 316, 862, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 0, 328, 329, 863, 331, 332, 333, 334, 335, 336, + 0, 337, 338, 339, 340, 341, 342, 0, 343, 344, + 345, 346, 347, 348, 349, 350, 0, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 0, 364, 365, 366, 367, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 0, + 382, 383, 384, 385, 386, 866, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 0, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, + 868, 411, 0, 412, 413, 0, 414, 415, 416, 417, + 418, 419, 420, 0, 421, 422, 0, 0, 423, 424, + 871, 426, 872, 0, 428, 429, 874, 431, 432, 433, + 434, 435, 0, 0, 436, 437, 438, 439, 440, 875, + 0, 441, 442, 443, 444, 445, 446, 447, 0, 448, + 449, 450, 451, 452, 453, 0, 0, 454, 0, 0, + 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 0, 746, 1238, 547, 0, 0, 0, 822, 0, + 0, 0, 0, 0, 0, 0, 0, 2731, 94, 95, + 96, 97, 98, 99, 100, 101, 0, 102, 103, 104, + 0, 0, 0, 0, 0, 0, 0, 105, 106, 0, + 107, 108, 109, 0, 111, 112, 113, 747, 748, 0, + 749, 750, 0, 119, 120, 121, 122, 123, 124, 0, + 0, 125, 126, 751, 752, 129, 0, 130, 131, 132, + 133, 753, 0, 0, 0, 136, 137, 138, 139, 140, + 141, 0, 143, 144, 145, 0, 146, 147, 148, 149, + 150, 151, 0, 0, 153, 154, 155, 0, 0, 0, + 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, + 163, 754, 755, 166, 0, 167, 0, 168, 169, 170, + 171, 172, 173, 0, 174, 175, 176, 177, 178, 0, + 0, 179, 180, 181, 182, 183, 0, 184, 185, 186, + 0, 187, 188, 189, 0, 190, 191, 192, 193, 756, + 195, 196, 197, 198, 199, 757, 1239, 201, 0, 202, + 203, 758, 205, 0, 206, 0, 207, 0, 0, 0, + 210, 211, 212, 0, 214, 0, 215, 0, 759, 760, + 218, 0, 219, 220, 221, 222, 223, 224, 225, 0, + 227, 228, 229, 230, 0, 231, 232, 233, 234, 235, + 236, 0, 237, 0, 761, 240, 241, 242, 243, 244, + 762, 763, 0, 764, 0, 248, 0, 0, 251, 0, + 253, 254, 255, 256, 257, 258, 0, 0, 259, 0, + 261, 0, 0, 263, 264, 265, 0, 0, 266, 267, + 268, 269, 270, 765, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 0, 289, 290, 291, 292, 293, 0, 294, 295, 0, - 297, 0, 298, 299, 300, 301, 302, 303, 0, 304, - 305, 0, 0, 306, 307, 308, 0, 0, 309, 310, - 0, 312, 0, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 343, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 0, 364, 365, - 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 0, - 384, 385, 386, 387, 388, 0, 390, 391, 392, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 502, 406, 407, 408, 0, 409, 410, 0, - 411, 0, 413, 414, 415, 416, 417, 0, 418, 419, - 0, 0, 420, 421, 422, 423, 424, 0, 425, 426, - 427, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 0, 0, 438, 439, 440, 441, 442, - 443, 444, 0, 445, 0, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 0, 498, 0, 0, 0, + 288, 289, 766, 0, 767, 293, 294, 295, 768, 0, + 297, 298, 0, 300, 0, 769, 302, 770, 304, 305, + 306, 0, 307, 308, 1240, 0, 309, 310, 311, 0, + 0, 312, 771, 0, 315, 0, 772, 318, 319, 320, + 321, 322, 323, 324, 325, 326, 327, 0, 328, 329, + 773, 331, 332, 774, 334, 335, 336, 0, 337, 338, + 339, 340, 341, 342, 0, 343, 344, 345, 775, 347, + 348, 349, 350, 0, 351, 352, 353, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 0, 364, 365, + 0, 367, 368, 369, 776, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 0, 382, 383, 384, + 385, 386, 0, 387, 777, 389, 390, 391, 0, 393, + 394, 778, 396, 0, 397, 398, 399, 400, 401, 402, + 403, 404, 405, 406, 407, 779, 409, 780, 411, 0, + 412, 413, 0, 414, 0, 416, 417, 418, 419, 420, + 0, 781, 782, 0, 0, 423, 424, 783, 426, 784, + 1241, 428, 429, 785, 431, 432, 433, 434, 435, 0, + 0, 436, 437, 438, 439, 440, 0, 0, 441, 442, + 443, 444, 445, 1131, 787, 0, 448, 0, 450, 451, + 452, 453, 0, 0, 454, 0, 0, 455, 456, 457, + 458, 459, 460, 788, 789, 790, 791, 792, 793, 794, + 795, 796, 797, 798, 472, 473, 474, 475, 0, 746, + 0, 0, 0, 0, 0, 1242, 1243, 1947, 0, 0, + 0, 0, 0, 0, 1948, 94, 95, 96, 97, 98, + 99, 100, 101, 0, 102, 103, 104, 3, 4, 0, + 0, 0, 0, 0, 105, 106, 0, 107, 108, 109, + 0, 111, 112, 113, 747, 748, 0, 749, 750, 0, + 119, 120, 121, 122, 123, 124, 0, 0, 125, 126, + 751, 752, 129, 0, 130, 131, 132, 133, 753, 0, + 0, 0, 136, 137, 138, 139, 140, 141, 0, 143, + 144, 145, 0, 146, 147, 148, 149, 150, 151, 0, + 0, 153, 154, 155, 0, 0, 0, 0, 0, 0, + 0, 157, 158, 159, 160, 161, 162, 163, 754, 755, + 166, 0, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 0, 0, 179, 180, + 181, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 756, 195, 196, 197, + 198, 199, 757, 0, 201, 0, 202, 203, 758, 205, + 0, 206, 0, 207, 0, 0, 0, 210, 211, 212, + 0, 214, 0, 215, 0, 759, 760, 218, 0, 219, + 220, 221, 222, 223, 224, 225, 0, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 0, 761, 240, 241, 242, 243, 244, 762, 763, 0, + 764, 0, 248, 0, 0, 251, 0, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 0, 261, 0, 0, + 263, 264, 265, 0, 0, 266, 267, 268, 269, 270, + 765, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 766, + 0, 767, 293, 294, 295, 768, 0, 297, 298, 0, + 300, 0, 769, 302, 770, 304, 305, 306, 0, 307, + 308, 0, 0, 309, 310, 311, 0, 0, 312, 771, + 0, 315, 0, 772, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 0, 328, 329, 773, 331, 332, + 774, 334, 335, 336, 0, 337, 338, 339, 340, 341, + 342, 0, 343, 344, 345, 775, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 0, 367, 368, + 369, 776, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 26, 382, 383, 384, 385, 386, 0, + 387, 777, 389, 390, 391, 0, 393, 394, 778, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 779, 409, 780, 411, 0, 412, 413, 31, + 414, 0, 416, 417, 418, 419, 420, 0, 781, 782, + 0, 0, 423, 424, 783, 426, 784, 0, 428, 429, + 785, 431, 432, 433, 434, 435, 0, 0, 436, 437, + 438, 439, 440, 0, 0, 441, 442, 443, 444, 445, + 786, 787, 0, 448, 0, 450, 451, 452, 453, 0, + 0, 454, 0, 34, 455, 456, 457, 458, 459, 460, + 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, + 798, 472, 473, 474, 475, 0, 498, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2539, 93, 94, 95, 96, 97, 98, 99, 100, - 0, 101, 102, 103, 0, 0, 0, 0, 0, 0, - 0, 104, 105, 0, 106, 107, 108, 0, 110, 111, - 112, 113, 114, 0, 116, 117, 0, 118, 119, 120, - 121, 122, 123, 0, 0, 124, 125, 126, 127, 128, - 0, 129, 130, 131, 132, 133, 0, 0, 0, 135, - 136, 137, 138, 139, 140, 0, 142, 143, 144, 0, - 145, 146, 147, 148, 149, 150, 0, 0, 152, 153, - 154, 0, 0, 0, 0, 0, 0, 0, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 0, 166, - 0, 167, 168, 169, 170, 171, 172, 0, 173, 174, - 175, 176, 177, 0, 0, 178, 179, 180, 181, 182, - 0, 183, 184, 185, 0, 186, 187, 188, 0, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 0, - 199, 0, 200, 201, 202, 203, 0, 204, 0, 205, - 0, 0, 0, 208, 209, 210, 0, 212, 0, 213, - 0, 214, 215, 216, 0, 217, 218, 219, 220, 221, - 222, 223, 0, 225, 226, 227, 228, 0, 229, 230, - 231, 232, 233, 234, 0, 235, 0, 237, 238, 239, - 240, 241, 242, 243, 244, 0, 245, 0, 246, 0, - 0, 249, 0, 251, 252, 253, 254, 255, 0, 0, - 256, 0, 258, 0, 0, 260, 261, 262, 0, 0, - 263, 264, 265, 266, 267, 500, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 0, 289, 290, 291, 292, - 293, 0, 294, 295, 0, 297, 0, 298, 299, 300, - 301, 302, 303, 0, 304, 305, 0, 0, 306, 307, - 308, 0, 0, 309, 310, 0, 312, 0, 314, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 0, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 0, - 334, 335, 336, 337, 338, 339, 0, 340, 341, 342, - 343, 344, 345, 346, 347, 0, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 0, - 361, 362, 0, 364, 365, 366, 367, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 0, 379, - 380, 381, 382, 383, 0, 384, 385, 386, 387, 388, - 0, 390, 391, 392, 393, 0, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 502, 406, 407, - 408, 0, 409, 410, 0, 411, 0, 413, 414, 415, - 416, 417, 0, 418, 419, 0, 0, 420, 421, 422, - 423, 424, 0, 425, 426, 427, 428, 429, 430, 431, - 432, 0, 0, 433, 434, 435, 436, 437, 0, 0, - 438, 439, 440, 441, 442, 443, 444, 0, 445, 0, - 447, 448, 449, 450, 0, 0, 451, 0, 0, 452, - 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, - 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 0, 498, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1655, 93, 94, 95, - 96, 97, 98, 99, 100, 0, 101, 102, 103, 0, - 0, 0, 0, 0, 0, 0, 104, 105, 0, 106, - 107, 108, 0, 110, 111, 112, 113, 114, 0, 116, - 117, 0, 118, 119, 120, 121, 122, 123, 0, 0, - 124, 125, 126, 127, 128, 0, 129, 130, 131, 132, - 133, 0, 0, 0, 135, 136, 137, 138, 139, 140, - 0, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 0, 152, 153, 154, 0, 0, 0, 0, - 0, 0, 0, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 0, 199, 0, 200, 201, 202, - 203, 0, 204, 0, 205, 0, 0, 0, 208, 209, - 210, 0, 212, 0, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 0, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 0, 237, 238, 239, 240, 241, 242, 243, 244, - 0, 245, 0, 246, 0, 0, 249, 0, 251, 252, - 253, 254, 255, 0, 0, 256, 0, 258, 0, 0, - 260, 261, 262, 0, 0, 263, 264, 265, 266, 267, - 500, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 0, 289, 290, 291, 292, 293, 0, 294, 295, 0, - 297, 0, 298, 299, 300, 301, 302, 303, 0, 304, - 305, 0, 0, 306, 307, 308, 0, 0, 309, 310, - 0, 312, 0, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 343, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 0, 364, 365, - 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 0, - 384, 385, 386, 387, 388, 0, 390, 391, 392, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 502, 406, 407, 408, 0, 409, 410, 0, - 411, 0, 413, 414, 415, 416, 417, 0, 418, 419, - 0, 0, 420, 421, 422, 423, 424, 0, 425, 426, - 427, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 0, 0, 438, 439, 440, 441, 442, - 443, 444, 0, 445, 0, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 0, 498, 0, 0, 0, + 0, 36, 94, 95, 96, 97, 98, 99, 100, 101, + 608, 102, 103, 104, 0, 0, 0, 0, 0, 0, + 0, 105, 106, 0, 107, 108, 109, 0, 111, 112, + 113, 114, 115, 0, 117, 118, 0, 119, 120, 121, + 122, 123, 124, 0, 0, 125, 126, 127, 128, 129, + 0, 130, 131, 132, 133, 134, 0, 0, 0, 136, + 137, 138, 139, 140, 141, 0, 143, 144, 145, 0, + 146, 147, 148, 149, 150, 151, 0, 0, 153, 154, + 155, 0, 0, 0, 0, 0, 0, 0, 157, 158, + 159, 160, 161, 162, 163, 164, 165, 166, 0, 167, + 0, 168, 169, 170, 171, 172, 173, 0, 174, 175, + 176, 177, 178, 0, 0, 179, 180, 181, 182, 183, + 0, 184, 185, 186, 0, 187, 188, 189, 0, 190, + 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, + 0, 201, 0, 202, 203, 204, 205, 0, 206, 0, + 207, 0, 0, 0, 210, 211, 212, 0, 214, 0, + 215, 0, 216, 217, 218, 0, 219, 220, 221, 222, + 223, 224, 225, 0, 227, 228, 229, 230, 0, 231, + 232, 233, 234, 235, 236, 0, 237, 0, 239, 240, + 241, 242, 243, 244, 245, 246, 0, 247, 0, 248, + 0, 0, 251, 0, 253, 254, 255, 256, 257, 258, + 0, 0, 259, 0, 261, 0, 0, 263, 264, 265, + 0, 0, 266, 267, 268, 269, 270, 500, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 0, 292, 293, + 294, 295, 296, 0, 297, 298, 0, 300, 0, 301, + 302, 303, 304, 305, 306, 0, 307, 308, 0, 0, + 309, 310, 311, 0, 0, 312, 313, 0, 315, 0, + 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 0, 328, 329, 330, 331, 332, 333, 334, 335, + 336, 0, 337, 338, 339, 340, 341, 342, 0, 343, + 344, 345, 346, 347, 348, 349, 350, 0, 351, 352, + 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, + 363, 0, 364, 365, 0, 367, 368, 369, 370, 371, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 26, 382, 383, 384, 385, 386, 0, 387, 388, 389, + 390, 391, 0, 393, 394, 395, 396, 0, 397, 398, + 399, 400, 401, 402, 403, 404, 405, 406, 407, 502, + 409, 410, 411, 0, 412, 413, 31, 414, 0, 416, + 417, 418, 419, 420, 0, 609, 422, 0, 0, 610, + 424, 425, 426, 427, 0, 428, 429, 430, 431, 432, + 433, 434, 435, 0, 0, 436, 437, 438, 439, 440, + 0, 0, 441, 442, 443, 444, 445, 575, 447, 0, + 448, 0, 450, 451, 452, 453, 0, 0, 454, 0, + 34, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 0, 498, 35, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 36, 94, + 95, 96, 97, 98, 99, 100, 101, 0, 102, 103, + 104, 0, 0, 0, 0, 0, 0, 0, 105, 106, + 0, 107, 108, 109, 0, 111, 112, 113, 114, 115, + 0, 117, 118, 0, 119, 120, 121, 122, 123, 124, + 0, 0, 125, 126, 127, 128, 129, 0, 130, 131, + 132, 133, 134, 0, 0, 0, 136, 137, 138, 139, + 140, 141, 0, 143, 144, 145, 0, 146, 147, 148, + 149, 150, 151, 0, 0, 153, 154, 155, 0, 0, + 0, 0, 0, 0, 0, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 0, 167, 0, 168, 169, + 170, 171, 172, 173, 0, 174, 175, 176, 177, 178, + 0, 0, 179, 180, 181, 182, 183, 0, 184, 185, + 186, 0, 187, 188, 189, 0, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 0, 201, 0, + 202, 203, 204, 205, 0, 206, 0, 207, 0, 0, + 0, 210, 211, 212, 0, 214, 0, 215, 0, 216, + 217, 218, 0, 219, 220, 221, 222, 223, 224, 225, + 0, 227, 228, 229, 230, 0, 231, 232, 233, 234, + 235, 236, 0, 237, 0, 239, 240, 241, 242, 243, + 244, 245, 246, 0, 247, 0, 248, 0, 0, 251, + 0, 253, 254, 255, 256, 257, 258, 0, 0, 259, + 0, 261, 0, 0, 263, 264, 265, 0, 0, 266, + 267, 268, 269, 270, 500, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 292, 293, 294, 295, 296, + 0, 297, 298, 0, 300, 0, 301, 302, 303, 304, + 305, 306, 0, 307, 308, 0, 0, 309, 310, 311, + 0, 0, 312, 313, 0, 315, 0, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 0, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 0, 337, + 338, 339, 340, 341, 342, 0, 343, 344, 345, 346, + 347, 348, 349, 350, 0, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 0, 364, + 365, 0, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 26, 382, 383, + 384, 385, 386, 0, 387, 388, 389, 390, 391, 0, + 393, 394, 395, 396, 0, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 502, 409, 410, 411, + 0, 412, 413, 31, 414, 0, 416, 417, 418, 419, + 420, 0, 421, 422, 0, 0, 423, 424, 425, 426, + 427, 0, 428, 429, 430, 431, 432, 433, 434, 435, + 0, 0, 436, 437, 438, 439, 440, 0, 0, 441, + 442, 443, 444, 445, 575, 447, 0, 448, 0, 450, + 451, 452, 453, 0, 0, 454, 0, 34, 455, 456, + 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 467, 468, 469, 470, 471, 472, 473, 474, 475, 0, + 498, 35, 579, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 36, 94, 95, 96, 97, + 98, 99, 100, 101, 0, 102, 103, 104, 0, 0, + 0, 0, 0, 0, 0, 105, 106, 0, 107, 108, + 109, 0, 111, 112, 113, 114, 115, 0, 117, 118, + 0, 119, 120, 121, 122, 123, 124, 0, 0, 125, + 126, 127, 128, 129, 0, 130, 131, 132, 133, 134, + 0, 0, 0, 136, 137, 138, 139, 140, 141, 0, + 143, 144, 145, 0, 146, 147, 148, 149, 150, 151, + 0, 0, 153, 154, 155, 0, 0, 0, 0, 0, + 0, 0, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 0, 167, 0, 168, 169, 170, 171, 172, + 173, 0, 174, 175, 176, 177, 178, 0, 0, 179, + 180, 181, 182, 183, 0, 184, 185, 186, 0, 187, + 188, 189, 0, 190, 191, 192, 193, 194, 195, 196, + 197, 198, 199, 200, 0, 201, 0, 202, 203, 204, + 205, 0, 206, 0, 207, 0, 0, 0, 210, 211, + 212, 0, 214, 0, 215, 0, 216, 217, 218, 0, + 219, 220, 221, 222, 223, 224, 225, 0, 227, 228, + 229, 230, 0, 231, 232, 233, 234, 235, 236, 0, + 237, 0, 239, 240, 241, 242, 243, 244, 245, 246, + 0, 247, 0, 248, 0, 0, 251, 0, 253, 254, + 255, 256, 257, 258, 0, 0, 259, 0, 261, 0, + 0, 263, 264, 265, 0, 0, 266, 267, 268, 269, + 270, 500, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 0, 292, 293, 294, 295, 296, 0, 297, 298, + 0, 300, 0, 301, 302, 303, 304, 305, 306, 0, + 307, 308, 0, 0, 309, 310, 311, 0, 0, 312, + 313, 0, 315, 0, 317, 318, 319, 320, 321, 322, + 323, 324, 325, 326, 327, 0, 328, 329, 330, 331, + 332, 333, 334, 335, 336, 0, 337, 338, 339, 340, + 341, 342, 0, 343, 344, 345, 346, 347, 348, 349, + 350, 0, 351, 352, 353, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 0, 364, 365, 0, 367, + 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 0, 382, 383, 384, 385, 386, + 0, 387, 388, 389, 390, 391, 0, 393, 394, 395, + 396, 0, 397, 398, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 502, 409, 410, 411, 0, 412, 413, + 0, 414, 0, 416, 417, 418, 419, 420, 0, 421, + 422, 0, 0, 423, 424, 425, 426, 427, 0, 428, + 429, 430, 431, 432, 433, 434, 435, 0, 0, 436, + 437, 438, 439, 440, 0, 0, 441, 442, 443, 444, + 445, 446, 447, 0, 448, 0, 450, 451, 452, 453, + 0, 0, 454, 0, 0, 455, 456, 457, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 0, 498, 0, 579, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1760, 93, 94, 95, 96, 97, 98, 99, 100, - 0, 101, 102, 103, 0, 0, 0, 0, 0, 0, - 0, 104, 105, 0, 106, 107, 108, 0, 110, 111, - 112, 113, 114, 0, 116, 117, 0, 118, 119, 120, - 121, 122, 123, 0, 0, 124, 125, 126, 127, 128, - 0, 129, 130, 131, 132, 133, 0, 0, 0, 135, - 136, 137, 138, 139, 140, 0, 142, 143, 144, 0, - 145, 146, 147, 148, 149, 150, 0, 0, 152, 153, - 154, 0, 0, 0, 0, 0, 0, 0, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 0, 166, - 0, 167, 168, 169, 170, 171, 172, 0, 173, 174, - 175, 176, 177, 0, 0, 178, 179, 180, 181, 182, - 0, 183, 184, 185, 0, 186, 187, 188, 0, 189, - 190, 191, 192, 193, 194, 195, 196, 197, 198, 0, - 199, 0, 200, 201, 202, 203, 0, 204, 0, 205, - 0, 0, 0, 208, 209, 210, 0, 212, 0, 213, - 0, 214, 215, 216, 0, 217, 218, 219, 220, 221, - 222, 223, 0, 225, 226, 227, 228, 0, 229, 230, - 231, 232, 233, 234, 0, 235, 0, 237, 238, 239, - 240, 241, 242, 243, 244, 0, 245, 0, 246, 0, - 0, 249, 0, 251, 252, 253, 254, 255, 0, 0, - 256, 0, 258, 0, 0, 260, 261, 262, 0, 0, - 263, 264, 265, 266, 267, 500, 269, 270, 271, 272, + 0, 0, 926, 94, 95, 96, 97, 98, 99, 100, + 101, 0, 102, 103, 104, 0, 0, 0, 0, 0, + 0, 0, 105, 106, 0, 107, 108, 109, 0, 111, + 112, 113, 114, 115, 0, 117, 118, 0, 119, 120, + 121, 122, 123, 124, 0, 0, 125, 126, 127, 128, + 129, 0, 130, 131, 132, 133, 134, 0, 0, 0, + 136, 137, 138, 139, 140, 141, 0, 143, 144, 145, + 0, 146, 147, 148, 149, 150, 151, 0, 0, 153, + 154, 155, 0, 0, 0, 0, 0, 0, 0, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 0, + 167, 0, 168, 169, 170, 171, 172, 173, 0, 174, + 175, 176, 177, 178, 0, 0, 179, 180, 181, 182, + 183, 0, 184, 185, 186, 0, 187, 188, 189, 0, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 0, 202, 203, 204, 205, 0, 206, + 0, 207, 0, 0, 0, 210, 211, 212, 0, 214, + 0, 215, 0, 216, 217, 218, 0, 219, 220, 221, + 222, 223, 224, 225, 0, 227, 228, 229, 230, 0, + 231, 232, 233, 234, 235, 236, 0, 237, 0, 239, + 240, 241, 242, 243, 244, 245, 246, 0, 247, 0, + 248, 0, 0, 251, 0, 253, 254, 255, 256, 257, + 258, 0, 0, 259, 0, 261, 0, 0, 263, 264, + 265, 0, 0, 266, 267, 268, 269, 270, 500, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 287, 0, 289, 290, 291, 292, - 293, 0, 294, 295, 0, 297, 0, 298, 299, 300, - 301, 302, 303, 0, 304, 305, 0, 0, 306, 307, - 308, 0, 0, 309, 310, 0, 312, 0, 314, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 0, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 0, - 334, 335, 336, 337, 338, 339, 0, 340, 341, 342, - 343, 344, 345, 346, 347, 0, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 0, - 361, 362, 0, 364, 365, 366, 367, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 0, 379, - 380, 381, 382, 383, 0, 384, 385, 386, 387, 388, - 0, 390, 391, 392, 393, 0, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 502, 406, 407, - 408, 0, 409, 410, 0, 411, 0, 413, 414, 415, - 416, 417, 0, 418, 419, 0, 0, 420, 421, 422, - 423, 424, 0, 425, 426, 427, 428, 429, 430, 431, - 432, 0, 0, 433, 434, 435, 436, 437, 0, 0, - 438, 439, 440, 441, 442, 443, 444, 0, 445, 0, - 447, 448, 449, 450, 0, 0, 451, 0, 0, 452, - 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, + 283, 284, 285, 286, 287, 288, 289, 290, 0, 292, + 293, 294, 295, 296, 0, 297, 298, 0, 300, 0, + 301, 302, 303, 304, 305, 306, 0, 307, 308, 0, + 0, 309, 310, 311, 0, 0, 312, 313, 0, 315, + 0, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 0, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 0, 337, 338, 339, 340, 341, 342, 0, + 343, 344, 345, 346, 347, 348, 349, 350, 0, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 0, 364, 365, 0, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 0, 382, 383, 384, 385, 386, 0, 387, 388, + 389, 390, 391, 0, 393, 394, 395, 396, 0, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 502, 409, 410, 411, 0, 412, 413, 0, 414, 0, + 416, 417, 418, 419, 420, 0, 421, 422, 0, 0, + 423, 424, 425, 426, 427, 0, 428, 429, 430, 431, + 432, 433, 434, 435, 0, 0, 436, 437, 438, 439, + 440, 0, 0, 441, 442, 443, 444, 445, 446, 447, + 0, 448, 0, 450, 451, 452, 453, 0, 0, 454, + 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 0, 0, 0, 0, 2397, 1232, 547, 0, 0, 1615, - 818, 0, 0, 0, 0, 0, 2295, 1616, 1617, 1618, - 93, 94, 95, 96, 97, 98, 99, 100, 1052, 101, - 102, 103, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 104, - 105, 1060, 106, 107, 108, 2398, 110, 111, 112, 0, - 663, 2399, 665, 666, 1061, 118, 119, 120, 121, 122, - 123, 1062, 1063, 124, 125, 667, 668, 128, 1064, 129, - 130, 131, 132, 0, 1065, 2400, 1066, 135, 136, 137, - 138, 139, 140, 2401, 142, 143, 144, 1067, 145, 146, - 147, 148, 149, 150, 1068, 2402, 152, 153, 154, 1069, - 1070, 1071, 2403, 1072, 1073, 1074, 156, 157, 158, 159, - 160, 161, 162, 673, 674, 165, 1075, 166, 1076, 167, - 168, 169, 170, 171, 172, 1077, 173, 174, 175, 176, - 177, 1078, 1079, 178, 179, 675, 181, 182, 1080, 183, - 184, 185, 1081, 186, 187, 188, 1082, 189, 190, 191, - 192, 0, 194, 195, 196, 197, 0, 1083, 199, 1084, - 200, 201, 676, 203, 1085, 204, 1086, 205, 2404, 1087, - 2405, 208, 209, 210, 2406, 212, 1088, 213, 1089, 0, - 0, 216, 1090, 217, 218, 219, 220, 221, 222, 223, - 2407, 225, 226, 227, 228, 1091, 229, 230, 231, 232, - 233, 234, 1092, 235, 2408, 0, 238, 239, 240, 241, - 242, 683, 684, 1093, 685, 1094, 246, 2409, 2410, 249, - 2411, 251, 252, 253, 254, 255, 1095, 1096, 256, 2412, - 258, 2413, 1097, 260, 261, 262, 1098, 1099, 263, 264, - 265, 266, 267, 2414, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 692, 2415, 694, 290, 291, 292, 2416, 1100, - 294, 295, 2417, 297, 1101, 0, 299, 696, 301, 302, - 303, 1102, 304, 305, 1103, 1104, 2418, 307, 308, 1105, - 1106, 309, 0, 2419, 312, 2420, 0, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 1107, 325, 326, - 0, 328, 329, 0, 331, 332, 333, 1108, 334, 335, - 336, 337, 338, 339, 1109, 340, 341, 342, 699, 344, - 345, 346, 347, 1110, 348, 349, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 1111, 361, 362, - 2421, 364, 365, 366, 701, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 378, 1112, 379, 380, 381, - 382, 383, 1113, 384, 2422, 386, 387, 388, 2423, 390, - 391, 704, 393, 1114, 394, 395, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 2424, 406, 0, 408, 1115, - 409, 410, 1116, 411, 2425, 413, 414, 415, 416, 417, - 1117, 707, 708, 1118, 1119, 420, 421, 0, 423, 0, - 1120, 425, 426, 2426, 428, 429, 430, 431, 432, 1121, - 1122, 433, 434, 435, 436, 437, 1123, 1124, 438, 439, - 440, 441, 442, 0, 710, 1126, 445, 2427, 447, 448, - 449, 450, 1127, 1128, 451, 1129, 1130, 452, 453, 454, - 455, 456, 457, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 469, 470, 471, 472, 0, 498, - 0, 1619, 1620, 1621, 1615, 2428, 2429, 1624, 1625, 1626, - 1627, 0, 1616, 1617, 1618, 93, 94, 95, 96, 97, - 98, 99, 100, 0, 101, 102, 103, 0, 0, 0, - 0, 0, 0, 0, 104, 105, 0, 106, 107, 108, - 0, 110, 111, 112, 113, 114, 0, 116, 117, 0, - 118, 119, 120, 121, 122, 123, 0, 0, 124, 125, - 126, 127, 128, 0, 129, 130, 131, 132, 133, 0, - 0, 0, 135, 136, 137, 138, 139, 140, 0, 142, - 143, 144, 0, 145, 146, 147, 148, 149, 150, 0, - 0, 152, 153, 154, 0, 0, 0, 0, 0, 0, - 0, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 0, 166, 0, 167, 168, 169, 170, 171, 172, - 0, 173, 174, 175, 176, 177, 0, 0, 178, 179, - 180, 181, 182, 0, 183, 184, 185, 0, 186, 187, - 188, 0, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 0, 199, 0, 200, 201, 202, 203, 0, - 204, 0, 205, 0, 0, 0, 208, 209, 210, 0, - 212, 0, 213, 0, 214, 215, 216, 0, 217, 218, - 219, 220, 221, 222, 223, 0, 225, 226, 227, 228, - 0, 229, 230, 231, 232, 233, 234, 0, 235, 0, - 237, 238, 239, 240, 241, 242, 243, 244, 0, 245, - 0, 246, 0, 0, 249, 0, 251, 252, 253, 254, - 255, 0, 0, 256, 0, 258, 0, 0, 260, 261, - 262, 0, 0, 263, 264, 265, 266, 267, 500, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 0, 289, - 290, 291, 292, 293, 0, 294, 295, 0, 297, 0, - 298, 299, 300, 301, 302, 303, 0, 304, 305, 0, - 0, 306, 307, 308, 0, 0, 309, 310, 0, 312, - 0, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 325, 326, 327, 328, 329, 330, 331, - 332, 333, 0, 334, 335, 336, 337, 338, 339, 0, - 340, 341, 342, 343, 344, 345, 346, 347, 0, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 0, 361, 362, 0, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 0, 379, 380, 381, 382, 383, 0, 384, 385, - 386, 387, 388, 0, 390, 391, 392, 393, 0, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 502, 406, 407, 408, 0, 409, 410, 0, 411, 0, - 413, 414, 415, 416, 417, 0, 418, 419, 0, 0, - 420, 421, 422, 423, 424, 0, 425, 426, 427, 428, - 429, 430, 431, 432, 0, 0, 433, 434, 435, 436, - 437, 0, 0, 438, 439, 440, 441, 442, 443, 444, - 0, 445, 0, 447, 448, 449, 450, 0, 0, 451, - 0, 0, 452, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 0, 0, 0, 1619, 1620, 1621, 0, - 1622, 1623, 1624, 1625, 1626, 1627, 1308, 0, 0, 1309, - 0, 0, 0, 0, 1310, 1311, 1312, 0, 0, 0, - 0, 0, 0, 0, 1308, 0, 0, 1309, 0, 0, - 0, 1313, 1310, 1311, 1312, 0, 0, 0, 0, 1315, - 0, 0, 0, 0, 0, 0, 1316, 0, 0, 1313, - 0, 0, 0, 1308, 0, 0, 1309, 1315, 0, 0, - 0, 1310, 1311, 1312, 1316, 0, 0, 0, 0, 0, - 0, 1317, 1308, 0, 0, 1309, 0, 0, 1313, 0, - 1310, 1311, 1312, 0, 0, 0, 1315, 0, 0, 1317, - 0, 0, 0, 1316, 0, 0, 0, 1313, 0, 0, - 0, 0, 0, 0, 0, 1315, 0, 0, 0, 0, - 0, 0, 1316, 0, 0, 0, 0, 0, 1317, 0, + 473, 474, 475, 0, 498, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 2563, + 94, 95, 96, 97, 98, 99, 100, 101, 0, 102, + 103, 104, 0, 0, 0, 0, 0, 0, 0, 105, + 106, 0, 107, 108, 109, 0, 111, 112, 113, 114, + 115, 0, 117, 118, 0, 119, 120, 121, 122, 123, + 124, 0, 0, 125, 126, 127, 128, 129, 0, 130, + 131, 132, 133, 134, 0, 0, 0, 136, 137, 138, + 139, 140, 141, 0, 143, 144, 145, 0, 146, 147, + 148, 149, 150, 151, 0, 0, 153, 154, 155, 0, + 0, 0, 0, 0, 0, 0, 157, 158, 159, 160, + 161, 162, 163, 164, 165, 166, 0, 167, 0, 168, + 169, 170, 171, 172, 173, 0, 174, 175, 176, 177, + 178, 0, 0, 179, 180, 181, 182, 183, 0, 184, + 185, 186, 0, 187, 188, 189, 0, 190, 191, 192, + 193, 194, 195, 196, 197, 198, 199, 200, 0, 201, + 0, 202, 203, 204, 205, 0, 206, 0, 207, 0, + 0, 0, 210, 211, 212, 0, 214, 0, 215, 0, + 216, 217, 218, 0, 219, 220, 221, 222, 223, 224, + 225, 0, 227, 228, 229, 230, 0, 231, 232, 233, + 234, 235, 236, 0, 237, 0, 239, 240, 241, 242, + 243, 244, 245, 246, 0, 247, 0, 248, 0, 0, + 251, 0, 253, 254, 255, 256, 257, 258, 0, 0, + 259, 0, 261, 0, 0, 263, 264, 265, 0, 0, + 266, 267, 268, 269, 270, 500, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, + 286, 287, 288, 289, 290, 0, 292, 293, 294, 295, + 296, 0, 297, 298, 0, 300, 0, 301, 302, 303, + 304, 305, 306, 0, 307, 308, 0, 0, 309, 310, + 311, 0, 0, 312, 313, 0, 315, 0, 317, 318, + 319, 320, 321, 322, 323, 324, 325, 326, 327, 0, + 328, 329, 330, 331, 332, 333, 334, 335, 336, 0, + 337, 338, 339, 340, 341, 342, 0, 343, 344, 345, + 346, 347, 348, 349, 350, 0, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 0, + 364, 365, 0, 367, 368, 369, 370, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 0, 382, + 383, 384, 385, 386, 0, 387, 388, 389, 390, 391, + 0, 393, 394, 395, 396, 0, 397, 398, 399, 400, + 401, 402, 403, 404, 405, 406, 407, 502, 409, 410, + 411, 0, 412, 413, 0, 414, 0, 416, 417, 418, + 419, 420, 0, 421, 422, 0, 0, 423, 424, 425, + 426, 427, 0, 428, 429, 430, 431, 432, 433, 434, + 435, 0, 0, 436, 437, 438, 439, 440, 0, 0, + 441, 442, 443, 444, 445, 446, 447, 0, 448, 0, + 450, 451, 452, 453, 0, 0, 454, 0, 0, 455, + 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 0, 498, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1660, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 0, 0, 0, 105, 106, 0, 107, + 108, 109, 0, 111, 112, 113, 114, 115, 0, 117, + 118, 0, 119, 120, 121, 122, 123, 124, 0, 0, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 133, + 134, 0, 0, 0, 136, 137, 138, 139, 140, 141, + 0, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 0, 153, 154, 155, 0, 0, 0, 0, + 0, 0, 0, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 0, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 181, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 0, 201, 0, 202, 203, + 204, 205, 0, 206, 0, 207, 0, 0, 0, 210, + 211, 212, 0, 214, 0, 215, 0, 216, 217, 218, + 0, 219, 220, 221, 222, 223, 224, 225, 0, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 0, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 0, 248, 0, 0, 251, 0, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 0, 261, + 0, 0, 263, 264, 265, 0, 0, 266, 267, 268, + 269, 270, 500, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 0, 292, 293, 294, 295, 296, 0, 297, + 298, 0, 300, 0, 301, 302, 303, 304, 305, 306, + 0, 307, 308, 0, 0, 309, 310, 311, 0, 0, + 312, 313, 0, 315, 0, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 330, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 346, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 0, + 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 0, 387, 388, 389, 390, 391, 0, 393, 394, + 395, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 502, 409, 410, 411, 0, 412, + 413, 0, 414, 0, 416, 417, 418, 419, 420, 0, + 421, 422, 0, 0, 423, 424, 425, 426, 427, 0, + 428, 429, 430, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 0, 0, 441, 442, 443, + 444, 445, 446, 447, 0, 448, 0, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 0, 498, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1317, 0, 0, + 0, 0, 0, 1799, 94, 95, 96, 97, 98, 99, + 100, 101, 0, 102, 103, 104, 0, 0, 0, 0, + 0, 0, 0, 105, 106, 0, 107, 108, 109, 0, + 111, 112, 113, 114, 115, 0, 117, 118, 0, 119, + 120, 121, 122, 123, 124, 0, 0, 125, 126, 127, + 128, 129, 0, 130, 131, 132, 133, 134, 0, 0, + 0, 136, 137, 138, 139, 140, 141, 0, 143, 144, + 145, 0, 146, 147, 148, 149, 150, 151, 0, 0, + 153, 154, 155, 0, 0, 0, 0, 0, 0, 0, + 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, + 0, 167, 0, 168, 169, 170, 171, 172, 173, 0, + 174, 175, 176, 177, 178, 0, 0, 179, 180, 181, + 182, 183, 0, 184, 185, 186, 0, 187, 188, 189, + 0, 190, 191, 192, 193, 194, 195, 196, 197, 198, + 199, 200, 0, 201, 0, 202, 203, 204, 205, 0, + 206, 0, 207, 0, 0, 0, 210, 211, 212, 0, + 214, 0, 215, 0, 216, 217, 218, 0, 219, 220, + 221, 222, 223, 224, 225, 0, 227, 228, 229, 230, + 0, 231, 232, 233, 234, 235, 236, 0, 237, 0, + 239, 240, 241, 242, 243, 244, 245, 246, 0, 247, + 0, 248, 0, 0, 251, 0, 253, 254, 255, 256, + 257, 258, 0, 0, 259, 0, 261, 0, 0, 263, + 264, 265, 0, 0, 266, 267, 268, 269, 270, 500, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 290, 0, + 292, 293, 294, 295, 296, 0, 297, 298, 0, 300, + 0, 301, 302, 303, 304, 305, 306, 0, 307, 308, + 0, 0, 309, 310, 311, 0, 0, 312, 313, 0, + 315, 0, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 0, 328, 329, 330, 331, 332, 333, + 334, 335, 336, 0, 337, 338, 339, 340, 341, 342, + 0, 343, 344, 345, 346, 347, 348, 349, 350, 0, + 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, + 361, 362, 363, 0, 364, 365, 0, 367, 368, 369, + 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 0, 382, 383, 384, 385, 386, 0, 387, + 388, 389, 390, 391, 0, 393, 394, 395, 396, 0, + 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, + 407, 502, 409, 410, 411, 0, 412, 413, 0, 414, + 0, 416, 417, 418, 419, 420, 0, 421, 422, 0, + 0, 423, 424, 425, 426, 427, 0, 428, 429, 430, + 431, 432, 433, 434, 435, 0, 0, 436, 437, 438, + 439, 440, 0, 0, 441, 442, 443, 444, 445, 446, + 447, 0, 448, 0, 450, 451, 452, 453, 0, 0, + 454, 0, 0, 455, 456, 457, 458, 459, 460, 461, + 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + 472, 473, 474, 475, 0, 0, 0, 0, 2416, 1238, + 547, 0, 0, 1621, 822, 0, 0, 0, 0, 0, + 2535, 1622, 1623, 1624, 94, 95, 96, 97, 98, 99, + 100, 101, 1058, 102, 103, 104, 1059, 1060, 1061, 1062, + 1063, 1064, 1065, 105, 106, 1066, 107, 108, 109, 2417, + 111, 112, 113, 0, 666, 2418, 668, 669, 1067, 119, + 120, 121, 122, 123, 124, 1068, 1069, 125, 126, 670, + 671, 129, 1070, 130, 131, 132, 133, 0, 1071, 2419, + 1072, 136, 137, 138, 139, 140, 141, 2420, 143, 144, + 145, 1073, 146, 147, 148, 149, 150, 151, 1074, 2421, + 153, 154, 155, 1075, 1076, 1077, 2422, 1078, 1079, 1080, + 157, 158, 159, 160, 161, 162, 163, 676, 677, 166, + 1081, 167, 1082, 168, 169, 170, 171, 172, 173, 1083, + 174, 175, 176, 177, 178, 1084, 1085, 179, 180, 678, + 182, 183, 1086, 184, 185, 186, 1087, 187, 188, 189, + 1088, 190, 191, 192, 193, 0, 195, 196, 197, 198, + 199, 0, 1089, 201, 1090, 202, 203, 679, 205, 1091, + 206, 1092, 207, 2423, 1093, 2424, 210, 211, 212, 2425, + 214, 1094, 215, 1095, 0, 0, 218, 1096, 219, 220, + 221, 222, 223, 224, 225, 2426, 227, 228, 229, 230, + 1097, 231, 232, 233, 234, 235, 236, 1098, 237, 2427, + 0, 240, 241, 242, 243, 244, 686, 687, 1099, 688, + 1100, 248, 2428, 2429, 251, 2430, 253, 254, 255, 256, + 257, 258, 1101, 1102, 259, 2431, 261, 2432, 1103, 263, + 264, 265, 1104, 1105, 266, 267, 268, 269, 270, 2433, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 695, 2434, + 697, 293, 294, 295, 2435, 1106, 297, 298, 2436, 300, + 1107, 0, 302, 699, 304, 305, 306, 1108, 307, 308, + 1109, 1110, 2437, 310, 311, 1111, 1112, 312, 0, 2438, + 315, 2439, 0, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 1113, 328, 329, 0, 331, 332, 0, + 334, 335, 336, 1114, 337, 338, 339, 340, 341, 342, + 1115, 343, 344, 345, 702, 347, 348, 349, 350, 1116, + 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, + 361, 362, 363, 1117, 364, 365, 2440, 367, 368, 369, + 704, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 1118, 382, 383, 384, 385, 386, 1119, 387, + 2441, 389, 390, 391, 2442, 393, 394, 707, 396, 1120, + 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, + 407, 2443, 409, 0, 411, 1121, 412, 413, 1122, 414, + 2444, 416, 417, 418, 419, 420, 1123, 710, 711, 1124, + 1125, 423, 424, 0, 426, 0, 1126, 428, 429, 2445, + 431, 432, 433, 434, 435, 1127, 1128, 436, 437, 438, + 439, 440, 1129, 1130, 441, 442, 443, 444, 445, 0, + 713, 1132, 448, 2446, 450, 451, 452, 453, 1133, 1134, + 454, 1135, 1136, 455, 456, 457, 458, 459, 460, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1308, 0, 0, 1309, 0, - 0, 0, 0, 1310, 1311, 1312, 0, 0, 0, 0, - 0, 1318, 0, 1308, 0, 0, 1309, 0, 0, 0, - 1313, 1310, 1311, 1312, 0, 0, 0, 1319, 1315, 1318, - 0, 0, 1320, 0, 0, 1316, 0, 0, 1313, 0, - 0, 0, 0, 0, 0, 1319, 1315, 0, 0, 0, - 1320, 0, 0, 1316, 1321, 1322, 0, 0, 1318, 0, - 1317, 0, 0, 0, 0, 0, 0, 0, 1323, 0, - 0, 0, 1321, 1322, 1319, 0, 0, 1318, 1317, 1320, - 0, 0, 0, 0, 0, 0, 1323, 0, 0, 0, - 0, 0, 0, 1319, 0, 0, 0, 0, 1320, 0, - 0, 1321, 1322, 0, 0, 0, 1324, 0, 0, 1325, - 0, 0, 0, 0, 0, 1323, 0, 0, 0, 0, - 1321, 1322, 0, 1326, 1324, 0, 1327, 1325, 0, 0, + 472, 473, 474, 475, 0, 498, 0, 1625, 1626, 1627, + 1621, 2447, 2448, 1630, 1631, 1632, 1633, 0, 1622, 1623, + 1624, 94, 95, 96, 97, 98, 99, 100, 101, 0, + 102, 103, 104, 0, 0, 0, 0, 0, 0, 0, + 105, 106, 0, 107, 108, 109, 0, 111, 112, 113, + 114, 115, 0, 117, 118, 0, 119, 120, 121, 122, + 123, 124, 0, 0, 125, 126, 127, 128, 129, 0, + 130, 131, 132, 133, 134, 0, 0, 0, 136, 137, + 138, 139, 140, 141, 0, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 0, 0, 153, 154, 155, + 0, 0, 0, 0, 0, 0, 0, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 0, 167, 0, + 168, 169, 170, 171, 172, 173, 0, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 181, 182, 183, 0, + 184, 185, 186, 0, 187, 188, 189, 0, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 0, + 201, 0, 202, 203, 204, 205, 0, 206, 0, 207, + 0, 0, 0, 210, 211, 212, 0, 214, 0, 215, + 0, 216, 217, 218, 0, 219, 220, 221, 222, 223, + 224, 225, 0, 227, 228, 229, 230, 0, 231, 232, + 233, 234, 235, 236, 0, 237, 0, 239, 240, 241, + 242, 243, 244, 245, 246, 0, 247, 0, 248, 0, + 0, 251, 0, 253, 254, 255, 256, 257, 258, 0, + 0, 259, 0, 261, 0, 0, 263, 264, 265, 0, + 0, 266, 267, 268, 269, 270, 500, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 0, 292, 293, 294, + 295, 296, 0, 297, 298, 0, 300, 0, 301, 302, + 303, 304, 305, 306, 0, 307, 308, 0, 0, 309, + 310, 311, 0, 0, 312, 313, 0, 315, 0, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 0, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 0, 337, 338, 339, 340, 341, 342, 0, 343, 344, + 345, 346, 347, 348, 349, 350, 0, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 0, 364, 365, 0, 367, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 0, + 382, 383, 384, 385, 386, 0, 387, 388, 389, 390, + 391, 0, 393, 394, 395, 396, 0, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 502, 409, + 410, 411, 0, 412, 413, 0, 414, 0, 416, 417, + 418, 419, 420, 0, 421, 422, 0, 0, 423, 424, + 425, 426, 427, 0, 428, 429, 430, 431, 432, 433, + 434, 435, 0, 0, 436, 437, 438, 439, 440, 0, + 0, 441, 442, 443, 444, 445, 446, 447, 0, 448, + 0, 450, 451, 452, 453, 0, 0, 454, 0, 0, + 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 0, 0, 0, 1625, 1626, 1627, 0, 1628, 1629, + 1630, 1631, 1632, 1633, 1315, 0, 0, 1316, 0, 0, + 0, 1317, 1318, 1319, 1320, 0, 0, 0, 0, 0, + 0, 0, 0, 1315, 0, 0, 1316, 0, 0, 1321, + 1317, 1318, 1319, 1320, 0, 0, 0, 1323, 0, 0, + 0, 0, 0, 0, 1324, 0, 0, 0, 1321, 0, + 0, 0, 1315, 0, 0, 1316, 1323, 0, 0, 1317, + 1318, 1319, 1320, 1324, 0, 0, 0, 0, 0, 1325, + 0, 1315, 0, 0, 1316, 0, 0, 1321, 1317, 1318, + 1319, 1320, 0, 0, 0, 1323, 0, 0, 1325, 0, + 0, 0, 1324, 0, 0, 0, 1321, 0, 0, 0, 0, 0, 0, 0, 1323, 0, 0, 0, 0, 0, - 0, 1326, 0, 0, 1327, 0, 0, 0, 0, 0, - 0, 0, 0, 1324, 0, 0, 1325, 0, 0, 0, - 1318, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1326, 0, 1324, 1327, 0, 1325, 1319, 0, 1318, 0, - 0, 1320, 0, 0, 0, 0, 0, 0, 0, 1326, - 0, 0, 1327, 0, 1319, 0, 0, 0, 0, 1320, - 0, 0, 0, 1321, 1322, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1328, 0, 1323, 0, 0, - 0, 1321, 1322, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1328, 0, 1323, 0, 0, 1308, 0, - 0, 1309, 0, 0, 0, 0, 1310, 1311, 1312, 0, - 0, 0, 0, 0, 0, 1324, 0, 0, 1325, 0, - 0, 0, 1328, 1313, 0, 0, 0, 0, 0, 0, - 0, 1315, 1326, 1324, 0, 1327, 1325, 0, 1316, 0, - 0, 1328, 0, 0, 0, 0, 0, 0, 0, 0, - 1326, 0, 0, 1327, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1317, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1329, 0, 0, 1330, 1331, - 1332, 0, 1333, 1334, 1335, 1336, 1337, 1338, 0, 0, - 0, 0, 2361, 1329, 0, 0, 1330, 1331, 1332, 0, - 1333, 1334, 1335, 1336, 1337, 1338, 0, 0, 0, 0, - 2487, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1329, 0, 1328, 1330, 1331, 1332, 0, 1333, - 1334, 1335, 1336, 1337, 1338, 0, 0, 0, 0, 2509, - 0, 1329, 1328, 0, 1330, 1331, 1332, 0, 1333, 1334, - 1335, 1336, 1337, 1338, 0, 0, 0, 0, 2654, 0, - 0, 0, 0, 1318, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1319, - 0, 0, 0, 0, 1320, 0, 0, 0, 0, 0, + 0, 1324, 0, 0, 0, 0, 0, 1325, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1321, 1322, 0, 0, + 0, 0, 0, 0, 0, 0, 1325, 0, 1315, 0, + 0, 1316, 0, 0, 0, 1317, 1318, 1319, 1320, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1323, 0, 0, 0, 1329, 0, 0, 1330, 1331, 1332, - 0, 1333, 1334, 1335, 1336, 1337, 1338, 0, 0, 0, - 0, 2875, 1329, 0, 0, 1330, 1331, 1332, 0, 1333, - 1334, 1335, 1336, 1337, 1338, 0, 0, 0, 1324, 2887, - 0, 1325, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1326, 0, 0, 1327, 0, + 0, 0, 0, 1321, 0, 0, 0, 0, 0, 0, + 1326, 1323, 0, 0, 0, 0, 0, 0, 1324, 0, + 0, 0, 0, 0, 0, 0, 1327, 0, 0, 1326, + 0, 1328, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1325, 0, 1327, 0, 0, 0, 0, + 1328, 0, 0, 1329, 1330, 0, 0, 0, 1326, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1331, 0, + 0, 0, 1329, 1330, 1327, 0, 0, 1326, 0, 1328, + 0, 0, 0, 0, 0, 0, 0, 1331, 0, 0, + 0, 0, 0, 1327, 0, 0, 0, 0, 1328, 0, + 0, 1329, 1330, 0, 0, 0, 1332, 0, 0, 1333, + 0, 0, 0, 0, 0, 0, 1331, 0, 0, 0, + 1329, 1330, 0, 1334, 0, 1332, 1335, 0, 1333, 0, + 0, 0, 0, 0, 0, 1331, 0, 0, 0, 0, + 0, 0, 1334, 0, 1326, 1335, 0, 0, 0, 0, + 0, 0, 0, 0, 1332, 0, 0, 1333, 0, 0, + 1327, 0, 0, 0, 0, 1328, 0, 0, 0, 0, + 0, 1334, 0, 1332, 1335, 0, 1333, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1329, 1330, 0, + 1334, 0, 0, 1335, 0, 0, 0, 0, 0, 0, + 0, 0, 1331, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1315, 0, 1336, 1316, 0, 0, 0, + 1317, 1318, 1319, 1320, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1336, 0, 0, 0, 1321, 0, + 1332, 0, 0, 1333, 0, 0, 1323, 0, 0, 0, + 0, 0, 0, 1324, 0, 0, 0, 1334, 0, 0, + 1335, 0, 0, 1336, 1315, 0, 0, 1316, 0, 0, + 0, 1317, 1318, 1319, 1320, 0, 0, 0, 1325, 0, + 0, 0, 1336, 0, 0, 0, 0, 0, 0, 1321, + 0, 0, 0, 0, 0, 0, 0, 1323, 0, 0, + 0, 0, 0, 0, 1324, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1337, 0, 0, 1338, 1339, + 1340, 0, 1341, 1342, 1343, 1344, 1345, 1346, 0, 1325, + 0, 0, 2293, 0, 1337, 0, 0, 1338, 1339, 1340, + 0, 1341, 1342, 1343, 1344, 1345, 1346, 0, 0, 1336, + 0, 2380, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1337, 0, 0, 1338, 1339, 1340, 0, + 1341, 1342, 1343, 1344, 1345, 1346, 0, 0, 0, 1326, + 2510, 0, 1337, 0, 0, 1338, 1339, 1340, 0, 1341, + 1342, 1343, 1344, 1345, 1346, 1327, 0, 0, 0, 2532, + 1328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1329, 1330, 0, 0, 0, 0, 0, 0, + 1326, 0, 0, 0, 0, 0, 0, 1331, 0, 0, + 0, 0, 0, 0, 0, 0, 1327, 0, 0, 1337, + 0, 1328, 1338, 1339, 1340, 0, 1341, 1342, 1343, 1344, + 1345, 1346, 0, 0, 0, 0, 2680, 0, 0, 0, + 0, 0, 0, 1329, 1330, 1332, 0, 0, 1333, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1331, 0, + 0, 0, 1334, 0, 0, 1335, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 1332, 0, 0, 1333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1334, 0, 0, 1335, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1336, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1336, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1337, 0, 0, 1338, 1339, 1340, + 0, 1341, 1342, 1343, 1344, 1345, 1346, 0, 0, 0, + 0, 2903, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1329, 1051, 0, - 1330, 1331, 1332, 0, 1333, 1334, 1335, 1336, 1337, 1338, - 0, 0, 1491, 0, 93, 94, 95, 96, 97, 98, - 99, 100, 1052, 101, 102, 103, 1053, 1054, 1055, 1056, - 1057, 1058, 1059, 104, 105, 1060, 106, 107, 108, 0, - 110, 111, 112, 743, 744, 0, 745, 746, 1061, 118, - 119, 120, 121, 122, 123, 1062, 1063, 124, 125, 747, - 748, 128, 1064, 129, 130, 131, 132, 749, 1065, 0, - 1066, 135, 136, 137, 138, 139, 140, 0, 142, 143, - 144, 1067, 145, 146, 147, 148, 149, 150, 1068, 0, - 152, 153, 154, 1069, 1070, 1071, 0, 1072, 1073, 1074, - 156, 157, 158, 159, 160, 161, 162, 750, 751, 165, - 1075, 166, 1076, 167, 168, 169, 170, 171, 172, 1077, - 173, 174, 175, 176, 177, 1078, 1079, 178, 179, 180, - 181, 182, 1080, 183, 184, 185, 1081, 186, 187, 188, - 1082, 189, 190, 191, 192, 752, 194, 195, 196, 197, - 753, 1083, 199, 1084, 200, 201, 754, 203, 1085, 204, - 1086, 205, 0, 1087, 0, 208, 209, 210, 0, 212, - 1088, 213, 1089, 755, 756, 216, 1090, 217, 218, 219, - 220, 221, 222, 223, 0, 225, 226, 227, 228, 1091, - 229, 230, 231, 232, 233, 234, 1092, 235, 0, 757, - 238, 239, 240, 241, 242, 758, 759, 1093, 760, 1094, - 246, 0, 0, 249, 0, 251, 252, 253, 254, 255, - 1095, 1096, 256, 0, 258, 0, 1097, 260, 261, 262, - 1098, 1099, 263, 264, 265, 266, 267, 761, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, - 281, 282, 283, 284, 285, 286, 762, 0, 763, 290, - 291, 292, 764, 1100, 294, 295, 0, 297, 1101, 765, - 299, 766, 301, 302, 303, 1102, 304, 305, 1103, 1104, - 306, 307, 308, 1105, 1106, 309, 767, 0, 312, 0, - 768, 315, 316, 317, 318, 319, 320, 321, 322, 323, - 324, 1107, 325, 326, 769, 328, 329, 770, 331, 332, - 333, 1108, 334, 335, 336, 337, 338, 339, 1109, 340, - 341, 342, 771, 344, 345, 346, 347, 1110, 348, 349, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 1111, 361, 362, 0, 364, 365, 366, 772, 368, - 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, - 1112, 379, 380, 381, 382, 383, 1113, 384, 773, 386, - 387, 388, 0, 390, 391, 774, 393, 1114, 394, 395, - 396, 397, 398, 399, 400, 401, 402, 403, 404, 775, - 406, 776, 408, 1115, 409, 410, 1116, 411, 0, 413, - 414, 415, 416, 417, 1117, 777, 778, 1118, 1119, 420, - 421, 779, 423, 780, 1120, 425, 426, 781, 428, 429, - 430, 431, 432, 1121, 1122, 433, 434, 435, 436, 437, - 1123, 1124, 438, 439, 440, 441, 442, 1125, 783, 1126, - 445, 0, 447, 448, 449, 450, 1127, 1128, 451, 1129, - 1130, 452, 453, 454, 455, 456, 457, 784, 785, 786, - 787, 788, 789, 790, 791, 792, 793, 794, 469, 470, - 471, 472, 498, 0, 0, 0, 0, 0, 0, 0, - 0, 1739, 0, 0, 0, 0, 0, 0, 93, 94, - 95, 96, 97, 98, 99, 100, 0, 101, 102, 103, - 0, 0, 0, 0, 0, 0, 0, 104, 105, 0, - 106, 107, 108, 0, 110, 111, 112, 113, 114, 0, - 116, 117, 0, 118, 119, 120, 121, 122, 123, 0, - 0, 124, 125, 126, 127, 128, 0, 129, 130, 131, - 132, 133, 0, 0, 0, 135, 136, 137, 138, 139, - 140, 0, 142, 143, 144, 0, 145, 146, 147, 148, - 149, 150, 0, 0, 152, 153, 154, 0, 0, 0, - 0, 0, 0, 0, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 0, 166, 0, 167, 168, 169, - 170, 171, 172, 0, 173, 174, 175, 176, 177, 0, - 0, 178, 179, 180, 181, 182, 0, 183, 184, 185, - 0, 186, 187, 188, 0, 189, 190, 191, 192, 193, - 194, 195, 196, 197, 198, 0, 199, 0, 200, 201, - 202, 203, 0, 204, 0, 205, 0, 0, 0, 208, - 209, 210, 0, 212, 0, 213, 0, 214, 215, 216, - 0, 217, 218, 219, 220, 221, 222, 223, 0, 225, - 226, 227, 228, 0, 229, 230, 231, 232, 233, 234, - 0, 235, 0, 237, 238, 239, 240, 241, 242, 243, - 244, 0, 245, 0, 246, 0, 0, 249, 0, 251, - 252, 253, 254, 255, 0, 0, 256, 0, 258, 0, - 0, 260, 261, 262, 0, 0, 263, 264, 265, 266, - 267, 500, 269, 270, 271, 272, 273, 274, 275, 276, + 0, 0, 0, 0, 0, 1337, 0, 1057, 1338, 1339, + 1340, 0, 1341, 1342, 1343, 1344, 1345, 1346, 0, 0, + 0, 0, 2915, 94, 95, 96, 97, 98, 99, 100, + 101, 1058, 102, 103, 104, 1059, 1060, 1061, 1062, 1063, + 1064, 1065, 105, 106, 1066, 107, 108, 109, 0, 111, + 112, 113, 747, 748, 0, 749, 750, 1067, 119, 120, + 121, 122, 123, 124, 1068, 1069, 125, 126, 751, 752, + 129, 1070, 130, 131, 132, 133, 753, 1071, 0, 1072, + 136, 137, 138, 139, 140, 141, 0, 143, 144, 145, + 1073, 146, 147, 148, 149, 150, 151, 1074, 0, 153, + 154, 155, 1075, 1076, 1077, 0, 1078, 1079, 1080, 157, + 158, 159, 160, 161, 162, 163, 754, 755, 166, 1081, + 167, 1082, 168, 169, 170, 171, 172, 173, 1083, 174, + 175, 176, 177, 178, 1084, 1085, 179, 180, 181, 182, + 183, 1086, 184, 185, 186, 1087, 187, 188, 189, 1088, + 190, 191, 192, 193, 756, 195, 196, 197, 198, 199, + 757, 1089, 201, 1090, 202, 203, 758, 205, 1091, 206, + 1092, 207, 0, 1093, 0, 210, 211, 212, 0, 214, + 1094, 215, 1095, 759, 760, 218, 1096, 219, 220, 221, + 222, 223, 224, 225, 0, 227, 228, 229, 230, 1097, + 231, 232, 233, 234, 235, 236, 1098, 237, 0, 761, + 240, 241, 242, 243, 244, 762, 763, 1099, 764, 1100, + 248, 0, 0, 251, 0, 253, 254, 255, 256, 257, + 258, 1101, 1102, 259, 0, 261, 0, 1103, 263, 264, + 265, 1104, 1105, 266, 267, 268, 269, 270, 765, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 766, 0, 767, + 293, 294, 295, 768, 1106, 297, 298, 0, 300, 1107, + 769, 302, 770, 304, 305, 306, 1108, 307, 308, 1109, + 1110, 309, 310, 311, 1111, 1112, 312, 771, 0, 315, + 0, 772, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 1113, 328, 329, 773, 331, 332, 774, 334, + 335, 336, 1114, 337, 338, 339, 340, 341, 342, 1115, + 343, 344, 345, 775, 347, 348, 349, 350, 1116, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 1117, 364, 365, 0, 367, 368, 369, 776, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 1118, 382, 383, 384, 385, 386, 1119, 387, 777, + 389, 390, 391, 0, 393, 394, 778, 396, 1120, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 779, 409, 780, 411, 1121, 412, 413, 1122, 414, 0, + 416, 417, 418, 419, 420, 1123, 781, 782, 1124, 1125, + 423, 424, 783, 426, 784, 1126, 428, 429, 785, 431, + 432, 433, 434, 435, 1127, 1128, 436, 437, 438, 439, + 440, 1129, 1130, 441, 442, 443, 444, 445, 1131, 787, + 1132, 448, 0, 450, 451, 452, 453, 1133, 1134, 454, + 1135, 1136, 455, 456, 457, 458, 459, 460, 788, 789, + 790, 791, 792, 793, 794, 795, 796, 797, 798, 472, + 473, 474, 475, 498, 0, 0, 0, 0, 0, 0, + 0, 0, 1743, 0, 0, 0, 0, 0, 0, 94, + 95, 96, 97, 98, 99, 100, 101, 0, 102, 103, + 104, 0, 0, 0, 0, 0, 0, 0, 105, 106, + 0, 107, 108, 109, 0, 111, 112, 113, 114, 115, + 0, 117, 118, 0, 119, 120, 121, 122, 123, 124, + 0, 0, 125, 126, 127, 128, 129, 0, 130, 131, + 132, 133, 134, 0, 0, 0, 136, 137, 138, 139, + 140, 141, 0, 143, 144, 145, 0, 146, 147, 148, + 149, 150, 151, 0, 0, 153, 154, 155, 0, 0, + 0, 0, 0, 0, 0, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 0, 167, 0, 168, 169, + 170, 171, 172, 173, 0, 174, 175, 176, 177, 178, + 0, 0, 179, 180, 181, 182, 183, 0, 184, 185, + 186, 0, 187, 188, 189, 0, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 0, 201, 0, + 202, 203, 204, 205, 0, 206, 0, 207, 0, 0, + 0, 210, 211, 212, 0, 214, 0, 215, 0, 216, + 217, 218, 0, 219, 220, 221, 222, 223, 224, 225, + 0, 227, 228, 229, 230, 0, 231, 232, 233, 234, + 235, 236, 0, 237, 0, 239, 240, 241, 242, 243, + 244, 245, 246, 0, 247, 0, 248, 0, 0, 251, + 0, 253, 254, 255, 256, 257, 258, 0, 0, 259, + 0, 261, 0, 0, 263, 264, 265, 0, 0, 266, + 267, 268, 269, 270, 500, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 287, 0, 289, 290, 291, 292, 293, 0, 294, 295, - 0, 297, 0, 298, 299, 300, 301, 302, 303, 0, - 304, 305, 0, 0, 306, 307, 308, 0, 0, 309, - 310, 0, 312, 0, 314, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 0, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 0, 334, 335, 336, 337, - 338, 339, 0, 340, 341, 342, 343, 344, 345, 346, - 347, 0, 348, 349, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 0, 361, 362, 0, 364, - 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 0, 379, 380, 381, 382, 383, - 0, 384, 385, 386, 387, 388, 0, 390, 391, 392, - 393, 0, 394, 395, 396, 397, 398, 399, 400, 401, - 402, 403, 404, 502, 406, 407, 408, 0, 409, 410, - 0, 411, 0, 413, 414, 415, 416, 417, 0, 418, - 419, 0, 0, 420, 421, 422, 423, 424, 0, 425, - 426, 427, 428, 429, 430, 431, 432, 0, 0, 433, - 434, 435, 436, 437, 0, 0, 438, 439, 440, 441, - 442, 443, 444, 0, 445, 0, 447, 448, 449, 450, - 0, 0, 451, 0, 0, 452, 453, 454, 455, 456, + 287, 288, 289, 290, 0, 292, 293, 294, 295, 296, + 0, 297, 298, 0, 300, 0, 301, 302, 303, 304, + 305, 306, 0, 307, 308, 0, 0, 309, 310, 311, + 0, 0, 312, 313, 0, 315, 0, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 0, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 0, 337, + 338, 339, 340, 341, 342, 0, 343, 344, 345, 346, + 347, 348, 349, 350, 0, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 0, 364, + 365, 0, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 0, 382, 383, + 384, 385, 386, 0, 387, 388, 389, 390, 391, 0, + 393, 394, 395, 396, 0, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 502, 409, 410, 411, + 0, 412, 413, 0, 414, 0, 416, 417, 418, 419, + 420, 0, 421, 422, 0, 0, 423, 424, 425, 426, + 427, 0, 428, 429, 430, 431, 432, 433, 434, 435, + 0, 0, 436, 437, 438, 439, 440, 0, 0, 441, + 442, 443, 444, 445, 446, 447, 0, 448, 0, 450, + 451, 452, 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 472, 742, 1232, 547, 0, - 0, 0, 818, 0, 0, 2226, 0, 0, 0, 0, - 0, 0, 93, 94, 95, 96, 97, 98, 99, 100, - 0, 101, 102, 103, 0, 0, 0, 0, 0, 0, - 0, 104, 105, 0, 106, 107, 108, 0, 110, 111, - 112, 743, 744, 0, 745, 746, 0, 118, 119, 120, - 121, 122, 123, 0, 0, 124, 125, 747, 748, 128, - 0, 129, 130, 131, 132, 749, 0, 0, 0, 135, - 136, 137, 138, 139, 140, 0, 142, 143, 144, 0, - 145, 146, 147, 148, 149, 150, 0, 0, 152, 153, - 154, 0, 0, 0, 0, 0, 0, 0, 156, 157, - 158, 159, 160, 161, 162, 750, 751, 165, 1367, 166, - 0, 167, 168, 169, 170, 171, 172, 0, 173, 174, - 175, 176, 177, 0, 0, 178, 179, 180, 181, 182, - 0, 183, 184, 185, 0, 186, 187, 188, 0, 189, - 190, 191, 192, 752, 194, 195, 196, 197, 753, 1233, - 199, 0, 200, 201, 754, 203, 0, 204, 0, 205, - 0, 0, 0, 208, 209, 210, 0, 212, 0, 213, - 0, 755, 756, 216, 0, 217, 218, 219, 220, 221, - 222, 223, 0, 225, 226, 227, 228, 0, 229, 230, - 231, 232, 233, 234, 0, 235, 0, 757, 238, 239, - 240, 241, 242, 758, 759, 0, 760, 0, 246, 0, - 0, 249, 0, 251, 252, 253, 254, 255, 0, 0, - 256, 0, 258, 0, 0, 260, 261, 262, 0, 0, - 263, 264, 265, 266, 267, 761, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, - 283, 284, 285, 286, 762, 0, 763, 290, 291, 292, - 764, 0, 294, 295, 0, 297, 0, 765, 299, 766, - 301, 302, 303, 0, 304, 305, 1234, 0, 306, 307, - 308, 0, 0, 309, 767, 0, 312, 0, 768, 315, - 316, 317, 318, 319, 320, 321, 322, 323, 324, 0, - 325, 326, 769, 328, 329, 770, 331, 332, 333, 0, - 334, 335, 336, 337, 338, 339, 0, 340, 341, 342, - 771, 344, 345, 346, 347, 0, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 0, - 361, 362, 0, 364, 365, 366, 772, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 0, 379, - 380, 381, 382, 383, 0, 384, 773, 386, 387, 388, - 0, 390, 391, 774, 393, 0, 394, 395, 396, 397, - 398, 399, 400, 401, 402, 403, 404, 775, 406, 776, - 408, 0, 409, 410, 0, 411, 0, 413, 414, 415, - 416, 417, 0, 777, 778, 0, 0, 420, 421, 779, - 423, 780, 1235, 425, 426, 781, 428, 429, 430, 431, - 432, 0, 0, 433, 434, 435, 436, 437, 0, 0, - 438, 439, 440, 441, 442, 1125, 783, 0, 445, 0, - 447, 448, 449, 450, 0, 0, 451, 0, 0, 452, - 453, 454, 455, 456, 457, 784, 785, 786, 787, 788, - 789, 790, 791, 792, 793, 794, 469, 470, 471, 472, - 742, 1232, 547, 0, 0, 0, 818, 1236, 1237, 0, - 0, 0, 0, 0, 0, 0, 93, 94, 95, 96, - 97, 98, 99, 100, 0, 101, 102, 103, 0, 0, - 0, 0, 0, 0, 0, 104, 105, 0, 106, 107, - 108, 0, 110, 111, 112, 743, 744, 0, 745, 746, - 0, 118, 119, 120, 121, 122, 123, 0, 0, 124, - 125, 747, 748, 128, 0, 129, 130, 131, 132, 749, - 0, 0, 0, 135, 136, 137, 138, 139, 140, 0, - 142, 143, 144, 0, 145, 146, 147, 148, 149, 150, - 0, 0, 152, 153, 154, 0, 0, 0, 0, 0, - 0, 0, 156, 157, 158, 159, 160, 161, 162, 750, - 751, 165, 1369, 166, 0, 167, 168, 169, 170, 171, - 172, 0, 173, 174, 175, 176, 177, 0, 0, 178, - 179, 180, 181, 182, 0, 183, 184, 185, 0, 186, - 187, 188, 0, 189, 190, 191, 192, 752, 194, 195, - 196, 197, 753, 1233, 199, 0, 200, 201, 754, 203, - 0, 204, 0, 205, 0, 0, 0, 208, 209, 210, - 0, 212, 0, 213, 0, 755, 756, 216, 0, 217, - 218, 219, 220, 221, 222, 223, 0, 225, 226, 227, - 228, 0, 229, 230, 231, 232, 233, 234, 0, 235, - 0, 757, 238, 239, 240, 241, 242, 758, 759, 0, - 760, 0, 246, 0, 0, 249, 0, 251, 252, 253, - 254, 255, 0, 0, 256, 0, 258, 0, 0, 260, - 261, 262, 0, 0, 263, 264, 265, 266, 267, 761, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, 762, 0, - 763, 290, 291, 292, 764, 0, 294, 295, 0, 297, - 0, 765, 299, 766, 301, 302, 303, 0, 304, 305, - 1234, 0, 306, 307, 308, 0, 0, 309, 767, 0, - 312, 0, 768, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 0, 325, 326, 769, 328, 329, 770, - 331, 332, 333, 0, 334, 335, 336, 337, 338, 339, - 0, 340, 341, 342, 771, 344, 345, 346, 347, 0, - 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 0, 361, 362, 0, 364, 365, 366, - 772, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 0, 379, 380, 381, 382, 383, 0, 384, - 773, 386, 387, 388, 0, 390, 391, 774, 393, 0, - 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, - 404, 775, 406, 776, 408, 0, 409, 410, 0, 411, - 0, 413, 414, 415, 416, 417, 0, 777, 778, 0, - 0, 420, 421, 779, 423, 780, 1235, 425, 426, 781, - 428, 429, 430, 431, 432, 0, 0, 433, 434, 435, - 436, 437, 0, 0, 438, 439, 440, 441, 442, 1125, - 783, 0, 445, 0, 447, 448, 449, 450, 0, 0, - 451, 0, 0, 452, 453, 454, 455, 456, 457, 784, - 785, 786, 787, 788, 789, 790, 791, 792, 793, 794, - 469, 470, 471, 472, 742, 1232, 547, 0, 0, 0, - 818, 1236, 1237, 0, 0, 0, 0, 0, 0, 0, - 93, 94, 95, 96, 97, 98, 99, 100, 0, 101, - 102, 103, 0, 0, 0, 0, 0, 0, 0, 104, - 105, 0, 106, 107, 108, 0, 110, 111, 112, 743, - 744, 0, 745, 746, 0, 118, 119, 120, 121, 122, - 123, 0, 0, 124, 125, 747, 748, 128, 0, 129, - 130, 131, 132, 749, 0, 0, 0, 135, 136, 137, - 138, 139, 140, 0, 142, 143, 144, 0, 145, 146, - 147, 148, 149, 150, 0, 0, 152, 153, 154, 0, - 0, 0, 0, 0, 0, 0, 156, 157, 158, 159, - 160, 161, 162, 750, 751, 165, 0, 166, 0, 167, - 168, 169, 170, 171, 172, 0, 173, 174, 175, 176, - 177, 0, 0, 178, 179, 180, 181, 182, 0, 183, - 184, 185, 0, 186, 187, 188, 0, 189, 190, 191, - 192, 752, 194, 195, 196, 197, 753, 1233, 199, 0, - 200, 201, 754, 203, 0, 204, 0, 205, 0, 0, - 0, 208, 209, 210, 0, 212, 0, 213, 0, 755, - 756, 216, 0, 217, 218, 219, 220, 221, 222, 223, - 0, 225, 226, 227, 228, 0, 229, 230, 231, 232, - 233, 234, 0, 235, 0, 757, 238, 239, 240, 241, - 242, 758, 759, 0, 760, 0, 246, 0, 0, 249, - 0, 251, 252, 253, 254, 255, 0, 0, 256, 0, - 258, 0, 0, 260, 261, 262, 0, 0, 263, 264, - 265, 266, 267, 761, 269, 270, 271, 272, 273, 274, + 467, 468, 469, 470, 471, 472, 473, 474, 475, 746, + 1238, 547, 0, 0, 0, 822, 0, 0, 2244, 0, + 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 0, 102, 103, 104, 0, 0, 0, + 0, 0, 0, 0, 105, 106, 0, 107, 108, 109, + 0, 111, 112, 113, 747, 748, 0, 749, 750, 0, + 119, 120, 121, 122, 123, 124, 0, 0, 125, 126, + 751, 752, 129, 0, 130, 131, 132, 133, 753, 0, + 0, 0, 136, 137, 138, 139, 140, 141, 0, 143, + 144, 145, 0, 146, 147, 148, 149, 150, 151, 0, + 0, 153, 154, 155, 0, 0, 0, 0, 0, 0, + 0, 157, 158, 159, 160, 161, 162, 163, 754, 755, + 166, 1373, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 0, 0, 179, 180, + 181, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 756, 195, 196, 197, + 198, 199, 757, 1239, 201, 0, 202, 203, 758, 205, + 0, 206, 0, 207, 0, 0, 0, 210, 211, 212, + 0, 214, 0, 215, 0, 759, 760, 218, 0, 219, + 220, 221, 222, 223, 224, 225, 0, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 0, 761, 240, 241, 242, 243, 244, 762, 763, 0, + 764, 0, 248, 0, 0, 251, 0, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 0, 261, 0, 0, + 263, 264, 265, 0, 0, 266, 267, 268, 269, 270, + 765, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 766, + 0, 767, 293, 294, 295, 768, 0, 297, 298, 0, + 300, 0, 769, 302, 770, 304, 305, 306, 0, 307, + 308, 1240, 0, 309, 310, 311, 0, 0, 312, 771, + 0, 315, 0, 772, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 0, 328, 329, 773, 331, 332, + 774, 334, 335, 336, 0, 337, 338, 339, 340, 341, + 342, 0, 343, 344, 345, 775, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 0, 367, 368, + 369, 776, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 0, 382, 383, 384, 385, 386, 0, + 387, 777, 389, 390, 391, 0, 393, 394, 778, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 779, 409, 780, 411, 0, 412, 413, 0, + 414, 0, 416, 417, 418, 419, 420, 0, 781, 782, + 0, 0, 423, 424, 783, 426, 784, 1241, 428, 429, + 785, 431, 432, 433, 434, 435, 0, 0, 436, 437, + 438, 439, 440, 0, 0, 441, 442, 443, 444, 445, + 1131, 787, 0, 448, 0, 450, 451, 452, 453, 0, + 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, + 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, + 798, 472, 473, 474, 475, 746, 1238, 547, 0, 0, + 0, 822, 1242, 1243, 0, 0, 0, 0, 0, 0, + 0, 94, 95, 96, 97, 98, 99, 100, 101, 0, + 102, 103, 104, 0, 0, 0, 0, 0, 0, 0, + 105, 106, 0, 107, 108, 109, 0, 111, 112, 113, + 747, 748, 0, 749, 750, 0, 119, 120, 121, 122, + 123, 124, 0, 0, 125, 126, 751, 752, 129, 0, + 130, 131, 132, 133, 753, 0, 0, 0, 136, 137, + 138, 139, 140, 141, 0, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 0, 0, 153, 154, 155, + 0, 0, 0, 0, 0, 0, 0, 157, 158, 159, + 160, 161, 162, 163, 754, 755, 166, 1375, 167, 0, + 168, 169, 170, 171, 172, 173, 0, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 181, 182, 183, 0, + 184, 185, 186, 0, 187, 188, 189, 0, 190, 191, + 192, 193, 756, 195, 196, 197, 198, 199, 757, 1239, + 201, 0, 202, 203, 758, 205, 0, 206, 0, 207, + 0, 0, 0, 210, 211, 212, 0, 214, 0, 215, + 0, 759, 760, 218, 0, 219, 220, 221, 222, 223, + 224, 225, 0, 227, 228, 229, 230, 0, 231, 232, + 233, 234, 235, 236, 0, 237, 0, 761, 240, 241, + 242, 243, 244, 762, 763, 0, 764, 0, 248, 0, + 0, 251, 0, 253, 254, 255, 256, 257, 258, 0, + 0, 259, 0, 261, 0, 0, 263, 264, 265, 0, + 0, 266, 267, 268, 269, 270, 765, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 762, 0, 763, 290, 291, 292, 764, 0, - 294, 295, 0, 297, 0, 765, 299, 766, 301, 302, - 303, 0, 304, 305, 1234, 0, 306, 307, 308, 0, - 0, 309, 767, 0, 312, 0, 768, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 0, 325, 326, - 769, 328, 329, 770, 331, 332, 333, 0, 334, 335, - 336, 337, 338, 339, 0, 340, 341, 342, 771, 344, - 345, 346, 347, 0, 348, 349, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 0, 361, 362, - 0, 364, 365, 366, 772, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 378, 0, 379, 380, 381, - 382, 383, 0, 384, 773, 386, 387, 388, 0, 390, - 391, 774, 393, 0, 394, 395, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 775, 406, 776, 408, 0, - 409, 410, 0, 411, 0, 413, 414, 415, 416, 417, - 0, 777, 778, 0, 0, 420, 421, 779, 423, 780, - 1235, 425, 426, 781, 428, 429, 430, 431, 432, 0, - 0, 433, 434, 435, 436, 437, 0, 0, 438, 439, - 440, 441, 442, 1125, 783, 0, 445, 0, 447, 448, - 449, 450, 0, 0, 451, 0, 0, 452, 453, 454, - 455, 456, 457, 784, 785, 786, 787, 788, 789, 790, - 791, 792, 793, 794, 469, 470, 471, 472, 0, 1308, - 0, 0, 1309, 0, 0, 1236, 1237, 1310, 1311, 1312, - 0, 0, 0, 0, 0, 0, 0, 1308, 0, 0, - 1309, 0, 0, 0, 1313, 1310, 1311, 1312, 1765, 0, - 0, 0, 1315, 0, 0, 0, 0, 0, 0, 1316, - 0, 0, 1313, 0, 0, 0, 1308, 0, 0, 1309, - 1315, 0, 0, 0, 1310, 1311, 1312, 1316, 0, 0, - 0, 0, 0, 0, 1317, 1308, 0, 0, 1309, 0, - 0, 1313, 0, 1310, 1311, 1312, 0, 0, 0, 1315, - 0, 0, 1317, 0, 0, 0, 1316, 0, 0, 0, - 1313, 0, 0, 1962, 0, 0, 0, 0, 1315, 0, - 0, 0, 0, 0, 0, 1316, 0, 0, 0, 0, - 0, 1317, 0, 0, 0, 1766, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1317, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1308, 0, - 0, 1309, 0, 0, 0, 0, 1310, 1311, 1312, 0, - 0, 0, 0, 0, 1318, 0, 0, 0, 0, 0, - 0, 0, 2000, 1313, 0, 0, 0, 2001, 0, 0, - 1319, 1315, 1318, 0, 0, 1320, 0, 0, 1316, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1319, 0, - 2948, 0, 0, 1320, 0, 0, 0, 1321, 1322, 0, - 0, 1318, 0, 1317, 0, 0, 0, 0, 0, 0, - 0, 1323, 0, 0, 0, 1321, 1322, 1319, 0, 0, - 1318, 0, 1320, 0, 0, 0, 0, 0, 0, 1323, - 0, 0, 0, 0, 0, 0, 1319, 0, 0, 0, - 0, 1320, 0, 0, 1321, 1322, 0, 0, 0, 1324, - 0, 0, 1325, 0, 0, 0, 0, 0, 1323, 0, - 0, 0, 0, 1321, 1322, 0, 1326, 1324, 0, 1327, - 1325, 0, 0, 0, 0, 0, 0, 1323, 0, 0, - 0, 0, 0, 0, 1326, 0, 0, 1327, 0, 0, - 0, 0, 0, 0, 0, 0, 1324, 0, 0, 1325, - 0, 0, 0, 1318, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1326, 0, 1324, 1327, 1308, 1325, 1319, - 1309, 0, 0, 0, 1320, 1310, 1311, 1312, 0, 0, - 0, 0, 1326, 0, 0, 1327, 0, 0, 0, 2949, - 0, 0, 1313, 0, 0, 2005, 1321, 1322, 0, 0, - 1315, 0, 0, 0, 0, 0, 0, 1316, 1328, 0, - 1323, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1328, 0, 0, 0, - 0, 1308, 1317, 0, 1309, 0, 0, 0, 0, 1310, - 1311, 1312, 0, 0, 0, 0, 0, 0, 1324, 0, - 0, 1325, 0, 0, 0, 1328, 1313, 0, 0, 0, - 0, 0, 0, 0, 1315, 1326, 0, 1770, 1327, 0, - 0, 1316, 0, 0, 1328, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1974, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1317, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1329, 0, - 0, 1330, 1331, 1332, 0, 1333, 1334, 1335, 1336, 1337, - 1338, 0, 0, 0, 0, 0, 1329, 0, 0, 1330, - 1331, 1332, 1318, 1333, 1334, 1335, 1336, 1337, 1338, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1319, 0, - 0, 0, 0, 1320, 0, 1329, 0, 1328, 1330, 1331, - 1332, 0, 1333, 1334, 1335, 1336, 1337, 1338, 0, 0, - 0, 0, 0, 0, 1329, 1321, 1322, 1330, 1331, 1332, - 0, 1333, 1334, 1335, 1336, 1337, 1338, 0, 0, 1323, - 0, 2010, 0, 0, 0, 0, 1318, 0, 1308, 0, - 0, 1309, 0, 0, 0, 0, 1310, 1311, 1312, 0, - 0, 0, 1319, 0, 0, 0, 0, 1320, 0, 0, - 0, 0, 0, 1313, 0, 0, 2012, 1324, 0, 0, - 1325, 1315, 0, 0, 0, 0, 0, 0, 1316, 1321, - 1322, 0, 0, 0, 1326, 0, 0, 1327, 0, 0, - 0, 0, 0, 1323, 0, 0, 0, 1329, 0, 0, - 1330, 1331, 1332, 1317, 1333, 1334, 1335, 1336, 1337, 1338, - 0, 0, 0, 1308, 0, 0, 1309, 0, 0, 0, - 0, 1310, 1311, 1312, 0, 0, 0, 0, 0, 0, - 0, 1324, 0, 0, 1325, 0, 0, 0, 1313, 0, - 0, 2272, 0, 0, 0, 0, 1315, 0, 1326, 0, - 0, 1327, 1308, 1316, 0, 1309, 0, 0, 0, 0, - 1310, 1311, 1312, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1328, 1313, 1317, 0, - 0, 0, 0, 0, 0, 1315, 0, 0, 0, 0, - 0, 0, 1316, 0, 0, 0, 0, 1308, 0, 0, - 1309, 0, 0, 1318, 0, 1310, 1311, 1312, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1317, 0, 1319, - 0, 0, 1313, 0, 1320, 0, 0, 0, 0, 0, - 1315, 0, 0, 0, 0, 0, 0, 1316, 0, 0, - 1328, 0, 0, 0, 0, 0, 1321, 1322, 0, 0, + 285, 286, 287, 288, 289, 766, 0, 767, 293, 294, + 295, 768, 0, 297, 298, 0, 300, 0, 769, 302, + 770, 304, 305, 306, 0, 307, 308, 1240, 0, 309, + 310, 311, 0, 0, 312, 771, 0, 315, 0, 772, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 0, 328, 329, 773, 331, 332, 774, 334, 335, 336, + 0, 337, 338, 339, 340, 341, 342, 0, 343, 344, + 345, 775, 347, 348, 349, 350, 0, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 0, 364, 365, 0, 367, 368, 369, 776, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 0, + 382, 383, 384, 385, 386, 0, 387, 777, 389, 390, + 391, 0, 393, 394, 778, 396, 0, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 779, 409, + 780, 411, 0, 412, 413, 0, 414, 0, 416, 417, + 418, 419, 420, 0, 781, 782, 0, 0, 423, 424, + 783, 426, 784, 1241, 428, 429, 785, 431, 432, 433, + 434, 435, 0, 0, 436, 437, 438, 439, 440, 0, + 0, 441, 442, 443, 444, 445, 1131, 787, 0, 448, + 0, 450, 451, 452, 453, 0, 0, 454, 0, 0, + 455, 456, 457, 458, 459, 460, 788, 789, 790, 791, + 792, 793, 794, 795, 796, 797, 798, 472, 473, 474, + 475, 746, 1238, 547, 0, 0, 0, 822, 1242, 1243, + 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 0, 0, 0, 105, 106, 0, 107, + 108, 109, 0, 111, 112, 113, 747, 748, 0, 749, + 750, 0, 119, 120, 121, 122, 123, 124, 0, 0, + 125, 126, 751, 752, 129, 0, 130, 131, 132, 133, + 753, 0, 0, 0, 136, 137, 138, 139, 140, 141, + 0, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 0, 153, 154, 155, 0, 0, 0, 0, + 0, 0, 0, 157, 158, 159, 160, 161, 162, 163, + 754, 755, 166, 0, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 181, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 756, 195, + 196, 197, 198, 199, 757, 1239, 201, 0, 202, 203, + 758, 205, 0, 206, 0, 207, 0, 0, 0, 210, + 211, 212, 0, 214, 0, 215, 0, 759, 760, 218, + 0, 219, 220, 221, 222, 223, 224, 225, 0, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 0, 761, 240, 241, 242, 243, 244, 762, + 763, 0, 764, 0, 248, 0, 0, 251, 0, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 0, 261, + 0, 0, 263, 264, 265, 0, 0, 266, 267, 268, + 269, 270, 765, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 766, 0, 767, 293, 294, 295, 768, 0, 297, + 298, 0, 300, 0, 769, 302, 770, 304, 305, 306, + 0, 307, 308, 1240, 0, 309, 310, 311, 0, 0, + 312, 771, 0, 315, 0, 772, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 773, + 331, 332, 774, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 775, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 0, + 367, 368, 369, 776, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 0, 387, 777, 389, 390, 391, 0, 393, 394, + 778, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 779, 409, 780, 411, 0, 412, + 413, 0, 414, 0, 416, 417, 418, 419, 420, 0, + 781, 782, 0, 0, 423, 424, 783, 426, 784, 1241, + 428, 429, 785, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 0, 0, 441, 442, 443, + 444, 445, 1131, 787, 0, 448, 0, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, + 459, 460, 788, 789, 790, 791, 792, 793, 794, 795, + 796, 797, 798, 472, 473, 474, 475, 0, 0, 1315, + 0, 0, 1316, 0, 1242, 1243, 1317, 1318, 1319, 1320, + 0, 0, 1315, 0, 0, 1316, 0, 0, 0, 1317, + 1318, 1319, 1320, 0, 1321, 0, 0, 0, 0, 0, + 0, 0, 1323, 0, 0, 0, 0, 1321, 0, 1324, + 0, 0, 0, 0, 0, 1323, 1315, 0, 0, 1316, + 0, 0, 1324, 1317, 1318, 1319, 1320, 0, 0, 1315, + 0, 0, 1316, 0, 1325, 0, 1317, 1318, 1319, 1320, + 0, 1321, 0, 0, 1971, 0, 0, 1325, 0, 1323, + 0, 0, 0, 0, 1321, 0, 1324, 0, 0, 0, + 0, 0, 1323, 0, 0, 0, 0, 0, 0, 1324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1323, 0, 1317, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1329, 0, 1318, 1330, - 1331, 1332, 0, 1333, 1334, 1335, 1336, 1337, 1338, 0, - 0, 0, 0, 0, 1319, 0, 0, 0, 1324, 1320, 0, 1325, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1326, 0, 1318, 1327, 0, - 0, 1321, 1322, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1319, 0, 1323, 0, 0, 1320, 0, - 1329, 0, 0, 1330, 1331, 1332, 0, 1333, 1334, 1335, - 1336, 1337, 1338, 0, 0, 0, 0, 0, 0, 0, - 1321, 1322, 1318, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1324, 1323, 0, 1325, 0, 1319, 0, - 0, 0, 0, 1320, 0, 0, 0, 0, 0, 0, - 1326, 1308, 0, 1327, 1309, 0, 0, 0, 0, 1310, - 1311, 1312, 0, 0, 0, 1321, 1322, 1328, 0, 0, - 0, 0, 1324, 0, 0, 1325, 1313, 0, 0, 1323, - 0, 0, 0, 0, 1315, 0, 0, 0, 0, 1326, - 1308, 1316, 1327, 1309, 0, 0, 0, 0, 1310, 1311, - 1312, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1313, 1317, 1324, 0, 0, - 1325, 0, 0, 1315, 0, 0, 0, 0, 0, 0, - 1316, 0, 0, 0, 1326, 0, 0, 1327, 0, 0, - 0, 0, 1328, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1317, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1329, 0, 0, - 1330, 1331, 1332, 0, 1333, 1334, 1335, 1336, 1337, 1338, - 0, 1328, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1308, 0, 0, 1309, 0, 0, 0, 0, 1310, - 1311, 1312, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 2230, 0, 0, 1318, 0, 0, 0, - 0, 0, 0, 0, 1315, 0, 1328, 0, 0, 0, - 0, 1316, 1319, 0, 0, 0, 0, 1320, 0, 0, - 0, 0, 1329, 0, 0, 1330, 1331, 1332, 0, 1333, - 1334, 1335, 1336, 1337, 1338, 1318, 1317, 0, 0, 1321, - 1322, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1319, 0, 1323, 0, 0, 1320, 0, 0, 0, - 0, 1329, 0, 0, 1330, 1331, 1332, 0, 1333, 1334, - 1335, 1336, 1337, 1338, 0, 0, 0, 0, 1321, 1322, + 0, 0, 0, 0, 1325, 0, 0, 0, 0, 0, + 0, 0, 0, 1315, 0, 0, 1316, 0, 0, 0, + 1317, 1318, 1319, 1320, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 2009, 0, 0, 1321, 0, + 2010, 2015, 0, 0, 0, 1326, 1323, 3001, 0, 0, + 0, 0, 0, 1324, 0, 0, 0, 0, 1326, 0, + 0, 1327, 0, 0, 0, 0, 1328, 0, 0, 0, + 0, 0, 0, 0, 1327, 0, 0, 0, 1325, 1328, + 0, 0, 0, 0, 0, 0, 0, 0, 1329, 1330, + 0, 0, 1326, 0, 0, 0, 0, 0, 0, 0, + 0, 1329, 1330, 1331, 0, 1326, 0, 0, 1327, 0, + 0, 0, 0, 1328, 0, 0, 1331, 0, 0, 0, + 0, 1327, 0, 0, 0, 0, 1328, 0, 0, 0, + 0, 0, 0, 0, 0, 1329, 1330, 0, 0, 0, + 0, 1332, 0, 0, 1333, 0, 0, 0, 1329, 1330, + 1331, 0, 0, 0, 1332, 0, 0, 1333, 1334, 0, + 0, 1335, 0, 1331, 0, 0, 0, 0, 0, 0, + 0, 1334, 0, 0, 1335, 0, 0, 0, 0, 1326, + 0, 0, 0, 0, 0, 0, 0, 0, 1332, 0, + 0, 1333, 0, 0, 0, 1327, 0, 3002, 0, 0, + 1328, 1332, 0, 0, 1333, 1334, 0, 0, 1335, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1334, 0, + 0, 1335, 1329, 1330, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1331, 0, 1983, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1324, 1323, 0, 1325, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1329, 0, 1326, 1330, - 1331, 1332, 0, 1333, 1334, 1335, 1336, 1337, 1338, 0, + 1336, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1336, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1315, 0, 1332, 1316, 0, 1333, 0, + 1317, 1318, 1319, 1320, 0, 0, 0, 0, 0, 0, + 0, 0, 1334, 0, 0, 1335, 0, 1336, 1321, 0, + 0, 0, 0, 0, 0, 0, 1323, 0, 0, 0, + 1336, 0, 0, 1324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1324, 0, 0, 1325, 0, 0, 1318, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1326, 0, 0, - 1327, 0, 1319, 0, 0, 0, 0, 1320, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1325, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1321, - 1322, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1323, 0, 0, 0, 0, 0, 0, + 1337, 0, 0, 1338, 1339, 1340, 0, 1341, 1342, 1343, + 1344, 1345, 1346, 1337, 0, 0, 1338, 1339, 1340, 0, + 1341, 1342, 1343, 1344, 1345, 1346, 0, 0, 0, 0, + 0, 0, 0, 0, 1336, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1337, 0, 0, + 1338, 1339, 1340, 0, 1341, 1342, 1343, 1344, 1345, 1346, + 1337, 0, 0, 1338, 1339, 1340, 0, 1341, 1342, 1343, + 1344, 1345, 1346, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 1315, 2020, 0, 1316, 0, 0, 1326, + 1317, 1318, 1319, 1320, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1327, 0, 0, 1321, 0, + 1328, 2022, 0, 0, 0, 0, 1323, 0, 0, 0, + 0, 0, 0, 1324, 0, 0, 0, 0, 0, 0, + 0, 0, 1329, 1330, 1337, 0, 0, 1338, 1339, 1340, + 0, 1341, 1342, 1343, 1344, 1345, 1346, 1331, 1325, 1315, + 0, 0, 1316, 0, 0, 0, 1317, 1318, 1319, 1320, + 0, 0, 0, 0, 0, 0, 0, 0, 1315, 0, + 0, 1316, 0, 0, 1321, 1317, 1318, 1319, 1320, 0, + 0, 0, 1323, 0, 0, 1332, 0, 0, 1333, 1324, + 0, 0, 0, 1321, 0, 0, 2292, 0, 0, 0, + 0, 1323, 1334, 1315, 0, 1335, 1316, 0, 1324, 0, + 1317, 1318, 1319, 1320, 1325, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1321, 0, + 0, 0, 0, 1325, 0, 0, 1323, 0, 0, 0, + 0, 0, 0, 1324, 0, 0, 0, 0, 0, 1326, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1327, 0, 0, 1325, 0, 1328, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1329, 1330, 1336, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1331, 0, 0, + 0, 0, 0, 0, 0, 1326, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1324, 0, 0, 1325, 0, 0, 0, 0, 1328, - 0, 0, 0, 0, 0, 0, 0, 0, 1326, 0, + 0, 1327, 0, 0, 1326, 0, 1328, 0, 0, 0, + 0, 0, 0, 0, 0, 1332, 0, 0, 1333, 0, + 1327, 0, 0, 0, 0, 1328, 0, 0, 1329, 1330, + 0, 0, 1334, 0, 0, 1335, 0, 0, 0, 1326, + 0, 0, 0, 1331, 0, 0, 0, 1329, 1330, 0, + 0, 0, 0, 0, 0, 1327, 0, 0, 0, 0, + 1328, 0, 1331, 0, 1337, 0, 0, 1338, 1339, 1340, + 0, 1341, 1342, 1343, 1344, 1345, 1346, 0, 0, 0, + 0, 1332, 1329, 1330, 1333, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1331, 1334, 0, + 1332, 1335, 0, 1333, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1334, 0, 0, + 1335, 0, 0, 0, 1336, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1332, 0, 0, 1333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1334, 0, 0, 1335, 1315, 0, 0, 1316, + 0, 0, 0, 1317, 1318, 1319, 1320, 0, 0, 0, + 0, 0, 0, 0, 0, 1315, 0, 0, 1316, 0, + 0, 1321, 0, 1318, 1319, 1320, 0, 0, 0, 1323, + 1336, 0, 0, 0, 0, 0, 1324, 0, 0, 0, + 1321, 0, 0, 0, 0, 0, 0, 0, 1323, 1336, + 0, 0, 0, 0, 0, 1324, 0, 0, 0, 0, + 0, 1325, 2248, 0, 1337, 0, 0, 1338, 1339, 1340, + 0, 1341, 1342, 1343, 1344, 1345, 1346, 0, 0, 0, + 1325, 0, 0, 0, 1336, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1329, 0, 0, 1330, 1331, 1332, 0, 1333, 1334, 1335, - 1336, 1337, 1338, 0, 0, 0, 0, 0, 0, 0, + 1337, 0, 0, 1338, 1339, 1340, 0, 1341, 1342, 1343, + 1344, 1345, 1346, 0, 0, 0, 0, 0, 0, 1337, + 0, 0, 1338, 1339, 1340, 0, 1341, 1342, 1343, 1344, + 1345, 1346, 1326, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1327, 0, + 0, 1326, 0, 1328, 1337, 0, 0, 1338, 1339, 1340, + 0, 1341, 1342, 1343, 1344, 1345, 1346, 1327, 0, 0, + 0, 0, 1328, 0, 0, 1329, 1330, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1329, - 1328, 0, 1330, 1331, 1332, 0, 1333, 1334, 1335, 1336, - 1785, 1338, 0, 0, 0, 0, 0, 0, 0, 0, + 1331, 0, 0, 0, 1329, 1330, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1331, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 1332, 0, + 0, 1333, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 1334, 0, 1332, 1335, 0, + 1333, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 1334, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1051, 0, 1674, - 1329, 0, 0, 1330, 1331, 1332, 0, 1333, 1334, 1335, - 1336, 1337, 1338, 93, 94, 95, 96, 97, 98, 99, - 100, 1052, 101, 102, 103, 1053, 1054, 1055, 1056, 1057, - 1058, 1059, 104, 105, 1060, 106, 107, 108, 0, 110, - 111, 112, 743, 744, 0, 745, 746, 1061, 118, 119, - 120, 121, 122, 123, 1062, 1063, 124, 125, 747, 748, - 128, 1064, 129, 130, 131, 132, 749, 1065, 0, 1066, - 135, 136, 137, 138, 139, 140, 0, 142, 143, 144, - 1067, 145, 146, 147, 148, 149, 150, 1068, 0, 152, - 153, 154, 1069, 1070, 1071, 0, 1072, 1073, 1074, 156, - 157, 158, 159, 160, 161, 162, 750, 751, 165, 1075, - 166, 1076, 167, 168, 169, 170, 171, 172, 1077, 173, - 174, 175, 176, 177, 1078, 1079, 178, 179, 180, 181, - 182, 1080, 183, 184, 185, 1081, 186, 187, 188, 1082, - 189, 190, 191, 192, 752, 194, 195, 196, 197, 753, - 1083, 199, 1084, 200, 201, 754, 203, 1085, 204, 1086, - 205, 0, 1087, 0, 208, 209, 210, 0, 212, 1088, - 213, 1089, 755, 756, 216, 1090, 217, 218, 219, 220, - 221, 222, 223, 0, 225, 226, 227, 228, 1091, 229, - 230, 231, 232, 233, 234, 1092, 235, 0, 757, 238, - 239, 240, 241, 242, 758, 759, 1093, 760, 1094, 246, - 0, 0, 249, 0, 251, 252, 253, 254, 255, 1095, - 1096, 256, 0, 258, 0, 1097, 260, 261, 262, 1098, - 1099, 263, 264, 265, 266, 267, 761, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 762, 0, 763, 290, 291, - 292, 764, 1100, 294, 295, 0, 297, 1101, 765, 299, - 766, 301, 302, 303, 1102, 304, 305, 1103, 1104, 306, - 307, 308, 1105, 1106, 309, 767, 0, 312, 0, 768, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 1107, 325, 326, 769, 328, 329, 770, 331, 332, 333, - 1108, 334, 335, 336, 337, 338, 339, 1109, 340, 341, - 342, 771, 344, 345, 346, 347, 1110, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 1111, 361, 362, 0, 364, 365, 366, 772, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 1112, - 379, 380, 381, 382, 383, 1113, 384, 773, 386, 387, - 388, 0, 390, 391, 774, 393, 1114, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 775, 406, - 776, 408, 1115, 409, 410, 1116, 411, 0, 413, 414, - 415, 416, 417, 1117, 777, 778, 1118, 1119, 420, 421, - 779, 423, 780, 1120, 425, 426, 781, 428, 429, 430, - 431, 432, 1121, 1122, 433, 434, 435, 436, 437, 1123, - 1124, 438, 439, 440, 441, 442, 1125, 783, 1126, 445, - 0, 447, 448, 449, 450, 1127, 1128, 451, 1129, 1130, - 452, 453, 454, 455, 456, 457, 784, 785, 786, 787, - 788, 789, 790, 791, 792, 793, 794, 469, 470, 471, - 472, 1051, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 93, 94, 95, - 96, 97, 98, 99, 100, 1052, 101, 102, 103, 1053, - 1054, 1055, 1056, 1057, 1058, 1059, 104, 105, 1060, 106, - 107, 108, 0, 110, 111, 112, 743, 744, 0, 745, - 746, 1061, 118, 119, 120, 121, 122, 123, 1062, 1063, - 124, 125, 747, 748, 128, 1064, 129, 130, 131, 132, - 749, 1065, 0, 1066, 135, 136, 137, 138, 139, 140, - 0, 142, 143, 144, 1067, 145, 146, 147, 148, 149, - 150, 1068, 0, 152, 153, 154, 1069, 1070, 1071, 0, - 1072, 1073, 1074, 156, 157, 158, 159, 160, 161, 162, - 750, 751, 165, 1075, 166, 1076, 167, 168, 169, 170, - 171, 172, 1077, 173, 174, 175, 176, 177, 1078, 1079, - 178, 179, 180, 181, 182, 1080, 183, 184, 185, 1081, - 186, 187, 188, 1082, 189, 190, 191, 192, 752, 194, - 195, 196, 197, 753, 1083, 199, 1084, 200, 201, 754, - 203, 1085, 204, 1086, 205, 0, 1087, 0, 208, 209, - 210, 0, 212, 1088, 213, 1089, 755, 756, 216, 1090, - 217, 218, 219, 220, 221, 222, 223, 0, 225, 226, - 227, 228, 1091, 229, 230, 231, 232, 233, 234, 1092, - 235, 0, 757, 238, 239, 240, 241, 242, 758, 759, - 1093, 760, 1094, 246, 0, 0, 249, 0, 251, 252, - 253, 254, 255, 1095, 1096, 256, 0, 258, 0, 1097, - 260, 261, 262, 1098, 1099, 263, 264, 265, 266, 267, - 761, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 762, - 0, 763, 290, 291, 292, 764, 1100, 294, 295, 0, - 297, 1101, 765, 299, 766, 301, 302, 303, 1102, 304, - 305, 1103, 1104, 306, 307, 308, 1105, 1106, 309, 767, - 0, 312, 0, 768, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 1107, 325, 326, 769, 328, 329, - 770, 331, 332, 333, 1108, 334, 335, 336, 337, 338, - 339, 1109, 340, 341, 342, 771, 344, 345, 346, 347, - 1110, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 1111, 361, 362, 0, 364, 365, - 366, 772, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 1112, 379, 380, 381, 382, 383, 1113, - 384, 773, 386, 387, 388, 0, 390, 391, 774, 393, - 1114, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 775, 406, 776, 408, 1115, 409, 410, 1116, - 411, 0, 413, 414, 415, 416, 417, 1117, 777, 778, - 1118, 1119, 420, 421, 779, 423, 780, 1120, 425, 426, - 781, 428, 429, 430, 431, 432, 1121, 1122, 433, 434, - 435, 436, 437, 1123, 1124, 438, 439, 440, 441, 442, - 1125, 783, 1126, 445, 0, 447, 448, 449, 450, 1127, - 1128, 451, 1129, 1130, 452, 453, 454, 455, 456, 457, - 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, - 794, 469, 470, 471, 472, 1051, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 1336, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 94, 95, 96, 1820, 98, 99, 100, 1052, - 101, 102, 103, 1053, 1054, 1055, 1056, 1057, 1058, 1059, - 104, 105, 1060, 106, 107, 108, 0, 110, 111, 112, - 743, 744, 0, 745, 746, 1061, 118, 119, 120, 121, - 122, 123, 1062, 1063, 124, 125, 747, 748, 128, 1064, - 129, 130, 131, 132, 749, 1065, 0, 1066, 135, 136, - 137, 138, 139, 140, 0, 142, 143, 144, 1067, 145, - 146, 147, 148, 149, 150, 1068, 0, 152, 153, 154, - 1069, 1070, 1071, 0, 1072, 1073, 1074, 156, 157, 158, - 159, 160, 161, 162, 750, 751, 165, 1075, 166, 1076, - 167, 168, 169, 170, 171, 172, 1077, 173, 174, 175, - 176, 177, 1078, 1079, 178, 179, 180, 1821, 182, 1080, - 183, 184, 185, 1081, 186, 187, 188, 1082, 189, 190, - 191, 192, 752, 194, 195, 196, 197, 753, 1083, 199, - 1084, 200, 201, 754, 203, 1085, 204, 1086, 205, 0, - 1087, 0, 208, 209, 210, 0, 212, 1088, 213, 1089, - 755, 756, 216, 1090, 217, 218, 219, 220, 221, 222, - 223, 0, 225, 226, 227, 228, 1091, 229, 230, 231, - 232, 233, 234, 1092, 235, 0, 757, 238, 239, 240, - 241, 242, 758, 759, 1093, 760, 1094, 246, 0, 0, - 249, 0, 251, 252, 253, 254, 255, 1095, 1096, 256, - 0, 258, 0, 1097, 260, 261, 262, 1098, 1099, 263, - 264, 265, 266, 267, 761, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 762, 0, 763, 290, 291, 292, 764, - 1100, 294, 295, 0, 297, 1101, 765, 299, 766, 301, - 302, 303, 1102, 304, 305, 1103, 1104, 306, 307, 308, - 1105, 1106, 309, 767, 0, 312, 0, 768, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 1107, 325, - 326, 769, 328, 329, 770, 331, 332, 333, 1108, 334, - 335, 336, 337, 338, 339, 1109, 340, 341, 342, 771, - 344, 345, 346, 347, 1110, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 1111, 361, - 362, 0, 364, 365, 366, 772, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 1112, 379, 380, - 381, 382, 383, 1113, 1822, 773, 386, 387, 388, 0, - 390, 391, 774, 393, 1114, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 775, 406, 776, 408, - 1115, 409, 410, 1116, 411, 0, 413, 414, 415, 416, - 417, 1117, 777, 778, 1118, 1119, 420, 421, 779, 423, - 780, 1120, 425, 426, 781, 428, 429, 430, 431, 432, - 1121, 1122, 433, 434, 435, 436, 437, 1123, 1124, 438, - 439, 440, 441, 442, 1125, 783, 1126, 445, 0, 447, - 448, 449, 450, 1127, 1128, 451, 1129, 1130, 452, 453, - 454, 455, 456, 457, 784, 785, 786, 787, 788, 789, - 790, 791, 792, 793, 794, 469, 470, 471, 472, 92, + 0, 0, 0, 0, 0, 0, 1336, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 93, 94, 95, 96, 97, - 98, 99, 100, 0, 101, 102, 103, 0, 0, 0, - 0, 0, 0, 0, 104, 105, 0, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 0, - 118, 119, 120, 121, 122, 123, 0, 825, 124, 125, - 126, 127, 128, 0, 129, 130, 131, 132, 828, 0, - 829, 0, 135, 136, 137, 138, 139, 140, 141, 142, - 143, 144, 0, 145, 146, 147, 148, 149, 150, 0, - 151, 152, 153, 154, 830, 831, 832, 833, 834, 835, - 836, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 0, 166, 0, 167, 168, 169, 170, 171, 172, - 0, 173, 174, 175, 176, 177, 0, 0, 178, 179, - 180, 181, 182, 0, 183, 184, 185, 0, 186, 187, - 188, 0, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 841, 0, 199, 0, 200, 201, 202, 203, 0, - 204, 0, 205, 206, 0, 207, 208, 209, 210, 211, - 212, 0, 213, 0, 214, 215, 216, 0, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 0, 229, 230, 231, 232, 233, 234, 0, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 0, 245, - 0, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 0, 0, 256, 257, 258, 259, 0, 260, 261, - 262, 849, 850, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, - 290, 291, 292, 293, 0, 294, 295, 296, 297, 0, - 855, 299, 300, 301, 302, 303, 0, 304, 305, 0, - 0, 306, 307, 308, 0, 0, 309, 310, 311, 312, - 313, 858, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 325, 326, 859, 328, 329, 330, 331, - 332, 333, 0, 334, 335, 336, 337, 338, 339, 0, - 340, 341, 342, 343, 344, 345, 346, 347, 0, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 0, 361, 362, 363, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 0, 379, 380, 381, 382, 383, 862, 384, 385, - 386, 387, 388, 389, 390, 391, 392, 393, 0, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 405, 406, 864, 408, 0, 409, 410, 0, 411, 412, - 413, 414, 415, 416, 417, 0, 418, 419, 0, 0, - 420, 421, 867, 423, 868, 0, 425, 426, 870, 428, - 429, 430, 431, 432, 0, 0, 433, 434, 435, 436, - 437, 871, 0, 438, 439, 440, 441, 442, 443, 444, - 0, 445, 446, 447, 448, 449, 450, 0, 0, 451, - 0, 0, 452, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 92, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, - 94, 95, 96, 97, 98, 99, 100, 0, 101, 102, - 103, 0, 0, 0, 0, 0, 0, 0, 104, 105, - 0, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 0, 118, 119, 120, 121, 122, 123, - 0, 0, 124, 125, 126, 127, 128, 0, 129, 130, - 131, 132, 133, 0, 134, 0, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 0, 145, 146, 147, - 148, 149, 150, 0, 151, 152, 153, 154, 0, 0, - 0, 155, 0, 0, 0, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 0, 166, 0, 167, 168, - 169, 170, 171, 172, 0, 173, 174, 175, 176, 177, - 0, 0, 178, 179, 180, 181, 182, 0, 183, 184, - 185, 0, 186, 187, 188, 0, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 0, 199, 0, 200, - 201, 202, 203, 0, 204, 0, 205, 206, 0, 207, - 208, 209, 210, 211, 212, 0, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 228, 0, 229, 230, 231, 232, 233, - 234, 0, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 0, 245, 0, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 0, 0, 256, 257, 258, - 259, 0, 260, 261, 262, 0, 0, 263, 264, 265, - 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 288, 289, 290, 291, 292, 293, 0, 294, - 295, 296, 297, 0, 298, 299, 300, 301, 302, 303, - 0, 304, 305, 0, 0, 306, 307, 308, 0, 0, - 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 0, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 0, 334, 335, 336, - 337, 338, 339, 0, 340, 341, 342, 343, 344, 345, - 346, 347, 0, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 0, 361, 362, 363, - 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 0, 379, 380, 381, 382, - 383, 0, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 0, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 405, 406, 407, 408, 0, 409, - 410, 0, 411, 412, 413, 414, 415, 416, 417, 0, - 418, 419, 0, 0, 420, 421, 422, 423, 424, 0, - 425, 426, 427, 428, 429, 430, 431, 432, 0, 0, - 433, 434, 435, 436, 437, 0, 0, 438, 439, 440, - 441, 442, 443, 444, 0, 445, 446, 447, 448, 449, - 450, 0, 0, 451, 0, 0, 452, 453, 454, 455, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 498, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 93, 94, 95, 96, 97, 98, 99, - 100, 0, 101, 102, 103, 0, 0, 0, 0, 0, - 0, 0, 104, 105, 0, 106, 107, 108, 0, 110, - 111, 112, 113, 114, 0, 116, 117, 0, 118, 119, - 120, 121, 122, 123, 0, 0, 124, 125, 126, 127, - 128, 1429, 129, 130, 131, 132, 133, 0, 0, 1430, - 135, 136, 137, 138, 139, 140, 0, 142, 143, 144, - 1431, 145, 146, 147, 148, 149, 150, 0, 0, 152, - 153, 154, 0, 0, 0, 0, 0, 0, 0, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 0, - 166, 0, 167, 168, 169, 170, 171, 172, 0, 173, - 174, 175, 176, 177, 0, 0, 178, 179, 180, 181, - 182, 0, 183, 184, 185, 0, 186, 187, 188, 0, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 0, 199, 0, 200, 201, 202, 203, 0, 204, 1432, - 205, 0, 0, 0, 208, 209, 210, 0, 212, 0, - 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 221, 1433, 223, 0, 225, 226, 227, 228, 0, 229, - 230, 231, 232, 233, 234, 0, 235, 0, 237, 238, - 239, 240, 241, 242, 243, 244, 0, 245, 0, 246, - 0, 0, 249, 0, 251, 252, 253, 254, 255, 0, - 0, 256, 0, 258, 0, 0, 260, 261, 262, 0, - 0, 263, 264, 265, 266, 267, 500, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 0, 289, 290, 291, - 292, 293, 0, 294, 295, 0, 297, 0, 298, 299, - 300, 301, 302, 303, 0, 304, 305, 0, 0, 306, - 307, 308, 0, 0, 309, 310, 0, 312, 0, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 0, 325, 326, 327, 328, 329, 330, 331, 332, 333, - 1434, 334, 335, 336, 337, 338, 339, 0, 340, 341, - 342, 343, 344, 345, 346, 347, 0, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 0, 361, 362, 0, 364, 365, 366, 367, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 0, - 379, 380, 381, 382, 383, 0, 384, 385, 386, 387, - 388, 0, 390, 391, 392, 393, 0, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 502, 406, - 407, 408, 0, 409, 410, 0, 411, 0, 413, 414, - 415, 416, 417, 0, 418, 419, 0, 0, 420, 421, - 422, 423, 424, 0, 425, 426, 427, 428, 429, 430, - 431, 432, 0, 1435, 433, 434, 435, 436, 437, 0, - 0, 438, 439, 440, 441, 442, 443, 444, 0, 445, - 0, 447, 448, 449, 450, 0, 0, 451, 0, 0, - 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 498, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 93, 94, 95, - 96, 97, 98, 99, 100, 0, 101, 102, 103, 0, - 0, 0, 0, 0, 0, 0, 104, 105, 0, 106, - 107, 108, 0, 110, 111, 112, 113, 114, 0, 116, - 117, 0, 118, 119, 120, 121, 122, 123, 0, 0, - 124, 125, 126, 127, 128, 1429, 129, 130, 131, 132, - 133, 0, 0, 0, 135, 136, 137, 138, 139, 140, - 0, 142, 143, 144, 1431, 145, 146, 147, 148, 149, - 150, 0, 0, 152, 153, 154, 0, 0, 0, 0, - 0, 0, 0, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 0, 199, 0, 200, 201, 202, - 203, 0, 204, 1432, 205, 0, 0, 0, 208, 209, - 210, 0, 212, 0, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 0, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 0, 237, 238, 239, 240, 241, 242, 243, 244, - 0, 245, 0, 246, 0, 0, 249, 0, 251, 252, - 253, 254, 255, 0, 0, 256, 0, 258, 1888, 0, - 260, 261, 262, 0, 0, 263, 264, 265, 266, 267, - 500, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 0, 289, 290, 291, 292, 293, 0, 294, 295, 0, - 297, 0, 298, 299, 300, 301, 302, 303, 0, 304, - 305, 0, 0, 306, 307, 308, 0, 0, 309, 310, - 0, 312, 0, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 1434, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 343, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 0, 364, 365, - 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 0, - 384, 385, 386, 387, 388, 0, 390, 391, 392, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 502, 406, 407, 408, 0, 409, 410, 0, - 411, 0, 413, 414, 415, 416, 417, 0, 418, 419, - 0, 0, 420, 421, 422, 423, 424, 0, 425, 426, - 427, 428, 429, 430, 431, 432, 0, 1435, 433, 434, - 435, 436, 437, 0, 0, 438, 439, 440, 441, 442, - 443, 444, 0, 445, 0, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 742, 0, 547, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 94, 95, 96, 97, 98, 99, 100, 0, - 101, 102, 103, 0, 0, 0, 0, 0, 0, 0, - 104, 105, 0, 106, 107, 108, 0, 110, 111, 112, - 743, 744, 0, 745, 746, 0, 118, 119, 120, 121, - 122, 123, 0, 0, 124, 125, 747, 748, 128, 0, - 129, 130, 131, 132, 749, 0, 0, 0, 135, 136, - 137, 138, 139, 140, 0, 142, 143, 144, 0, 145, - 146, 147, 148, 149, 150, 0, 0, 152, 153, 154, - 0, 0, 0, 0, 0, 0, 0, 156, 157, 158, - 159, 160, 161, 162, 750, 751, 165, 0, 166, 0, - 167, 168, 169, 170, 171, 172, 0, 173, 174, 175, - 176, 177, 0, 0, 178, 179, 180, 181, 182, 0, - 183, 184, 185, 0, 186, 187, 188, 0, 189, 190, - 191, 192, 752, 194, 195, 196, 197, 753, 1233, 199, - 0, 200, 201, 754, 203, 0, 204, 0, 205, 0, - 0, 0, 208, 209, 210, 0, 212, 0, 213, 0, - 755, 756, 216, 0, 217, 218, 219, 220, 221, 222, - 223, 0, 225, 226, 227, 228, 0, 229, 230, 231, - 232, 233, 234, 0, 235, 0, 757, 238, 239, 240, - 241, 242, 758, 759, 0, 760, 0, 246, 0, 0, - 249, 0, 251, 252, 253, 254, 255, 0, 0, 256, - 0, 258, 0, 0, 260, 261, 262, 0, 0, 263, - 264, 265, 266, 267, 761, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 762, 0, 763, 290, 291, 292, 764, - 0, 294, 295, 0, 297, 0, 765, 299, 766, 301, - 302, 303, 0, 304, 305, 1234, 0, 306, 307, 308, - 0, 0, 309, 767, 0, 312, 0, 768, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 0, 325, - 326, 769, 328, 329, 770, 331, 332, 333, 0, 334, - 335, 336, 337, 338, 339, 0, 340, 341, 342, 771, - 344, 345, 346, 347, 0, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 0, 361, - 362, 0, 364, 365, 366, 772, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 0, 379, 380, - 381, 382, 383, 0, 384, 773, 386, 387, 388, 0, - 390, 391, 774, 393, 0, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 775, 406, 776, 408, - 0, 409, 410, 0, 411, 0, 413, 414, 415, 416, - 417, 0, 777, 778, 0, 0, 420, 421, 779, 423, - 780, 1235, 425, 426, 781, 428, 429, 430, 431, 432, - 0, 0, 433, 434, 435, 436, 437, 0, 0, 438, - 439, 440, 441, 442, 1125, 783, 0, 445, 0, 447, - 448, 449, 450, 0, 0, 451, 0, 0, 452, 453, - 454, 455, 456, 457, 784, 785, 786, 787, 788, 789, - 790, 791, 792, 793, 794, 469, 470, 471, 472, 498, - 0, 579, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 93, 94, 95, 96, 97, - 98, 99, 100, 0, 101, 102, 103, 3, 4, 0, - 0, 0, 0, 0, 104, 105, 0, 106, 107, 108, - 0, 110, 111, 112, 113, 114, 0, 116, 117, 0, - 118, 119, 120, 121, 122, 123, 0, 0, 124, 125, - 126, 127, 128, 0, 129, 130, 131, 132, 133, 0, - 0, 0, 135, 136, 137, 138, 139, 140, 0, 142, - 143, 144, 0, 145, 146, 147, 148, 149, 150, 0, - 0, 152, 153, 154, 0, 0, 0, 0, 0, 0, - 0, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 0, 166, 0, 167, 168, 169, 170, 171, 172, - 0, 173, 174, 175, 176, 177, 0, 0, 178, 179, - 180, 181, 182, 0, 183, 184, 185, 0, 186, 187, - 188, 0, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 0, 199, 0, 200, 201, 202, 203, 0, - 204, 0, 205, 0, 0, 0, 208, 209, 210, 0, - 212, 0, 213, 0, 214, 215, 216, 0, 217, 218, - 219, 220, 221, 222, 223, 0, 225, 226, 227, 228, - 0, 229, 230, 231, 232, 233, 234, 0, 235, 0, - 237, 238, 239, 240, 241, 242, 243, 244, 0, 245, - 0, 246, 0, 0, 249, 0, 251, 252, 253, 254, - 255, 0, 0, 256, 0, 258, 0, 0, 260, 261, - 262, 0, 0, 263, 264, 265, 266, 267, 500, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 0, 289, - 290, 291, 292, 293, 0, 294, 295, 0, 297, 0, - 298, 299, 300, 301, 302, 303, 0, 304, 305, 0, - 0, 306, 307, 308, 0, 0, 309, 310, 0, 312, - 0, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 325, 326, 327, 328, 329, 330, 331, - 332, 333, 0, 334, 335, 336, 337, 338, 339, 0, - 340, 341, 342, 343, 344, 345, 346, 347, 0, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 0, 361, 362, 0, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 0, 379, 380, 381, 382, 383, 0, 384, 385, - 386, 387, 388, 0, 390, 391, 392, 393, 0, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 502, 406, 407, 408, 0, 409, 410, 0, 411, 0, - 413, 414, 415, 416, 417, 0, 418, 419, 0, 0, - 420, 421, 422, 423, 424, 0, 425, 426, 427, 428, - 429, 430, 431, 432, 0, 0, 433, 434, 435, 436, - 437, 0, 0, 438, 439, 440, 441, 442, 443, 444, - 0, 445, 0, 447, 448, 449, 450, 0, 0, 451, - 0, 0, 452, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 498, 0, 579, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, - 94, 95, 96, 97, 98, 99, 100, 0, 101, 102, - 103, 0, 0, 0, 0, 0, 0, 0, 104, 105, - 0, 106, 107, 108, 0, 110, 111, 112, 113, 114, - 0, 116, 117, 0, 118, 119, 120, 121, 122, 123, - 0, 0, 124, 125, 126, 127, 128, 0, 129, 130, - 131, 132, 133, 0, 0, 0, 135, 136, 137, 138, - 139, 140, 0, 142, 143, 144, 0, 145, 146, 147, - 148, 149, 150, 0, 0, 152, 153, 154, 0, 0, - 0, 0, 0, 0, 0, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 0, 166, 0, 167, 168, - 169, 170, 171, 172, 0, 173, 174, 175, 176, 177, - 0, 0, 178, 179, 180, 181, 182, 0, 183, 184, - 185, 0, 186, 187, 188, 0, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 0, 199, 0, 200, - 201, 202, 203, 0, 204, 0, 205, 0, 0, 0, - 208, 209, 210, 0, 212, 0, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, 221, 222, 223, 0, - 225, 226, 227, 228, 0, 229, 230, 231, 232, 233, - 234, 0, 235, 0, 237, 238, 239, 240, 241, 242, - 243, 244, 0, 245, 0, 246, 0, 0, 249, 0, - 251, 252, 253, 254, 255, 0, 0, 256, 0, 258, - 0, 0, 260, 261, 262, 0, 0, 263, 264, 265, - 266, 267, 500, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 0, 289, 290, 291, 292, 293, 0, 294, - 295, 0, 297, 0, 298, 299, 300, 301, 302, 303, - 0, 304, 305, 0, 580, 306, 307, 308, 0, 0, - 309, 310, 0, 312, 0, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 0, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 0, 334, 335, 336, - 337, 338, 339, 0, 340, 341, 342, 343, 344, 345, - 346, 347, 0, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 0, 361, 362, 0, - 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 0, 379, 380, 381, 382, - 383, 0, 384, 385, 386, 387, 388, 0, 390, 391, - 392, 393, 0, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 502, 406, 407, 408, 0, 409, - 410, 0, 411, 0, 413, 414, 415, 416, 417, 0, - 418, 419, 0, 0, 420, 421, 422, 423, 424, 0, - 425, 426, 427, 428, 429, 430, 431, 432, 0, 0, - 433, 434, 435, 436, 437, 0, 0, 438, 439, 440, - 441, 442, 443, 444, 0, 445, 0, 447, 448, 449, - 450, 0, 0, 451, 0, 0, 452, 453, 454, 455, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 498, 0, 579, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 93, 94, 95, 96, 97, 98, 99, - 100, 0, 101, 102, 103, 0, 0, 0, 0, 0, - 0, 0, 104, 105, 0, 106, 107, 108, 0, 110, - 111, 112, 113, 114, 0, 116, 117, 0, 118, 119, - 120, 121, 122, 123, 0, 0, 124, 125, 126, 127, - 128, 0, 129, 130, 131, 132, 133, 0, 0, 0, - 135, 136, 137, 138, 139, 140, 0, 142, 143, 144, - 0, 145, 146, 147, 148, 149, 150, 0, 0, 152, - 153, 154, 0, 0, 0, 0, 0, 0, 0, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 0, - 166, 0, 167, 168, 169, 170, 171, 172, 0, 173, - 174, 175, 176, 177, 0, 0, 178, 179, 180, 181, - 182, 0, 183, 184, 185, 0, 186, 187, 188, 0, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 0, 199, 0, 200, 201, 202, 203, 0, 204, 0, - 205, 0, 0, 0, 208, 209, 210, 0, 212, 0, - 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 221, 623, 223, 0, 225, 226, 227, 228, 0, 229, - 230, 231, 232, 233, 234, 0, 235, 0, 237, 238, - 239, 240, 241, 242, 243, 244, 0, 245, 0, 246, - 0, 0, 249, 0, 251, 252, 253, 254, 255, 0, - 0, 256, 0, 258, 0, 0, 260, 261, 262, 0, - 0, 263, 264, 265, 266, 267, 500, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 0, 289, 290, 291, - 292, 293, 0, 294, 295, 0, 297, 0, 298, 299, - 300, 301, 302, 303, 0, 304, 305, 0, 580, 306, - 307, 308, 0, 0, 309, 310, 0, 312, 0, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 0, 325, 326, 327, 328, 329, 330, 331, 332, 333, - 0, 334, 335, 336, 337, 338, 339, 0, 340, 341, - 342, 343, 344, 345, 346, 347, 0, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 0, 361, 362, 0, 364, 365, 366, 367, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 0, - 379, 380, 381, 382, 383, 0, 384, 385, 386, 387, - 388, 0, 390, 391, 392, 393, 0, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 502, 406, - 407, 408, 0, 409, 410, 0, 411, 0, 413, 414, - 415, 416, 417, 0, 418, 419, 0, 0, 420, 421, - 422, 423, 424, 0, 425, 426, 427, 428, 429, 430, - 431, 432, 0, 0, 433, 434, 435, 436, 437, 0, - 0, 438, 439, 440, 441, 442, 443, 444, 0, 445, - 0, 447, 448, 449, 450, 0, 0, 451, 0, 0, - 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 742, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 93, 94, 95, - 96, 97, 98, 99, 100, 0, 101, 102, 103, 3, - 4, 0, 0, 0, 0, 0, 104, 105, 0, 106, - 107, 108, 0, 110, 111, 112, 743, 744, 0, 745, - 746, 0, 118, 119, 120, 121, 122, 123, 0, 0, - 124, 125, 747, 748, 128, 0, 129, 130, 131, 132, - 749, 0, 0, 0, 135, 136, 137, 138, 139, 140, - 0, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 0, 152, 153, 154, 0, 0, 0, 0, - 0, 0, 0, 156, 157, 158, 159, 160, 161, 162, - 750, 751, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 752, 194, - 195, 196, 197, 753, 0, 199, 0, 200, 201, 754, - 203, 0, 204, 0, 205, 0, 0, 0, 208, 209, - 210, 0, 212, 0, 213, 0, 755, 756, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 0, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 0, 757, 238, 239, 240, 241, 242, 758, 759, - 0, 760, 0, 246, 0, 0, 249, 0, 251, 252, - 253, 254, 255, 0, 0, 256, 0, 258, 0, 0, - 260, 261, 262, 0, 0, 263, 264, 265, 266, 267, - 761, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 762, - 0, 763, 290, 291, 292, 764, 0, 294, 295, 0, - 297, 0, 765, 299, 766, 301, 302, 303, 0, 304, - 305, 0, 0, 306, 307, 308, 0, 0, 309, 767, - 0, 312, 0, 768, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 769, 328, 329, - 770, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 771, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 0, 364, 365, - 366, 772, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 0, - 384, 773, 386, 387, 388, 0, 390, 391, 774, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 775, 406, 776, 408, 0, 409, 410, 0, - 411, 0, 413, 414, 415, 416, 417, 0, 777, 778, - 0, 0, 420, 421, 779, 423, 780, 0, 425, 426, - 781, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 0, 0, 438, 439, 440, 441, 442, - 1125, 783, 0, 445, 0, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, - 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, - 794, 469, 470, 471, 472, 498, 0, 579, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 94, 95, 96, 97, 98, 99, 100, 0, - 101, 102, 103, 0, 0, 0, 0, 0, 0, 0, - 104, 105, 0, 106, 107, 108, 0, 110, 111, 112, - 113, 114, 0, 116, 117, 0, 118, 119, 120, 121, - 122, 123, 0, 0, 124, 125, 126, 127, 128, 0, - 129, 130, 131, 132, 133, 0, 0, 0, 135, 136, - 137, 138, 139, 140, 0, 142, 143, 144, 0, 145, - 146, 147, 148, 149, 150, 0, 0, 152, 153, 154, - 0, 0, 0, 0, 0, 0, 0, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 0, 166, 0, - 167, 168, 169, 170, 171, 172, 0, 173, 174, 175, - 176, 177, 0, 0, 178, 179, 180, 181, 182, 0, - 183, 184, 185, 0, 186, 187, 188, 0, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 0, 199, - 0, 200, 201, 202, 203, 0, 204, 0, 205, 0, - 0, 0, 208, 209, 210, 0, 1727, 0, 213, 0, - 214, 215, 216, 0, 217, 218, 219, 220, 221, 222, - 223, 0, 225, 226, 227, 228, 0, 229, 230, 231, - 232, 233, 234, 0, 235, 0, 237, 238, 239, 240, - 241, 242, 243, 244, 0, 245, 0, 246, 0, 0, - 249, 0, 251, 252, 253, 254, 255, 0, 0, 256, - 0, 258, 0, 0, 260, 261, 1728, 0, 0, 263, - 264, 265, 266, 267, 500, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 287, 0, 289, 290, 291, 292, 293, - 0, 294, 295, 0, 297, 0, 298, 299, 300, 301, - 302, 303, 0, 304, 305, 0, 0, 306, 307, 308, - 0, 0, 309, 310, 0, 312, 0, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 0, 325, - 326, 327, 328, 329, 330, 331, 332, 333, 0, 334, - 335, 336, 337, 338, 339, 0, 340, 341, 342, 343, - 344, 345, 346, 347, 0, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 0, 361, - 362, 0, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 0, 379, 380, - 381, 382, 383, 0, 384, 385, 386, 387, 388, 0, - 390, 391, 392, 393, 0, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 502, 406, 407, 408, - 0, 409, 410, 1729, 411, 0, 413, 1730, 415, 1731, - 417, 0, 418, 419, 0, 0, 420, 421, 422, 423, - 424, 0, 425, 426, 427, 428, 429, 430, 431, 432, - 0, 0, 433, 434, 1732, 436, 437, 0, 0, 438, - 439, 440, 441, 442, 443, 444, 0, 445, 0, 447, - 448, 449, 450, 0, 0, 451, 0, 0, 452, 453, - 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 498, - 2662, 0, 0, 0, 0, 2663, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 93, 94, 95, 96, 97, - 98, 99, 100, 0, 101, 102, 103, 0, 0, 0, - 0, 0, 0, 0, 104, 105, 0, 106, 107, 108, - 0, 110, 111, 112, 113, 114, 0, 116, 117, 0, - 118, 119, 120, 121, 122, 123, 0, 0, 124, 125, - 126, 127, 128, 0, 129, 130, 131, 132, 133, 0, - 0, 0, 135, 136, 137, 138, 139, 140, 0, 142, - 143, 144, 0, 145, 146, 147, 148, 149, 150, 0, - 0, 152, 153, 154, 0, 0, 0, 0, 0, 0, - 0, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 0, 166, 0, 167, 168, 169, 170, 171, 172, - 0, 173, 174, 175, 176, 177, 0, 0, 178, 179, - 180, 181, 182, 0, 183, 184, 185, 0, 186, 187, - 188, 0, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 0, 199, 0, 200, 201, 202, 203, 0, - 204, 0, 205, 0, 0, 0, 208, 209, 210, 0, - 212, 0, 213, 0, 214, 215, 216, 0, 217, 218, - 219, 220, 221, 222, 223, 0, 225, 226, 227, 228, - 0, 229, 230, 231, 232, 233, 234, 0, 235, 0, - 237, 238, 239, 240, 241, 242, 243, 244, 0, 245, - 0, 246, 0, 0, 249, 0, 251, 252, 253, 254, - 255, 0, 0, 256, 0, 258, 0, 0, 260, 261, - 262, 0, 0, 263, 264, 265, 266, 267, 500, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 0, 289, - 290, 291, 292, 293, 0, 294, 295, 0, 297, 0, - 298, 299, 300, 301, 302, 303, 0, 304, 305, 0, - 0, 306, 307, 308, 0, 0, 309, 310, 0, 312, - 0, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 325, 326, 327, 328, 329, 330, 331, - 332, 333, 0, 334, 335, 336, 337, 338, 339, 0, - 340, 341, 342, 343, 344, 345, 346, 347, 0, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 0, 361, 362, 0, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 0, 379, 380, 381, 382, 383, 0, 384, 385, - 386, 387, 388, 0, 390, 391, 392, 393, 0, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 502, 406, 407, 408, 0, 409, 410, 0, 411, 0, - 413, 414, 415, 416, 417, 0, 418, 419, 0, 0, - 420, 421, 422, 423, 424, 0, 425, 426, 427, 428, - 429, 430, 431, 432, 0, 0, 433, 434, 435, 436, - 437, 0, 0, 438, 439, 440, 441, 442, 443, 444, - 0, 445, 0, 447, 448, 449, 450, 0, 0, 451, - 0, 0, 452, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 498, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, - 94, 95, 96, 97, 98, 99, 100, 499, 101, 102, - 103, 0, 0, 0, 0, 0, 0, 0, 104, 105, - 0, 106, 107, 108, 0, 110, 111, 112, 113, 114, - 0, 116, 117, 0, 118, 119, 120, 121, 122, 123, - 0, 0, 124, 125, 126, 127, 128, 0, 129, 130, - 131, 132, 133, 0, 0, 0, 135, 136, 137, 138, - 139, 140, 0, 142, 143, 144, 0, 145, 146, 147, - 148, 149, 150, 0, 0, 152, 153, 154, 0, 0, - 0, 0, 0, 0, 0, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 0, 166, 0, 167, 168, - 169, 170, 171, 172, 0, 173, 174, 175, 176, 177, - 0, 0, 178, 179, 180, 181, 182, 0, 183, 184, - 185, 0, 186, 187, 188, 0, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 0, 199, 0, 200, - 201, 202, 203, 0, 204, 0, 205, 0, 0, 0, - 208, 209, 210, 0, 212, 0, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, 221, 222, 223, 0, - 225, 226, 227, 228, 0, 229, 230, 231, 232, 233, - 234, 0, 235, 0, 237, 238, 239, 240, 241, 242, - 243, 244, 0, 245, 0, 246, 0, 0, 249, 0, - 251, 252, 253, 254, 255, 0, 0, 256, 0, 258, - 0, 0, 260, 261, 262, 0, 0, 263, 264, 265, - 266, 267, 500, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 0, 289, 290, 291, 292, 293, 0, 294, - 295, 0, 297, 0, 298, 299, 300, 301, 302, 303, - 0, 304, 305, 0, 0, 306, 307, 308, 0, 0, - 309, 310, 0, 312, 0, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 0, 325, 326, 327, - 328, 329, 330, 501, 332, 333, 0, 334, 335, 336, - 337, 338, 339, 0, 340, 341, 342, 343, 344, 345, - 346, 347, 0, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 0, 361, 362, 0, - 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 0, 379, 380, 381, 382, - 383, 0, 384, 385, 386, 387, 388, 0, 390, 391, - 392, 393, 0, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 502, 406, 407, 408, 0, 409, - 410, 0, 411, 0, 413, 414, 415, 416, 417, 0, - 418, 419, 0, 0, 420, 421, 422, 423, 424, 0, - 425, 426, 427, 428, 429, 430, 431, 432, 0, 0, - 433, 434, 435, 436, 437, 0, 0, 438, 439, 440, - 441, 442, 443, 444, 0, 445, 0, 447, 448, 449, - 450, 0, 0, 451, 0, 0, 452, 453, 454, 455, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 498, 0, 547, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 93, 94, 95, 96, 97, 98, 99, - 100, 0, 101, 102, 103, 0, 0, 0, 0, 0, - 0, 0, 104, 105, 0, 106, 107, 108, 0, 110, - 111, 112, 113, 114, 0, 116, 117, 0, 118, 119, - 120, 121, 122, 123, 0, 0, 124, 125, 126, 127, - 128, 0, 129, 130, 131, 132, 133, 0, 0, 0, - 135, 136, 137, 138, 139, 140, 0, 142, 143, 144, - 0, 145, 146, 147, 148, 149, 150, 0, 0, 152, - 153, 154, 0, 0, 0, 0, 0, 0, 0, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 0, - 166, 0, 167, 168, 169, 170, 171, 172, 0, 173, - 174, 175, 176, 177, 0, 0, 178, 179, 180, 181, - 182, 0, 183, 184, 185, 0, 186, 187, 188, 0, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 0, 199, 0, 200, 201, 202, 203, 0, 204, 0, - 205, 0, 0, 0, 208, 209, 210, 0, 212, 0, - 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 221, 222, 223, 0, 225, 226, 227, 228, 0, 229, - 230, 231, 232, 233, 234, 0, 235, 0, 237, 238, - 239, 240, 241, 242, 243, 244, 0, 245, 0, 246, - 0, 0, 249, 0, 251, 252, 253, 254, 255, 0, - 0, 256, 0, 258, 0, 0, 260, 261, 262, 0, - 0, 263, 264, 265, 266, 267, 500, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 0, 289, 290, 291, - 292, 293, 0, 294, 295, 0, 297, 0, 298, 299, - 300, 301, 302, 303, 0, 304, 305, 0, 0, 306, - 307, 308, 0, 0, 309, 310, 0, 312, 0, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 0, 325, 326, 327, 328, 329, 330, 331, 332, 333, - 0, 334, 335, 336, 337, 338, 339, 0, 340, 341, - 342, 343, 344, 345, 346, 347, 0, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 0, 361, 362, 0, 364, 365, 366, 367, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 0, - 379, 380, 381, 382, 383, 0, 384, 385, 386, 387, - 388, 0, 390, 391, 392, 393, 0, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 502, 406, - 407, 408, 0, 409, 410, 0, 411, 0, 413, 414, - 415, 416, 417, 0, 418, 419, 0, 0, 420, 421, - 422, 423, 424, 0, 425, 426, 427, 428, 429, 430, - 431, 432, 0, 0, 433, 434, 435, 436, 437, 0, - 0, 438, 439, 440, 441, 442, 443, 444, 0, 445, - 0, 447, 448, 449, 450, 0, 0, 451, 0, 0, - 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 498, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 93, 94, 95, - 96, 97, 98, 99, 100, 554, 101, 102, 103, 0, - 0, 0, 0, 0, 0, 0, 104, 105, 0, 106, - 107, 108, 0, 110, 111, 112, 113, 114, 0, 116, - 117, 0, 118, 119, 120, 121, 122, 123, 0, 0, - 124, 125, 126, 127, 128, 0, 129, 130, 131, 132, - 133, 0, 0, 0, 135, 136, 137, 138, 139, 140, - 0, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 0, 152, 153, 154, 0, 0, 0, 0, - 0, 0, 0, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 0, 199, 0, 200, 201, 202, - 203, 0, 204, 0, 205, 0, 0, 0, 208, 209, - 210, 0, 212, 0, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 0, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 0, 237, 238, 239, 240, 241, 242, 243, 244, - 0, 245, 0, 246, 0, 0, 249, 0, 251, 252, - 253, 254, 255, 0, 0, 256, 0, 258, 0, 0, - 260, 261, 262, 0, 0, 263, 264, 265, 266, 267, - 500, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 0, 289, 290, 291, 292, 293, 0, 294, 295, 0, - 297, 0, 298, 299, 300, 301, 302, 303, 0, 304, - 305, 0, 0, 306, 307, 308, 0, 0, 309, 310, - 0, 312, 0, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 343, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 0, 364, 365, - 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 0, - 384, 385, 386, 387, 388, 0, 390, 391, 392, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 502, 406, 407, 408, 0, 409, 410, 0, - 411, 0, 413, 414, 415, 416, 417, 0, 555, 419, - 0, 0, 556, 421, 422, 423, 424, 0, 425, 426, - 427, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 0, 0, 438, 439, 440, 441, 442, - 443, 444, 0, 445, 0, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 498, 0, 579, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 94, 95, 96, 97, 98, 99, 100, 0, - 101, 102, 103, 0, 0, 0, 0, 0, 0, 0, - 104, 105, 0, 106, 107, 108, 0, 110, 111, 112, - 113, 114, 0, 116, 117, 0, 118, 119, 120, 121, - 122, 123, 0, 0, 124, 125, 126, 127, 128, 0, - 129, 130, 131, 132, 133, 0, 0, 0, 135, 136, - 137, 138, 139, 140, 0, 142, 143, 144, 0, 145, - 146, 147, 148, 149, 150, 0, 0, 152, 153, 154, - 0, 0, 0, 0, 0, 0, 0, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 0, 166, 0, - 167, 168, 169, 170, 171, 172, 0, 173, 174, 175, - 176, 177, 0, 0, 178, 179, 180, 181, 182, 0, - 183, 184, 185, 0, 186, 187, 188, 0, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 0, 199, - 0, 200, 201, 202, 203, 0, 204, 0, 205, 0, - 0, 0, 208, 209, 210, 0, 212, 0, 213, 0, - 214, 215, 216, 0, 217, 218, 219, 220, 221, 618, - 223, 0, 225, 226, 227, 228, 0, 229, 230, 231, - 232, 233, 234, 0, 235, 0, 237, 238, 239, 240, - 241, 242, 243, 244, 0, 245, 0, 246, 0, 0, - 249, 0, 251, 252, 253, 254, 255, 0, 0, 256, - 0, 258, 0, 0, 260, 261, 262, 0, 0, 263, - 264, 265, 266, 267, 500, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 287, 0, 289, 290, 291, 292, 293, - 0, 294, 295, 0, 297, 0, 298, 299, 300, 301, - 302, 303, 0, 304, 305, 0, 0, 306, 307, 308, - 0, 0, 309, 310, 0, 312, 0, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 0, 325, - 326, 327, 328, 329, 330, 331, 332, 333, 0, 334, - 335, 336, 337, 338, 339, 0, 340, 341, 342, 343, - 344, 345, 346, 347, 0, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 0, 361, - 362, 0, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 0, 379, 380, - 381, 382, 383, 0, 384, 385, 386, 387, 388, 0, - 390, 391, 392, 393, 0, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 502, 406, 407, 408, - 0, 409, 410, 0, 411, 0, 413, 414, 415, 416, - 417, 0, 418, 419, 0, 0, 420, 421, 422, 423, - 424, 0, 425, 426, 427, 428, 429, 430, 431, 432, - 0, 0, 433, 434, 435, 436, 437, 0, 0, 438, - 439, 440, 441, 442, 443, 444, 0, 445, 0, 447, - 448, 449, 450, 0, 0, 451, 0, 0, 452, 453, - 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 498, - 0, 579, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 93, 94, 95, 96, 97, - 98, 99, 100, 0, 101, 102, 103, 0, 0, 0, - 0, 0, 0, 0, 104, 105, 0, 106, 107, 108, - 0, 110, 111, 112, 113, 114, 0, 116, 117, 0, - 118, 119, 120, 121, 122, 123, 0, 0, 124, 125, - 126, 127, 128, 0, 129, 130, 131, 132, 133, 0, - 0, 0, 135, 136, 137, 138, 139, 140, 0, 142, - 143, 144, 0, 145, 146, 147, 148, 149, 150, 0, - 0, 152, 153, 154, 0, 0, 0, 0, 0, 0, - 0, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 0, 166, 0, 167, 168, 169, 170, 171, 172, - 0, 173, 174, 175, 176, 177, 0, 0, 178, 179, - 180, 181, 182, 0, 183, 184, 185, 0, 186, 187, - 188, 0, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 0, 199, 0, 200, 201, 202, 203, 0, - 204, 0, 205, 0, 0, 0, 208, 209, 210, 0, - 212, 0, 213, 0, 214, 215, 216, 0, 217, 218, - 219, 220, 221, 621, 223, 0, 225, 226, 227, 228, - 0, 229, 230, 231, 232, 233, 234, 0, 235, 0, - 237, 238, 239, 240, 241, 242, 243, 244, 0, 245, - 0, 246, 0, 0, 249, 0, 251, 252, 253, 254, - 255, 0, 0, 256, 0, 258, 0, 0, 260, 261, - 262, 0, 0, 263, 264, 265, 266, 267, 500, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 0, 289, - 290, 291, 292, 293, 0, 294, 295, 0, 297, 0, - 298, 299, 300, 301, 302, 303, 0, 304, 305, 0, - 0, 306, 307, 308, 0, 0, 309, 310, 0, 312, - 0, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 325, 326, 327, 328, 329, 330, 331, - 332, 333, 0, 334, 335, 336, 337, 338, 339, 0, - 340, 341, 342, 343, 344, 345, 346, 347, 0, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 0, 361, 362, 0, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 0, 379, 380, 381, 382, 383, 0, 384, 385, - 386, 387, 388, 0, 390, 391, 392, 393, 0, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 502, 406, 407, 408, 0, 409, 410, 0, 411, 0, - 413, 414, 415, 416, 417, 0, 418, 419, 0, 0, - 420, 421, 422, 423, 424, 0, 425, 426, 427, 428, - 429, 430, 431, 432, 0, 0, 433, 434, 435, 436, - 437, 0, 0, 438, 439, 440, 441, 442, 443, 444, - 0, 445, 0, 447, 448, 449, 450, 0, 0, 451, - 0, 0, 452, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 498, 0, 579, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, - 94, 95, 96, 97, 98, 99, 100, 0, 101, 102, - 103, 0, 0, 0, 0, 0, 0, 0, 104, 105, - 0, 106, 107, 108, 0, 110, 111, 112, 113, 114, - 0, 116, 117, 0, 118, 119, 120, 121, 122, 123, - 0, 0, 124, 125, 126, 127, 128, 0, 129, 130, - 131, 132, 133, 0, 0, 0, 135, 136, 137, 138, - 139, 140, 0, 142, 143, 144, 0, 145, 146, 147, - 148, 149, 150, 0, 0, 152, 153, 154, 0, 0, - 0, 0, 0, 0, 0, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 0, 166, 0, 167, 168, - 169, 170, 171, 172, 0, 173, 174, 175, 176, 177, - 0, 0, 178, 179, 180, 181, 182, 0, 183, 184, - 185, 0, 186, 187, 188, 0, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 0, 199, 0, 200, - 201, 202, 203, 0, 204, 0, 205, 0, 0, 0, - 208, 209, 210, 0, 212, 0, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, 221, 625, 223, 0, - 225, 226, 227, 228, 0, 229, 230, 231, 232, 233, - 234, 0, 235, 0, 237, 238, 239, 240, 241, 242, - 243, 244, 0, 245, 0, 246, 0, 0, 249, 0, - 251, 252, 253, 254, 255, 0, 0, 256, 0, 258, - 0, 0, 260, 261, 262, 0, 0, 263, 264, 265, - 266, 267, 500, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 0, 289, 290, 291, 292, 293, 0, 294, - 295, 0, 297, 0, 298, 299, 300, 301, 302, 303, - 0, 304, 305, 0, 0, 306, 307, 308, 0, 0, - 309, 310, 0, 312, 0, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 0, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 0, 334, 335, 336, - 337, 338, 339, 0, 340, 341, 342, 343, 344, 345, - 346, 347, 0, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 0, 361, 362, 0, - 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 0, 379, 380, 381, 382, - 383, 0, 384, 385, 386, 387, 388, 0, 390, 391, - 392, 393, 0, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 502, 406, 407, 408, 0, 409, - 410, 0, 411, 0, 413, 414, 415, 416, 417, 0, - 418, 419, 0, 0, 420, 421, 422, 423, 424, 0, - 425, 426, 427, 428, 429, 430, 431, 432, 0, 0, - 433, 434, 435, 436, 437, 0, 0, 438, 439, 440, - 441, 442, 443, 444, 0, 445, 0, 447, 448, 449, - 450, 0, 0, 451, 0, 0, 452, 453, 454, 455, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 498, 0, 579, + 0, 0, 0, 0, 0, 0, 0, 1337, 0, 0, + 1338, 1339, 1340, 0, 1341, 1342, 1343, 1344, 1775, 1346, + 0, 0, 0, 1057, 0, 1680, 1337, 0, 0, 1338, + 1339, 1340, 0, 1341, 1342, 1343, 1344, 1345, 1346, 94, + 95, 96, 97, 98, 99, 100, 101, 1058, 102, 103, + 104, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 105, 106, + 1066, 107, 108, 109, 0, 111, 112, 113, 747, 748, + 0, 749, 750, 1067, 119, 120, 121, 122, 123, 124, + 1068, 1069, 125, 126, 751, 752, 129, 1070, 130, 131, + 132, 133, 753, 1071, 0, 1072, 136, 137, 138, 139, + 140, 141, 0, 143, 144, 145, 1073, 146, 147, 148, + 149, 150, 151, 1074, 0, 153, 154, 155, 1075, 1076, + 1077, 0, 1078, 1079, 1080, 157, 158, 159, 160, 161, + 162, 163, 754, 755, 166, 1081, 167, 1082, 168, 169, + 170, 171, 172, 173, 1083, 174, 175, 176, 177, 178, + 1084, 1085, 179, 180, 181, 182, 183, 1086, 184, 185, + 186, 1087, 187, 188, 189, 1088, 190, 191, 192, 193, + 756, 195, 196, 197, 198, 199, 757, 1089, 201, 1090, + 202, 203, 758, 205, 1091, 206, 1092, 207, 0, 1093, + 0, 210, 211, 212, 0, 214, 1094, 215, 1095, 759, + 760, 218, 1096, 219, 220, 221, 222, 223, 224, 225, + 0, 227, 228, 229, 230, 1097, 231, 232, 233, 234, + 235, 236, 1098, 237, 0, 761, 240, 241, 242, 243, + 244, 762, 763, 1099, 764, 1100, 248, 0, 0, 251, + 0, 253, 254, 255, 256, 257, 258, 1101, 1102, 259, + 0, 261, 0, 1103, 263, 264, 265, 1104, 1105, 266, + 267, 268, 269, 270, 765, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 766, 0, 767, 293, 294, 295, 768, + 1106, 297, 298, 0, 300, 1107, 769, 302, 770, 304, + 305, 306, 1108, 307, 308, 1109, 1110, 309, 310, 311, + 1111, 1112, 312, 771, 0, 315, 0, 772, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 1113, 328, + 329, 773, 331, 332, 774, 334, 335, 336, 1114, 337, + 338, 339, 340, 341, 342, 1115, 343, 344, 345, 775, + 347, 348, 349, 350, 1116, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 1117, 364, + 365, 0, 367, 368, 369, 776, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 1118, 382, 383, + 384, 385, 386, 1119, 387, 777, 389, 390, 391, 0, + 393, 394, 778, 396, 1120, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 779, 409, 780, 411, + 1121, 412, 413, 1122, 414, 0, 416, 417, 418, 419, + 420, 1123, 781, 782, 1124, 1125, 423, 424, 783, 426, + 784, 1126, 428, 429, 785, 431, 432, 433, 434, 435, + 1127, 1128, 436, 437, 438, 439, 440, 1129, 1130, 441, + 442, 443, 444, 445, 1131, 787, 1132, 448, 0, 450, + 451, 452, 453, 1133, 1134, 454, 1135, 1136, 455, 456, + 457, 458, 459, 460, 788, 789, 790, 791, 792, 793, + 794, 795, 796, 797, 798, 472, 473, 474, 475, 1057, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 93, 94, 95, 96, 97, 98, 99, - 100, 0, 101, 102, 103, 0, 0, 0, 0, 0, - 0, 0, 104, 105, 0, 106, 107, 108, 0, 110, - 111, 112, 113, 114, 0, 116, 117, 0, 118, 119, - 120, 121, 122, 123, 0, 0, 124, 125, 126, 127, - 128, 0, 129, 130, 131, 132, 133, 0, 0, 0, - 135, 136, 137, 138, 139, 140, 0, 142, 143, 144, - 0, 145, 146, 147, 148, 149, 150, 0, 0, 152, - 153, 154, 0, 0, 0, 0, 0, 0, 0, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 0, - 166, 0, 167, 168, 169, 170, 171, 172, 0, 173, - 174, 175, 176, 177, 0, 0, 178, 179, 180, 181, - 182, 0, 183, 184, 185, 0, 186, 187, 188, 0, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 0, 199, 0, 200, 201, 202, 203, 0, 204, 0, - 205, 0, 0, 0, 208, 209, 210, 0, 212, 0, - 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 221, 222, 223, 0, 225, 226, 227, 228, 0, 229, - 230, 231, 232, 233, 234, 0, 235, 0, 237, 238, - 239, 240, 241, 242, 243, 244, 0, 245, 0, 246, - 0, 0, 249, 0, 251, 252, 253, 254, 255, 0, - 0, 256, 0, 258, 0, 0, 260, 261, 262, 0, - 0, 263, 264, 265, 266, 267, 500, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 0, 289, 290, 291, - 292, 293, 0, 294, 295, 0, 297, 0, 298, 299, - 300, 301, 302, 303, 0, 304, 305, 0, 0, 306, - 307, 308, 0, 0, 309, 310, 0, 312, 0, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 0, 325, 326, 327, 328, 329, 330, 331, 332, 333, - 0, 334, 335, 336, 337, 338, 339, 0, 340, 341, - 342, 343, 344, 345, 346, 347, 0, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 0, 361, 362, 0, 364, 365, 366, 367, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 0, - 379, 380, 381, 382, 383, 0, 384, 385, 386, 387, - 388, 0, 390, 391, 392, 393, 0, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 502, 406, - 407, 408, 0, 409, 410, 0, 411, 0, 413, 414, - 415, 416, 417, 0, 418, 419, 0, 0, 420, 421, - 422, 423, 424, 0, 425, 426, 427, 428, 429, 430, - 431, 432, 0, 0, 433, 434, 435, 436, 437, 0, - 0, 438, 439, 440, 441, 442, 443, 444, 0, 445, - 0, 447, 448, 449, 450, 0, 0, 451, 0, 0, - 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 498, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 93, 94, 95, - 96, 97, 98, 99, 100, 653, 101, 102, 103, 0, - 0, 0, 0, 0, 0, 0, 104, 105, 0, 106, - 107, 108, 0, 110, 111, 112, 113, 114, 0, 116, - 117, 0, 118, 119, 120, 121, 122, 123, 0, 0, - 124, 125, 126, 127, 128, 0, 129, 130, 131, 132, - 133, 0, 0, 0, 135, 136, 137, 138, 139, 140, - 0, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 0, 152, 153, 154, 0, 0, 0, 0, - 0, 0, 0, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 0, 199, 0, 200, 201, 202, - 203, 0, 204, 0, 205, 0, 0, 0, 208, 209, - 210, 0, 212, 0, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 0, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 0, 237, 238, 239, 240, 241, 242, 243, 244, - 0, 245, 0, 246, 0, 0, 249, 0, 251, 252, - 253, 254, 255, 0, 0, 256, 0, 258, 0, 0, - 260, 261, 262, 0, 0, 263, 264, 265, 266, 267, - 500, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 0, 289, 290, 291, 292, 293, 0, 294, 295, 0, - 297, 0, 298, 299, 300, 301, 302, 303, 0, 304, - 305, 0, 0, 306, 307, 308, 0, 0, 309, 310, - 0, 312, 0, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 343, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 0, 364, 365, - 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 0, - 384, 385, 386, 387, 388, 0, 390, 391, 392, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 502, 406, 407, 408, 0, 409, 410, 0, - 411, 0, 413, 414, 415, 416, 417, 0, 418, 419, - 0, 0, 420, 421, 422, 423, 424, 0, 425, 426, - 427, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 0, 0, 438, 439, 440, 441, 442, - 443, 444, 0, 445, 0, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 498, 0, 579, 0, 0, + 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 1058, 102, 103, 104, 1059, 1060, 1061, + 1062, 1063, 1064, 1065, 105, 106, 1066, 107, 108, 109, + 0, 111, 112, 113, 747, 748, 0, 749, 750, 1067, + 119, 120, 121, 122, 123, 124, 1068, 1069, 125, 126, + 751, 752, 129, 1070, 130, 131, 132, 133, 753, 1071, + 0, 1072, 136, 137, 138, 139, 140, 141, 0, 143, + 144, 145, 1073, 146, 147, 148, 149, 150, 151, 1074, + 0, 153, 154, 155, 1075, 1076, 1077, 0, 1078, 1079, + 1080, 157, 158, 159, 160, 161, 162, 163, 754, 755, + 166, 1081, 167, 1082, 168, 169, 170, 171, 172, 173, + 1083, 174, 175, 176, 177, 178, 1084, 1085, 179, 180, + 181, 182, 183, 1086, 184, 185, 186, 1087, 187, 188, + 189, 1088, 190, 191, 192, 193, 756, 195, 196, 197, + 198, 199, 757, 1089, 201, 1090, 202, 203, 758, 205, + 1091, 206, 1092, 207, 0, 1093, 0, 210, 211, 212, + 0, 214, 1094, 215, 1095, 759, 760, 218, 1096, 219, + 220, 221, 222, 223, 224, 225, 0, 227, 228, 229, + 230, 1097, 231, 232, 233, 234, 235, 236, 1098, 237, + 0, 761, 240, 241, 242, 243, 244, 762, 763, 1099, + 764, 1100, 248, 0, 0, 251, 0, 253, 254, 255, + 256, 257, 258, 1101, 1102, 259, 0, 261, 0, 1103, + 263, 264, 265, 1104, 1105, 266, 267, 268, 269, 270, + 765, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 766, + 0, 767, 293, 294, 295, 768, 1106, 297, 298, 0, + 300, 1107, 769, 302, 770, 304, 305, 306, 1108, 307, + 308, 1109, 1110, 309, 310, 311, 1111, 1112, 312, 771, + 0, 315, 0, 772, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 1113, 328, 329, 773, 331, 332, + 774, 334, 335, 336, 1114, 337, 338, 339, 340, 341, + 342, 1115, 343, 344, 345, 775, 347, 348, 349, 350, + 1116, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 1117, 364, 365, 0, 367, 368, + 369, 776, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 1118, 382, 383, 384, 385, 386, 1119, + 387, 777, 389, 390, 391, 0, 393, 394, 778, 396, + 1120, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 779, 409, 780, 411, 1121, 412, 413, 1122, + 414, 0, 416, 417, 418, 419, 420, 1123, 781, 782, + 1124, 1125, 423, 424, 783, 426, 784, 1126, 428, 429, + 785, 431, 432, 433, 434, 435, 1127, 1128, 436, 437, + 438, 439, 440, 1129, 1130, 441, 442, 443, 444, 445, + 1131, 787, 1132, 448, 0, 450, 451, 452, 453, 1133, + 1134, 454, 1135, 1136, 455, 456, 457, 458, 459, 460, + 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, + 798, 472, 473, 474, 475, 1057, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 94, 95, 96, 97, 98, 99, 100, 0, - 101, 102, 103, 0, 0, 0, 0, 0, 0, 0, - 104, 105, 0, 106, 107, 108, 0, 110, 111, 112, - 113, 114, 0, 116, 117, 0, 118, 119, 120, 121, - 122, 123, 0, 0, 124, 125, 126, 127, 128, 0, - 129, 130, 131, 132, 133, 0, 0, 0, 135, 136, - 137, 138, 139, 140, 0, 142, 143, 144, 0, 145, - 146, 147, 148, 149, 150, 0, 0, 152, 153, 154, - 0, 0, 0, 0, 0, 0, 0, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 0, 166, 0, - 167, 168, 169, 170, 171, 172, 0, 173, 174, 175, - 176, 177, 0, 0, 178, 179, 180, 181, 182, 0, - 183, 184, 185, 0, 186, 187, 188, 0, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 0, 199, - 0, 200, 201, 202, 203, 0, 204, 0, 205, 0, - 0, 0, 208, 209, 210, 0, 212, 0, 213, 0, - 214, 215, 216, 0, 217, 218, 219, 220, 221, 1147, - 223, 0, 225, 226, 227, 228, 0, 229, 230, 231, - 232, 233, 234, 0, 235, 0, 237, 238, 239, 240, - 241, 242, 243, 244, 0, 245, 0, 246, 0, 0, - 249, 0, 251, 252, 253, 254, 255, 0, 0, 256, - 0, 258, 0, 0, 260, 261, 262, 0, 0, 263, - 264, 265, 266, 267, 500, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 287, 0, 289, 290, 291, 292, 293, - 0, 294, 295, 0, 297, 0, 298, 299, 300, 301, - 302, 303, 0, 304, 305, 0, 0, 306, 307, 308, - 0, 0, 309, 310, 0, 312, 0, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 0, 325, - 326, 327, 328, 329, 330, 331, 332, 333, 0, 334, - 335, 336, 337, 338, 339, 0, 340, 341, 342, 343, - 344, 345, 346, 347, 0, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 0, 361, - 362, 0, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 0, 379, 380, - 381, 382, 383, 0, 384, 385, 386, 387, 388, 0, - 390, 391, 392, 393, 0, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 502, 406, 407, 408, - 0, 409, 410, 0, 411, 0, 413, 414, 415, 416, - 417, 0, 418, 419, 0, 0, 420, 421, 422, 423, - 424, 0, 425, 426, 427, 428, 429, 430, 431, 432, - 0, 0, 433, 434, 435, 436, 437, 0, 0, 438, - 439, 440, 441, 442, 443, 444, 0, 445, 0, 447, - 448, 449, 450, 0, 0, 451, 0, 0, 452, 453, - 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 498, - 0, 579, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 93, 94, 95, 96, 97, - 98, 99, 100, 0, 101, 102, 103, 0, 0, 0, - 0, 0, 0, 0, 104, 105, 0, 106, 107, 108, - 0, 110, 111, 112, 113, 114, 0, 116, 117, 0, - 118, 119, 120, 121, 122, 123, 0, 0, 124, 125, - 126, 127, 128, 0, 129, 130, 131, 132, 133, 0, - 0, 0, 135, 136, 137, 138, 139, 140, 0, 142, - 143, 144, 0, 145, 146, 147, 148, 149, 150, 0, - 0, 152, 153, 154, 0, 0, 0, 0, 0, 0, - 0, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 0, 166, 0, 167, 168, 169, 170, 171, 172, - 0, 173, 174, 175, 176, 177, 0, 0, 178, 179, - 180, 181, 182, 0, 183, 184, 185, 0, 186, 187, - 188, 0, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 0, 199, 0, 200, 201, 202, 203, 0, - 204, 0, 205, 0, 0, 0, 208, 209, 210, 0, - 212, 0, 213, 0, 214, 215, 216, 0, 217, 218, - 219, 220, 221, 1149, 223, 0, 225, 226, 227, 228, - 0, 229, 230, 231, 232, 233, 234, 0, 235, 0, - 237, 238, 239, 240, 241, 242, 243, 244, 0, 245, - 0, 246, 0, 0, 249, 0, 251, 252, 253, 254, - 255, 0, 0, 256, 0, 258, 0, 0, 260, 261, - 262, 0, 0, 263, 264, 265, 266, 267, 500, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 0, 289, - 290, 291, 292, 293, 0, 294, 295, 0, 297, 0, - 298, 299, 300, 301, 302, 303, 0, 304, 305, 0, - 0, 306, 307, 308, 0, 0, 309, 310, 0, 312, - 0, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 325, 326, 327, 328, 329, 330, 331, - 332, 333, 0, 334, 335, 336, 337, 338, 339, 0, - 340, 341, 342, 343, 344, 345, 346, 347, 0, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 0, 361, 362, 0, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 0, 379, 380, 381, 382, 383, 0, 384, 385, - 386, 387, 388, 0, 390, 391, 392, 393, 0, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 502, 406, 407, 408, 0, 409, 410, 0, 411, 0, - 413, 414, 415, 416, 417, 0, 418, 419, 0, 0, - 420, 421, 422, 423, 424, 0, 425, 426, 427, 428, - 429, 430, 431, 432, 0, 0, 433, 434, 435, 436, - 437, 0, 0, 438, 439, 440, 441, 442, 443, 444, - 0, 445, 0, 447, 448, 449, 450, 0, 0, 451, - 0, 0, 452, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 498, 0, 579, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, - 94, 95, 96, 97, 98, 99, 100, 0, 101, 102, - 103, 0, 0, 0, 0, 0, 0, 0, 104, 105, - 0, 106, 107, 108, 0, 110, 111, 112, 113, 114, - 0, 116, 117, 0, 118, 119, 120, 121, 122, 123, - 0, 0, 124, 125, 126, 127, 128, 0, 129, 130, - 131, 132, 133, 0, 0, 0, 135, 136, 137, 138, - 139, 140, 0, 142, 143, 144, 0, 145, 146, 147, - 148, 149, 150, 0, 0, 152, 153, 154, 0, 0, - 0, 0, 0, 0, 0, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 0, 166, 0, 167, 168, - 169, 170, 171, 172, 0, 173, 174, 175, 176, 177, - 0, 0, 178, 179, 180, 181, 182, 0, 183, 184, - 185, 0, 186, 187, 188, 0, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 0, 199, 0, 200, - 201, 202, 203, 0, 204, 0, 205, 0, 0, 0, - 208, 209, 210, 0, 212, 0, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, 221, 1559, 223, 0, - 225, 226, 227, 228, 0, 229, 230, 231, 232, 233, - 234, 0, 235, 0, 237, 238, 239, 240, 241, 242, - 243, 244, 0, 245, 0, 246, 0, 0, 249, 0, - 251, 252, 253, 254, 255, 0, 0, 256, 0, 258, - 0, 0, 260, 261, 262, 0, 0, 263, 264, 265, - 266, 267, 500, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 0, 289, 290, 291, 292, 293, 0, 294, - 295, 0, 297, 0, 298, 299, 300, 301, 302, 303, - 0, 304, 305, 0, 0, 306, 307, 308, 0, 0, - 309, 310, 0, 312, 0, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 0, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 0, 334, 335, 336, - 337, 338, 339, 0, 340, 341, 342, 343, 344, 345, - 346, 347, 0, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 0, 361, 362, 0, - 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 0, 379, 380, 381, 382, - 383, 0, 384, 385, 386, 387, 388, 0, 390, 391, - 392, 393, 0, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 502, 406, 407, 408, 0, 409, - 410, 0, 411, 0, 413, 414, 415, 416, 417, 0, - 418, 419, 0, 0, 420, 421, 422, 423, 424, 0, - 425, 426, 427, 428, 429, 430, 431, 432, 0, 0, - 433, 434, 435, 436, 437, 0, 0, 438, 439, 440, - 441, 442, 443, 444, 0, 445, 0, 447, 448, 449, - 450, 0, 0, 451, 0, 0, 452, 453, 454, 455, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 498, 0, 0, + 0, 94, 95, 96, 97, 1825, 99, 100, 101, 1058, + 102, 103, 104, 1059, 1060, 1061, 1062, 1063, 1064, 1065, + 105, 106, 1066, 107, 108, 109, 0, 111, 112, 113, + 747, 748, 0, 749, 750, 1067, 119, 120, 121, 122, + 123, 124, 1068, 1069, 125, 126, 751, 752, 129, 1070, + 130, 131, 132, 133, 753, 1071, 0, 1072, 136, 137, + 138, 139, 140, 141, 0, 143, 144, 145, 1073, 146, + 147, 148, 149, 150, 151, 1074, 0, 153, 154, 155, + 1075, 1076, 1077, 0, 1078, 1079, 1080, 157, 158, 159, + 160, 161, 162, 163, 754, 755, 166, 1081, 167, 1082, + 168, 169, 170, 171, 172, 173, 1083, 174, 175, 176, + 177, 178, 1084, 1085, 179, 180, 181, 1826, 183, 1086, + 184, 185, 186, 1087, 187, 188, 189, 1088, 190, 191, + 192, 193, 756, 195, 196, 197, 198, 199, 757, 1089, + 201, 1090, 202, 203, 758, 205, 1091, 206, 1092, 207, + 0, 1093, 0, 210, 211, 212, 0, 214, 1094, 215, + 1095, 759, 760, 218, 1096, 219, 220, 221, 222, 223, + 224, 225, 0, 227, 228, 229, 230, 1097, 231, 232, + 233, 234, 235, 236, 1098, 237, 0, 761, 240, 241, + 242, 243, 244, 762, 763, 1099, 764, 1100, 248, 0, + 0, 251, 0, 253, 254, 255, 256, 257, 258, 1101, + 1102, 259, 0, 261, 0, 1103, 263, 264, 265, 1104, + 1105, 266, 267, 268, 269, 270, 765, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 766, 0, 767, 293, 294, + 295, 768, 1106, 297, 298, 0, 300, 1107, 769, 302, + 770, 304, 305, 306, 1108, 307, 308, 1109, 1110, 309, + 310, 311, 1111, 1112, 312, 771, 0, 315, 0, 772, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 1113, 328, 329, 773, 331, 332, 774, 334, 335, 336, + 1114, 337, 338, 339, 340, 341, 342, 1115, 343, 344, + 345, 775, 347, 348, 349, 350, 1116, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 1117, 364, 365, 0, 367, 368, 369, 776, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 1118, + 382, 383, 384, 385, 386, 1119, 1827, 777, 389, 390, + 391, 0, 393, 394, 778, 396, 1120, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 779, 409, + 780, 411, 1121, 412, 413, 1122, 414, 0, 416, 417, + 418, 419, 420, 1123, 781, 782, 1124, 1125, 423, 424, + 783, 426, 784, 1126, 428, 429, 785, 431, 432, 433, + 434, 435, 1127, 1128, 436, 437, 438, 439, 440, 1129, + 1130, 441, 442, 443, 444, 445, 1131, 787, 1132, 448, + 0, 450, 451, 452, 453, 1133, 1134, 454, 1135, 1136, + 455, 456, 457, 458, 459, 460, 788, 789, 790, 791, + 792, 793, 794, 795, 796, 797, 798, 472, 473, 474, + 475, 93, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 0, 0, 0, 105, 106, 0, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, + 118, 0, 119, 120, 121, 122, 123, 124, 0, 829, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 133, + 832, 0, 833, 0, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 152, 153, 154, 155, 834, 835, 836, 837, + 838, 839, 840, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 0, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 181, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 845, 0, 201, 0, 202, 203, + 204, 205, 0, 206, 0, 207, 208, 0, 209, 210, + 211, 212, 213, 214, 0, 215, 0, 216, 217, 218, + 0, 219, 220, 221, 222, 223, 224, 225, 226, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 0, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 260, 261, + 262, 0, 263, 264, 265, 853, 854, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 291, 292, 293, 294, 295, 296, 0, 297, + 298, 299, 300, 0, 859, 302, 303, 304, 305, 306, + 0, 307, 308, 0, 0, 309, 310, 311, 0, 0, + 312, 313, 314, 315, 316, 862, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 863, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 346, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 366, + 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 866, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 408, 409, 868, 411, 0, 412, + 413, 0, 414, 415, 416, 417, 418, 419, 420, 0, + 421, 422, 0, 0, 423, 424, 871, 426, 872, 0, + 428, 429, 874, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 875, 0, 441, 442, 443, + 444, 445, 446, 447, 0, 448, 449, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 93, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 93, 94, 95, 96, 97, 98, 99, - 100, 0, 101, 102, 103, 0, 0, 0, 0, 0, - 2311, 0, 104, 105, 0, 106, 107, 108, 0, 110, - 111, 112, 113, 114, 0, 116, 117, 0, 118, 119, - 120, 121, 122, 123, 0, 0, 124, 125, 126, 127, - 128, 0, 129, 130, 131, 132, 133, 0, 0, 0, - 135, 136, 137, 138, 139, 140, 0, 142, 143, 144, - 0, 145, 146, 147, 148, 149, 150, 0, 0, 152, - 153, 154, 0, 0, 0, 0, 0, 0, 0, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 0, - 166, 0, 167, 168, 169, 170, 171, 172, 0, 173, - 174, 175, 176, 177, 0, 0, 178, 179, 180, 181, - 182, 0, 183, 184, 185, 0, 186, 187, 188, 0, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 0, 199, 0, 200, 201, 202, 203, 0, 204, 0, - 205, 0, 0, 0, 208, 209, 210, 0, 212, 0, - 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 221, 222, 223, 0, 225, 226, 227, 228, 0, 229, - 230, 231, 232, 233, 234, 0, 235, 0, 237, 238, - 239, 240, 241, 242, 243, 244, 0, 245, 0, 246, - 0, 0, 249, 0, 251, 252, 253, 254, 255, 0, - 0, 256, 0, 258, 0, 0, 260, 261, 262, 0, - 0, 263, 264, 265, 266, 267, 500, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 0, 289, 290, 291, - 292, 293, 0, 294, 295, 0, 297, 0, 298, 299, - 300, 301, 302, 303, 0, 304, 305, 0, 0, 306, - 307, 308, 0, 0, 309, 310, 0, 312, 0, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 0, 325, 326, 327, 328, 329, 330, 331, 332, 333, - 0, 334, 335, 336, 337, 338, 339, 0, 340, 341, - 342, 343, 344, 345, 346, 347, 0, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 0, 361, 362, 0, 364, 365, 366, 367, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 0, - 379, 380, 381, 382, 383, 0, 384, 385, 386, 387, - 388, 0, 390, 391, 392, 393, 0, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 502, 406, - 407, 408, 0, 409, 410, 0, 411, 0, 413, 414, - 415, 416, 417, 0, 418, 419, 0, 0, 420, 421, - 422, 423, 424, 0, 425, 426, 427, 428, 429, 430, - 431, 432, 0, 0, 433, 434, 435, 436, 437, 0, - 0, 438, 439, 440, 441, 442, 443, 444, 0, 445, - 0, 447, 448, 449, 450, 0, 0, 451, 0, 0, - 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 498, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 93, 94, 95, - 96, 97, 98, 99, 100, 0, 101, 102, 103, 0, - 0, 0, 0, 0, 2325, 0, 104, 105, 0, 106, - 107, 108, 0, 110, 111, 112, 113, 114, 0, 116, - 117, 0, 118, 119, 120, 121, 122, 123, 0, 0, - 124, 125, 126, 127, 128, 0, 129, 130, 131, 132, - 133, 0, 0, 0, 135, 136, 137, 138, 139, 140, - 0, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 0, 152, 153, 154, 0, 0, 0, 0, - 0, 0, 0, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 0, 199, 0, 200, 201, 202, - 203, 0, 204, 0, 205, 0, 0, 0, 208, 209, - 210, 0, 212, 0, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 0, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 0, 237, 238, 239, 240, 241, 242, 243, 244, - 0, 245, 0, 246, 0, 0, 249, 0, 251, 252, - 253, 254, 255, 0, 0, 256, 0, 258, 0, 0, - 260, 261, 262, 0, 0, 263, 264, 265, 266, 267, - 500, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 0, 289, 290, 291, 292, 293, 0, 294, 295, 0, - 297, 0, 298, 299, 300, 301, 302, 303, 0, 304, - 305, 0, 0, 306, 307, 308, 0, 0, 309, 310, - 0, 312, 0, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 343, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 0, 364, 365, - 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 0, - 384, 385, 386, 387, 388, 0, 390, 391, 392, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 502, 406, 407, 408, 0, 409, 410, 0, - 411, 0, 413, 414, 415, 416, 417, 0, 418, 419, - 0, 0, 420, 421, 422, 423, 424, 0, 425, 426, - 427, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 0, 0, 438, 439, 440, 441, 442, - 443, 444, 0, 445, 0, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 498, 0, 579, 0, 0, + 0, 0, 0, 94, 95, 96, 97, 98, 99, 100, + 101, 0, 102, 103, 104, 0, 0, 0, 0, 0, + 0, 0, 105, 106, 0, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, 117, 118, 0, 119, 120, + 121, 122, 123, 124, 0, 0, 125, 126, 127, 128, + 129, 0, 130, 131, 132, 133, 134, 0, 135, 0, + 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, + 0, 146, 147, 148, 149, 150, 151, 0, 152, 153, + 154, 155, 0, 0, 0, 156, 0, 0, 0, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 0, + 167, 0, 168, 169, 170, 171, 172, 173, 0, 174, + 175, 176, 177, 178, 0, 0, 179, 180, 181, 182, + 183, 0, 184, 185, 186, 0, 187, 188, 189, 0, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 0, 202, 203, 204, 205, 0, 206, + 0, 207, 208, 0, 209, 210, 211, 212, 213, 214, + 0, 215, 0, 216, 217, 218, 0, 219, 220, 221, + 222, 223, 224, 225, 226, 227, 228, 229, 230, 0, + 231, 232, 233, 234, 235, 236, 0, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 0, 247, 0, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 0, 0, 259, 260, 261, 262, 0, 263, 264, + 265, 0, 0, 266, 267, 268, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, + 293, 294, 295, 296, 0, 297, 298, 299, 300, 0, + 301, 302, 303, 304, 305, 306, 0, 307, 308, 0, + 0, 309, 310, 311, 0, 0, 312, 313, 314, 315, + 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 0, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 0, 337, 338, 339, 340, 341, 342, 0, + 343, 344, 345, 346, 347, 348, 349, 350, 0, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 0, 364, 365, 366, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 0, 382, 383, 384, 385, 386, 0, 387, 388, + 389, 390, 391, 392, 393, 394, 395, 396, 0, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 408, 409, 410, 411, 0, 412, 413, 0, 414, 415, + 416, 417, 418, 419, 420, 0, 421, 422, 0, 0, + 423, 424, 425, 426, 427, 0, 428, 429, 430, 431, + 432, 433, 434, 435, 0, 0, 436, 437, 438, 439, + 440, 0, 0, 441, 442, 443, 444, 445, 446, 447, + 0, 448, 449, 450, 451, 452, 453, 0, 0, 454, + 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 498, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, + 95, 96, 97, 98, 99, 100, 101, 0, 102, 103, + 104, 0, 0, 0, 0, 0, 0, 0, 105, 106, + 0, 107, 108, 109, 0, 111, 112, 113, 114, 115, + 0, 117, 118, 0, 119, 120, 121, 122, 123, 124, + 0, 0, 125, 126, 127, 128, 129, 1435, 130, 131, + 132, 133, 134, 0, 0, 1436, 136, 137, 138, 139, + 140, 141, 0, 143, 144, 145, 1437, 146, 147, 148, + 149, 150, 151, 0, 0, 153, 154, 155, 0, 0, + 0, 0, 0, 0, 0, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 0, 167, 0, 168, 169, + 170, 171, 172, 173, 0, 174, 175, 176, 177, 178, + 0, 0, 179, 180, 181, 182, 183, 0, 184, 185, + 186, 0, 187, 188, 189, 0, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 0, 201, 0, + 202, 203, 204, 205, 0, 206, 1438, 207, 0, 0, + 0, 210, 211, 212, 0, 214, 0, 215, 0, 216, + 217, 218, 0, 219, 220, 221, 222, 223, 1439, 225, + 0, 227, 228, 229, 230, 0, 231, 232, 233, 234, + 235, 236, 0, 237, 0, 239, 240, 241, 242, 243, + 244, 245, 246, 0, 247, 0, 248, 0, 0, 251, + 0, 253, 254, 255, 256, 257, 258, 0, 0, 259, + 0, 261, 0, 0, 263, 264, 265, 0, 0, 266, + 267, 268, 269, 270, 500, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 292, 293, 294, 295, 296, + 0, 297, 298, 0, 300, 0, 301, 302, 303, 304, + 305, 306, 0, 307, 308, 0, 0, 309, 310, 311, + 0, 0, 312, 313, 0, 315, 0, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 0, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 1440, 337, + 338, 339, 340, 341, 342, 0, 343, 344, 345, 346, + 347, 348, 349, 350, 0, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 0, 364, + 365, 0, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 0, 382, 383, + 384, 385, 386, 0, 387, 388, 389, 390, 391, 0, + 393, 394, 395, 396, 0, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 502, 409, 410, 411, + 0, 412, 413, 0, 414, 0, 416, 417, 418, 419, + 420, 0, 421, 422, 0, 0, 423, 424, 425, 426, + 427, 0, 428, 429, 430, 431, 432, 433, 434, 435, + 0, 1441, 436, 437, 438, 439, 440, 0, 0, 441, + 442, 443, 444, 445, 446, 447, 0, 448, 0, 450, + 451, 452, 453, 0, 0, 454, 0, 0, 455, 456, + 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 467, 468, 469, 470, 471, 472, 473, 474, 475, 498, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 94, 95, 96, 97, 98, 99, 100, 0, - 101, 102, 103, 0, 0, 0, 0, 0, 0, 0, - 104, 105, 0, 106, 107, 108, 0, 110, 111, 112, - 113, 114, 0, 116, 117, 0, 118, 119, 120, 121, - 122, 123, 0, 0, 124, 125, 126, 127, 128, 0, - 129, 130, 131, 132, 133, 0, 0, 0, 135, 136, - 137, 138, 139, 140, 0, 142, 143, 144, 0, 145, - 146, 147, 148, 149, 150, 0, 0, 152, 153, 154, - 0, 0, 0, 0, 0, 0, 0, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 0, 166, 0, - 167, 168, 169, 170, 171, 172, 0, 173, 174, 175, - 176, 177, 0, 0, 178, 179, 180, 181, 182, 0, - 183, 184, 185, 0, 186, 187, 188, 0, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 0, 199, - 0, 200, 201, 202, 203, 0, 204, 0, 205, 0, - 0, 0, 208, 209, 210, 0, 212, 0, 213, 0, - 214, 215, 216, 0, 217, 218, 219, 220, 221, 2459, - 223, 0, 225, 226, 227, 228, 0, 229, 230, 231, - 232, 233, 234, 0, 235, 0, 237, 238, 239, 240, - 241, 242, 243, 244, 0, 245, 0, 246, 0, 0, - 249, 0, 251, 252, 253, 254, 255, 0, 0, 256, - 0, 258, 0, 0, 260, 261, 262, 0, 0, 263, - 264, 265, 266, 267, 500, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 287, 0, 289, 290, 291, 292, 293, - 0, 294, 295, 0, 297, 0, 298, 299, 300, 301, - 302, 303, 0, 304, 305, 0, 0, 306, 307, 308, - 0, 0, 309, 310, 0, 312, 0, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 0, 325, - 326, 327, 328, 329, 330, 331, 332, 333, 0, 334, - 335, 336, 337, 338, 339, 0, 340, 341, 342, 343, - 344, 345, 346, 347, 0, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 0, 361, - 362, 0, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 0, 379, 380, - 381, 382, 383, 0, 384, 385, 386, 387, 388, 0, - 390, 391, 392, 393, 0, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 502, 406, 407, 408, - 0, 409, 410, 0, 411, 0, 413, 414, 415, 416, - 417, 0, 418, 419, 0, 0, 420, 421, 422, 423, - 424, 0, 425, 426, 427, 428, 429, 430, 431, 432, - 0, 0, 433, 434, 435, 436, 437, 0, 0, 438, - 439, 440, 441, 442, 443, 444, 0, 445, 0, 447, - 448, 449, 450, 0, 0, 451, 0, 0, 452, 453, - 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 498, + 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 0, 102, 103, 104, 0, 0, 0, + 0, 0, 0, 0, 105, 106, 0, 107, 108, 109, + 0, 111, 112, 113, 114, 115, 0, 117, 118, 0, + 119, 120, 121, 122, 123, 124, 0, 0, 125, 126, + 127, 128, 129, 1435, 130, 131, 132, 133, 134, 0, + 0, 0, 136, 137, 138, 139, 140, 141, 0, 143, + 144, 145, 1437, 146, 147, 148, 149, 150, 151, 0, + 0, 153, 154, 155, 0, 0, 0, 0, 0, 0, + 0, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 0, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 0, 0, 179, 180, + 181, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 0, 201, 0, 202, 203, 204, 205, + 0, 206, 1438, 207, 0, 0, 0, 210, 211, 212, + 0, 214, 0, 215, 0, 216, 217, 218, 0, 219, + 220, 221, 222, 223, 224, 225, 0, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 0, 239, 240, 241, 242, 243, 244, 245, 246, 0, + 247, 0, 248, 0, 0, 251, 0, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 0, 261, 1897, 0, + 263, 264, 265, 0, 0, 266, 267, 268, 269, 270, + 500, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 0, 292, 293, 294, 295, 296, 0, 297, 298, 0, + 300, 0, 301, 302, 303, 304, 305, 306, 0, 307, + 308, 0, 0, 309, 310, 311, 0, 0, 312, 313, + 0, 315, 0, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 0, 328, 329, 330, 331, 332, + 333, 334, 335, 336, 1440, 337, 338, 339, 340, 341, + 342, 0, 343, 344, 345, 346, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 0, 367, 368, + 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 0, 382, 383, 384, 385, 386, 0, + 387, 388, 389, 390, 391, 0, 393, 394, 395, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 502, 409, 410, 411, 0, 412, 413, 0, + 414, 0, 416, 417, 418, 419, 420, 0, 421, 422, + 0, 0, 423, 424, 425, 426, 427, 0, 428, 429, + 430, 431, 432, 433, 434, 435, 0, 1441, 436, 437, + 438, 439, 440, 0, 0, 441, 442, 443, 444, 445, + 446, 447, 0, 448, 0, 450, 451, 452, 453, 0, + 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 746, 0, 547, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 93, 94, 95, 96, 97, - 98, 99, 100, 0, 101, 102, 103, 0, 0, 0, - 0, 0, 0, 0, 104, 105, 0, 106, 107, 108, - 0, 110, 111, 112, 113, 114, 0, 116, 117, 0, - 118, 119, 120, 121, 122, 123, 0, 0, 124, 125, - 126, 127, 128, 0, 129, 130, 131, 132, 133, 0, - 0, 0, 135, 136, 137, 138, 139, 140, 0, 142, - 143, 144, 0, 145, 146, 147, 148, 149, 150, 0, - 0, 152, 153, 154, 0, 0, 0, 0, 0, 0, - 0, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 0, 166, 0, 167, 168, 169, 170, 171, 172, - 0, 173, 174, 175, 176, 177, 0, 0, 178, 179, - 180, 181, 182, 0, 183, 184, 185, 0, 186, 187, - 188, 0, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 0, 199, 0, 200, 201, 202, 203, 0, - 204, 0, 205, 0, 0, 0, 208, 209, 210, 0, - 212, 0, 213, 0, 214, 215, 216, 0, 217, 218, - 219, 220, 221, 222, 223, 0, 225, 226, 227, 228, - 0, 229, 230, 231, 232, 233, 234, 0, 235, 0, - 237, 238, 239, 240, 241, 242, 243, 244, 0, 245, - 0, 246, 0, 0, 249, 0, 251, 252, 253, 254, - 255, 0, 0, 256, 0, 258, 0, 0, 260, 261, - 262, 0, 0, 263, 264, 265, 266, 267, 500, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 0, 289, - 290, 291, 292, 293, 0, 294, 295, 0, 297, 0, - 298, 299, 300, 301, 302, 303, 0, 304, 305, 0, - 0, 306, 307, 308, 0, 0, 309, 310, 0, 312, - 0, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 325, 326, 327, 328, 329, 330, 331, - 332, 333, 0, 334, 335, 336, 337, 338, 339, 0, - 340, 341, 342, 343, 344, 345, 346, 347, 0, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 0, 361, 362, 0, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 0, 379, 380, 381, 382, 383, 0, 384, 385, - 386, 387, 388, 0, 390, 391, 392, 393, 0, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 502, 406, 407, 408, 0, 409, 410, 0, 411, 0, - 413, 414, 415, 416, 417, 0, 418, 419, 0, 0, - 420, 421, 422, 423, 424, 0, 425, 426, 427, 428, - 429, 430, 431, 432, 0, 0, 433, 434, 435, 436, - 437, 0, 0, 438, 439, 440, 441, 442, 443, 444, - 0, 445, 0, 447, 448, 449, 450, 0, 0, 451, - 0, 0, 452, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 498, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, - 94, 95, 96, 97, 98, 99, 100, 0, 101, 102, - 103, 0, 0, 0, 0, 0, 0, 0, 104, 105, - 0, 106, 107, 108, 0, 110, 111, 112, 113, 114, - 0, 116, 117, 0, 118, 119, 120, 121, 122, 123, - 0, 0, 124, 125, 126, 127, 128, 0, 129, 130, - 131, 132, 133, 0, 0, 0, 135, 136, 137, 138, - 139, 140, 0, 142, 143, 144, 0, 145, 146, 147, - 148, 149, 150, 0, 0, 152, 153, 154, 0, 0, - 0, 0, 0, 0, 0, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 0, 166, 0, 167, 168, - 169, 170, 171, 172, 0, 173, 174, 175, 176, 177, - 0, 0, 178, 179, 180, 181, 182, 0, 183, 184, - 185, 0, 186, 187, 188, 0, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 0, 199, 0, 200, - 201, 202, 203, 0, 204, 0, 205, 0, 0, 0, - 208, 209, 210, 0, 566, 0, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, 221, 222, 223, 0, - 225, 226, 227, 228, 0, 229, 230, 231, 232, 233, - 234, 0, 235, 0, 237, 238, 239, 240, 241, 242, - 243, 244, 0, 245, 0, 246, 0, 0, 249, 0, - 251, 252, 253, 254, 255, 0, 0, 256, 0, 258, - 0, 0, 260, 261, 567, 0, 0, 263, 264, 265, - 266, 267, 500, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 0, 289, 290, 291, 292, 293, 0, 294, - 295, 0, 297, 0, 298, 299, 300, 301, 302, 303, - 0, 304, 305, 0, 0, 306, 307, 308, 0, 0, - 309, 310, 0, 312, 0, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 0, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 0, 334, 335, 336, - 337, 338, 339, 0, 340, 341, 342, 343, 344, 345, - 346, 347, 0, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 0, 361, 362, 0, - 364, 365, 366, 367, 368, 369, 370, 371, 568, 373, - 374, 375, 376, 377, 378, 0, 379, 380, 381, 382, - 569, 0, 384, 385, 386, 387, 388, 0, 390, 391, - 392, 393, 0, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 502, 406, 407, 408, 0, 409, - 410, 0, 411, 0, 413, 414, 415, 416, 417, 0, - 570, 419, 0, 0, 420, 421, 422, 423, 424, 0, - 425, 426, 427, 428, 429, 430, 431, 432, 0, 0, - 433, 434, 435, 436, 437, 0, 0, 438, 439, 440, - 441, 442, 443, 444, 0, 445, 0, 447, 448, 449, - 450, 0, 0, 451, 0, 0, 452, 453, 454, 455, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 498, 0, 0, + 0, 94, 95, 96, 97, 98, 99, 100, 101, 0, + 102, 103, 104, 0, 0, 0, 0, 0, 0, 0, + 105, 106, 0, 107, 108, 109, 0, 111, 112, 113, + 747, 748, 0, 749, 750, 0, 119, 120, 121, 122, + 123, 124, 0, 0, 125, 126, 751, 752, 129, 0, + 130, 131, 132, 133, 753, 0, 0, 0, 136, 137, + 138, 139, 140, 141, 0, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 0, 0, 153, 154, 155, + 0, 0, 0, 0, 0, 0, 0, 157, 158, 159, + 160, 161, 162, 163, 754, 755, 166, 0, 167, 0, + 168, 169, 170, 171, 172, 173, 0, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 181, 182, 183, 0, + 184, 185, 186, 0, 187, 188, 189, 0, 190, 191, + 192, 193, 756, 195, 196, 197, 198, 199, 757, 1239, + 201, 0, 202, 203, 758, 205, 0, 206, 0, 207, + 0, 0, 0, 210, 211, 212, 0, 214, 0, 215, + 0, 759, 760, 218, 0, 219, 220, 221, 222, 223, + 224, 225, 0, 227, 228, 229, 230, 0, 231, 232, + 233, 234, 235, 236, 0, 237, 0, 761, 240, 241, + 242, 243, 244, 762, 763, 0, 764, 0, 248, 0, + 0, 251, 0, 253, 254, 255, 256, 257, 258, 0, + 0, 259, 0, 261, 0, 0, 263, 264, 265, 0, + 0, 266, 267, 268, 269, 270, 765, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 766, 0, 767, 293, 294, + 295, 768, 0, 297, 298, 0, 300, 0, 769, 302, + 770, 304, 305, 306, 0, 307, 308, 1240, 0, 309, + 310, 311, 0, 0, 312, 771, 0, 315, 0, 772, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 0, 328, 329, 773, 331, 332, 774, 334, 335, 336, + 0, 337, 338, 339, 340, 341, 342, 0, 343, 344, + 345, 775, 347, 348, 349, 350, 0, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 0, 364, 365, 0, 367, 368, 369, 776, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 0, + 382, 383, 384, 385, 386, 0, 387, 777, 389, 390, + 391, 0, 393, 394, 778, 396, 0, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 779, 409, + 780, 411, 0, 412, 413, 0, 414, 0, 416, 417, + 418, 419, 420, 0, 781, 782, 0, 0, 423, 424, + 783, 426, 784, 1241, 428, 429, 785, 431, 432, 433, + 434, 435, 0, 0, 436, 437, 438, 439, 440, 0, + 0, 441, 442, 443, 444, 445, 1131, 787, 0, 448, + 0, 450, 451, 452, 453, 0, 0, 454, 0, 0, + 455, 456, 457, 458, 459, 460, 788, 789, 790, 791, + 792, 793, 794, 795, 796, 797, 798, 472, 473, 474, + 475, 498, 0, 579, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 3, + 4, 0, 0, 0, 0, 0, 105, 106, 0, 107, + 108, 109, 0, 111, 112, 113, 114, 115, 0, 117, + 118, 0, 119, 120, 121, 122, 123, 124, 0, 0, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 133, + 134, 0, 0, 0, 136, 137, 138, 139, 140, 141, + 0, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 0, 153, 154, 155, 0, 0, 0, 0, + 0, 0, 0, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 0, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 181, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 0, 201, 0, 202, 203, + 204, 205, 0, 206, 0, 207, 0, 0, 0, 210, + 211, 212, 0, 214, 0, 215, 0, 216, 217, 218, + 0, 219, 220, 221, 222, 223, 224, 225, 0, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 0, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 0, 248, 0, 0, 251, 0, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 0, 261, + 0, 0, 263, 264, 265, 0, 0, 266, 267, 268, + 269, 270, 500, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 0, 292, 293, 294, 295, 296, 0, 297, + 298, 0, 300, 0, 301, 302, 303, 304, 305, 306, + 0, 307, 308, 0, 0, 309, 310, 311, 0, 0, + 312, 313, 0, 315, 0, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 330, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 346, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 0, + 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 0, 387, 388, 389, 390, 391, 0, 393, 394, + 395, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 502, 409, 410, 411, 0, 412, + 413, 0, 414, 0, 416, 417, 418, 419, 420, 0, + 421, 422, 0, 0, 423, 424, 425, 426, 427, 0, + 428, 429, 430, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 0, 0, 441, 442, 443, + 444, 445, 446, 447, 0, 448, 0, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 498, 0, 579, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 93, 94, 95, 96, 97, 98, 99, - 100, 0, 101, 102, 103, 0, 0, 0, 0, 0, - 0, 0, 104, 105, 0, 106, 107, 108, 0, 110, - 111, 112, 113, 114, 0, 116, 117, 0, 118, 119, - 120, 121, 122, 123, 0, 0, 124, 125, 126, 127, - 128, 0, 129, 130, 131, 132, 133, 0, 0, 0, - 135, 136, 137, 138, 139, 140, 0, 142, 143, 144, - 0, 145, 146, 147, 148, 149, 150, 0, 0, 152, - 153, 154, 0, 0, 0, 0, 0, 0, 0, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 0, - 166, 0, 167, 168, 169, 170, 171, 172, 0, 173, - 174, 175, 176, 177, 0, 0, 178, 179, 180, 181, - 182, 0, 183, 184, 185, 0, 186, 187, 188, 0, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 0, 199, 0, 200, 201, 202, 203, 0, 204, 0, - 205, 0, 0, 0, 208, 209, 210, 0, 212, 0, - 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 221, 222, 223, 0, 225, 226, 227, 228, 0, 229, - 230, 231, 232, 233, 234, 0, 235, 0, 237, 238, - 239, 240, 241, 242, 243, 244, 0, 245, 0, 246, - 0, 0, 249, 0, 251, 252, 253, 254, 255, 0, - 0, 256, 0, 258, 0, 0, 260, 261, 262, 0, - 0, 263, 264, 265, 266, 267, 500, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 0, 289, 290, 291, - 292, 293, 0, 294, 295, 0, 297, 0, 298, 299, - 300, 301, 302, 303, 0, 304, 305, 0, 0, 306, - 307, 308, 0, 0, 309, 310, 0, 312, 0, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 0, 325, 326, 327, 328, 329, 330, 331, 332, 333, - 0, 334, 335, 336, 337, 338, 339, 0, 340, 341, - 342, 343, 344, 345, 589, 347, 0, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 0, 361, 362, 0, 364, 365, 366, 367, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 0, - 379, 380, 381, 382, 383, 0, 384, 385, 386, 387, - 388, 0, 390, 391, 392, 393, 0, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 502, 406, - 407, 408, 0, 409, 410, 0, 411, 0, 413, 414, - 415, 416, 417, 0, 418, 419, 0, 0, 420, 421, - 422, 423, 424, 0, 425, 426, 427, 428, 429, 430, - 431, 432, 0, 0, 433, 434, 435, 436, 437, 0, - 0, 438, 439, 440, 441, 442, 443, 444, 0, 445, - 0, 447, 448, 449, 450, 0, 0, 451, 0, 0, - 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 498, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 93, 94, 95, - 96, 97, 98, 99, 100, 0, 101, 102, 103, 0, - 0, 0, 0, 0, 0, 0, 104, 105, 0, 106, - 107, 108, 0, 110, 111, 112, 113, 114, 0, 116, - 117, 0, 118, 119, 120, 121, 122, 123, 0, 0, - 124, 125, 126, 127, 128, 0, 129, 130, 131, 132, - 133, 0, 0, 0, 135, 136, 137, 138, 139, 140, - 0, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 0, 152, 153, 154, 0, 0, 0, 0, - 0, 0, 0, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 0, 199, 0, 200, 201, 202, - 203, 0, 204, 0, 205, 0, 0, 0, 208, 209, - 210, 0, 212, 0, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 221, 643, 223, 0, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 0, 237, 238, 239, 240, 241, 242, 243, 244, - 0, 245, 0, 246, 0, 0, 249, 0, 251, 252, - 253, 254, 255, 0, 0, 256, 0, 258, 0, 0, - 260, 261, 262, 0, 0, 263, 264, 265, 266, 267, - 500, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 0, 289, 290, 291, 292, 293, 0, 294, 295, 0, - 297, 0, 298, 299, 300, 301, 302, 303, 0, 304, - 305, 0, 0, 306, 307, 308, 0, 0, 309, 310, - 0, 312, 0, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 343, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 0, 364, 365, - 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 0, - 384, 385, 386, 387, 388, 0, 390, 391, 392, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 502, 406, 407, 408, 0, 409, 410, 0, - 411, 0, 413, 414, 415, 416, 417, 0, 418, 419, - 0, 0, 420, 421, 422, 423, 424, 0, 425, 426, - 427, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 0, 0, 438, 439, 440, 441, 442, - 443, 444, 0, 445, 0, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 498, 0, 0, 0, 0, + 0, 0, 0, 94, 95, 96, 97, 98, 99, 100, + 101, 0, 102, 103, 104, 0, 0, 0, 0, 0, + 0, 0, 105, 106, 0, 107, 108, 109, 0, 111, + 112, 113, 114, 115, 0, 117, 118, 0, 119, 120, + 121, 122, 123, 124, 0, 0, 125, 126, 127, 128, + 129, 0, 130, 131, 132, 133, 134, 0, 0, 0, + 136, 137, 138, 139, 140, 141, 0, 143, 144, 145, + 0, 146, 147, 148, 149, 150, 151, 0, 0, 153, + 154, 155, 0, 0, 0, 0, 0, 0, 0, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 0, + 167, 0, 168, 169, 170, 171, 172, 173, 0, 174, + 175, 176, 177, 178, 0, 0, 179, 180, 181, 182, + 183, 0, 184, 185, 186, 0, 187, 188, 189, 0, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 0, 202, 203, 204, 205, 0, 206, + 0, 207, 0, 0, 0, 210, 211, 212, 0, 214, + 0, 215, 0, 216, 217, 218, 0, 219, 220, 221, + 222, 223, 224, 225, 0, 227, 228, 229, 230, 0, + 231, 232, 233, 234, 235, 236, 0, 237, 0, 239, + 240, 241, 242, 243, 244, 245, 246, 0, 247, 0, + 248, 0, 0, 251, 0, 253, 254, 255, 256, 257, + 258, 0, 0, 259, 0, 261, 0, 0, 263, 264, + 265, 0, 0, 266, 267, 268, 269, 270, 500, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 0, 292, + 293, 294, 295, 296, 0, 297, 298, 0, 300, 0, + 301, 302, 303, 304, 305, 306, 0, 307, 308, 0, + 580, 309, 310, 311, 0, 0, 312, 313, 0, 315, + 0, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 0, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 0, 337, 338, 339, 340, 341, 342, 0, + 343, 344, 345, 346, 347, 348, 349, 350, 0, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 0, 364, 365, 0, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 0, 382, 383, 384, 385, 386, 0, 387, 388, + 389, 390, 391, 0, 393, 394, 395, 396, 0, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 502, 409, 410, 411, 0, 412, 413, 0, 414, 0, + 416, 417, 418, 419, 420, 0, 421, 422, 0, 0, + 423, 424, 425, 426, 427, 0, 428, 429, 430, 431, + 432, 433, 434, 435, 0, 0, 436, 437, 438, 439, + 440, 0, 0, 441, 442, 443, 444, 445, 446, 447, + 0, 448, 0, 450, 451, 452, 453, 0, 0, 454, + 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 498, 0, 579, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, + 95, 96, 97, 98, 99, 100, 101, 0, 102, 103, + 104, 0, 0, 0, 0, 0, 0, 0, 105, 106, + 0, 107, 108, 109, 0, 111, 112, 113, 114, 115, + 0, 117, 118, 0, 119, 120, 121, 122, 123, 124, + 0, 0, 125, 126, 127, 128, 129, 0, 130, 131, + 132, 133, 134, 0, 0, 0, 136, 137, 138, 139, + 140, 141, 0, 143, 144, 145, 0, 146, 147, 148, + 149, 150, 151, 0, 0, 153, 154, 155, 0, 0, + 0, 0, 0, 0, 0, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 0, 167, 0, 168, 169, + 170, 171, 172, 173, 0, 174, 175, 176, 177, 178, + 0, 0, 179, 180, 181, 182, 183, 0, 184, 185, + 186, 0, 187, 188, 189, 0, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 0, 201, 0, + 202, 203, 204, 205, 0, 206, 0, 207, 0, 0, + 0, 210, 211, 212, 0, 214, 0, 215, 0, 216, + 217, 218, 0, 219, 220, 221, 222, 223, 623, 225, + 0, 227, 228, 229, 230, 0, 231, 232, 233, 234, + 235, 236, 0, 237, 0, 239, 240, 241, 242, 243, + 244, 245, 246, 0, 247, 0, 248, 0, 0, 251, + 0, 253, 254, 255, 256, 257, 258, 0, 0, 259, + 0, 261, 0, 0, 263, 264, 265, 0, 0, 266, + 267, 268, 269, 270, 500, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 292, 293, 294, 295, 296, + 0, 297, 298, 0, 300, 0, 301, 302, 303, 304, + 305, 306, 0, 307, 308, 0, 580, 309, 310, 311, + 0, 0, 312, 313, 0, 315, 0, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 0, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 0, 337, + 338, 339, 340, 341, 342, 0, 343, 344, 345, 346, + 347, 348, 349, 350, 0, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 0, 364, + 365, 0, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 0, 382, 383, + 384, 385, 386, 0, 387, 388, 389, 390, 391, 0, + 393, 394, 395, 396, 0, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 502, 409, 410, 411, + 0, 412, 413, 0, 414, 0, 416, 417, 418, 419, + 420, 0, 421, 422, 0, 0, 423, 424, 425, 426, + 427, 0, 428, 429, 430, 431, 432, 433, 434, 435, + 0, 0, 436, 437, 438, 439, 440, 0, 0, 441, + 442, 443, 444, 445, 446, 447, 0, 448, 0, 450, + 451, 452, 453, 0, 0, 454, 0, 0, 455, 456, + 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 467, 468, 469, 470, 471, 472, 473, 474, 475, 746, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 94, 95, 96, 97, 98, 99, 100, 0, - 101, 102, 103, 0, 0, 0, 0, 0, 0, 0, - 104, 105, 0, 106, 107, 108, 0, 110, 111, 112, - 113, 114, 0, 116, 117, 0, 118, 119, 120, 121, - 122, 123, 0, 0, 124, 125, 126, 127, 128, 0, - 129, 130, 131, 132, 133, 0, 0, 0, 135, 136, - 137, 138, 139, 140, 0, 142, 143, 144, 0, 145, - 146, 147, 148, 149, 150, 0, 0, 152, 153, 154, - 0, 0, 0, 0, 0, 0, 0, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 0, 166, 0, - 167, 168, 169, 170, 171, 172, 0, 173, 174, 175, - 176, 177, 0, 0, 178, 179, 180, 181, 182, 0, - 183, 184, 185, 0, 186, 187, 188, 0, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 0, 199, - 0, 200, 201, 202, 203, 0, 204, 0, 205, 0, - 0, 0, 208, 209, 210, 0, 212, 0, 213, 0, - 214, 215, 216, 0, 217, 218, 219, 220, 221, 730, - 223, 0, 225, 226, 227, 228, 0, 229, 230, 231, - 232, 233, 234, 0, 235, 0, 237, 238, 239, 240, - 241, 242, 243, 244, 0, 245, 0, 246, 0, 0, - 249, 0, 251, 252, 253, 254, 255, 0, 0, 256, - 0, 258, 0, 0, 260, 261, 262, 0, 0, 263, - 264, 265, 266, 267, 500, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 287, 0, 289, 290, 291, 292, 293, - 0, 294, 295, 0, 297, 0, 298, 299, 300, 301, - 302, 303, 0, 304, 305, 0, 0, 306, 307, 308, - 0, 0, 309, 310, 0, 312, 0, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 0, 325, - 326, 327, 328, 329, 330, 331, 332, 333, 0, 334, - 335, 336, 337, 338, 339, 0, 340, 341, 342, 343, - 344, 345, 346, 347, 0, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 0, 361, - 362, 0, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 0, 379, 380, - 381, 382, 383, 0, 384, 385, 386, 387, 388, 0, - 390, 391, 392, 393, 0, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 502, 406, 407, 408, - 0, 409, 410, 0, 411, 0, 413, 414, 415, 416, - 417, 0, 418, 419, 0, 0, 420, 421, 422, 423, - 424, 0, 425, 426, 427, 428, 429, 430, 431, 432, - 0, 0, 433, 434, 435, 436, 437, 0, 0, 438, - 439, 440, 441, 442, 443, 444, 0, 445, 0, 447, - 448, 449, 450, 0, 0, 451, 0, 0, 452, 453, - 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 498, + 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 0, 102, 103, 104, 3, 4, 0, + 0, 0, 0, 0, 105, 106, 0, 107, 108, 109, + 0, 111, 112, 113, 747, 748, 0, 749, 750, 0, + 119, 120, 121, 122, 123, 124, 0, 0, 125, 126, + 751, 752, 129, 0, 130, 131, 132, 133, 753, 0, + 0, 0, 136, 137, 138, 139, 140, 141, 0, 143, + 144, 145, 0, 146, 147, 148, 149, 150, 151, 0, + 0, 153, 154, 155, 0, 0, 0, 0, 0, 0, + 0, 157, 158, 159, 160, 161, 162, 163, 754, 755, + 166, 0, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 0, 0, 179, 180, + 181, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 756, 195, 196, 197, + 198, 199, 757, 0, 201, 0, 202, 203, 758, 205, + 0, 206, 0, 207, 0, 0, 0, 210, 211, 212, + 0, 214, 0, 215, 0, 759, 760, 218, 0, 219, + 220, 221, 222, 223, 224, 225, 0, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 0, 761, 240, 241, 242, 243, 244, 762, 763, 0, + 764, 0, 248, 0, 0, 251, 0, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 0, 261, 0, 0, + 263, 264, 265, 0, 0, 266, 267, 268, 269, 270, + 765, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 766, + 0, 767, 293, 294, 295, 768, 0, 297, 298, 0, + 300, 0, 769, 302, 770, 304, 305, 306, 0, 307, + 308, 0, 0, 309, 310, 311, 0, 0, 312, 771, + 0, 315, 0, 772, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 0, 328, 329, 773, 331, 332, + 774, 334, 335, 336, 0, 337, 338, 339, 340, 341, + 342, 0, 343, 344, 345, 775, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 0, 367, 368, + 369, 776, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 0, 382, 383, 384, 385, 386, 0, + 387, 777, 389, 390, 391, 0, 393, 394, 778, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 779, 409, 780, 411, 0, 412, 413, 0, + 414, 0, 416, 417, 418, 419, 420, 0, 781, 782, + 0, 0, 423, 424, 783, 426, 784, 0, 428, 429, + 785, 431, 432, 433, 434, 435, 0, 0, 436, 437, + 438, 439, 440, 0, 0, 441, 442, 443, 444, 445, + 1131, 787, 0, 448, 0, 450, 451, 452, 453, 0, + 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, + 788, 789, 790, 791, 792, 793, 794, 795, 796, 797, + 798, 472, 473, 474, 475, 498, 0, 579, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 93, 94, 95, 96, 97, - 98, 99, 100, 0, 101, 102, 103, 0, 0, 0, - 0, 0, 0, 0, 104, 105, 0, 106, 107, 108, - 0, 110, 111, 112, 113, 114, 0, 116, 117, 0, - 118, 119, 120, 121, 122, 123, 0, 0, 124, 125, - 126, 127, 128, 0, 129, 130, 131, 132, 133, 0, - 0, 0, 135, 136, 137, 138, 139, 140, 0, 142, - 143, 144, 0, 145, 146, 147, 148, 149, 150, 0, - 0, 152, 153, 154, 0, 0, 0, 0, 0, 0, - 0, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 0, 166, 0, 167, 168, 169, 170, 171, 172, - 0, 173, 174, 175, 176, 177, 0, 0, 178, 179, - 180, 181, 182, 0, 183, 184, 185, 0, 186, 187, - 188, 0, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 0, 199, 0, 200, 201, 202, 203, 0, - 204, 0, 205, 0, 0, 0, 208, 209, 210, 0, - 212, 0, 213, 0, 214, 215, 216, 0, 217, 218, - 219, 220, 221, 733, 223, 0, 225, 226, 227, 228, - 0, 229, 230, 231, 232, 233, 234, 0, 235, 0, - 237, 238, 239, 240, 241, 242, 243, 244, 0, 245, - 0, 246, 0, 0, 249, 0, 251, 252, 253, 254, - 255, 0, 0, 256, 0, 258, 0, 0, 260, 261, - 262, 0, 0, 263, 264, 265, 266, 267, 500, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 0, 289, - 290, 291, 292, 293, 0, 294, 295, 0, 297, 0, - 298, 299, 300, 301, 302, 303, 0, 304, 305, 0, - 0, 306, 307, 308, 0, 0, 309, 310, 0, 312, - 0, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 325, 326, 327, 328, 329, 330, 331, - 332, 333, 0, 334, 335, 336, 337, 338, 339, 0, - 340, 341, 342, 343, 344, 345, 346, 347, 0, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 0, 361, 362, 0, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 0, 379, 380, 381, 382, 383, 0, 384, 385, - 386, 387, 388, 0, 390, 391, 392, 393, 0, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 502, 406, 407, 408, 0, 409, 410, 0, 411, 0, - 413, 414, 415, 416, 417, 0, 418, 419, 0, 0, - 420, 421, 422, 423, 424, 0, 425, 426, 427, 428, - 429, 430, 431, 432, 0, 0, 433, 434, 435, 436, - 437, 0, 0, 438, 439, 440, 441, 442, 443, 444, - 0, 445, 0, 447, 448, 449, 450, 0, 0, 451, - 0, 0, 452, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 498, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, - 94, 95, 96, 97, 98, 99, 100, 0, 101, 102, - 103, 0, 0, 0, 0, 0, 0, 0, 104, 105, - 0, 106, 107, 108, 0, 110, 111, 112, 113, 114, - 0, 116, 117, 0, 118, 119, 120, 121, 122, 123, - 0, 0, 124, 125, 126, 127, 128, 0, 129, 130, - 131, 132, 133, 0, 0, 0, 135, 136, 137, 138, - 139, 140, 0, 142, 143, 144, 0, 145, 146, 147, - 148, 149, 150, 0, 0, 152, 153, 154, 0, 0, - 0, 0, 0, 0, 0, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 0, 166, 0, 167, 168, - 169, 170, 171, 172, 0, 173, 174, 175, 176, 177, - 0, 0, 178, 179, 180, 181, 182, 0, 183, 184, - 185, 0, 186, 187, 188, 0, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 0, 199, 0, 200, - 201, 202, 203, 0, 204, 0, 205, 0, 0, 0, - 208, 209, 210, 0, 212, 0, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, 221, 736, 223, 0, - 225, 226, 227, 228, 0, 229, 230, 231, 232, 233, - 234, 0, 235, 0, 237, 238, 239, 240, 241, 242, - 243, 244, 0, 245, 0, 246, 0, 0, 249, 0, - 251, 252, 253, 254, 255, 0, 0, 256, 0, 258, - 0, 0, 260, 261, 262, 0, 0, 263, 264, 265, - 266, 267, 500, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 0, 289, 290, 291, 292, 293, 0, 294, - 295, 0, 297, 0, 298, 299, 300, 301, 302, 303, - 0, 304, 305, 0, 0, 306, 307, 308, 0, 0, - 309, 310, 0, 312, 0, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 0, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 0, 334, 335, 336, - 337, 338, 339, 0, 340, 341, 342, 343, 344, 345, - 346, 347, 0, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 0, 361, 362, 0, - 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 0, 379, 380, 381, 382, - 383, 0, 384, 385, 386, 387, 388, 0, 390, 391, - 392, 393, 0, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 502, 406, 407, 408, 0, 409, - 410, 0, 411, 0, 413, 414, 415, 416, 417, 0, - 418, 419, 0, 0, 420, 421, 422, 423, 424, 0, - 425, 426, 427, 428, 429, 430, 431, 432, 0, 0, - 433, 434, 435, 436, 437, 0, 0, 438, 439, 440, - 441, 442, 443, 444, 0, 445, 0, 447, 448, 449, - 450, 0, 0, 451, 0, 0, 452, 453, 454, 455, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 498, 0, 0, + 0, 94, 95, 96, 97, 98, 99, 100, 101, 0, + 102, 103, 104, 0, 0, 0, 0, 0, 0, 0, + 105, 106, 0, 107, 108, 109, 0, 111, 112, 113, + 114, 115, 0, 117, 118, 0, 119, 120, 121, 122, + 123, 124, 0, 0, 125, 126, 127, 128, 129, 0, + 130, 131, 132, 133, 134, 0, 0, 0, 136, 137, + 138, 139, 140, 141, 0, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 0, 0, 153, 154, 155, + 0, 0, 0, 0, 0, 0, 0, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 0, 167, 0, + 168, 169, 170, 171, 172, 173, 0, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 181, 182, 183, 0, + 184, 185, 186, 0, 187, 188, 189, 0, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 0, + 201, 0, 202, 203, 204, 205, 0, 206, 0, 207, + 0, 0, 0, 210, 211, 212, 0, 1732, 0, 215, + 0, 216, 217, 218, 0, 219, 220, 221, 222, 223, + 224, 225, 0, 227, 228, 229, 230, 0, 231, 232, + 233, 234, 235, 236, 0, 237, 0, 239, 240, 241, + 242, 243, 244, 245, 246, 0, 247, 0, 248, 0, + 0, 251, 0, 253, 254, 255, 256, 257, 258, 0, + 0, 259, 0, 261, 0, 0, 263, 264, 1733, 0, + 0, 266, 267, 268, 269, 270, 500, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 0, 292, 293, 294, + 295, 296, 0, 297, 298, 0, 300, 0, 301, 302, + 303, 304, 305, 306, 0, 307, 308, 0, 0, 309, + 310, 311, 0, 0, 312, 313, 0, 315, 0, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 0, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 0, 337, 338, 339, 340, 341, 342, 0, 343, 344, + 345, 346, 347, 348, 349, 350, 0, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 0, 364, 365, 0, 367, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 0, + 382, 383, 384, 385, 386, 0, 387, 388, 389, 390, + 391, 0, 393, 394, 395, 396, 0, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 502, 409, + 410, 411, 0, 412, 413, 1734, 414, 0, 416, 1735, + 418, 1736, 420, 0, 421, 422, 0, 0, 423, 424, + 425, 426, 427, 0, 428, 429, 430, 431, 432, 433, + 434, 435, 0, 0, 436, 437, 1737, 439, 440, 0, + 0, 441, 442, 443, 444, 445, 446, 447, 0, 448, + 0, 450, 451, 452, 453, 0, 0, 454, 0, 0, + 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 498, 2688, 0, 0, 0, 0, 2689, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 0, 0, 0, 105, 106, 0, 107, + 108, 109, 0, 111, 112, 113, 114, 115, 0, 117, + 118, 0, 119, 120, 121, 122, 123, 124, 0, 0, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 133, + 134, 0, 0, 0, 136, 137, 138, 139, 140, 141, + 0, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 0, 153, 154, 155, 0, 0, 0, 0, + 0, 0, 0, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 0, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 181, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 0, 201, 0, 202, 203, + 204, 205, 0, 206, 0, 207, 0, 0, 0, 210, + 211, 212, 0, 214, 0, 215, 0, 216, 217, 218, + 0, 219, 220, 221, 222, 223, 224, 225, 0, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 0, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 0, 248, 0, 0, 251, 0, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 0, 261, + 0, 0, 263, 264, 265, 0, 0, 266, 267, 268, + 269, 270, 500, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 0, 292, 293, 294, 295, 296, 0, 297, + 298, 0, 300, 0, 301, 302, 303, 304, 305, 306, + 0, 307, 308, 0, 0, 309, 310, 311, 0, 0, + 312, 313, 0, 315, 0, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 330, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 346, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 0, + 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 0, 387, 388, 389, 390, 391, 0, 393, 394, + 395, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 502, 409, 410, 411, 0, 412, + 413, 0, 414, 0, 416, 417, 418, 419, 420, 0, + 421, 422, 0, 0, 423, 424, 425, 426, 427, 0, + 428, 429, 430, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 0, 0, 441, 442, 443, + 444, 445, 446, 447, 0, 448, 0, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 498, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 93, 94, 95, 96, 97, 98, 99, - 100, 0, 101, 102, 103, 0, 0, 0, 0, 0, - 0, 0, 104, 105, 0, 106, 107, 108, 0, 110, - 111, 112, 113, 114, 0, 116, 117, 0, 118, 119, - 120, 121, 122, 123, 0, 0, 124, 125, 126, 127, - 128, 0, 129, 130, 131, 132, 133, 0, 0, 0, - 135, 136, 137, 138, 139, 140, 0, 142, 143, 144, - 0, 145, 146, 147, 148, 149, 150, 0, 0, 152, - 153, 154, 0, 0, 0, 0, 0, 0, 0, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 0, - 166, 0, 167, 168, 169, 170, 171, 172, 0, 173, - 174, 175, 176, 177, 0, 0, 178, 179, 180, 181, - 182, 0, 183, 184, 185, 0, 186, 187, 188, 0, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 0, 199, 0, 200, 201, 202, 203, 0, 204, 0, - 205, 0, 0, 0, 208, 209, 210, 0, 212, 0, - 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 221, 222, 223, 0, 225, 226, 227, 228, 0, 229, - 230, 231, 232, 233, 234, 0, 235, 0, 237, 238, - 239, 240, 241, 242, 243, 244, 0, 245, 0, 246, - 0, 0, 249, 0, 251, 252, 253, 254, 255, 0, - 0, 256, 0, 258, 0, 0, 260, 261, 262, 0, - 0, 263, 264, 265, 266, 267, 500, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 0, 289, 290, 291, - 292, 293, 0, 294, 295, 0, 297, 0, 298, 299, - 300, 301, 302, 303, 0, 304, 305, 0, 0, 306, - 307, 308, 0, 0, 309, 310, 0, 312, 0, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 0, 325, 326, 327, 328, 329, 330, 331, 332, 333, - 0, 334, 335, 336, 337, 338, 339, 0, 340, 341, - 342, 343, 344, 345, 346, 347, 0, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 0, 361, 362, 0, 364, 365, 366, 367, 368, 369, - 370, 371, 568, 373, 374, 375, 376, 377, 378, 0, - 379, 380, 381, 382, 383, 0, 384, 385, 386, 387, - 388, 0, 390, 391, 392, 393, 0, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 502, 406, - 407, 408, 0, 409, 410, 0, 411, 0, 413, 414, - 415, 416, 417, 0, 570, 419, 0, 0, 420, 421, - 422, 423, 424, 0, 425, 426, 427, 428, 429, 430, - 431, 432, 0, 0, 433, 434, 435, 436, 437, 0, - 0, 438, 439, 440, 441, 442, 443, 444, 0, 445, - 0, 447, 448, 449, 450, 0, 0, 451, 0, 0, - 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 498, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 93, 94, 95, - 96, 97, 98, 99, 100, 0, 101, 102, 103, 0, - 0, 0, 0, 0, 1383, 0, 104, 105, 0, 106, - 107, 108, 0, 110, 111, 112, 113, 114, 0, 116, - 117, 0, 118, 119, 120, 121, 122, 123, 0, 0, - 124, 125, 126, 127, 128, 0, 129, 130, 131, 132, - 133, 0, 0, 0, 135, 136, 137, 138, 139, 140, - 0, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 0, 152, 153, 154, 0, 0, 0, 0, - 0, 0, 0, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 0, 199, 0, 200, 201, 202, - 203, 0, 204, 0, 205, 0, 0, 0, 208, 209, - 210, 0, 212, 0, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 0, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 0, 237, 238, 239, 240, 241, 242, 243, 244, - 0, 245, 0, 246, 0, 0, 249, 0, 251, 252, - 253, 254, 255, 0, 0, 256, 0, 258, 0, 0, - 260, 261, 262, 0, 0, 263, 264, 265, 266, 267, - 500, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 0, 289, 290, 291, 292, 293, 0, 294, 295, 0, - 297, 0, 298, 299, 300, 301, 302, 303, 0, 304, - 305, 0, 0, 306, 307, 308, 0, 0, 309, 310, - 0, 312, 0, 314, 315, 316, 317, 318, 319, 320, - 321, 322, 323, 324, 0, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 341, 342, 343, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 0, 364, 365, - 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 0, - 0, 385, 386, 387, 388, 0, 390, 391, 392, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 502, 406, 407, 408, 0, 409, 410, 0, - 411, 0, 413, 414, 415, 416, 417, 0, 418, 419, - 0, 0, 420, 421, 422, 423, 424, 0, 425, 426, - 427, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 0, 0, 438, 439, 440, 441, 442, - 443, 444, 0, 445, 0, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 498, 0, 0, 0, 0, + 0, 0, 0, 94, 95, 96, 97, 98, 99, 100, + 101, 499, 102, 103, 104, 0, 0, 0, 0, 0, + 0, 0, 105, 106, 0, 107, 108, 109, 0, 111, + 112, 113, 114, 115, 0, 117, 118, 0, 119, 120, + 121, 122, 123, 124, 0, 0, 125, 126, 127, 128, + 129, 0, 130, 131, 132, 133, 134, 0, 0, 0, + 136, 137, 138, 139, 140, 141, 0, 143, 144, 145, + 0, 146, 147, 148, 149, 150, 151, 0, 0, 153, + 154, 155, 0, 0, 0, 0, 0, 0, 0, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 0, + 167, 0, 168, 169, 170, 171, 172, 173, 0, 174, + 175, 176, 177, 178, 0, 0, 179, 180, 181, 182, + 183, 0, 184, 185, 186, 0, 187, 188, 189, 0, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 0, 202, 203, 204, 205, 0, 206, + 0, 207, 0, 0, 0, 210, 211, 212, 0, 214, + 0, 215, 0, 216, 217, 218, 0, 219, 220, 221, + 222, 223, 224, 225, 0, 227, 228, 229, 230, 0, + 231, 232, 233, 234, 235, 236, 0, 237, 0, 239, + 240, 241, 242, 243, 244, 245, 246, 0, 247, 0, + 248, 0, 0, 251, 0, 253, 254, 255, 256, 257, + 258, 0, 0, 259, 0, 261, 0, 0, 263, 264, + 265, 0, 0, 266, 267, 268, 269, 270, 500, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 0, 292, + 293, 294, 295, 296, 0, 297, 298, 0, 300, 0, + 301, 302, 303, 304, 305, 306, 0, 307, 308, 0, + 0, 309, 310, 311, 0, 0, 312, 313, 0, 315, + 0, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 0, 328, 329, 330, 331, 332, 333, 501, + 335, 336, 0, 337, 338, 339, 340, 341, 342, 0, + 343, 344, 345, 346, 347, 348, 349, 350, 0, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 0, 364, 365, 0, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 0, 382, 383, 384, 385, 386, 0, 387, 388, + 389, 390, 391, 0, 393, 394, 395, 396, 0, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 502, 409, 410, 411, 0, 412, 413, 0, 414, 0, + 416, 417, 418, 419, 420, 0, 421, 422, 0, 0, + 423, 424, 425, 426, 427, 0, 428, 429, 430, 431, + 432, 433, 434, 435, 0, 0, 436, 437, 438, 439, + 440, 0, 0, 441, 442, 443, 444, 445, 446, 447, + 0, 448, 0, 450, 451, 452, 453, 0, 0, 454, + 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 498, 0, 547, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, + 95, 96, 97, 98, 99, 100, 101, 0, 102, 103, + 104, 0, 0, 0, 0, 0, 0, 0, 105, 106, + 0, 107, 108, 109, 0, 111, 112, 113, 114, 115, + 0, 117, 118, 0, 119, 120, 121, 122, 123, 124, + 0, 0, 125, 126, 127, 128, 129, 0, 130, 131, + 132, 133, 134, 0, 0, 0, 136, 137, 138, 139, + 140, 141, 0, 143, 144, 145, 0, 146, 147, 148, + 149, 150, 151, 0, 0, 153, 154, 155, 0, 0, + 0, 0, 0, 0, 0, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 0, 167, 0, 168, 169, + 170, 171, 172, 173, 0, 174, 175, 176, 177, 178, + 0, 0, 179, 180, 181, 182, 183, 0, 184, 185, + 186, 0, 187, 188, 189, 0, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 0, 201, 0, + 202, 203, 204, 205, 0, 206, 0, 207, 0, 0, + 0, 210, 211, 212, 0, 214, 0, 215, 0, 216, + 217, 218, 0, 219, 220, 221, 222, 223, 224, 225, + 0, 227, 228, 229, 230, 0, 231, 232, 233, 234, + 235, 236, 0, 237, 0, 239, 240, 241, 242, 243, + 244, 245, 246, 0, 247, 0, 248, 0, 0, 251, + 0, 253, 254, 255, 256, 257, 258, 0, 0, 259, + 0, 261, 0, 0, 263, 264, 265, 0, 0, 266, + 267, 268, 269, 270, 500, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 292, 293, 294, 295, 296, + 0, 297, 298, 0, 300, 0, 301, 302, 303, 304, + 305, 306, 0, 307, 308, 0, 0, 309, 310, 311, + 0, 0, 312, 313, 0, 315, 0, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 0, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 0, 337, + 338, 339, 340, 341, 342, 0, 343, 344, 345, 346, + 347, 348, 349, 350, 0, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 0, 364, + 365, 0, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 0, 382, 383, + 384, 385, 386, 0, 387, 388, 389, 390, 391, 0, + 393, 394, 395, 396, 0, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 502, 409, 410, 411, + 0, 412, 413, 0, 414, 0, 416, 417, 418, 419, + 420, 0, 421, 422, 0, 0, 423, 424, 425, 426, + 427, 0, 428, 429, 430, 431, 432, 433, 434, 435, + 0, 0, 436, 437, 438, 439, 440, 0, 0, 441, + 442, 443, 444, 445, 446, 447, 0, 448, 0, 450, + 451, 452, 453, 0, 0, 454, 0, 0, 455, 456, + 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 467, 468, 469, 470, 471, 472, 473, 474, 475, 498, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 94, 95, 96, 97, 98, 99, 100, 0, - 101, 102, 103, 0, 0, 0, 0, 0, 0, 0, - 104, 105, 0, 106, 107, 108, 0, 110, 111, 112, - 113, 114, 0, 116, 117, 0, 118, 119, 120, 121, - 122, 123, 0, 0, 124, 125, 126, 127, 128, 0, - 129, 130, 131, 132, 133, 0, 0, 0, 135, 136, - 137, 138, 139, 140, 0, 142, 143, 144, 0, 145, - 146, 147, 148, 149, 150, 0, 0, 152, 153, 154, - 0, 0, 0, 0, 0, 0, 0, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 0, 166, 0, - 167, 168, 169, 170, 171, 172, 0, 173, 174, 175, - 176, 177, 0, 0, 178, 179, 180, 181, 182, 0, - 183, 184, 185, 0, 186, 187, 188, 0, 189, 190, - 191, 192, 193, 194, 195, 196, 197, 198, 0, 199, - 0, 200, 201, 202, 203, 0, 204, 0, 205, 0, - 0, 0, 208, 209, 210, 0, 212, 0, 213, 0, - 214, 215, 216, 0, 217, 218, 219, 220, 221, 1524, - 223, 0, 225, 226, 227, 228, 0, 229, 230, 231, - 232, 233, 234, 0, 235, 0, 237, 238, 239, 240, - 241, 242, 243, 244, 0, 245, 0, 246, 0, 0, - 249, 0, 251, 252, 253, 254, 255, 0, 0, 256, - 0, 258, 0, 0, 260, 261, 262, 0, 0, 263, - 264, 265, 266, 267, 500, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 287, 0, 289, 290, 291, 292, 293, - 0, 294, 295, 0, 297, 0, 298, 299, 300, 301, - 302, 303, 0, 304, 305, 0, 0, 306, 307, 308, - 0, 0, 309, 310, 0, 312, 0, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 0, 325, - 326, 327, 328, 329, 330, 331, 332, 333, 0, 334, - 335, 336, 337, 338, 339, 0, 340, 341, 342, 343, - 344, 345, 346, 347, 0, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 0, 361, - 362, 0, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 0, 379, 380, - 381, 382, 383, 0, 384, 385, 386, 387, 388, 0, - 390, 391, 392, 393, 0, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 502, 406, 407, 408, - 0, 409, 410, 0, 411, 0, 413, 414, 415, 416, - 417, 0, 418, 419, 0, 0, 420, 421, 422, 423, - 424, 0, 425, 426, 427, 428, 429, 430, 431, 432, - 0, 0, 433, 434, 435, 436, 437, 0, 0, 438, - 439, 440, 441, 442, 443, 444, 0, 445, 0, 447, - 448, 449, 450, 0, 0, 451, 0, 0, 452, 453, - 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 498, + 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 554, 102, 103, 104, 0, 0, 0, + 0, 0, 0, 0, 105, 106, 0, 107, 108, 109, + 0, 111, 112, 113, 114, 115, 0, 117, 118, 0, + 119, 120, 121, 122, 123, 124, 0, 0, 125, 126, + 127, 128, 129, 0, 130, 131, 132, 133, 134, 0, + 0, 0, 136, 137, 138, 139, 140, 141, 0, 143, + 144, 145, 0, 146, 147, 148, 149, 150, 151, 0, + 0, 153, 154, 155, 0, 0, 0, 0, 0, 0, + 0, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 0, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 0, 0, 179, 180, + 181, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 0, 201, 0, 202, 203, 204, 205, + 0, 206, 0, 207, 0, 0, 0, 210, 211, 212, + 0, 214, 0, 215, 0, 216, 217, 218, 0, 219, + 220, 221, 222, 223, 224, 225, 0, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 0, 239, 240, 241, 242, 243, 244, 245, 246, 0, + 247, 0, 248, 0, 0, 251, 0, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 0, 261, 0, 0, + 263, 264, 265, 0, 0, 266, 267, 268, 269, 270, + 500, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 0, 292, 293, 294, 295, 296, 0, 297, 298, 0, + 300, 0, 301, 302, 303, 304, 305, 306, 0, 307, + 308, 0, 0, 309, 310, 311, 0, 0, 312, 313, + 0, 315, 0, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 0, 328, 329, 330, 331, 332, + 333, 334, 335, 336, 0, 337, 338, 339, 340, 341, + 342, 0, 343, 344, 345, 346, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 0, 367, 368, + 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 0, 382, 383, 384, 385, 386, 0, + 387, 388, 389, 390, 391, 0, 393, 394, 395, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 502, 409, 410, 411, 0, 412, 413, 0, + 414, 0, 416, 417, 418, 419, 420, 0, 555, 422, + 0, 0, 556, 424, 425, 426, 427, 0, 428, 429, + 430, 431, 432, 433, 434, 435, 0, 0, 436, 437, + 438, 439, 440, 0, 0, 441, 442, 443, 444, 445, + 446, 447, 0, 448, 0, 450, 451, 452, 453, 0, + 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 498, 0, 579, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 93, 94, 95, 96, 97, - 98, 99, 100, 0, 101, 102, 103, 0, 0, 0, - 0, 0, 0, 0, 104, 105, 0, 106, 107, 108, - 0, 110, 111, 112, 113, 114, 0, 116, 117, 0, - 118, 119, 120, 121, 122, 123, 0, 0, 124, 125, - 126, 127, 128, 0, 129, 130, 131, 132, 133, 0, - 0, 0, 135, 136, 137, 138, 139, 140, 0, 142, - 143, 144, 0, 145, 146, 147, 148, 149, 150, 0, - 0, 152, 153, 154, 0, 0, 0, 0, 0, 0, - 0, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 0, 166, 0, 167, 168, 169, 170, 171, 172, - 0, 173, 174, 175, 176, 177, 0, 0, 178, 179, - 180, 181, 182, 0, 183, 184, 185, 0, 186, 187, - 188, 0, 189, 190, 191, 192, 193, 194, 195, 196, - 197, 198, 0, 199, 0, 200, 201, 202, 203, 0, - 204, 0, 205, 0, 0, 0, 208, 209, 210, 0, - 212, 0, 213, 0, 214, 215, 216, 0, 217, 218, - 219, 220, 221, 1804, 223, 0, 225, 226, 227, 228, - 0, 229, 230, 231, 232, 233, 234, 0, 235, 0, - 237, 238, 239, 240, 241, 242, 243, 244, 0, 245, - 0, 246, 0, 0, 249, 0, 251, 252, 253, 254, - 255, 0, 0, 256, 0, 258, 0, 0, 260, 261, - 262, 0, 0, 263, 264, 265, 266, 267, 500, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - 280, 281, 282, 283, 284, 285, 286, 287, 0, 289, - 290, 291, 292, 293, 0, 294, 295, 0, 297, 0, - 298, 299, 300, 301, 302, 303, 0, 304, 305, 0, - 0, 306, 307, 308, 0, 0, 309, 310, 0, 312, - 0, 314, 315, 316, 317, 318, 319, 320, 321, 322, - 323, 324, 0, 325, 326, 327, 328, 329, 330, 331, - 332, 333, 0, 334, 335, 336, 337, 338, 339, 0, - 340, 341, 342, 343, 344, 345, 346, 347, 0, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 0, 361, 362, 0, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 0, 379, 380, 381, 382, 383, 0, 384, 385, - 386, 387, 388, 0, 390, 391, 392, 393, 0, 394, - 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, - 502, 406, 407, 408, 0, 409, 410, 0, 411, 0, - 413, 414, 415, 416, 417, 0, 418, 419, 0, 0, - 420, 421, 422, 423, 424, 0, 425, 426, 427, 428, - 429, 430, 431, 432, 0, 0, 433, 434, 435, 436, - 437, 0, 0, 438, 439, 440, 441, 442, 443, 444, - 0, 445, 0, 447, 448, 449, 450, 0, 0, 451, - 0, 0, 452, 453, 454, 455, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 498, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 93, - 94, 95, 96, 97, 98, 99, 100, 0, 101, 102, - 103, 0, 0, 0, 0, 0, 0, 0, 104, 105, - 0, 106, 107, 108, 0, 110, 111, 112, 113, 114, - 0, 116, 117, 0, 118, 119, 120, 121, 122, 123, - 0, 0, 124, 125, 126, 127, 128, 0, 129, 130, - 131, 132, 133, 0, 0, 0, 135, 136, 137, 138, - 139, 140, 0, 142, 143, 144, 0, 145, 146, 147, - 148, 149, 150, 0, 0, 152, 153, 154, 0, 0, - 0, 0, 0, 0, 0, 156, 157, 158, 159, 160, - 161, 162, 163, 164, 165, 0, 166, 0, 167, 168, - 169, 170, 171, 172, 0, 173, 174, 175, 176, 177, - 0, 0, 178, 179, 180, 181, 182, 0, 183, 184, - 185, 0, 186, 187, 188, 0, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 198, 0, 199, 0, 200, - 201, 202, 203, 0, 204, 0, 205, 0, 0, 0, - 208, 209, 210, 0, 212, 0, 213, 0, 214, 215, - 216, 0, 217, 218, 219, 220, 221, 1816, 223, 0, - 225, 226, 227, 228, 0, 229, 230, 231, 232, 233, - 234, 0, 235, 0, 237, 238, 239, 240, 241, 242, - 243, 244, 0, 245, 0, 246, 0, 0, 249, 0, - 251, 252, 253, 254, 255, 0, 0, 256, 0, 258, - 0, 0, 260, 261, 262, 0, 0, 263, 264, 265, - 266, 267, 500, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 0, 289, 290, 291, 292, 293, 0, 294, - 295, 0, 297, 0, 298, 299, 300, 301, 302, 303, - 0, 304, 305, 0, 0, 306, 307, 308, 0, 0, - 309, 310, 0, 312, 0, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 0, 325, 326, 327, - 328, 329, 330, 331, 332, 333, 0, 334, 335, 336, - 337, 338, 339, 0, 340, 341, 342, 343, 344, 345, - 346, 347, 0, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 0, 361, 362, 0, - 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 0, 379, 380, 381, 382, - 383, 0, 384, 385, 386, 387, 388, 0, 390, 391, - 392, 393, 0, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 502, 406, 407, 408, 0, 409, - 410, 0, 411, 0, 413, 414, 415, 416, 417, 0, - 418, 419, 0, 0, 420, 421, 422, 423, 424, 0, - 425, 426, 427, 428, 429, 430, 431, 432, 0, 0, - 433, 434, 435, 436, 437, 0, 0, 438, 439, 440, - 441, 442, 443, 444, 0, 445, 0, 447, 448, 449, - 450, 0, 0, 451, 0, 0, 452, 453, 454, 455, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 498, 0, 0, + 0, 94, 95, 96, 97, 98, 99, 100, 101, 0, + 102, 103, 104, 0, 0, 0, 0, 0, 0, 0, + 105, 106, 0, 107, 108, 109, 0, 111, 112, 113, + 114, 115, 0, 117, 118, 0, 119, 120, 121, 122, + 123, 124, 0, 0, 125, 126, 127, 128, 129, 0, + 130, 131, 132, 133, 134, 0, 0, 0, 136, 137, + 138, 139, 140, 141, 0, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 0, 0, 153, 154, 155, + 0, 0, 0, 0, 0, 0, 0, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 0, 167, 0, + 168, 169, 170, 171, 172, 173, 0, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 181, 182, 183, 0, + 184, 185, 186, 0, 187, 188, 189, 0, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 0, + 201, 0, 202, 203, 204, 205, 0, 206, 0, 207, + 0, 0, 0, 210, 211, 212, 0, 214, 0, 215, + 0, 216, 217, 218, 0, 219, 220, 221, 222, 223, + 618, 225, 0, 227, 228, 229, 230, 0, 231, 232, + 233, 234, 235, 236, 0, 237, 0, 239, 240, 241, + 242, 243, 244, 245, 246, 0, 247, 0, 248, 0, + 0, 251, 0, 253, 254, 255, 256, 257, 258, 0, + 0, 259, 0, 261, 0, 0, 263, 264, 265, 0, + 0, 266, 267, 268, 269, 270, 500, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 0, 292, 293, 294, + 295, 296, 0, 297, 298, 0, 300, 0, 301, 302, + 303, 304, 305, 306, 0, 307, 308, 0, 0, 309, + 310, 311, 0, 0, 312, 313, 0, 315, 0, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 0, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 0, 337, 338, 339, 340, 341, 342, 0, 343, 344, + 345, 346, 347, 348, 349, 350, 0, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 0, 364, 365, 0, 367, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 0, + 382, 383, 384, 385, 386, 0, 387, 388, 389, 390, + 391, 0, 393, 394, 395, 396, 0, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 502, 409, + 410, 411, 0, 412, 413, 0, 414, 0, 416, 417, + 418, 419, 420, 0, 421, 422, 0, 0, 423, 424, + 425, 426, 427, 0, 428, 429, 430, 431, 432, 433, + 434, 435, 0, 0, 436, 437, 438, 439, 440, 0, + 0, 441, 442, 443, 444, 445, 446, 447, 0, 448, + 0, 450, 451, 452, 453, 0, 0, 454, 0, 0, + 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 498, 0, 579, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 0, 0, 0, 105, 106, 0, 107, + 108, 109, 0, 111, 112, 113, 114, 115, 0, 117, + 118, 0, 119, 120, 121, 122, 123, 124, 0, 0, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 133, + 134, 0, 0, 0, 136, 137, 138, 139, 140, 141, + 0, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 0, 153, 154, 155, 0, 0, 0, 0, + 0, 0, 0, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 0, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 181, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 0, 201, 0, 202, 203, + 204, 205, 0, 206, 0, 207, 0, 0, 0, 210, + 211, 212, 0, 214, 0, 215, 0, 216, 217, 218, + 0, 219, 220, 221, 222, 223, 621, 225, 0, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 0, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 0, 248, 0, 0, 251, 0, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 0, 261, + 0, 0, 263, 264, 265, 0, 0, 266, 267, 268, + 269, 270, 500, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 0, 292, 293, 294, 295, 296, 0, 297, + 298, 0, 300, 0, 301, 302, 303, 304, 305, 306, + 0, 307, 308, 0, 0, 309, 310, 311, 0, 0, + 312, 313, 0, 315, 0, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 330, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 346, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 0, + 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 0, 387, 388, 389, 390, 391, 0, 393, 394, + 395, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 502, 409, 410, 411, 0, 412, + 413, 0, 414, 0, 416, 417, 418, 419, 420, 0, + 421, 422, 0, 0, 423, 424, 425, 426, 427, 0, + 428, 429, 430, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 0, 0, 441, 442, 443, + 444, 445, 446, 447, 0, 448, 0, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 498, 0, 579, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 93, 94, 95, 96, 97, 98, 99, - 100, 0, 101, 102, 103, 0, 0, 0, 0, 0, - 0, 0, 104, 105, 0, 106, 107, 108, 0, 110, - 111, 112, 113, 114, 0, 116, 117, 0, 118, 119, - 120, 121, 122, 123, 0, 0, 124, 125, 126, 127, - 128, 0, 129, 130, 131, 132, 133, 0, 0, 0, - 135, 136, 137, 138, 139, 140, 0, 142, 143, 144, - 0, 145, 146, 147, 148, 149, 150, 0, 0, 152, - 153, 154, 0, 0, 0, 0, 0, 0, 0, 156, - 157, 158, 159, 160, 161, 162, 163, 164, 165, 0, - 166, 0, 167, 168, 169, 170, 171, 172, 0, 173, - 174, 175, 176, 177, 0, 0, 178, 179, 180, 181, - 182, 0, 183, 184, 185, 0, 186, 187, 188, 0, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 0, 199, 0, 200, 201, 202, 203, 0, 204, 0, - 205, 0, 0, 0, 208, 209, 210, 0, 212, 0, - 213, 0, 214, 215, 216, 0, 217, 218, 219, 220, - 221, 1818, 223, 0, 225, 226, 227, 228, 0, 229, - 230, 231, 232, 233, 234, 0, 235, 0, 237, 238, - 239, 240, 241, 242, 243, 244, 0, 245, 0, 246, - 0, 0, 249, 0, 251, 252, 253, 254, 255, 0, - 0, 256, 0, 258, 0, 0, 260, 261, 262, 0, - 0, 263, 264, 265, 266, 267, 500, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 0, 289, 290, 291, - 292, 293, 0, 294, 295, 0, 297, 0, 298, 299, - 300, 301, 302, 303, 0, 304, 305, 0, 0, 306, - 307, 308, 0, 0, 309, 310, 0, 312, 0, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 0, 325, 326, 327, 328, 329, 330, 331, 332, 333, - 0, 334, 335, 336, 337, 338, 339, 0, 340, 341, - 342, 343, 344, 345, 346, 347, 0, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 0, 361, 362, 0, 364, 365, 366, 367, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 0, - 379, 380, 381, 382, 383, 0, 384, 385, 386, 387, - 388, 0, 390, 391, 392, 393, 0, 394, 395, 396, - 397, 398, 399, 400, 401, 402, 403, 404, 502, 406, - 407, 408, 0, 409, 410, 0, 411, 0, 413, 414, - 415, 416, 417, 0, 418, 419, 0, 0, 420, 421, - 422, 423, 424, 0, 425, 426, 427, 428, 429, 430, - 431, 432, 0, 0, 433, 434, 435, 436, 437, 0, - 0, 438, 439, 440, 441, 442, 443, 444, 0, 445, - 0, 447, 448, 449, 450, 0, 0, 451, 0, 0, - 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 498, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 93, 94, 95, - 96, 97, 98, 99, 100, 0, 101, 102, 103, 0, - 0, 0, 0, 0, 0, 0, 104, 105, 0, 106, - 107, 108, 0, 110, 111, 112, 113, 114, 0, 116, - 117, 0, 118, 119, 120, 121, 122, 123, 0, 0, - 124, 125, 126, 127, 128, 0, 129, 130, 131, 132, - 133, 0, 0, 0, 135, 136, 137, 138, 139, 140, - 0, 142, 143, 144, 0, 145, 146, 147, 148, 149, - 150, 0, 0, 152, 153, 154, 0, 0, 0, 0, - 0, 0, 0, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 0, 166, 0, 167, 168, 169, 170, - 171, 172, 0, 173, 174, 175, 176, 177, 0, 0, - 178, 179, 180, 181, 182, 0, 183, 184, 185, 0, - 186, 187, 188, 0, 189, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 0, 199, 0, 200, 201, 202, - 203, 0, 204, 0, 205, 0, 0, 0, 208, 209, - 210, 0, 212, 0, 213, 0, 214, 215, 216, 0, - 217, 218, 219, 220, 221, 222, 223, 0, 225, 226, - 227, 228, 0, 229, 230, 231, 232, 233, 234, 0, - 235, 0, 237, 238, 239, 240, 241, 242, 243, 244, - 0, 245, 0, 246, 0, 0, 249, 0, 251, 252, - 253, 254, 255, 0, 0, 256, 0, 258, 0, 0, - 260, 261, 262, 0, 0, 263, 264, 265, 266, 267, - 500, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 0, 289, 290, 291, 292, 293, 0, 294, 295, 0, - 297, 0, 298, 299, 300, 301, 302, 303, 0, 304, - 305, 0, 0, 306, 307, 308, 0, 0, 309, 310, - 0, 312, 0, 314, 315, 316, 317, 318, 319, 320, - 0, 322, 323, 324, 0, 325, 326, 327, 328, 329, - 330, 331, 332, 333, 0, 334, 335, 336, 337, 338, - 339, 0, 340, 0, 342, 343, 344, 345, 346, 347, - 0, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 0, 361, 362, 0, 364, 365, - 366, 367, 0, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 0, 379, 380, 381, 382, 383, 0, - 384, 385, 386, 387, 388, 0, 390, 391, 392, 393, - 0, 394, 395, 396, 397, 398, 399, 400, 401, 402, - 403, 404, 502, 406, 407, 408, 0, 409, 410, 0, - 411, 0, 413, 414, 415, 416, 417, 0, 418, 419, - 0, 0, 420, 421, 422, 423, 424, 0, 425, 426, - 427, 428, 429, 430, 431, 432, 0, 0, 433, 434, - 435, 436, 437, 0, 0, 438, 439, 440, 441, 442, - 443, 444, 0, 445, 0, 447, 448, 449, 450, 0, - 0, 451, 0, 0, 452, 453, 454, 455, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 661, 0, 0, 0, 0, + 0, 0, 0, 94, 95, 96, 97, 98, 99, 100, + 101, 0, 102, 103, 104, 0, 0, 0, 0, 0, + 0, 0, 105, 106, 0, 107, 108, 109, 0, 111, + 112, 113, 114, 115, 0, 117, 118, 0, 119, 120, + 121, 122, 123, 124, 0, 0, 125, 126, 127, 128, + 129, 0, 130, 131, 132, 133, 134, 0, 0, 0, + 136, 137, 138, 139, 140, 141, 0, 143, 144, 145, + 0, 146, 147, 148, 149, 150, 151, 0, 0, 153, + 154, 155, 0, 0, 0, 0, 0, 0, 0, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 0, + 167, 0, 168, 169, 170, 171, 172, 173, 0, 174, + 175, 176, 177, 178, 0, 0, 179, 180, 181, 182, + 183, 0, 184, 185, 186, 0, 187, 188, 189, 0, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 0, 202, 203, 204, 205, 0, 206, + 0, 207, 0, 0, 0, 210, 211, 212, 0, 214, + 0, 215, 0, 216, 217, 218, 0, 219, 220, 221, + 222, 223, 625, 225, 0, 227, 228, 229, 230, 0, + 231, 232, 233, 234, 235, 236, 0, 237, 0, 239, + 240, 241, 242, 243, 244, 245, 246, 0, 247, 0, + 248, 0, 0, 251, 0, 253, 254, 255, 256, 257, + 258, 0, 0, 259, 0, 261, 0, 0, 263, 264, + 265, 0, 0, 266, 267, 268, 269, 270, 500, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 0, 292, + 293, 294, 295, 296, 0, 297, 298, 0, 300, 0, + 301, 302, 303, 304, 305, 306, 0, 307, 308, 0, + 0, 309, 310, 311, 0, 0, 312, 313, 0, 315, + 0, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 0, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 0, 337, 338, 339, 340, 341, 342, 0, + 343, 344, 345, 346, 347, 348, 349, 350, 0, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 0, 364, 365, 0, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 0, 382, 383, 384, 385, 386, 0, 387, 388, + 389, 390, 391, 0, 393, 394, 395, 396, 0, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 502, 409, 410, 411, 0, 412, 413, 0, 414, 0, + 416, 417, 418, 419, 420, 0, 421, 422, 0, 0, + 423, 424, 425, 426, 427, 0, 428, 429, 430, 431, + 432, 433, 434, 435, 0, 0, 436, 437, 438, 439, + 440, 0, 0, 441, 442, 443, 444, 445, 446, 447, + 0, 448, 0, 450, 451, 452, 453, 0, 0, 454, + 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 498, 0, 579, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, + 95, 96, 97, 98, 99, 100, 101, 0, 102, 103, + 104, 0, 0, 0, 0, 0, 0, 0, 105, 106, + 0, 107, 108, 109, 0, 111, 112, 113, 114, 115, + 0, 117, 118, 0, 119, 120, 121, 122, 123, 124, + 0, 0, 125, 126, 127, 128, 129, 0, 130, 131, + 132, 133, 134, 0, 0, 0, 136, 137, 138, 139, + 140, 141, 0, 143, 144, 145, 0, 146, 147, 148, + 149, 150, 151, 0, 0, 153, 154, 155, 0, 0, + 0, 0, 0, 0, 0, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 0, 167, 0, 168, 169, + 170, 171, 172, 173, 0, 174, 175, 176, 177, 178, + 0, 0, 179, 180, 181, 182, 183, 0, 184, 185, + 186, 0, 187, 188, 189, 0, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 0, 201, 0, + 202, 203, 204, 205, 0, 206, 0, 207, 0, 0, + 0, 210, 211, 212, 0, 214, 0, 215, 0, 216, + 217, 218, 0, 219, 220, 221, 222, 223, 224, 225, + 0, 227, 228, 229, 230, 0, 231, 232, 233, 234, + 235, 236, 0, 237, 0, 239, 240, 241, 242, 243, + 244, 245, 246, 0, 247, 0, 248, 0, 0, 251, + 0, 253, 254, 255, 256, 257, 258, 0, 0, 259, + 0, 261, 0, 0, 263, 264, 265, 0, 0, 266, + 267, 268, 269, 270, 500, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 292, 293, 294, 295, 296, + 0, 297, 298, 0, 300, 0, 301, 302, 303, 304, + 305, 306, 0, 307, 308, 0, 0, 309, 310, 311, + 0, 0, 312, 313, 0, 315, 0, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 0, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 0, 337, + 338, 339, 340, 341, 342, 0, 343, 344, 345, 346, + 347, 348, 349, 350, 0, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 0, 364, + 365, 0, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 0, 382, 383, + 384, 385, 386, 0, 387, 388, 389, 390, 391, 0, + 393, 394, 395, 396, 0, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 502, 409, 410, 411, + 0, 412, 413, 0, 414, 0, 416, 417, 418, 419, + 420, 0, 421, 422, 0, 0, 423, 424, 425, 426, + 427, 0, 428, 429, 430, 431, 432, 433, 434, 435, + 0, 0, 436, 437, 438, 439, 440, 0, 0, 441, + 442, 443, 444, 445, 446, 447, 0, 448, 0, 450, + 451, 452, 453, 0, 0, 454, 0, 0, 455, 456, + 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 467, 468, 469, 470, 471, 472, 473, 474, 475, 498, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 93, 94, 95, 96, 97, 98, 99, 100, 0, - 101, 102, 103, 0, 0, 0, 0, 0, 0, 0, - 104, 105, 0, 106, 107, 108, 662, 110, 111, 112, - 0, 663, 664, 665, 666, 0, 118, 119, 120, 121, - 122, 123, 0, 0, 124, 125, 667, 668, 128, 0, - 129, 130, 131, 132, 0, 0, 669, 0, 135, 136, - 137, 138, 139, 140, 670, 142, 143, 144, 0, 145, - 146, 147, 148, 149, 150, 0, 671, 152, 153, 154, - 0, 0, 0, 672, 0, 0, 0, 156, 157, 158, - 159, 160, 161, 162, 673, 674, 165, 0, 166, 0, - 167, 168, 169, 170, 171, 172, 0, 173, 174, 175, - 176, 177, 0, 0, 178, 179, 675, 181, 182, 0, - 183, 184, 185, 0, 186, 187, 188, 0, 189, 190, - 191, 192, 0, 194, 195, 196, 197, 0, 0, 199, - 0, 200, 201, 676, 203, 0, 204, 0, 205, 677, - 0, 678, 208, 209, 210, 679, 212, 0, 213, 0, - 0, 0, 216, 0, 217, 218, 219, 220, 221, 680, - 223, 681, 225, 226, 227, 228, 0, 229, 230, 231, - 232, 233, 234, 0, 235, 682, 0, 238, 239, 240, - 241, 242, 683, 684, 0, 685, 0, 246, 686, 687, - 249, 688, 251, 252, 253, 254, 255, 0, 0, 256, - 689, 258, 690, 0, 260, 261, 262, 0, 0, 263, - 264, 265, 266, 267, 691, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, - 284, 285, 286, 692, 693, 694, 290, 291, 292, 0, - 0, 294, 295, 695, 297, 0, 0, 299, 696, 301, - 302, 303, 0, 304, 305, 0, 0, 306, 307, 308, - 0, 0, 309, 0, 697, 312, 698, 0, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, 0, 325, - 326, 0, 328, 329, 0, 331, 332, 333, 0, 334, - 335, 336, 337, 338, 339, 0, 340, 341, 342, 699, - 344, 345, 346, 347, 0, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 0, 361, - 362, 700, 364, 365, 366, 701, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 0, 379, 380, - 381, 382, 383, 0, 384, 702, 386, 387, 388, 703, - 390, 391, 704, 393, 0, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 705, 406, 0, 408, - 0, 409, 410, 0, 411, 706, 413, 414, 415, 416, - 417, 0, 707, 708, 0, 0, 420, 421, 0, 423, - 0, 0, 425, 426, 709, 428, 429, 430, 431, 432, - 0, 0, 433, 434, 435, 436, 437, 0, 0, 438, - 439, 440, 441, 442, 0, 710, 0, 445, 711, 447, - 448, 449, 450, 0, 0, 451, 0, 0, 452, 453, - 454, 455, 456, 457, 661, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 469, 470, 471, 472, 0, - 93, 94, 95, 96, 97, 98, 99, 100, 0, 101, - 102, 103, 0, 0, 0, 0, 0, 0, 0, 104, - 105, 0, 106, 107, 108, 662, 110, 111, 112, 0, - 663, 664, 665, 666, 0, 118, 119, 120, 121, 122, - 123, 0, 0, 124, 125, 667, 668, 128, 0, 129, - 130, 131, 132, 0, 0, 669, 0, 135, 136, 137, - 138, 139, 140, 670, 142, 143, 144, 0, 145, 146, - 147, 148, 149, 150, 0, 671, 152, 153, 154, 0, - 0, 0, 672, 0, 0, 0, 156, 157, 158, 159, - 160, 161, 162, 673, 674, 165, 0, 166, 0, 167, - 168, 169, 170, 171, 172, 0, 173, 174, 175, 176, - 177, 0, 0, 178, 179, 675, 181, 182, 0, 183, - 184, 185, 0, 186, 187, 188, 0, 189, 190, 191, - 192, 0, 194, 195, 196, 197, 0, 0, 199, 0, - 200, 201, 676, 203, 0, 204, 0, 205, 677, 0, - 678, 208, 209, 210, 679, 212, 0, 213, 0, 0, - 0, 216, 0, 217, 218, 219, 220, 221, 222, 223, - 681, 225, 226, 227, 228, 0, 229, 230, 231, 232, - 233, 234, 0, 235, 682, 0, 238, 239, 240, 241, - 242, 683, 684, 0, 685, 0, 246, 686, 687, 249, - 688, 251, 252, 253, 254, 255, 0, 0, 256, 689, - 258, 690, 0, 260, 261, 262, 0, 0, 263, 264, - 265, 266, 267, 691, 269, 270, 271, 272, 273, 274, + 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 655, 102, 103, 104, 0, 0, 0, + 0, 0, 0, 0, 105, 106, 0, 107, 108, 109, + 0, 111, 112, 113, 114, 115, 0, 117, 118, 0, + 119, 120, 121, 122, 123, 124, 0, 0, 125, 126, + 127, 128, 129, 0, 130, 131, 132, 133, 134, 0, + 0, 0, 136, 137, 138, 139, 140, 141, 0, 143, + 144, 145, 0, 146, 147, 148, 149, 150, 151, 0, + 0, 153, 154, 155, 0, 0, 0, 0, 0, 0, + 0, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 0, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 0, 0, 179, 180, + 181, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 0, 201, 0, 202, 203, 204, 205, + 0, 206, 0, 207, 0, 0, 0, 210, 211, 212, + 0, 214, 0, 215, 0, 216, 217, 218, 0, 219, + 220, 221, 222, 223, 224, 225, 0, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 0, 239, 240, 241, 242, 243, 244, 245, 246, 0, + 247, 0, 248, 0, 0, 251, 0, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 0, 261, 0, 0, + 263, 264, 265, 0, 0, 266, 267, 268, 269, 270, + 500, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 0, 292, 293, 294, 295, 296, 0, 297, 298, 0, + 300, 0, 301, 302, 303, 304, 305, 306, 0, 307, + 308, 0, 0, 309, 310, 311, 0, 0, 312, 313, + 0, 315, 0, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 0, 328, 329, 330, 331, 332, + 333, 334, 335, 336, 0, 337, 338, 339, 340, 341, + 342, 0, 343, 344, 345, 346, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 0, 367, 368, + 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 0, 382, 383, 384, 385, 386, 0, + 387, 388, 389, 390, 391, 0, 393, 394, 395, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 502, 409, 410, 411, 0, 412, 413, 0, + 414, 0, 416, 417, 418, 419, 420, 0, 421, 422, + 0, 0, 423, 424, 425, 426, 427, 0, 428, 429, + 430, 431, 432, 433, 434, 435, 0, 0, 436, 437, + 438, 439, 440, 0, 0, 441, 442, 443, 444, 445, + 446, 447, 0, 448, 0, 450, 451, 452, 453, 0, + 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 498, 0, 579, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 94, 95, 96, 97, 98, 99, 100, 101, 0, + 102, 103, 104, 0, 0, 0, 0, 0, 0, 0, + 105, 106, 0, 107, 108, 109, 0, 111, 112, 113, + 114, 115, 0, 117, 118, 0, 119, 120, 121, 122, + 123, 124, 0, 0, 125, 126, 127, 128, 129, 0, + 130, 131, 132, 133, 134, 0, 0, 0, 136, 137, + 138, 139, 140, 141, 0, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 0, 0, 153, 154, 155, + 0, 0, 0, 0, 0, 0, 0, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 0, 167, 0, + 168, 169, 170, 171, 172, 173, 0, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 181, 182, 183, 0, + 184, 185, 186, 0, 187, 188, 189, 0, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 0, + 201, 0, 202, 203, 204, 205, 0, 206, 0, 207, + 0, 0, 0, 210, 211, 212, 0, 214, 0, 215, + 0, 216, 217, 218, 0, 219, 220, 221, 222, 223, + 1153, 225, 0, 227, 228, 229, 230, 0, 231, 232, + 233, 234, 235, 236, 0, 237, 0, 239, 240, 241, + 242, 243, 244, 245, 246, 0, 247, 0, 248, 0, + 0, 251, 0, 253, 254, 255, 256, 257, 258, 0, + 0, 259, 0, 261, 0, 0, 263, 264, 265, 0, + 0, 266, 267, 268, 269, 270, 500, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 692, 693, 694, 290, 291, 292, 0, 0, - 294, 295, 695, 297, 0, 0, 299, 696, 301, 302, - 303, 0, 304, 305, 0, 0, 306, 307, 308, 0, - 0, 309, 0, 697, 312, 698, 0, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 0, 325, 326, - 0, 328, 329, 0, 331, 332, 333, 0, 334, 335, - 336, 337, 338, 339, 0, 340, 341, 342, 699, 344, - 345, 346, 347, 0, 348, 349, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 0, 361, 362, - 700, 364, 365, 366, 701, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 378, 0, 379, 380, 381, - 382, 383, 0, 384, 702, 386, 387, 388, 703, 390, - 391, 704, 393, 0, 394, 395, 396, 397, 398, 399, - 400, 401, 402, 403, 404, 705, 406, 0, 408, 0, - 409, 410, 0, 411, 706, 413, 414, 415, 416, 417, - 0, 707, 708, 0, 0, 420, 421, 0, 423, 0, - 0, 425, 426, 709, 428, 429, 430, 431, 432, 0, - 0, 433, 434, 435, 436, 437, 0, 0, 438, 439, - 440, 441, 442, 0, 710, 0, 445, 711, 447, 448, - 449, 450, 0, 0, 451, 0, 0, 452, 453, 454, - 455, 456, 457, 2397, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 469, 470, 471, 472, 0, 93, - 94, 95, 96, 97, 98, 99, 100, 0, 101, 102, - 103, 0, 0, 0, 0, 0, 0, 0, 104, 105, - 0, 106, 107, 108, 2398, 110, 111, 112, 0, 663, - 2399, 665, 666, 0, 118, 119, 120, 121, 122, 123, - 0, 0, 124, 125, 667, 668, 128, 0, 129, 130, - 131, 132, 0, 0, 2400, 0, 135, 136, 137, 138, - 139, 140, 2401, 142, 143, 144, 0, 145, 146, 147, - 148, 149, 150, 0, 2402, 152, 153, 154, 0, 0, - 0, 2403, 0, 0, 0, 156, 157, 158, 159, 160, - 161, 162, 673, 674, 165, 0, 166, 0, 167, 168, - 169, 170, 171, 172, 0, 173, 174, 175, 176, 177, - 0, 0, 178, 179, 675, 181, 182, 0, 183, 184, - 185, 0, 186, 187, 188, 0, 189, 190, 191, 192, - 0, 194, 195, 196, 197, 0, 0, 199, 0, 200, - 201, 676, 203, 0, 204, 0, 205, 2404, 0, 2405, - 208, 209, 210, 2406, 212, 0, 213, 0, 0, 0, - 216, 0, 217, 218, 219, 220, 221, 222, 223, 2407, - 225, 226, 227, 228, 0, 229, 230, 231, 232, 233, - 234, 0, 235, 2408, 0, 238, 239, 240, 241, 242, - 683, 684, 0, 685, 0, 246, 2409, 2410, 249, 2411, - 251, 252, 253, 254, 255, 0, 0, 256, 2412, 258, - 2413, 0, 260, 261, 262, 0, 0, 263, 264, 265, - 266, 267, 2607, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 692, 2415, 694, 290, 291, 292, 0, 0, 294, - 295, 2417, 297, 0, 0, 299, 696, 301, 302, 303, - 0, 304, 305, 0, 0, 306, 307, 308, 0, 0, - 309, 0, 2419, 312, 2420, 0, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 0, 325, 326, 0, - 328, 329, 0, 331, 332, 333, 0, 334, 335, 336, - 337, 338, 339, 0, 340, 341, 342, 699, 344, 345, - 346, 347, 0, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 0, 361, 362, 2421, - 364, 365, 366, 0, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 0, 379, 380, 381, 382, - 383, 0, 384, 0, 386, 387, 388, 2423, 390, 391, - 704, 393, 0, 394, 395, 396, 397, 398, 399, 400, - 401, 402, 403, 404, 2608, 406, 0, 408, 0, 409, - 410, 0, 411, 2425, 413, 414, 415, 416, 417, 0, - 707, 708, 0, 0, 420, 421, 0, 423, 0, 0, - 425, 426, 2426, 428, 429, 430, 431, 432, 0, 0, - 433, 434, 435, 436, 437, 0, 0, 438, 439, 440, - 441, 442, 0, 710, 0, 445, 2427, 447, 448, 449, - 450, 0, 0, 451, 0, 0, 452, 453, 454, 455, - 456, 457, 661, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 469, 470, 471, 472, 0, 93, 94, - 95, 96, 97, 98, 99, 100, 0, 101, 102, 103, - 0, 0, 0, 0, 0, 0, 0, 104, 105, 0, - 106, 107, 108, 662, 110, 111, 112, 0, 663, 664, - 665, 666, 0, 118, 119, 120, 121, 122, 123, 0, - 0, 124, 125, 667, 668, 128, 0, 129, 130, 131, - 132, 0, 0, 669, 0, 135, 136, 137, 138, 139, - 140, 670, 142, 143, 144, 0, 145, 146, 147, 148, - 149, 150, 0, 671, 152, 153, 154, 0, 0, 0, - 672, 0, 0, 0, 156, 157, 158, 159, 160, 161, - 162, 673, 674, 165, 0, 166, 0, 167, 168, 169, - 170, 171, 172, 0, 173, 174, 175, 176, 177, 0, - 0, 178, 179, 675, 181, 182, 0, 183, 184, 185, - 0, 186, 187, 188, 0, 189, 190, 191, 192, 0, - 194, 195, 196, 197, 0, 0, 199, 0, 200, 201, - 676, 203, 0, 204, 0, 205, 677, 0, 678, 208, - 209, 210, 679, 212, 0, 213, 0, 0, 0, 216, - 0, 217, 218, 219, 220, 221, 222, 223, 681, 225, - 226, 227, 228, 0, 229, 230, 231, 232, 233, 234, - 0, 235, 682, 0, 238, 239, 240, 241, 242, 683, - 684, 0, 685, 0, 246, 686, 687, 249, 688, 251, - 252, 253, 254, 255, 0, 0, 256, 689, 258, 690, - 0, 260, 261, 262, 0, 0, 263, 264, 265, 266, - 267, 0, 269, 270, 271, 272, 273, 274, 275, 276, + 285, 286, 287, 288, 289, 290, 0, 292, 293, 294, + 295, 296, 0, 297, 298, 0, 300, 0, 301, 302, + 303, 304, 305, 306, 0, 307, 308, 0, 0, 309, + 310, 311, 0, 0, 312, 313, 0, 315, 0, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 0, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 0, 337, 338, 339, 340, 341, 342, 0, 343, 344, + 345, 346, 347, 348, 349, 350, 0, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 0, 364, 365, 0, 367, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 0, + 382, 383, 384, 385, 386, 0, 387, 388, 389, 390, + 391, 0, 393, 394, 395, 396, 0, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 502, 409, + 410, 411, 0, 412, 413, 0, 414, 0, 416, 417, + 418, 419, 420, 0, 421, 422, 0, 0, 423, 424, + 425, 426, 427, 0, 428, 429, 430, 431, 432, 433, + 434, 435, 0, 0, 436, 437, 438, 439, 440, 0, + 0, 441, 442, 443, 444, 445, 446, 447, 0, 448, + 0, 450, 451, 452, 453, 0, 0, 454, 0, 0, + 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 498, 0, 579, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 0, 0, 0, 105, 106, 0, 107, + 108, 109, 0, 111, 112, 113, 114, 115, 0, 117, + 118, 0, 119, 120, 121, 122, 123, 124, 0, 0, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 133, + 134, 0, 0, 0, 136, 137, 138, 139, 140, 141, + 0, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 0, 153, 154, 155, 0, 0, 0, 0, + 0, 0, 0, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 0, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 181, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 0, 201, 0, 202, 203, + 204, 205, 0, 206, 0, 207, 0, 0, 0, 210, + 211, 212, 0, 214, 0, 215, 0, 216, 217, 218, + 0, 219, 220, 221, 222, 223, 1155, 225, 0, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 0, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 0, 248, 0, 0, 251, 0, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 0, 261, + 0, 0, 263, 264, 265, 0, 0, 266, 267, 268, + 269, 270, 500, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 0, 292, 293, 294, 295, 296, 0, 297, + 298, 0, 300, 0, 301, 302, 303, 304, 305, 306, + 0, 307, 308, 0, 0, 309, 310, 311, 0, 0, + 312, 313, 0, 315, 0, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 330, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 346, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 0, + 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 0, 387, 388, 389, 390, 391, 0, 393, 394, + 395, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 502, 409, 410, 411, 0, 412, + 413, 0, 414, 0, 416, 417, 418, 419, 420, 0, + 421, 422, 0, 0, 423, 424, 425, 426, 427, 0, + 428, 429, 430, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 0, 0, 441, 442, 443, + 444, 445, 446, 447, 0, 448, 0, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 498, 0, 579, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 94, 95, 96, 97, 98, 99, 100, + 101, 0, 102, 103, 104, 0, 0, 0, 0, 0, + 0, 0, 105, 106, 0, 107, 108, 109, 0, 111, + 112, 113, 114, 115, 0, 117, 118, 0, 119, 120, + 121, 122, 123, 124, 0, 0, 125, 126, 127, 128, + 129, 0, 130, 131, 132, 133, 134, 0, 0, 0, + 136, 137, 138, 139, 140, 141, 0, 143, 144, 145, + 0, 146, 147, 148, 149, 150, 151, 0, 0, 153, + 154, 155, 0, 0, 0, 0, 0, 0, 0, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 0, + 167, 0, 168, 169, 170, 171, 172, 173, 0, 174, + 175, 176, 177, 178, 0, 0, 179, 180, 181, 182, + 183, 0, 184, 185, 186, 0, 187, 188, 189, 0, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 0, 202, 203, 204, 205, 0, 206, + 0, 207, 0, 0, 0, 210, 211, 212, 0, 214, + 0, 215, 0, 216, 217, 218, 0, 219, 220, 221, + 222, 223, 1565, 225, 0, 227, 228, 229, 230, 0, + 231, 232, 233, 234, 235, 236, 0, 237, 0, 239, + 240, 241, 242, 243, 244, 245, 246, 0, 247, 0, + 248, 0, 0, 251, 0, 253, 254, 255, 256, 257, + 258, 0, 0, 259, 0, 261, 0, 0, 263, 264, + 265, 0, 0, 266, 267, 268, 269, 270, 500, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 0, 292, + 293, 294, 295, 296, 0, 297, 298, 0, 300, 0, + 301, 302, 303, 304, 305, 306, 0, 307, 308, 0, + 0, 309, 310, 311, 0, 0, 312, 313, 0, 315, + 0, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 0, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 0, 337, 338, 339, 340, 341, 342, 0, + 343, 344, 345, 346, 347, 348, 349, 350, 0, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 0, 364, 365, 0, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 0, 382, 383, 384, 385, 386, 0, 387, 388, + 389, 390, 391, 0, 393, 394, 395, 396, 0, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 502, 409, 410, 411, 0, 412, 413, 0, 414, 0, + 416, 417, 418, 419, 420, 0, 421, 422, 0, 0, + 423, 424, 425, 426, 427, 0, 428, 429, 430, 431, + 432, 433, 434, 435, 0, 0, 436, 437, 438, 439, + 440, 0, 0, 441, 442, 443, 444, 445, 446, 447, + 0, 448, 0, 450, 451, 452, 453, 0, 0, 454, + 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 498, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, + 95, 96, 97, 98, 99, 100, 101, 0, 102, 103, + 104, 0, 0, 0, 0, 0, 2330, 0, 105, 106, + 0, 107, 108, 109, 0, 111, 112, 113, 114, 115, + 0, 117, 118, 0, 119, 120, 121, 122, 123, 124, + 0, 0, 125, 126, 127, 128, 129, 0, 130, 131, + 132, 133, 134, 0, 0, 0, 136, 137, 138, 139, + 140, 141, 0, 143, 144, 145, 0, 146, 147, 148, + 149, 150, 151, 0, 0, 153, 154, 155, 0, 0, + 0, 0, 0, 0, 0, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 0, 167, 0, 168, 169, + 170, 171, 172, 173, 0, 174, 175, 176, 177, 178, + 0, 0, 179, 180, 181, 182, 183, 0, 184, 185, + 186, 0, 187, 188, 189, 0, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 0, 201, 0, + 202, 203, 204, 205, 0, 206, 0, 207, 0, 0, + 0, 210, 211, 212, 0, 214, 0, 215, 0, 216, + 217, 218, 0, 219, 220, 221, 222, 223, 224, 225, + 0, 227, 228, 229, 230, 0, 231, 232, 233, 234, + 235, 236, 0, 237, 0, 239, 240, 241, 242, 243, + 244, 245, 246, 0, 247, 0, 248, 0, 0, 251, + 0, 253, 254, 255, 256, 257, 258, 0, 0, 259, + 0, 261, 0, 0, 263, 264, 265, 0, 0, 266, + 267, 268, 269, 270, 500, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 292, 293, 294, 295, 296, + 0, 297, 298, 0, 300, 0, 301, 302, 303, 304, + 305, 306, 0, 307, 308, 0, 0, 309, 310, 311, + 0, 0, 312, 313, 0, 315, 0, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 0, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 0, 337, + 338, 339, 340, 341, 342, 0, 343, 344, 345, 346, + 347, 348, 349, 350, 0, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 0, 364, + 365, 0, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 0, 382, 383, + 384, 385, 386, 0, 387, 388, 389, 390, 391, 0, + 393, 394, 395, 396, 0, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 502, 409, 410, 411, + 0, 412, 413, 0, 414, 0, 416, 417, 418, 419, + 420, 0, 421, 422, 0, 0, 423, 424, 425, 426, + 427, 0, 428, 429, 430, 431, 432, 433, 434, 435, + 0, 0, 436, 437, 438, 439, 440, 0, 0, 441, + 442, 443, 444, 445, 446, 447, 0, 448, 0, 450, + 451, 452, 453, 0, 0, 454, 0, 0, 455, 456, + 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 467, 468, 469, 470, 471, 472, 473, 474, 475, 498, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 0, 102, 103, 104, 0, 0, 0, + 0, 0, 2344, 0, 105, 106, 0, 107, 108, 109, + 0, 111, 112, 113, 114, 115, 0, 117, 118, 0, + 119, 120, 121, 122, 123, 124, 0, 0, 125, 126, + 127, 128, 129, 0, 130, 131, 132, 133, 134, 0, + 0, 0, 136, 137, 138, 139, 140, 141, 0, 143, + 144, 145, 0, 146, 147, 148, 149, 150, 151, 0, + 0, 153, 154, 155, 0, 0, 0, 0, 0, 0, + 0, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 0, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 0, 0, 179, 180, + 181, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 0, 201, 0, 202, 203, 204, 205, + 0, 206, 0, 207, 0, 0, 0, 210, 211, 212, + 0, 214, 0, 215, 0, 216, 217, 218, 0, 219, + 220, 221, 222, 223, 224, 225, 0, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 0, 239, 240, 241, 242, 243, 244, 245, 246, 0, + 247, 0, 248, 0, 0, 251, 0, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 0, 261, 0, 0, + 263, 264, 265, 0, 0, 266, 267, 268, 269, 270, + 500, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 0, 292, 293, 294, 295, 296, 0, 297, 298, 0, + 300, 0, 301, 302, 303, 304, 305, 306, 0, 307, + 308, 0, 0, 309, 310, 311, 0, 0, 312, 313, + 0, 315, 0, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 0, 328, 329, 330, 331, 332, + 333, 334, 335, 336, 0, 337, 338, 339, 340, 341, + 342, 0, 343, 344, 345, 346, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 0, 367, 368, + 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 0, 382, 383, 384, 385, 386, 0, + 387, 388, 389, 390, 391, 0, 393, 394, 395, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 502, 409, 410, 411, 0, 412, 413, 0, + 414, 0, 416, 417, 418, 419, 420, 0, 421, 422, + 0, 0, 423, 424, 425, 426, 427, 0, 428, 429, + 430, 431, 432, 433, 434, 435, 0, 0, 436, 437, + 438, 439, 440, 0, 0, 441, 442, 443, 444, 445, + 446, 447, 0, 448, 0, 450, 451, 452, 453, 0, + 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 498, 0, 579, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 94, 95, 96, 97, 98, 99, 100, 101, 0, + 102, 103, 104, 0, 0, 0, 0, 0, 0, 0, + 105, 106, 0, 107, 108, 109, 0, 111, 112, 113, + 114, 115, 0, 117, 118, 0, 119, 120, 121, 122, + 123, 124, 0, 0, 125, 126, 127, 128, 129, 0, + 130, 131, 132, 133, 134, 0, 0, 0, 136, 137, + 138, 139, 140, 141, 0, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 0, 0, 153, 154, 155, + 0, 0, 0, 0, 0, 0, 0, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 0, 167, 0, + 168, 169, 170, 171, 172, 173, 0, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 181, 182, 183, 0, + 184, 185, 186, 0, 187, 188, 189, 0, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 0, + 201, 0, 202, 203, 204, 205, 0, 206, 0, 207, + 0, 0, 0, 210, 211, 212, 0, 214, 0, 215, + 0, 216, 217, 218, 0, 219, 220, 221, 222, 223, + 2481, 225, 0, 227, 228, 229, 230, 0, 231, 232, + 233, 234, 235, 236, 0, 237, 0, 239, 240, 241, + 242, 243, 244, 245, 246, 0, 247, 0, 248, 0, + 0, 251, 0, 253, 254, 255, 256, 257, 258, 0, + 0, 259, 0, 261, 0, 0, 263, 264, 265, 0, + 0, 266, 267, 268, 269, 270, 500, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 0, 292, 293, 294, + 295, 296, 0, 297, 298, 0, 300, 0, 301, 302, + 303, 304, 305, 306, 0, 307, 308, 0, 0, 309, + 310, 311, 0, 0, 312, 313, 0, 315, 0, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 0, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 0, 337, 338, 339, 340, 341, 342, 0, 343, 344, + 345, 346, 347, 348, 349, 350, 0, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 0, 364, 365, 0, 367, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 0, + 382, 383, 384, 385, 386, 0, 387, 388, 389, 390, + 391, 0, 393, 394, 395, 396, 0, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 502, 409, + 410, 411, 0, 412, 413, 0, 414, 0, 416, 417, + 418, 419, 420, 0, 421, 422, 0, 0, 423, 424, + 425, 426, 427, 0, 428, 429, 430, 431, 432, 433, + 434, 435, 0, 0, 436, 437, 438, 439, 440, 0, + 0, 441, 442, 443, 444, 445, 446, 447, 0, 448, + 0, 450, 451, 452, 453, 0, 0, 454, 0, 0, + 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 498, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 0, 0, 0, 105, 106, 0, 107, + 108, 109, 0, 111, 112, 113, 114, 115, 0, 117, + 118, 0, 119, 120, 121, 122, 123, 124, 0, 0, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 133, + 134, 0, 0, 0, 136, 137, 138, 139, 140, 141, + 0, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 0, 153, 154, 155, 0, 0, 0, 0, + 0, 0, 0, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 0, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 181, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 0, 201, 0, 202, 203, + 204, 205, 0, 206, 0, 207, 0, 0, 0, 210, + 211, 212, 0, 214, 0, 215, 0, 216, 217, 218, + 0, 219, 220, 221, 222, 223, 224, 225, 0, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 0, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 0, 248, 0, 0, 251, 0, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 0, 261, + 0, 0, 263, 264, 265, 0, 0, 266, 267, 268, + 269, 270, 500, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 0, 292, 293, 294, 295, 296, 0, 297, + 298, 0, 300, 0, 301, 302, 303, 304, 305, 306, + 0, 307, 308, 0, 0, 309, 310, 311, 0, 0, + 312, 313, 0, 315, 0, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 330, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 346, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 0, + 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 0, 387, 388, 389, 390, 391, 0, 393, 394, + 395, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 502, 409, 410, 411, 0, 412, + 413, 0, 414, 0, 416, 417, 418, 419, 420, 0, + 421, 422, 0, 0, 423, 424, 425, 426, 427, 0, + 428, 429, 430, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 0, 0, 441, 442, 443, + 444, 445, 446, 447, 0, 448, 0, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 498, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 94, 95, 96, 97, 98, 99, 100, + 101, 0, 102, 103, 104, 0, 0, 0, 0, 0, + 0, 0, 105, 106, 0, 107, 108, 109, 0, 111, + 112, 113, 114, 115, 0, 117, 118, 0, 119, 120, + 121, 122, 123, 124, 0, 0, 125, 126, 127, 128, + 129, 0, 130, 131, 132, 133, 134, 0, 0, 0, + 136, 137, 138, 139, 140, 141, 0, 143, 144, 145, + 0, 146, 147, 148, 149, 150, 151, 0, 0, 153, + 154, 155, 0, 0, 0, 0, 0, 0, 0, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 0, + 167, 0, 168, 169, 170, 171, 172, 173, 0, 174, + 175, 176, 177, 178, 0, 0, 179, 180, 181, 182, + 183, 0, 184, 185, 186, 0, 187, 188, 189, 0, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 0, 202, 203, 204, 205, 0, 206, + 0, 207, 0, 0, 0, 210, 211, 212, 0, 566, + 0, 215, 0, 216, 217, 218, 0, 219, 220, 221, + 222, 223, 224, 225, 0, 227, 228, 229, 230, 0, + 231, 232, 233, 234, 235, 236, 0, 237, 0, 239, + 240, 241, 242, 243, 244, 245, 246, 0, 247, 0, + 248, 0, 0, 251, 0, 253, 254, 255, 256, 257, + 258, 0, 0, 259, 0, 261, 0, 0, 263, 264, + 567, 0, 0, 266, 267, 268, 269, 270, 500, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 0, 292, + 293, 294, 295, 296, 0, 297, 298, 0, 300, 0, + 301, 302, 303, 304, 305, 306, 0, 307, 308, 0, + 0, 309, 310, 311, 0, 0, 312, 313, 0, 315, + 0, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 0, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 0, 337, 338, 339, 340, 341, 342, 0, + 343, 344, 345, 346, 347, 348, 349, 350, 0, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 0, 364, 365, 0, 367, 368, 369, 370, + 371, 372, 373, 374, 568, 376, 377, 378, 379, 380, + 381, 0, 382, 383, 384, 385, 569, 0, 387, 388, + 389, 390, 391, 0, 393, 394, 395, 396, 0, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 502, 409, 410, 411, 0, 412, 413, 0, 414, 0, + 416, 417, 418, 419, 420, 0, 570, 422, 0, 0, + 423, 424, 425, 426, 427, 0, 428, 429, 430, 431, + 432, 433, 434, 435, 0, 0, 436, 437, 438, 439, + 440, 0, 0, 441, 442, 443, 444, 445, 446, 447, + 0, 448, 0, 450, 451, 452, 453, 0, 0, 454, + 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 498, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, + 95, 96, 97, 98, 99, 100, 101, 0, 102, 103, + 104, 0, 0, 0, 0, 0, 0, 0, 105, 106, + 0, 107, 108, 109, 0, 111, 112, 113, 114, 115, + 0, 117, 118, 0, 119, 120, 121, 122, 123, 124, + 0, 0, 125, 126, 127, 128, 129, 0, 130, 131, + 132, 133, 134, 0, 0, 0, 136, 137, 138, 139, + 140, 141, 0, 143, 144, 145, 0, 146, 147, 148, + 149, 150, 151, 0, 0, 153, 154, 155, 0, 0, + 0, 0, 0, 0, 0, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 0, 167, 0, 168, 169, + 170, 171, 172, 173, 0, 174, 175, 176, 177, 178, + 0, 0, 179, 180, 181, 182, 183, 0, 184, 185, + 186, 0, 187, 188, 189, 0, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 0, 201, 0, + 202, 203, 204, 205, 0, 206, 0, 207, 0, 0, + 0, 210, 211, 212, 0, 214, 0, 215, 0, 216, + 217, 218, 0, 219, 220, 221, 222, 223, 224, 225, + 0, 227, 228, 229, 230, 0, 231, 232, 233, 234, + 235, 236, 0, 237, 0, 239, 240, 241, 242, 243, + 244, 245, 246, 0, 247, 0, 248, 0, 0, 251, + 0, 253, 254, 255, 256, 257, 258, 0, 0, 259, + 0, 261, 0, 0, 263, 264, 265, 0, 0, 266, + 267, 268, 269, 270, 500, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 292, 293, 294, 295, 296, + 0, 297, 298, 0, 300, 0, 301, 302, 303, 304, + 305, 306, 0, 307, 308, 0, 0, 309, 310, 311, + 0, 0, 312, 313, 0, 315, 0, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 0, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 0, 337, + 338, 339, 340, 341, 342, 0, 343, 344, 345, 346, + 347, 348, 589, 350, 0, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 0, 364, + 365, 0, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 0, 382, 383, + 384, 385, 386, 0, 387, 388, 389, 390, 391, 0, + 393, 394, 395, 396, 0, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 502, 409, 410, 411, + 0, 412, 413, 0, 414, 0, 416, 417, 418, 419, + 420, 0, 421, 422, 0, 0, 423, 424, 425, 426, + 427, 0, 428, 429, 430, 431, 432, 433, 434, 435, + 0, 0, 436, 437, 438, 439, 440, 0, 0, 441, + 442, 443, 444, 445, 446, 447, 0, 448, 0, 450, + 451, 452, 453, 0, 0, 454, 0, 0, 455, 456, + 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 467, 468, 469, 470, 471, 472, 473, 474, 475, 498, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 0, 102, 103, 104, 0, 0, 0, + 0, 0, 0, 0, 105, 106, 0, 107, 108, 109, + 0, 111, 112, 113, 114, 115, 0, 117, 118, 0, + 119, 120, 121, 122, 123, 124, 0, 0, 125, 126, + 127, 128, 129, 0, 130, 131, 132, 133, 134, 0, + 0, 0, 136, 137, 138, 139, 140, 141, 0, 143, + 144, 145, 0, 146, 147, 148, 149, 150, 151, 0, + 0, 153, 154, 155, 0, 0, 0, 0, 0, 0, + 0, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 0, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 0, 0, 179, 180, + 181, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 0, 201, 0, 202, 203, 204, 205, + 0, 206, 0, 207, 0, 0, 0, 210, 211, 212, + 0, 214, 0, 215, 0, 216, 217, 218, 0, 219, + 220, 221, 222, 223, 643, 225, 0, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 0, 239, 240, 241, 242, 243, 244, 245, 246, 0, + 247, 0, 248, 0, 0, 251, 0, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 0, 261, 0, 0, + 263, 264, 265, 0, 0, 266, 267, 268, 269, 270, + 500, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 0, 292, 293, 294, 295, 296, 0, 297, 298, 0, + 300, 0, 301, 302, 303, 304, 305, 306, 0, 307, + 308, 0, 0, 309, 310, 311, 0, 0, 312, 313, + 0, 315, 0, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 0, 328, 329, 330, 331, 332, + 333, 334, 335, 336, 0, 337, 338, 339, 340, 341, + 342, 0, 343, 344, 345, 346, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 0, 367, 368, + 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 0, 382, 383, 384, 385, 386, 0, + 387, 388, 389, 390, 391, 0, 393, 394, 395, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 502, 409, 410, 411, 0, 412, 413, 0, + 414, 0, 416, 417, 418, 419, 420, 0, 421, 422, + 0, 0, 423, 424, 425, 426, 427, 0, 428, 429, + 430, 431, 432, 433, 434, 435, 0, 0, 436, 437, + 438, 439, 440, 0, 0, 441, 442, 443, 444, 445, + 446, 447, 0, 448, 0, 450, 451, 452, 453, 0, + 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 498, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 94, 95, 96, 97, 98, 99, 100, 101, 0, + 102, 103, 104, 0, 0, 0, 0, 0, 0, 0, + 105, 106, 0, 107, 108, 109, 0, 111, 112, 113, + 114, 115, 0, 117, 118, 0, 119, 120, 121, 122, + 123, 124, 0, 0, 125, 126, 127, 128, 129, 0, + 130, 131, 132, 133, 134, 0, 0, 0, 136, 137, + 138, 139, 140, 141, 0, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 0, 0, 153, 154, 155, + 0, 0, 0, 0, 0, 0, 0, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 0, 167, 0, + 168, 169, 170, 171, 172, 173, 0, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 181, 182, 183, 0, + 184, 185, 186, 0, 187, 188, 189, 0, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 0, + 201, 0, 202, 203, 204, 205, 0, 206, 0, 207, + 0, 0, 0, 210, 211, 212, 0, 214, 0, 215, + 0, 216, 217, 218, 0, 219, 220, 221, 222, 223, + 733, 225, 0, 227, 228, 229, 230, 0, 231, 232, + 233, 234, 235, 236, 0, 237, 0, 239, 240, 241, + 242, 243, 244, 245, 246, 0, 247, 0, 248, 0, + 0, 251, 0, 253, 254, 255, 256, 257, 258, 0, + 0, 259, 0, 261, 0, 0, 263, 264, 265, 0, + 0, 266, 267, 268, 269, 270, 500, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 0, 292, 293, 294, + 295, 296, 0, 297, 298, 0, 300, 0, 301, 302, + 303, 304, 305, 306, 0, 307, 308, 0, 0, 309, + 310, 311, 0, 0, 312, 313, 0, 315, 0, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 0, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 0, 337, 338, 339, 340, 341, 342, 0, 343, 344, + 345, 346, 347, 348, 349, 350, 0, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 0, 364, 365, 0, 367, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 0, + 382, 383, 384, 385, 386, 0, 387, 388, 389, 390, + 391, 0, 393, 394, 395, 396, 0, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 502, 409, + 410, 411, 0, 412, 413, 0, 414, 0, 416, 417, + 418, 419, 420, 0, 421, 422, 0, 0, 423, 424, + 425, 426, 427, 0, 428, 429, 430, 431, 432, 433, + 434, 435, 0, 0, 436, 437, 438, 439, 440, 0, + 0, 441, 442, 443, 444, 445, 446, 447, 0, 448, + 0, 450, 451, 452, 453, 0, 0, 454, 0, 0, + 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 498, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 0, 0, 0, 105, 106, 0, 107, + 108, 109, 0, 111, 112, 113, 114, 115, 0, 117, + 118, 0, 119, 120, 121, 122, 123, 124, 0, 0, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 133, + 134, 0, 0, 0, 136, 137, 138, 139, 140, 141, + 0, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 0, 153, 154, 155, 0, 0, 0, 0, + 0, 0, 0, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 0, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 181, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 0, 201, 0, 202, 203, + 204, 205, 0, 206, 0, 207, 0, 0, 0, 210, + 211, 212, 0, 214, 0, 215, 0, 216, 217, 218, + 0, 219, 220, 221, 222, 223, 736, 225, 0, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 0, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 0, 248, 0, 0, 251, 0, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 0, 261, + 0, 0, 263, 264, 265, 0, 0, 266, 267, 268, + 269, 270, 500, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 0, 292, 293, 294, 295, 296, 0, 297, + 298, 0, 300, 0, 301, 302, 303, 304, 305, 306, + 0, 307, 308, 0, 0, 309, 310, 311, 0, 0, + 312, 313, 0, 315, 0, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 330, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 346, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 0, + 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 0, 387, 388, 389, 390, 391, 0, 393, 394, + 395, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 502, 409, 410, 411, 0, 412, + 413, 0, 414, 0, 416, 417, 418, 419, 420, 0, + 421, 422, 0, 0, 423, 424, 425, 426, 427, 0, + 428, 429, 430, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 0, 0, 441, 442, 443, + 444, 445, 446, 447, 0, 448, 0, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 498, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 94, 95, 96, 97, 98, 99, 100, + 101, 0, 102, 103, 104, 0, 0, 0, 0, 0, + 0, 0, 105, 106, 0, 107, 108, 109, 0, 111, + 112, 113, 114, 115, 0, 117, 118, 0, 119, 120, + 121, 122, 123, 124, 0, 0, 125, 126, 127, 128, + 129, 0, 130, 131, 132, 133, 134, 0, 0, 0, + 136, 137, 138, 139, 140, 141, 0, 143, 144, 145, + 0, 146, 147, 148, 149, 150, 151, 0, 0, 153, + 154, 155, 0, 0, 0, 0, 0, 0, 0, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 0, + 167, 0, 168, 169, 170, 171, 172, 173, 0, 174, + 175, 176, 177, 178, 0, 0, 179, 180, 181, 182, + 183, 0, 184, 185, 186, 0, 187, 188, 189, 0, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 0, 202, 203, 204, 205, 0, 206, + 0, 207, 0, 0, 0, 210, 211, 212, 0, 214, + 0, 215, 0, 216, 217, 218, 0, 219, 220, 221, + 222, 223, 739, 225, 0, 227, 228, 229, 230, 0, + 231, 232, 233, 234, 235, 236, 0, 237, 0, 239, + 240, 241, 242, 243, 244, 245, 246, 0, 247, 0, + 248, 0, 0, 251, 0, 253, 254, 255, 256, 257, + 258, 0, 0, 259, 0, 261, 0, 0, 263, 264, + 265, 0, 0, 266, 267, 268, 269, 270, 500, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 0, 292, + 293, 294, 295, 296, 0, 297, 298, 0, 300, 0, + 301, 302, 303, 304, 305, 306, 0, 307, 308, 0, + 0, 309, 310, 311, 0, 0, 312, 313, 0, 315, + 0, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 0, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 0, 337, 338, 339, 340, 341, 342, 0, + 343, 344, 345, 346, 347, 348, 349, 350, 0, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 0, 364, 365, 0, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 0, 382, 383, 384, 385, 386, 0, 387, 388, + 389, 390, 391, 0, 393, 394, 395, 396, 0, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 502, 409, 410, 411, 0, 412, 413, 0, 414, 0, + 416, 417, 418, 419, 420, 0, 421, 422, 0, 0, + 423, 424, 425, 426, 427, 0, 428, 429, 430, 431, + 432, 433, 434, 435, 0, 0, 436, 437, 438, 439, + 440, 0, 0, 441, 442, 443, 444, 445, 446, 447, + 0, 448, 0, 450, 451, 452, 453, 0, 0, 454, + 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 498, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, + 95, 96, 97, 98, 99, 100, 101, 0, 102, 103, + 104, 0, 0, 0, 0, 0, 0, 0, 105, 106, + 0, 107, 108, 109, 0, 111, 112, 113, 114, 115, + 0, 117, 118, 0, 119, 120, 121, 122, 123, 124, + 0, 0, 125, 126, 127, 128, 129, 0, 130, 131, + 132, 133, 134, 0, 0, 0, 136, 137, 138, 139, + 140, 141, 0, 143, 144, 145, 0, 146, 147, 148, + 149, 150, 151, 0, 0, 153, 154, 155, 0, 0, + 0, 0, 0, 0, 0, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 0, 167, 0, 168, 169, + 170, 171, 172, 173, 0, 174, 175, 176, 177, 178, + 0, 0, 179, 180, 181, 182, 183, 0, 184, 185, + 186, 0, 187, 188, 189, 0, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 0, 201, 0, + 202, 203, 204, 205, 0, 206, 0, 207, 0, 0, + 0, 210, 211, 212, 0, 214, 0, 215, 0, 216, + 217, 218, 0, 219, 220, 221, 222, 223, 224, 225, + 0, 227, 228, 229, 230, 0, 231, 232, 233, 234, + 235, 236, 0, 237, 0, 239, 240, 241, 242, 243, + 244, 245, 246, 0, 247, 0, 248, 0, 0, 251, + 0, 253, 254, 255, 256, 257, 258, 0, 0, 259, + 0, 261, 0, 0, 263, 264, 265, 0, 0, 266, + 267, 268, 269, 270, 500, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, + 287, 288, 289, 290, 0, 292, 293, 294, 295, 296, + 0, 297, 298, 0, 300, 0, 301, 302, 303, 304, + 305, 306, 0, 307, 308, 0, 0, 309, 310, 311, + 0, 0, 312, 313, 0, 315, 0, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 0, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 0, 337, + 338, 339, 340, 341, 342, 0, 343, 344, 345, 346, + 347, 348, 349, 350, 0, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 0, 364, + 365, 0, 367, 368, 369, 370, 371, 372, 373, 374, + 568, 376, 377, 378, 379, 380, 381, 0, 382, 383, + 384, 385, 386, 0, 387, 388, 389, 390, 391, 0, + 393, 394, 395, 396, 0, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 502, 409, 410, 411, + 0, 412, 413, 0, 414, 0, 416, 417, 418, 419, + 420, 0, 570, 422, 0, 0, 423, 424, 425, 426, + 427, 0, 428, 429, 430, 431, 432, 433, 434, 435, + 0, 0, 436, 437, 438, 439, 440, 0, 0, 441, + 442, 443, 444, 445, 446, 447, 0, 448, 0, 450, + 451, 452, 453, 0, 0, 454, 0, 0, 455, 456, + 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 467, 468, 469, 470, 471, 472, 473, 474, 475, 498, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 0, 102, 103, 104, 0, 0, 0, + 0, 0, 1431, 0, 105, 106, 0, 107, 108, 109, + 0, 111, 112, 113, 114, 115, 0, 117, 118, 0, + 119, 120, 121, 122, 123, 124, 0, 0, 125, 126, + 127, 128, 129, 0, 130, 131, 132, 133, 134, 0, + 0, 0, 136, 137, 138, 139, 140, 141, 0, 143, + 144, 145, 0, 146, 147, 148, 149, 150, 151, 0, + 0, 153, 154, 155, 0, 0, 0, 0, 0, 0, + 0, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 0, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 0, 0, 179, 180, + 181, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 0, 201, 0, 202, 203, 204, 205, + 0, 206, 0, 207, 0, 0, 0, 210, 211, 212, + 0, 214, 0, 215, 0, 216, 217, 218, 0, 219, + 220, 221, 222, 223, 224, 225, 0, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 0, 239, 240, 241, 242, 243, 244, 245, 246, 0, + 247, 0, 248, 0, 0, 251, 0, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 0, 261, 0, 0, + 263, 264, 265, 0, 0, 266, 267, 268, 269, 270, + 500, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 0, 292, 293, 294, 295, 296, 0, 297, 298, 0, + 300, 0, 301, 302, 303, 304, 305, 306, 0, 307, + 308, 0, 0, 309, 310, 311, 0, 0, 312, 313, + 0, 315, 0, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 0, 328, 329, 330, 331, 332, + 333, 334, 335, 336, 0, 337, 338, 339, 340, 341, + 342, 0, 343, 344, 345, 346, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 0, 367, 368, + 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 0, 382, 383, 384, 385, 386, 0, + 0, 388, 389, 390, 391, 0, 393, 394, 395, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 502, 409, 410, 411, 0, 412, 413, 0, + 414, 0, 416, 417, 418, 419, 420, 0, 421, 422, + 0, 0, 423, 424, 425, 426, 427, 0, 428, 429, + 430, 431, 432, 433, 434, 435, 0, 0, 436, 437, + 438, 439, 440, 0, 0, 441, 442, 443, 444, 445, + 446, 447, 0, 448, 0, 450, 451, 452, 453, 0, + 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 498, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 94, 95, 96, 97, 98, 99, 100, 101, 0, + 102, 103, 104, 0, 0, 0, 0, 0, 0, 0, + 105, 106, 0, 107, 108, 109, 0, 111, 112, 113, + 114, 115, 0, 117, 118, 0, 119, 120, 121, 122, + 123, 124, 0, 0, 125, 126, 127, 128, 129, 0, + 130, 131, 132, 133, 134, 0, 0, 0, 136, 137, + 138, 139, 140, 141, 0, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 0, 0, 153, 154, 155, + 0, 0, 0, 0, 0, 0, 0, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 0, 167, 0, + 168, 169, 170, 171, 172, 173, 0, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 181, 182, 183, 0, + 184, 185, 186, 0, 187, 188, 189, 0, 190, 191, + 192, 193, 194, 195, 196, 197, 198, 199, 200, 0, + 201, 0, 202, 203, 204, 205, 0, 206, 0, 207, + 0, 0, 0, 210, 211, 212, 0, 214, 0, 215, + 0, 216, 217, 218, 0, 219, 220, 221, 222, 223, + 1529, 225, 0, 227, 228, 229, 230, 0, 231, 232, + 233, 234, 235, 236, 0, 237, 0, 239, 240, 241, + 242, 243, 244, 245, 246, 0, 247, 0, 248, 0, + 0, 251, 0, 253, 254, 255, 256, 257, 258, 0, + 0, 259, 0, 261, 0, 0, 263, 264, 265, 0, + 0, 266, 267, 268, 269, 270, 500, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 0, 292, 293, 294, + 295, 296, 0, 297, 298, 0, 300, 0, 301, 302, + 303, 304, 305, 306, 0, 307, 308, 0, 0, 309, + 310, 311, 0, 0, 312, 313, 0, 315, 0, 317, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 0, 328, 329, 330, 331, 332, 333, 334, 335, 336, + 0, 337, 338, 339, 340, 341, 342, 0, 343, 344, + 345, 346, 347, 348, 349, 350, 0, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 0, 364, 365, 0, 367, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 0, + 382, 383, 384, 385, 386, 0, 387, 388, 389, 390, + 391, 0, 393, 394, 395, 396, 0, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 502, 409, + 410, 411, 0, 412, 413, 0, 414, 0, 416, 417, + 418, 419, 420, 0, 421, 422, 0, 0, 423, 424, + 425, 426, 427, 0, 428, 429, 430, 431, 432, 433, + 434, 435, 0, 0, 436, 437, 438, 439, 440, 0, + 0, 441, 442, 443, 444, 445, 446, 447, 0, 448, + 0, 450, 451, 452, 453, 0, 0, 454, 0, 0, + 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 498, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, + 97, 98, 99, 100, 101, 0, 102, 103, 104, 0, + 0, 0, 0, 0, 0, 0, 105, 106, 0, 107, + 108, 109, 0, 111, 112, 113, 114, 115, 0, 117, + 118, 0, 119, 120, 121, 122, 123, 124, 0, 0, + 125, 126, 127, 128, 129, 0, 130, 131, 132, 133, + 134, 0, 0, 0, 136, 137, 138, 139, 140, 141, + 0, 143, 144, 145, 0, 146, 147, 148, 149, 150, + 151, 0, 0, 153, 154, 155, 0, 0, 0, 0, + 0, 0, 0, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 0, 167, 0, 168, 169, 170, 171, + 172, 173, 0, 174, 175, 176, 177, 178, 0, 0, + 179, 180, 181, 182, 183, 0, 184, 185, 186, 0, + 187, 188, 189, 0, 190, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 0, 201, 0, 202, 203, + 204, 205, 0, 206, 0, 207, 0, 0, 0, 210, + 211, 212, 0, 214, 0, 215, 0, 216, 217, 218, + 0, 219, 220, 221, 222, 223, 1809, 225, 0, 227, + 228, 229, 230, 0, 231, 232, 233, 234, 235, 236, + 0, 237, 0, 239, 240, 241, 242, 243, 244, 245, + 246, 0, 247, 0, 248, 0, 0, 251, 0, 253, + 254, 255, 256, 257, 258, 0, 0, 259, 0, 261, + 0, 0, 263, 264, 265, 0, 0, 266, 267, 268, + 269, 270, 500, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, + 289, 290, 0, 292, 293, 294, 295, 296, 0, 297, + 298, 0, 300, 0, 301, 302, 303, 304, 305, 306, + 0, 307, 308, 0, 0, 309, 310, 311, 0, 0, + 312, 313, 0, 315, 0, 317, 318, 319, 320, 321, + 322, 323, 324, 325, 326, 327, 0, 328, 329, 330, + 331, 332, 333, 334, 335, 336, 0, 337, 338, 339, + 340, 341, 342, 0, 343, 344, 345, 346, 347, 348, + 349, 350, 0, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 0, 364, 365, 0, + 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 0, 382, 383, 384, 385, + 386, 0, 387, 388, 389, 390, 391, 0, 393, 394, + 395, 396, 0, 397, 398, 399, 400, 401, 402, 403, + 404, 405, 406, 407, 502, 409, 410, 411, 0, 412, + 413, 0, 414, 0, 416, 417, 418, 419, 420, 0, + 421, 422, 0, 0, 423, 424, 425, 426, 427, 0, + 428, 429, 430, 431, 432, 433, 434, 435, 0, 0, + 436, 437, 438, 439, 440, 0, 0, 441, 442, 443, + 444, 445, 446, 447, 0, 448, 0, 450, 451, 452, + 453, 0, 0, 454, 0, 0, 455, 456, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 498, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 94, 95, 96, 97, 98, 99, 100, + 101, 0, 102, 103, 104, 0, 0, 0, 0, 0, + 0, 0, 105, 106, 0, 107, 108, 109, 0, 111, + 112, 113, 114, 115, 0, 117, 118, 0, 119, 120, + 121, 122, 123, 124, 0, 0, 125, 126, 127, 128, + 129, 0, 130, 131, 132, 133, 134, 0, 0, 0, + 136, 137, 138, 139, 140, 141, 0, 143, 144, 145, + 0, 146, 147, 148, 149, 150, 151, 0, 0, 153, + 154, 155, 0, 0, 0, 0, 0, 0, 0, 157, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 0, + 167, 0, 168, 169, 170, 171, 172, 173, 0, 174, + 175, 176, 177, 178, 0, 0, 179, 180, 181, 182, + 183, 0, 184, 185, 186, 0, 187, 188, 189, 0, + 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 0, 201, 0, 202, 203, 204, 205, 0, 206, + 0, 207, 0, 0, 0, 210, 211, 212, 0, 214, + 0, 215, 0, 216, 217, 218, 0, 219, 220, 221, + 222, 223, 1821, 225, 0, 227, 228, 229, 230, 0, + 231, 232, 233, 234, 235, 236, 0, 237, 0, 239, + 240, 241, 242, 243, 244, 245, 246, 0, 247, 0, + 248, 0, 0, 251, 0, 253, 254, 255, 256, 257, + 258, 0, 0, 259, 0, 261, 0, 0, 263, 264, + 265, 0, 0, 266, 267, 268, 269, 270, 500, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 290, 0, 292, + 293, 294, 295, 296, 0, 297, 298, 0, 300, 0, + 301, 302, 303, 304, 305, 306, 0, 307, 308, 0, + 0, 309, 310, 311, 0, 0, 312, 313, 0, 315, + 0, 317, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 0, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 0, 337, 338, 339, 340, 341, 342, 0, + 343, 344, 345, 346, 347, 348, 349, 350, 0, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 0, 364, 365, 0, 367, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 0, 382, 383, 384, 385, 386, 0, 387, 388, + 389, 390, 391, 0, 393, 394, 395, 396, 0, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 502, 409, 410, 411, 0, 412, 413, 0, 414, 0, + 416, 417, 418, 419, 420, 0, 421, 422, 0, 0, + 423, 424, 425, 426, 427, 0, 428, 429, 430, 431, + 432, 433, 434, 435, 0, 0, 436, 437, 438, 439, + 440, 0, 0, 441, 442, 443, 444, 445, 446, 447, + 0, 448, 0, 450, 451, 452, 453, 0, 0, 454, + 0, 0, 455, 456, 457, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 498, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 94, + 95, 96, 97, 98, 99, 100, 101, 0, 102, 103, + 104, 0, 0, 0, 0, 0, 0, 0, 105, 106, + 0, 107, 108, 109, 0, 111, 112, 113, 114, 115, + 0, 117, 118, 0, 119, 120, 121, 122, 123, 124, + 0, 0, 125, 126, 127, 128, 129, 0, 130, 131, + 132, 133, 134, 0, 0, 0, 136, 137, 138, 139, + 140, 141, 0, 143, 144, 145, 0, 146, 147, 148, + 149, 150, 151, 0, 0, 153, 154, 155, 0, 0, + 0, 0, 0, 0, 0, 157, 158, 159, 160, 161, + 162, 163, 164, 165, 166, 0, 167, 0, 168, 169, + 170, 171, 172, 173, 0, 174, 175, 176, 177, 178, + 0, 0, 179, 180, 181, 182, 183, 0, 184, 185, + 186, 0, 187, 188, 189, 0, 190, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 0, 201, 0, + 202, 203, 204, 205, 0, 206, 0, 207, 0, 0, + 0, 210, 211, 212, 0, 214, 0, 215, 0, 216, + 217, 218, 0, 219, 220, 221, 222, 223, 1823, 225, + 0, 227, 228, 229, 230, 0, 231, 232, 233, 234, + 235, 236, 0, 237, 0, 239, 240, 241, 242, 243, + 244, 245, 246, 0, 247, 0, 248, 0, 0, 251, + 0, 253, 254, 255, 256, 257, 258, 0, 0, 259, + 0, 261, 0, 0, 263, 264, 265, 0, 0, 266, + 267, 268, 269, 270, 500, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, - 692, 693, 694, 290, 291, 292, 0, 0, 294, 295, - 695, 297, 0, 0, 299, 696, 301, 302, 303, 0, - 304, 305, 0, 0, 306, 307, 308, 0, 0, 309, - 0, 697, 312, 698, 0, 315, 316, 317, 318, 319, - 320, 321, 322, 323, 324, 0, 325, 326, 0, 328, - 329, 0, 331, 332, 333, 0, 334, 335, 336, 337, - 338, 339, 0, 340, 341, 342, 699, 344, 345, 346, - 347, 0, 348, 349, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 0, 361, 362, 700, 364, - 365, 366, 0, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 0, 379, 380, 381, 382, 383, - 0, 384, 0, 386, 387, 388, 703, 390, 391, 704, - 393, 0, 394, 395, 396, 397, 398, 399, 400, 401, - 402, 403, 404, 0, 406, 0, 408, 0, 409, 410, - 0, 411, 706, 413, 414, 415, 416, 417, 0, 707, - 708, 0, 0, 420, 421, 0, 423, 0, 0, 425, - 426, 709, 428, 429, 430, 431, 432, 0, 0, 433, - 434, 435, 436, 437, 0, 0, 438, 439, 440, 441, - 442, 0, 710, 0, 445, 711, 447, 448, 449, 450, - 0, 0, 451, 0, 0, 452, 453, 454, 455, 456, - 457, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 469, 470, 471, 472 + 287, 288, 289, 290, 0, 292, 293, 294, 295, 296, + 0, 297, 298, 0, 300, 0, 301, 302, 303, 304, + 305, 306, 0, 307, 308, 0, 0, 309, 310, 311, + 0, 0, 312, 313, 0, 315, 0, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 0, 328, + 329, 330, 331, 332, 333, 334, 335, 336, 0, 337, + 338, 339, 340, 341, 342, 0, 343, 344, 345, 346, + 347, 348, 349, 350, 0, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 0, 364, + 365, 0, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 0, 382, 383, + 384, 385, 386, 0, 387, 388, 389, 390, 391, 0, + 393, 394, 395, 396, 0, 397, 398, 399, 400, 401, + 402, 403, 404, 405, 406, 407, 502, 409, 410, 411, + 0, 412, 413, 0, 414, 0, 416, 417, 418, 419, + 420, 0, 421, 422, 0, 0, 423, 424, 425, 426, + 427, 0, 428, 429, 430, 431, 432, 433, 434, 435, + 0, 0, 436, 437, 438, 439, 440, 0, 0, 441, + 442, 443, 444, 445, 446, 447, 0, 448, 0, 450, + 451, 452, 453, 0, 0, 454, 0, 0, 455, 456, + 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 467, 468, 469, 470, 471, 472, 473, 474, 475, 498, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, + 99, 100, 101, 0, 102, 103, 104, 0, 0, 0, + 0, 0, 0, 0, 105, 106, 0, 107, 108, 109, + 0, 111, 112, 113, 114, 115, 0, 117, 118, 0, + 119, 120, 121, 122, 123, 124, 0, 0, 125, 126, + 127, 128, 129, 0, 130, 131, 132, 133, 134, 0, + 0, 0, 136, 137, 138, 139, 140, 141, 0, 143, + 144, 145, 0, 146, 147, 148, 149, 150, 151, 0, + 0, 153, 154, 155, 0, 0, 0, 0, 0, 0, + 0, 157, 158, 159, 160, 161, 162, 163, 164, 165, + 166, 0, 167, 0, 168, 169, 170, 171, 172, 173, + 0, 174, 175, 176, 177, 178, 0, 0, 179, 180, + 181, 182, 183, 0, 184, 185, 186, 0, 187, 188, + 189, 0, 190, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 0, 201, 0, 202, 203, 204, 205, + 0, 206, 0, 207, 0, 0, 0, 210, 211, 212, + 0, 214, 0, 215, 0, 216, 217, 218, 0, 219, + 220, 221, 222, 223, 224, 225, 0, 227, 228, 229, + 230, 0, 231, 232, 233, 234, 235, 236, 0, 237, + 0, 239, 240, 241, 242, 243, 244, 245, 246, 0, + 247, 0, 248, 0, 0, 251, 0, 253, 254, 255, + 256, 257, 258, 0, 0, 259, 0, 261, 0, 0, + 263, 264, 265, 0, 0, 266, 267, 268, 269, 270, + 500, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, + 0, 292, 293, 294, 295, 296, 0, 297, 298, 0, + 300, 0, 301, 302, 303, 304, 305, 306, 0, 307, + 308, 0, 0, 309, 310, 311, 0, 0, 312, 313, + 0, 315, 0, 317, 318, 319, 320, 321, 322, 323, + 0, 325, 326, 327, 0, 328, 329, 330, 331, 332, + 333, 334, 335, 336, 0, 337, 338, 339, 340, 341, + 342, 0, 343, 0, 345, 346, 347, 348, 349, 350, + 0, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 0, 364, 365, 0, 367, 368, + 369, 370, 0, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 0, 382, 383, 384, 385, 386, 0, + 387, 388, 389, 390, 391, 0, 393, 394, 395, 396, + 0, 397, 398, 399, 400, 401, 402, 403, 404, 405, + 406, 407, 502, 409, 410, 411, 0, 412, 413, 0, + 414, 0, 416, 417, 418, 419, 420, 0, 421, 422, + 0, 0, 423, 424, 425, 426, 427, 0, 428, 429, + 430, 431, 432, 433, 434, 435, 0, 0, 436, 437, + 438, 439, 440, 0, 0, 441, 442, 443, 444, 445, + 446, 447, 0, 448, 0, 450, 451, 452, 453, 0, + 0, 454, 0, 0, 455, 456, 457, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 664, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 94, 95, 96, 97, 98, 99, 100, 101, 0, + 102, 103, 104, 0, 0, 0, 0, 0, 0, 0, + 105, 106, 0, 107, 108, 109, 665, 111, 112, 113, + 0, 666, 667, 668, 669, 0, 119, 120, 121, 122, + 123, 124, 0, 0, 125, 126, 670, 671, 129, 0, + 130, 131, 132, 133, 0, 0, 672, 0, 136, 137, + 138, 139, 140, 141, 673, 143, 144, 145, 0, 146, + 147, 148, 149, 150, 151, 0, 674, 153, 154, 155, + 0, 0, 0, 675, 0, 0, 0, 157, 158, 159, + 160, 161, 162, 163, 676, 677, 166, 0, 167, 0, + 168, 169, 170, 171, 172, 173, 0, 174, 175, 176, + 177, 178, 0, 0, 179, 180, 678, 182, 183, 0, + 184, 185, 186, 0, 187, 188, 189, 0, 190, 191, + 192, 193, 0, 195, 196, 197, 198, 199, 0, 0, + 201, 0, 202, 203, 679, 205, 0, 206, 0, 207, + 680, 0, 681, 210, 211, 212, 682, 214, 0, 215, + 0, 0, 0, 218, 0, 219, 220, 221, 222, 223, + 683, 225, 684, 227, 228, 229, 230, 0, 231, 232, + 233, 234, 235, 236, 0, 237, 685, 0, 240, 241, + 242, 243, 244, 686, 687, 0, 688, 0, 248, 689, + 690, 251, 691, 253, 254, 255, 256, 257, 258, 0, + 0, 259, 692, 261, 693, 0, 263, 264, 265, 0, + 0, 266, 267, 268, 269, 270, 694, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 695, 696, 697, 293, 294, + 295, 0, 0, 297, 298, 698, 300, 0, 0, 302, + 699, 304, 305, 306, 0, 307, 308, 0, 0, 309, + 310, 311, 0, 0, 312, 0, 700, 315, 701, 0, + 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, + 0, 328, 329, 0, 331, 332, 0, 334, 335, 336, + 0, 337, 338, 339, 340, 341, 342, 0, 343, 344, + 345, 702, 347, 348, 349, 350, 0, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 0, 364, 365, 703, 367, 368, 369, 704, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 0, + 382, 383, 384, 385, 386, 0, 387, 705, 389, 390, + 391, 706, 393, 394, 707, 396, 0, 397, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 708, 409, + 0, 411, 0, 412, 413, 0, 414, 709, 416, 417, + 418, 419, 420, 0, 710, 711, 0, 0, 423, 424, + 0, 426, 0, 0, 428, 429, 712, 431, 432, 433, + 434, 435, 0, 0, 436, 437, 438, 439, 440, 0, + 0, 441, 442, 443, 444, 445, 0, 713, 0, 448, + 714, 450, 451, 452, 453, 0, 0, 454, 0, 0, + 455, 456, 457, 458, 459, 460, 664, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 472, 473, 474, + 475, 0, 94, 95, 96, 97, 98, 99, 100, 101, + 0, 102, 103, 104, 0, 0, 0, 0, 0, 0, + 0, 105, 106, 0, 107, 108, 109, 665, 111, 112, + 113, 0, 666, 667, 668, 669, 0, 119, 120, 121, + 122, 123, 124, 0, 0, 125, 126, 670, 671, 129, + 0, 130, 131, 132, 133, 0, 0, 672, 0, 136, + 137, 138, 139, 140, 141, 673, 143, 144, 145, 0, + 146, 147, 148, 149, 150, 151, 0, 674, 153, 154, + 155, 0, 0, 0, 675, 0, 0, 0, 157, 158, + 159, 160, 161, 162, 163, 676, 677, 166, 0, 167, + 0, 168, 169, 170, 171, 172, 173, 0, 174, 175, + 176, 177, 178, 0, 0, 179, 180, 678, 182, 183, + 0, 184, 185, 186, 0, 187, 188, 189, 0, 190, + 191, 192, 193, 0, 195, 196, 197, 198, 199, 0, + 0, 201, 0, 202, 203, 679, 205, 0, 206, 0, + 207, 680, 0, 681, 210, 211, 212, 682, 214, 0, + 215, 0, 0, 0, 218, 0, 219, 220, 221, 222, + 223, 224, 225, 684, 227, 228, 229, 230, 0, 231, + 232, 233, 234, 235, 236, 0, 237, 685, 0, 240, + 241, 242, 243, 244, 686, 687, 0, 688, 0, 248, + 689, 690, 251, 691, 253, 254, 255, 256, 257, 258, + 0, 0, 259, 692, 261, 693, 0, 263, 264, 265, + 0, 0, 266, 267, 268, 269, 270, 694, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 695, 696, 697, 293, + 294, 295, 0, 0, 297, 298, 698, 300, 0, 0, + 302, 699, 304, 305, 306, 0, 307, 308, 0, 0, + 309, 310, 311, 0, 0, 312, 0, 700, 315, 701, + 0, 318, 319, 320, 321, 322, 323, 324, 325, 326, + 327, 0, 328, 329, 0, 331, 332, 0, 334, 335, + 336, 0, 337, 338, 339, 340, 341, 342, 0, 343, + 344, 345, 702, 347, 348, 349, 350, 0, 351, 352, + 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, + 363, 0, 364, 365, 703, 367, 368, 369, 704, 371, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 0, 382, 383, 384, 385, 386, 0, 387, 705, 389, + 390, 391, 706, 393, 394, 707, 396, 0, 397, 398, + 399, 400, 401, 402, 403, 404, 405, 406, 407, 708, + 409, 0, 411, 0, 412, 413, 0, 414, 709, 416, + 417, 418, 419, 420, 0, 710, 711, 0, 0, 423, + 424, 0, 426, 0, 0, 428, 429, 712, 431, 432, + 433, 434, 435, 0, 0, 436, 437, 438, 439, 440, + 0, 0, 441, 442, 443, 444, 445, 0, 713, 0, + 448, 714, 450, 451, 452, 453, 0, 0, 454, 0, + 0, 455, 456, 457, 458, 459, 460, 2416, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 472, 473, + 474, 475, 0, 94, 95, 96, 97, 98, 99, 100, + 101, 0, 102, 103, 104, 0, 0, 0, 0, 0, + 0, 0, 105, 106, 0, 107, 108, 109, 2417, 111, + 112, 113, 0, 666, 2418, 668, 669, 0, 119, 120, + 121, 122, 123, 124, 0, 0, 125, 126, 670, 671, + 129, 0, 130, 131, 132, 133, 0, 0, 2419, 0, + 136, 137, 138, 139, 140, 141, 2420, 143, 144, 145, + 0, 146, 147, 148, 149, 150, 151, 0, 2421, 153, + 154, 155, 0, 0, 0, 2422, 0, 0, 0, 157, + 158, 159, 160, 161, 162, 163, 676, 677, 166, 0, + 167, 0, 168, 169, 170, 171, 172, 173, 0, 174, + 175, 176, 177, 178, 0, 0, 179, 180, 678, 182, + 183, 0, 184, 185, 186, 0, 187, 188, 189, 0, + 190, 191, 192, 193, 0, 195, 196, 197, 198, 199, + 0, 0, 201, 0, 202, 203, 679, 205, 0, 206, + 0, 207, 2423, 0, 2424, 210, 211, 212, 2425, 214, + 0, 215, 0, 0, 0, 218, 0, 219, 220, 221, + 222, 223, 224, 225, 2426, 227, 228, 229, 230, 0, + 231, 232, 233, 234, 235, 236, 0, 237, 2427, 0, + 240, 241, 242, 243, 244, 686, 687, 0, 688, 0, + 248, 2428, 2429, 251, 2430, 253, 254, 255, 256, 257, + 258, 0, 0, 259, 2431, 261, 2432, 0, 263, 264, + 265, 0, 0, 266, 267, 268, 269, 270, 2631, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, + 283, 284, 285, 286, 287, 288, 289, 695, 2434, 697, + 293, 294, 295, 0, 0, 297, 298, 2436, 300, 0, + 0, 302, 699, 304, 305, 306, 0, 307, 308, 0, + 0, 309, 310, 311, 0, 0, 312, 0, 2438, 315, + 2439, 0, 318, 319, 320, 321, 322, 323, 324, 325, + 326, 327, 0, 328, 329, 0, 331, 332, 0, 334, + 335, 336, 0, 337, 338, 339, 340, 341, 342, 0, + 343, 344, 345, 702, 347, 348, 349, 350, 0, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 0, 364, 365, 2440, 367, 368, 369, 0, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 0, 382, 383, 384, 385, 386, 0, 387, 0, + 389, 390, 391, 2442, 393, 394, 707, 396, 0, 397, + 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, + 2632, 409, 0, 411, 0, 412, 413, 0, 414, 2444, + 416, 417, 418, 419, 420, 0, 710, 711, 0, 0, + 423, 424, 0, 426, 0, 0, 428, 429, 2445, 431, + 432, 433, 434, 435, 0, 0, 436, 437, 438, 439, + 440, 0, 0, 441, 442, 443, 444, 445, 0, 713, + 0, 448, 2446, 450, 451, 452, 453, 0, 0, 454, + 0, 0, 455, 456, 457, 458, 459, 460, 664, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 472, + 473, 474, 475, 0, 94, 95, 96, 97, 98, 99, + 100, 101, 0, 102, 103, 104, 0, 0, 0, 0, + 0, 0, 0, 105, 106, 0, 107, 108, 109, 665, + 111, 112, 113, 0, 666, 667, 668, 669, 0, 119, + 120, 121, 122, 123, 124, 0, 0, 125, 126, 670, + 671, 129, 0, 130, 131, 132, 133, 0, 0, 672, + 0, 136, 137, 138, 139, 140, 141, 673, 143, 144, + 145, 0, 146, 147, 148, 149, 150, 151, 0, 674, + 153, 154, 155, 0, 0, 0, 675, 0, 0, 0, + 157, 158, 159, 160, 161, 162, 163, 676, 677, 166, + 0, 167, 0, 168, 169, 170, 171, 172, 173, 0, + 174, 175, 176, 177, 178, 0, 0, 179, 180, 678, + 182, 183, 0, 184, 185, 186, 0, 187, 188, 189, + 0, 190, 191, 192, 193, 0, 195, 196, 197, 198, + 199, 0, 0, 201, 0, 202, 203, 679, 205, 0, + 206, 0, 207, 680, 0, 681, 210, 211, 212, 682, + 214, 0, 215, 0, 0, 0, 218, 0, 219, 220, + 221, 222, 223, 224, 225, 684, 227, 228, 229, 230, + 0, 231, 232, 233, 234, 235, 236, 0, 237, 685, + 0, 240, 241, 242, 243, 244, 686, 687, 0, 688, + 0, 248, 689, 690, 251, 691, 253, 254, 255, 256, + 257, 258, 0, 0, 259, 692, 261, 693, 0, 263, + 264, 265, 0, 0, 266, 267, 268, 269, 270, 0, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + 282, 283, 284, 285, 286, 287, 288, 289, 695, 696, + 697, 293, 294, 295, 0, 0, 297, 298, 698, 300, + 0, 0, 302, 699, 304, 305, 306, 0, 307, 308, + 0, 0, 309, 310, 311, 0, 0, 312, 0, 700, + 315, 701, 0, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 0, 328, 329, 0, 331, 332, 0, + 334, 335, 336, 0, 337, 338, 339, 340, 341, 342, + 0, 343, 344, 345, 702, 347, 348, 349, 350, 0, + 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, + 361, 362, 363, 0, 364, 365, 703, 367, 368, 369, + 0, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 0, 382, 383, 384, 385, 386, 0, 387, + 0, 389, 390, 391, 706, 393, 394, 707, 396, 0, + 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, + 407, 0, 409, 0, 411, 0, 412, 413, 0, 414, + 709, 416, 417, 418, 419, 420, 0, 710, 711, 0, + 0, 423, 424, 0, 426, 0, 0, 428, 429, 712, + 431, 432, 433, 434, 435, 0, 0, 436, 437, 438, + 439, 440, 0, 0, 441, 442, 443, 444, 445, 0, + 713, 0, 448, 714, 450, 451, 452, 453, 0, 0, + 454, 0, 0, 455, 456, 457, 458, 459, 460, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 472, 473, 474, 475 }; static const yytype_int16 yycheck[] = { - 6, 6, 637, 622, 0, 608, 535, 529, 629, 999, - 492, 526, 6, 59, 36, 565, 799, 702, 997, 799, - 583, 0, 1173, 0, 1276, 879, 1389, 0, 1740, 1392, - 0, 708, 588, 972, 30, 16, 1768, 16, 881, 1771, - 977, 1142, 1814, 631, 1142, 1142, 528, 1142, 533, 1229, - 974, 61, 1038, 1820, 897, 1822, 31, 968, 1178, 534, - 2181, 0, 535, 61, 731, 2062, 909, 734, 1278, 1811, - 2182, 622, 1760, 624, 2154, 626, 35, 2154, 1002, 1305, - 1306, 1696, 1257, 79, 1858, 1859, 1860, 2193, 807, 2200, - 21, 0, 5, 5, 2014, 5, 667, 668, 5, 2068, - 11, 0, 5, 5, 5, 5, 50, 9, 5, 9, - 13, 14, 13, 14, 89, 9, 11, 1633, 1634, 2468, - 5, 5, 1638, 694, 5, 5, 58, 5, 13, 14, - 41, 5, 13, 14, 917, 13, 14, 1358, 957, 73, - 5, 5, 540, 1885, 5, 5, 605, 5, 5, 2471, - 605, 2611, 1408, 214, 5, 75, 168, 642, 107, 1143, - 13, 14, 73, 1679, 1680, 0, 86, 3, 4, 5, - 1736, 4, 40, 9, 117, 168, 9, 1410, 9, 1271, - 67, 16, 738, 169, 93, 1751, 1396, 1271, 4, 866, - 40, 2520, 2067, 9, 93, 30, 58, 120, 2002, 75, - 2454, 36, 3, 986, 83, 11, 989, 990, 1950, 1951, - 86, 58, 1271, 27, 58, 27, 27, 58, 15, 281, - 34, 48, 34, 34, 2642, 305, 61, 2556, 220, 2093, - 31, 32, 120, 289, 269, 41, 283, 120, 107, 2542, - 169, 2436, 11, 674, 79, 289, 137, 135, 127, 122, - 117, 2706, 2745, 68, 2384, 826, 827, 27, 272, 2125, - 115, 106, 13, 14, 168, 696, 162, 73, 374, 108, - 799, 305, 41, 2904, 266, 436, 169, 806, 165, 115, - 59, 852, 330, 188, 207, 160, 2813, 414, 67, 145, - 400, 1010, 11, 37, 252, 253, 727, 160, 1017, 118, - 985, 2075, 436, 108, 73, 455, 2628, 115, 11, 158, - 203, 482, 452, 2642, 330, 147, 118, 344, 2315, 882, - 354, 877, 2319, 4, 495, 435, 219, 802, 9, 479, - 482, 458, 493, 365, 326, 228, 924, 2306, 41, 2205, - 2971, 493, 2422, 0, 2465, 372, 173, 910, 2841, 224, - 366, 2463, 2124, 401, 73, 493, 212, 497, 1973, 493, - 130, 1975, 189, 195, 11, 379, 167, 194, 169, 401, - 73, 190, 301, 936, 283, 2107, 2679, 213, 186, 2121, - 124, 2123, 231, 375, 283, 401, 1271, 493, 190, 2003, - 919, 920, 405, 208, 407, 2744, 2923, 266, 234, 434, - 448, 246, 265, 230, 362, 363, 273, 838, 488, 254, - 442, 967, 163, 345, 2609, 311, 11, 939, 273, 412, - 2875, 300, 266, 1633, 1634, 856, 2886, 315, 1638, 316, - 2305, 493, 448, 289, 1153, 2239, 497, 346, 343, 11, - 1043, 497, 434, 15, 1696, 2774, 493, 346, 2941, 378, - 2580, 23, 401, 497, 488, 234, 349, 1549, 1550, 1278, - 268, 493, 34, 35, 1548, 1981, 1982, 1983, 1984, 1679, - 1680, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, - 1996, 2810, 2224, 345, 2902, 497, 482, 2741, 2352, 482, - 1549, 1430, 412, 2842, 2060, 438, 2062, 294, 345, 240, - 1486, 345, 495, 482, 345, 482, 965, 493, 412, 482, - 965, 434, 482, 535, 2620, 87, 1742, 1152, 1770, 1775, - 526, 2843, 1143, 2039, 2040, 1515, 1510, 406, 372, 535, - 398, 2611, 2529, 445, 2611, 933, 412, 2534, 389, 390, - 2537, 1762, 429, 1776, 457, 240, 455, 457, 398, 493, - 377, 434, 2521, 2856, 535, 534, 455, 491, 564, 565, - 451, 495, 608, 436, 497, 497, 479, 577, 382, 479, - 382, 382, 428, 2902, 130, 1750, 2496, 1396, 489, 577, - 493, 493, 588, 493, 491, 494, 493, 496, 495, 2361, - 493, 493, 493, 493, 489, 494, 493, 496, 492, 1585, - 94, 597, 130, 1174, 1175, 586, 496, 2374, 493, 493, - 1166, 353, 493, 493, 545, 493, 446, 358, 597, 493, - 597, 627, 628, 629, 597, 600, 1247, 597, 493, 493, - 589, 2743, 493, 493, 1353, 493, 493, 30, 2749, 455, - 493, 27, 2748, 2324, 340, 446, 2327, 482, 484, 485, - 497, 484, 485, 484, 485, 268, 497, 1172, 597, 325, - 273, 54, 2350, 479, 1549, 1550, 1551, 174, 484, 485, - 115, 488, 1187, 1261, 75, 169, 1459, 2674, 495, 2453, - 486, 487, 488, 489, 2565, 86, 1469, 75, 354, 1472, - 4, 432, 149, 1314, 240, 9, 702, 220, 86, 534, - 535, 1223, 1231, 27, 1260, 2586, 1262, 1887, 457, 203, - 1266, 324, 1300, 1301, 2456, 484, 485, 486, 487, 488, - 489, 1973, 278, 1279, 1280, 219, 1282, 234, 4, 1292, - 479, 493, 738, 9, 228, 1356, 2848, 432, 1220, 1221, - 268, 2356, 577, 266, 130, 1227, 1302, 197, 117, 2315, - 278, 493, 493, 2319, 78, 1230, 8, 1345, 1231, 11, - 247, 158, 597, 87, 16, 17, 18, 1355, 262, 1357, - 240, 1981, 1982, 1983, 1984, 2896, 417, 1987, 1988, 1989, - 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1570, 457, 283, - 1570, 1911, 116, 799, 1309, 2567, 2022, 1917, 493, 1575, - 806, 807, 808, 1579, 23, 1581, 2886, 491, 1662, 2886, - 479, 495, 358, 8, 1633, 1634, 11, 1660, 824, 1638, - 240, 488, 494, 802, 493, 497, 1447, 240, 495, 2039, - 2040, 448, 201, 1744, 231, 1317, 1455, 484, 485, 486, - 487, 488, 489, 361, 4, 2726, 41, 853, 1838, 9, - 493, 296, 375, 48, 158, 349, 878, 240, 2970, 163, - 1679, 1680, 186, 1647, 1531, 1649, 1650, 873, 874, 875, - 23, 877, 878, 493, 198, 1861, 29, 1428, 73, 1482, - 1483, 1484, 5, 280, 2035, 1552, 432, 1554, 358, 1510, - 1557, 486, 487, 488, 489, 901, 36, 266, 405, 268, - 407, 476, 2154, 494, 1455, 197, 497, 158, 365, 218, - 130, 434, 163, 919, 920, 55, 135, 145, 13, 14, - 365, 1764, 1846, 1474, 1439, 432, 495, 231, 1479, 501, - 158, 31, 32, 491, 283, 163, 156, 495, 358, 2711, - 950, 951, 436, 953, 401, 358, 952, 493, 143, 2716, - 956, 957, 950, 951, 2520, 953, 401, 476, 530, 1896, - 330, 967, 432, 2529, 1901, 457, 106, 802, 2534, 944, - 486, 2537, 1528, 2489, 494, 358, 280, 497, 173, 985, - 231, 167, 135, 1465, 212, 442, 497, 479, 1470, 24, - 2556, 64, 65, 93, 189, 30, 366, 442, 455, 194, - 23, 493, 493, 231, 1010, 840, 29, 405, 494, 407, - 455, 1017, 432, 566, 567, 494, 569, 589, 1503, 432, - 168, 494, 479, 493, 497, 93, 1001, 494, 1543, 280, - 497, 401, 1038, 285, 479, 230, 493, 2217, 491, 214, - 493, 1570, 495, 878, 79, 13, 14, 494, 493, 432, - 497, 54, 280, 273, 1583, 493, 196, 494, 278, 476, - 497, 289, 2578, 497, 388, 499, 358, 391, 287, 405, - 150, 407, 1587, 493, 366, 23, 2642, 455, 448, 457, - 493, 29, 2183, 218, 494, 2183, 2183, 497, 2183, 23, - 285, 1647, 1648, 1649, 1650, 29, 338, 2809, 494, 23, - 494, 497, 150, 497, 2356, 29, 246, 150, 2674, 401, - 493, 405, 135, 407, 254, 950, 951, 494, 953, 494, - 497, 494, 497, 342, 497, 344, 266, 494, 1684, 494, - 2646, 2282, 497, 1655, 287, 1738, 494, 1143, 494, 497, - 602, 497, 604, 23, 2320, 2135, 2322, 1153, 494, 29, - 1817, 497, 1819, 372, 150, 2134, 448, 297, 13, 14, - 1166, 1941, 1981, 1982, 1983, 1984, 1172, 1173, 1987, 1988, - 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1731, 1732, - 493, 1187, 377, 2122, 495, 338, 268, 135, 2960, 342, - 36, 2903, 2924, 2925, 13, 14, 2133, 2176, 2135, 419, - 428, 135, 448, 5, 344, 493, 8, 82, 2774, 459, - 430, 135, 14, 494, 2926, 493, 497, 150, 149, 372, - 2039, 2040, 445, 25, 312, 1231, 366, 29, 480, 481, - 482, 493, 484, 485, 486, 487, 488, 489, 1915, 1916, - 494, 1247, 2974, 497, 2810, 1880, 386, 35, 2091, 494, - 1231, 1230, 497, 493, 1260, 135, 1262, 13, 14, 1265, - 1266, 1257, 493, 491, 287, 365, 494, 495, 493, 1275, - 2982, 1277, 1278, 1279, 1280, 1281, 1282, 1283, 1257, 2489, - 1257, 150, 477, 130, 1257, 494, 439, 1257, 497, 484, - 485, 486, 487, 488, 489, 283, 1302, 365, 1304, 13, - 14, 401, 150, 1309, 1310, 1311, 1312, 1313, 1314, 156, - 150, 494, 1318, 1319, 497, 338, 401, 1323, 1939, 342, - 494, 1327, 493, 497, 1330, 1331, 1332, 1333, 1334, 1335, - 1336, 1337, 1338, 401, 36, 1341, 2902, 13, 14, 287, - 1346, 2492, 442, 1349, 229, 1351, 446, 1353, 494, 372, - 1356, 497, 493, 287, 494, 455, 5, 494, 494, 2611, - 497, 497, 494, 287, 491, 497, 938, 23, 2578, 5, - 1376, 2154, 67, 29, 442, 494, 13, 14, 497, 479, - 1895, 526, 163, 494, 493, 1381, 497, 455, 494, 493, - 1396, 497, 1373, 493, 342, 1230, 494, 13, 14, 497, - 2390, 1407, 1408, 494, 338, 5, 497, 287, 342, 5, - 494, 479, 1941, 497, 338, 493, 439, 493, 342, 493, - 115, 268, 1257, 2362, 372, 493, 273, 494, 493, 2017, - 497, 278, 494, 1439, 365, 497, 2646, 494, 372, 1445, - 497, 1447, 494, 494, 493, 497, 497, 1962, 372, 5, - 494, 8, 1934, 497, 2010, 13, 14, 2311, 338, 16, - 17, 18, 342, 494, 494, 1980, 497, 497, 5, 494, - 401, 2325, 497, 494, 146, 494, 497, 172, 497, 135, - 1486, 353, 354, 1489, 1490, 1320, 1492, 493, 20, 21, - 2005, 439, 372, 13, 14, 493, 2647, 2012, 2051, 2052, - 2053, 2054, 184, 185, 1510, 439, 9, 494, 493, 2072, - 497, 442, 2100, 13, 14, 439, 2879, 1523, 2881, 67, - 13, 14, 1528, 1519, 455, 73, 6, 494, 13, 14, - 497, 11, 2153, 494, 2155, 15, 497, 1543, 86, 493, - 20, 21, 22, 23, 24, 456, 1381, 27, 479, 2216, - 30, 31, 15, 494, 34, 35, 497, 702, 494, 439, - 214, 497, 493, 493, 1570, 494, 2169, 115, 497, 117, - 252, 253, 419, 268, 13, 14, 493, 1583, 273, 1585, - 174, 1587, 494, 430, 494, 497, 1592, 497, 497, 494, - 493, 1597, 497, 2956, 13, 14, 13, 14, 2381, 79, - 13, 14, 296, 197, 13, 14, 86, 87, 88, 89, - 90, 13, 14, 1635, 13, 14, 13, 14, 13, 14, - 493, 316, 353, 354, 172, 256, 257, 1633, 1634, 1635, - 493, 287, 1638, 493, 2886, 94, 493, 332, 2617, 2154, - 234, 1647, 1648, 1649, 1650, 362, 363, 353, 354, 353, - 354, 1657, 1224, 201, 1226, 1661, 493, 8, 1664, 493, - 11, 97, 1684, 808, 36, 16, 17, 18, 163, 372, - 2489, 365, 280, 1679, 1680, 163, 365, 278, 1684, 229, - 362, 363, 338, 493, 1519, 412, 342, 493, 145, 919, - 920, 412, 1698, 86, 288, 1701, 497, 1703, 2213, 54, - 54, 158, 412, 2483, 259, 412, 163, 401, 494, 502, - 169, 412, 401, 455, 8, 150, 372, 11, 1724, 93, - 268, 495, 16, 17, 18, 273, 2393, 2394, 285, 268, - 1736, 1736, 142, 1755, 429, 268, 50, 2422, 493, 33, - 36, 436, 1736, 2331, 203, 1751, 1751, 36, 442, 493, - 9, 35, 410, 442, 1750, 212, 491, 1751, 2346, 2578, - 219, 455, 410, 1769, 497, 491, 455, 412, 316, 228, - 412, 1750, 917, 1750, 231, 493, 451, 1750, 1784, 1785, - 1750, 95, 412, 439, 332, 479, 412, 11, 340, 497, - 479, 2341, 492, 502, 273, 410, 493, 1803, 497, 493, - 1635, 493, 412, 262, 493, 168, 177, 121, 494, 159, - 493, 405, 436, 407, 1820, 1821, 1822, 36, 212, 497, - 220, 375, 284, 280, 305, 139, 497, 2646, 2611, 143, - 305, 493, 289, 220, 268, 429, 220, 289, 432, 321, - 985, 281, 448, 194, 150, 150, 493, 493, 455, 1684, - 164, 283, 268, 167, 494, 1861, 491, 476, 476, 1431, - 494, 494, 494, 283, 268, 216, 494, 1702, 182, 1441, - 36, 1443, 36, 494, 1446, 492, 168, 2392, 168, 493, - 1452, 429, 1454, 1718, 495, 494, 476, 412, 436, 1895, - 349, 494, 494, 452, 1466, 494, 494, 494, 493, 1471, - 493, 1736, 494, 1475, 1476, 1477, 1478, 494, 1480, 1481, - 494, 493, 293, 442, 452, 1750, 1751, 283, 482, 284, - 1755, 434, 216, 480, 481, 482, 284, 484, 485, 486, - 487, 488, 489, 1939, 285, 1941, 478, 284, 239, 412, - 268, 1937, 493, 150, 497, 197, 287, 150, 150, 275, - 2940, 412, 412, 1959, 2483, 275, 1962, 412, 412, 273, - 494, 492, 1968, 493, 281, 1971, 494, 281, 1974, 455, - 497, 428, 283, 150, 1980, 1981, 1982, 1983, 1984, 36, - 492, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, - 1996, 285, 2014, 492, 2000, 2001, 150, 273, 141, 2005, - 168, 2047, 11, 483, 2010, 163, 2012, 494, 2014, 489, - 324, 543, 492, 545, 546, 168, 496, 2023, 494, 493, - 2026, 501, 2028, 2045, 494, 494, 452, 1172, 1173, 2035, - 2036, 401, 168, 2039, 2040, 479, 568, 177, 2044, 2045, - 2062, 497, 1187, 36, 494, 494, 346, 84, 528, 529, - 530, 441, 493, 2656, 2060, 2060, 2062, 2062, 284, 150, - 493, 172, 55, 423, 494, 545, 2060, 2073, 2062, 494, - 494, 493, 36, 494, 497, 493, 79, 2083, 492, 436, - 168, 493, 36, 494, 564, 565, 566, 567, 494, 569, - 497, 2712, 2727, 2099, 2576, 493, 2611, 219, 494, 403, - 580, 55, 1937, 2886, 292, 494, 494, 493, 493, 589, - 219, 290, 54, 106, 181, 494, 455, 199, 482, 187, - 600, 273, 273, 482, 412, 412, 495, 495, 495, 480, - 481, 482, 612, 484, 485, 486, 487, 488, 489, 2661, - 36, 268, 495, 2149, 107, 493, 495, 2153, 2154, 2155, - 495, 495, 106, 495, 283, 495, 494, 2679, 495, 495, - 495, 495, 495, 2678, 1309, 495, 2681, 36, 648, 649, - 650, 495, 495, 8, 495, 455, 11, 495, 168, 2014, - 495, 2816, 495, 495, 493, 495, 480, 481, 482, 302, - 484, 485, 486, 487, 488, 489, 495, 86, 495, 88, - 495, 90, 495, 196, 495, 219, 41, 2213, 2204, 454, - 2045, 493, 493, 48, 493, 2771, 86, 131, 172, 494, - 332, 493, 493, 220, 2230, 2060, 81, 2062, 115, 36, - 73, 150, 494, 150, 122, 36, 494, 354, 73, 2795, - 8, 2797, 196, 11, 354, 54, 36, 493, 16, 17, - 18, 2733, 493, 246, 493, 493, 493, 8, 323, 441, - 11, 254, 497, 73, 2885, 2787, 36, 799, 186, 436, - 2276, 2277, 2891, 266, 806, 2281, 2282, 423, 67, 286, - 2286, 67, 493, 2289, 2290, 493, 36, 497, 2294, 436, - 41, 372, 246, 482, 1439, 273, 186, 48, 244, 493, - 254, 36, 423, 493, 297, 286, 286, 493, 143, 2315, - 2315, 494, 266, 2319, 2319, 356, 494, 493, 266, 353, - 9, 2315, 73, 283, 339, 2319, 199, 1899, 283, 2811, - 283, 33, 812, 494, 493, 2341, 120, 434, 173, 9, - 23, 22, 597, 297, 494, 2136, 29, 2343, 2344, 2149, - 1453, 344, 884, 36, 189, 1815, 2345, 2097, 2810, 194, - 2552, 893, 2882, 2189, 2888, 2386, 2963, 2719, 2374, 2204, - 2939, 2886, 55, 366, 906, 2927, 2630, 2383, 1809, 1821, - 2885, 972, 2937, 1873, 2194, 917, 2392, 919, 920, 2153, - 344, 1806, 143, 386, 2883, 230, 1220, 1172, 1543, 879, - 1877, 1939, 2483, 2179, 911, 1769, 1424, 2784, 2805, 2922, - 1784, 960, 366, 959, 938, 1396, 2422, 2077, 2865, 2799, - 2337, 2699, 173, 106, 1423, 1751, 962, 2062, 2675, 2306, - 2060, 2774, 386, 2773, 2791, 2321, 2792, 2548, 189, 1271, - 1271, 921, 1587, 194, 1271, 1271, 2868, 526, 216, 2869, - 285, 2852, 135, 1347, 1662, 1770, 1492, 1262, 938, 939, - 1593, 1702, 1699, 526, 944, 945, 946, 1351, 1739, 2076, - 2466, 2766, 1881, 1231, 1373, 1583, 944, 2483, 1374, 230, - 2315, -1, 2098, 2489, 2319, -1, 2492, -1, -1, -1, - 2496, 971, 972, -1, -1, -1, -1, -1, 2504, 2505, - -1, -1, 2508, -1, 984, -1, -1, -1, 2343, 2344, - -1, -1, -1, 196, 2520, 2520, -1, 285, -1, -1, - -1, 1001, -1, 2529, 2529, 1005, 2520, -1, 2534, 2534, - -1, 2537, 2537, -1, 285, 2529, -1, -1, 2544, 2545, - 2534, -1, 377, 2537, -1, 2117, -1, -1, -1, -1, - 2556, 2556, 2558, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 2556, 246, -1, -1, -1, -1, -1, 2141, - -1, 254, 2578, -1, 170, -1, -1, -1, 174, -1, - -1, -1, -1, 266, 2156, 2157, 2158, 2159, 2160, 2161, - 2162, 2163, 2164, 2165, 483, -1, -1, -1, -1, -1, - -1, 197, -1, -1, 287, 2611, 526, 496, -1, -1, - -1, -1, -1, -1, 297, -1, -1, -1, -1, -1, - -1, -1, -1, 702, -1, 2621, 377, -1, -1, -1, - -1, 2466, -1, -1, -1, -1, 2642, 2642, 234, 702, - 2646, 2647, 477, -1, -1, 241, -1, 2643, 2642, 484, - 485, 486, 487, 488, 489, 338, -1, -1, 1138, 342, - -1, 344, -1, -1, 2670, 2687, 1146, -1, 2674, 2674, - -1, -1, 2678, -1, -1, 2681, 1156, 526, -1, -1, - 2674, 2687, -1, 366, -1, -1, -1, -1, -1, 372, - -1, 580, 288, -1, 2529, -1, 2702, -1, -1, 2534, - -1, -1, 2537, 386, -1, -1, 2712, -1, -1, 1189, - 2716, 2717, 480, 481, 482, -1, 484, 485, 486, 487, - 488, 489, 8, 612, -1, 11, 477, -1, -1, 808, - 16, 17, 18, 484, 485, 486, 487, 488, 489, 1271, - 1220, 1221, -1, 1223, 1224, 808, 1226, 1227, -1, 1229, - 1895, 2747, -1, -1, -1, -1, 439, -1, -1, 648, - 649, 650, 358, -1, -1, 2771, -1, -1, 2774, 2774, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 2774, -1, 702, -1, -1, -1, 2621, -1, -1, 2795, - -1, 2797, -1, 2799, -1, -1, 1276, 2803, -1, -1, - -1, -1, -1, -1, 2810, 2810, -1, 1287, 2643, 405, - 2806, 407, -1, -1, -1, -1, 2810, 1962, -1, -1, - -1, -1, -1, -1, -1, 2831, -1, 423, -1, -1, - -1, 1363, -1, 429, -1, 1980, 432, 1317, -1, 2674, - -1, -1, -1, -1, -1, 2851, 2852, -1, -1, -1, - -1, -1, 2687, 702, -1, -1, -1, -1, -1, 2865, - 2005, -1, -1, -1, -1, -1, -1, 2012, -1, -1, - 1350, 1351, -1, -1, -1, -1, -1, -1, -1, 2885, - 2886, -1, -1, -1, -1, -1, -1, -1, 808, 0, - 2035, -1, 1372, -1, 1374, -1, 2902, 2902, 2904, 2895, - -1, -1, -1, 1383, -1, 1385, 985, -1, 2902, 36, - -1, -1, 2747, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 985, -1, -1, -1, -1, -1, 55, -1, - 216, -1, -1, -1, -1, -1, -1, 109, 110, -1, - -1, 1421, -1, -1, -1, -1, -1, -1, -1, -1, - 1430, 1431, -1, -1, -1, -1, -1, -1, -1, 808, - -1, 1441, 1442, 1443, 1444, 2971, 1446, -1, -1, -1, - -1, 2806, 1452, -1, 1454, -1, -1, -1, -1, 106, - 107, -1, 93, -1, -1, 1465, 1466, -1, 115, -1, - 1470, 1471, -1, -1, -1, 1475, 1476, 1477, 1478, 285, - 1480, 1481, -1, 0, -1, 2577, -1, -1, -1, 2154, - -1, -1, 184, 185, -1, -1, -1, -1, -1, -1, - 1500, 1501, 1502, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 921, -1, 145, -1, -1, 1517, 1570, -1, - 2612, 2613, 1574, -1, -1, 172, -1, 158, -1, -1, - -1, 1583, 163, -1, -1, 2627, 945, 168, -1, -1, - 2895, -1, -1, -1, -1, 985, 177, -1, 2213, 196, - 181, -1, -1, -1, -1, -1, 248, 249, 250, 251, - 252, 253, 971, -1, 256, 257, -1, -1, -1, -1, - -1, -1, -1, 1172, 1173, 984, 93, -1, -1, -1, - -1, 212, -1, -1, -1, -1, -1, -1, 1187, 1172, - 1173, -1, -1, -1, -1, -1, 1005, -1, -1, 246, - 231, -1, -1, -1, 1187, -1, -1, 254, -1, 2701, - -1, -1, -1, -1, -1, -1, 985, 2282, -1, 266, - 526, 268, -1, -1, -1, -1, -1, -1, 145, -1, - -1, -1, -1, -1, -1, -1, -1, 2729, -1, -1, - -1, 158, -1, -1, -1, -1, 163, -1, -1, 280, - 297, 168, 283, -1, -1, 1655, -1, -1, 289, -1, - 177, -1, 1662, -1, 181, -1, -1, -1, -1, -1, - 362, 363, -1, -1, 480, 481, 482, 526, 484, 485, - 486, 487, 488, 489, -1, -1, -1, -1, -1, -1, - -1, -1, 323, -1, -1, 212, 1696, 344, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 1309, -1, -1, -1, 231, 346, -1, -1, -1, 366, - -1, -1, -1, -1, -1, -1, 1309, 2392, -1, 1729, - -1, -1, 1172, 1173, -1, -1, 1736, 1146, -1, 386, - -1, 388, -1, -1, 391, -1, -1, 1187, -1, -1, - -1, 1751, 0, -1, -1, 1755, -1, 2422, 1758, 8, - 1760, -1, 11, 280, -1, -1, 283, 16, 17, 18, - 401, -1, 289, -1, 1826, -1, -1, 8, -1, -1, - 11, 473, 474, -1, 33, 16, 17, 18, -1, -1, - -1, -1, -1, -1, -1, -1, 702, 428, -1, -1, - -1, 493, 33, 1172, 1173, 436, 323, -1, -1, -1, - -1, 1811, -1, -1, -1, -1, -1, -1, 1187, 1871, - 1229, 452, -1, 454, 455, -1, -1, 2492, -1, 346, - -1, -1, 1884, -1, -1, -1, -1, -1, -1, -1, - 1439, -1, -1, -1, -1, 93, 493, -1, -1, -1, - -1, -1, -1, 702, -1, -1, 1439, -1, -1, -1, - 491, -1, -1, 494, 495, 496, -1, -1, -1, 1309, - -1, -1, -1, 1873, -1, -1, -1, -1, 1878, -1, - -1, -1, -1, -1, 401, 1885, 1886, 1887, 1888, 1941, - 8, -1, -1, 11, 1946, -1, 1948, 145, -1, 1899, - 1952, 1953, 808, -1, -1, -1, 1906, -1, -1, -1, - 158, 428, -1, -1, -1, 163, -1, -1, 1918, 436, - 168, -1, -1, 41, -1, -1, -1, -1, -1, 177, - 48, -1, -1, 181, 1934, 452, -1, 454, 455, -1, - 1309, 1350, -1, -1, 1543, -1, 2611, -1, -1, -1, - 1950, 1951, -1, -1, -1, 73, -1, -1, -1, 808, - 1543, -1, -1, 1372, 212, 1374, -1, 216, -1, -1, - -1, -1, -1, 1973, 491, -1, -1, 494, 495, 496, - -1, -1, 2647, 231, -1, 216, -1, -1, 1587, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 1439, - -1, -1, -1, -1, 1587, -1, -1, -1, -1, -1, - -1, -1, 1421, 2678, -1, -1, 2681, -1, -1, -1, - -1, -1, -1, -1, -1, 143, -1, -1, -1, 109, - 110, -1, 280, -1, -1, 283, 285, -1, -1, -1, - -1, 289, -1, -1, -1, -1, -1, -1, -1, 2049, - -1, -1, -1, -1, 285, 173, -1, 2057, 2058, 2059, - 2060, -1, 2062, 2063, -1, -1, -1, 2067, 2068, -1, - 1439, 189, -1, -1, -1, 323, 194, -1, -1, 985, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 1500, 1501, -1, -1, -1, -1, 2097, 346, -1, - -1, -1, 2154, 1543, 184, 185, -1, -1, -1, -1, - -1, -1, 230, -1, -1, 2115, -1, 2117, -1, -1, - -1, 2121, 2122, 2123, -1, 2125, -1, 2179, -1, -1, - -1, -1, -1, -1, -1, -1, 985, -1, -1, -1, - -1, 2141, -1, 2143, -1, -1, -1, 1587, -1, -1, - -1, -1, -1, 401, -1, -1, 2156, 2157, 2158, 2159, - 2160, 2161, 2162, 2163, 2164, 2165, -1, 285, 248, 249, - 250, 251, 252, 253, 1543, -1, 256, 257, -1, -1, - 428, 2181, -1, -1, 2184, -1, -1, -1, 436, -1, - -1, -1, -1, -1, 2194, -1, -1, -1, -1, 564, - 565, -1, -1, -1, 452, 2205, 454, 455, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 2217, 1587, -1, - -1, 2886, -1, -1, 2224, -1, -1, -1, -1, -1, - -1, 480, 481, 482, -1, 484, 485, 486, 487, 488, - 489, -1, -1, 491, -1, -1, 494, 495, 496, 480, - 481, 482, -1, 484, 485, 486, 487, 488, 489, 377, - -1, -1, 627, 628, -1, -1, 1172, 1173, -1, -1, - -1, -1, 2272, -1, -1, -1, -1, -1, -1, -1, - -1, 1187, 362, 363, -1, -1, 2338, -1, -1, 8, - -1, -1, 11, -1, -1, 2295, 1895, -1, 2298, 2299, - 2300, 2301, -1, -1, -1, 2305, 2306, -1, 2308, -1, - -1, 2311, 1895, -1, -1, 2315, -1, -1, -1, 2319, - 1729, -1, 41, 1172, 1173, 2325, -1, -1, -1, 48, - -1, -1, -1, -1, -1, -1, -1, -1, 1187, -1, - -1, 2341, -1, -1, -1, 2345, -1, -1, -1, -1, - 2350, -1, -1, -1, 73, -1, 2356, -1, -1, 477, - -1, -1, 2362, 1962, -1, -1, 484, 485, 486, 487, - 488, 489, -1, -1, -1, -1, -1, -1, -1, 1962, - -1, 1980, -1, 8, -1, -1, 11, 2387, -1, -1, - -1, -1, -1, 473, 474, -1, -1, 1980, -1, -1, - -1, -1, -1, 1309, -1, -1, 2005, -1, -1, -1, - 2462, -1, -1, 2012, -1, -1, 41, -1, -1, -1, - -1, -1, 2005, 48, 143, -1, -1, -1, -1, 2012, - -1, 2483, -1, -1, -1, -1, 2035, -1, -1, -1, - -1, -1, 807, -1, -1, -1, -1, -1, 73, -1, - -1, -1, 2035, -1, 173, 1895, 2456, -1, -1, 824, - 1309, -1, -1, -1, -1, 2465, -1, -1, -1, 1878, - 189, -1, -1, -1, -1, 194, 2476, 1886, 1887, 1888, - -1, -1, -1, -1, -1, -1, -1, -1, 853, -1, - -1, -1, -1, -1, -1, 2547, -1, 1906, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 873, 874, - 875, 230, -1, 878, -1, -1, -1, -1, 143, -1, - 2520, 2521, 1962, -1, 2524, -1, 1895, 2527, -1, 2529, - -1, -1, -1, 1439, 2534, -1, 901, 2537, -1, 2539, - 1980, -1, 2542, -1, -1, -1, -1, -1, 173, -1, - -1, -1, -1, -1, -1, 2154, 2556, -1, -1, 2611, - -1, -1, -1, -1, 189, 2005, 285, -1, -1, 194, - -1, 2154, 2012, -1, -1, -1, 2576, 2577, -1, -1, - -1, -1, -1, -1, -1, 2585, -1, 952, -1, -1, - 1439, 956, 957, 1962, -1, 2035, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 230, -1, -1, -1, -1, - -1, 1980, 2612, 2613, 2213, -1, -1, -1, -1, -1, - -1, -1, -1, 2623, -1, -1, -1, 2627, -1, -1, - 2213, -1, -1, -1, -1, -1, 2005, 1543, -1, 2639, - -1, -1, 2642, 2012, -1, 1010, -1, -1, 2057, 2058, - 2059, -1, 1017, -1, -1, -1, -1, -1, 377, -1, - 285, 2661, -1, -1, -1, 8, 2035, -1, 11, -1, - -1, -1, -1, 1038, 2674, -1, -1, -1, -1, 2679, - -1, 1587, -1, 2282, -1, -1, -1, -1, -1, -1, - 2742, -1, -1, -1, 1543, -1, 2696, -1, 41, 2282, - -1, 2701, -1, -1, -1, 48, 2115, -1, -1, -1, - 2710, -1, -1, -1, 2154, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 2729, - 73, -1, 8, 2733, -1, 11, -1, -1, 1587, -1, - 16, 17, 18, -1, -1, -1, 2746, -1, -1, -1, - -1, -1, 377, -1, -1, -1, -1, 33, 477, -1, - -1, -1, -1, -1, -1, 484, 485, 486, 487, 488, - 489, -1, -1, 2213, 2774, 2184, -1, -1, -1, -1, - -1, -1, -1, 2783, -1, 2154, -1, 2787, 1153, -1, - -1, 2791, -1, 2392, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 799, 2217, 2392, - 2810, 2811, 2812, 2813, 806, -1, -1, -1, -1, -1, - -1, -1, -1, 2422, -1, -1, -1, -1, -1, -1, - 173, -1, -1, -1, 2886, -1, -1, -1, -1, 2422, - -1, -1, 2282, 3, 2213, 5, 189, -1, -1, -1, - -1, 194, 477, -1, -1, -1, 2856, -1, -1, 484, - 485, 486, 487, 488, 489, -1, -1, -1, 2868, -1, + 6, 6, 622, 605, 493, 637, 47, 629, 0, 535, + 0, 588, 882, 705, 803, 803, 1003, 631, 533, 36, + 1005, 0, 0, 0, 651, 1178, 6, 583, 978, 16, + 883, 1356, 1389, 526, 1660, 1392, 711, 16, 30, 528, + 1744, 1282, 1758, 1148, 1148, 1761, 1148, 976, 1819, 1740, + 31, 983, 1148, 2165, 980, 885, 1825, 1183, 1827, 2195, + 2165, 1639, 1640, 1312, 1313, 959, 1644, 526, 534, 529, + 62, 901, 535, 622, 1816, 624, 0, 626, 1799, 735, + 811, 737, 1008, 1044, 914, 2073, 1863, 1864, 1865, 2196, + 2207, 2211, 1702, 21, 35, 1878, 2025, 5, 5, 9, + 1791, 20, 21, 670, 671, 1263, 2080, 1685, 1686, 90, + 49, 11, 5, 5, 73, 9, 49, 9, 0, 542, + 13, 14, 1149, 50, 5, 5, 93, 642, 58, 3, + 697, 602, 2493, 1364, 922, 1408, 169, 2477, 602, 5, + 75, 40, 58, 0, 58, 5, 5, 13, 14, 2489, + 1892, 86, 5, 13, 14, 5, 5, 31, 32, 9, + 13, 14, 5, 2566, 741, 5, 5, 5, 5, 170, + 13, 14, 5, 5, 75, 5, 5, 5, 130, 13, + 14, 27, 40, 120, 1410, 86, 27, 4, 2474, 137, + 2544, 11, 9, 34, 117, 870, 1277, 3, 4, 5, + 122, 2635, 67, 9, 992, 157, 94, 995, 996, 2011, + 2404, 93, 705, 2668, 169, 4, 83, 1959, 1960, 2122, + 9, 41, 283, 27, 27, 2079, 11, 2581, 222, 120, + 34, 34, 78, 1277, 222, 58, 93, 107, 117, 2733, + 285, 87, 120, 107, 170, 11, 58, 115, 291, 11, + 159, 2773, 291, 73, 68, 307, 376, 135, 161, 2452, + 127, 355, 274, 830, 831, 11, 118, 271, 27, 37, + 116, 208, 2840, 159, 268, 41, 2589, 803, 8, 41, + 268, 11, 170, 495, 810, 1016, 16, 17, 18, 856, + 161, 27, 1023, 118, 168, 41, 170, 2610, 11, 991, + 11, 166, 2705, 402, 881, 147, 438, 73, 130, 115, + 2087, 73, 189, 2653, 2668, 929, 204, 438, 270, 812, + 48, 1277, 459, 275, 233, 13, 14, 73, 280, 2441, + 886, 4, 220, 346, 328, 484, 9, 108, 437, 191, + 806, 187, 230, 416, 481, 108, 2334, 233, 497, 2871, + 2338, 2325, 2488, 199, 196, 226, 124, 1984, 2137, 915, + 59, 374, 73, 495, 267, 2136, 191, 496, 67, 381, + 499, 130, 1982, 282, 495, 495, 264, 303, 2485, 2947, + 2071, 414, 2073, 377, 2100, 2012, 942, 460, 0, 377, + 1284, 2133, 969, 2135, 130, 209, 275, 285, 924, 925, + 367, 495, 163, 285, 268, 498, 2968, 275, 214, 2903, + 2604, 2772, 1990, 1991, 1992, 1993, 1286, 347, 1996, 1997, + 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 285, 922, + 236, 347, 436, 347, 495, 302, 403, 1277, 490, 317, + 2633, 2754, 436, 2965, 2223, 268, 174, 1049, 436, 2803, + 495, 484, 3014, 318, 380, 2257, 499, 499, 280, 414, + 499, 1702, 190, 351, 497, 195, 348, 195, 345, 421, + 2324, 1552, 2050, 2051, 2377, 2930, 164, 444, 2912, 414, + 432, 2884, 115, 2769, 448, 945, 1436, 217, 2842, 1516, + 457, 348, 1765, 485, 495, 485, 967, 1746, 991, 436, + 2242, 400, 1396, 967, 232, 453, 485, 485, 485, 1553, + 391, 392, 2873, 414, 481, 938, 438, 440, 535, 1760, + 526, 1736, 1737, 2635, 347, 2645, 1158, 1149, 495, 535, + 2635, 1492, 2872, 403, 493, 347, 1521, 236, 497, 447, + 1766, 408, 400, 384, 390, 436, 496, 393, 535, 499, + 438, 374, 313, 8, 187, 534, 11, 287, 564, 565, + 23, 16, 17, 18, 605, 2553, 431, 106, 495, 499, + 2558, 2545, 1803, 2561, 448, 457, 2930, 242, 33, 459, + 384, 384, 588, 499, 494, 499, 493, 495, 495, 2518, + 497, 491, 486, 487, 1171, 484, 1754, 1553, 1554, 586, + 457, 481, 495, 495, 2387, 597, 495, 597, 1235, 2380, + 459, 327, 1179, 1180, 496, 495, 498, 545, 597, 597, + 597, 627, 628, 629, 543, 2394, 545, 546, 1359, 495, + 1591, 1253, 481, 307, 615, 495, 495, 270, 577, 496, + 356, 498, 495, 2334, 577, 495, 495, 2338, 589, 568, + 457, 379, 495, 1267, 2375, 495, 495, 495, 495, 2779, + 2777, 495, 495, 495, 2771, 495, 495, 495, 457, 486, + 487, 491, 135, 597, 481, 493, 242, 1465, 4, 497, + 486, 487, 356, 9, 1177, 1178, 30, 1475, 342, 1266, + 1478, 1268, 481, 1307, 1308, 1272, 2473, 486, 487, 705, + 1322, 486, 487, 488, 489, 490, 491, 67, 1285, 248, + 54, 1237, 2700, 1553, 1554, 1555, 526, 256, 1177, 1234, + 486, 487, 488, 489, 490, 491, 488, 489, 490, 491, + 1223, 495, 1309, 2869, 2476, 741, 1225, 1226, 198, 1353, + 1362, 1982, 1298, 1232, 493, 1639, 1640, 1361, 497, 1363, + 1644, 2361, 482, 483, 484, 115, 486, 487, 488, 489, + 490, 491, 217, 5, 1223, 171, 8, 249, 1228, 434, + 1236, 2878, 14, 419, 1237, 488, 489, 490, 491, 459, + 31, 32, 130, 25, 2033, 1574, 1574, 29, 2924, 242, + 270, 1685, 1686, 1919, 360, 275, 1527, 803, 145, 1925, + 2912, 481, 23, 242, 810, 811, 812, 2912, 29, 242, + 407, 23, 409, 173, 1667, 495, 490, 29, 23, 1748, + 2591, 332, 828, 1316, 29, 403, 289, 806, 185, 186, + 495, 1453, 287, 450, 130, 1665, 1325, 243, 115, 24, + 11, 1461, 93, 367, 15, 30, 326, 2062, 2063, 2064, + 2065, 857, 23, 2544, 407, 175, 409, 1316, 1843, 1729, + 367, 157, 2553, 34, 35, 882, 213, 2558, 434, 4, + 2561, 877, 878, 879, 9, 881, 882, 62, 242, 403, + 1536, 344, 363, 346, 803, 1434, 1488, 1489, 1490, 2996, + 2581, 810, 403, 2046, 1516, 705, 403, 254, 255, 905, + 495, 1557, 75, 1559, 117, 1866, 1562, 360, 64, 65, + 270, 374, 1461, 86, 135, 275, 236, 88, 924, 925, + 444, 360, 270, 135, 2165, 1851, 332, 360, 459, 495, + 135, 1480, 280, 457, 2512, 75, 1485, 444, 490, 450, + 254, 255, 13, 14, 291, 497, 86, 490, 954, 1442, + 481, 175, 958, 959, 497, 23, 1533, 481, 318, 5, + 4, 29, 368, 969, 495, 9, 13, 14, 2739, 888, + 1800, 495, 495, 1905, 334, 2744, 1908, 2668, 897, 275, + 478, 434, 1471, 1442, 280, 991, 219, 1476, 495, 202, + 8, 972, 911, 11, 1509, 434, 360, 403, 16, 17, + 18, 434, 812, 922, 332, 924, 925, 364, 365, 2700, + 1016, 497, 236, 952, 953, 33, 955, 1023, 285, 952, + 953, 298, 955, 0, 2602, 168, 1007, 482, 483, 484, + 677, 486, 487, 488, 489, 490, 491, 1581, 1044, 16, + 368, 1585, 495, 1587, 450, 493, 478, 495, 1574, 497, + 364, 365, 699, 30, 1547, 268, 495, 270, 23, 36, + 488, 2687, 495, 1589, 29, 94, 290, 135, 289, 499, + 434, 431, 49, 13, 14, 403, 1653, 289, 438, 2705, + 13, 14, 729, 430, 289, 62, 495, 407, 1547, 409, + 367, 496, 2197, 2197, 2672, 2197, 1990, 1991, 1992, 1993, + 1593, 2197, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2004, 2005, 2803, 1690, 434, 1652, 367, 1654, 1655, 340, + 2361, 496, 450, 344, 499, 421, 403, 242, 340, 13, + 14, 495, 344, 159, 1593, 340, 432, 2841, 164, 344, + 1742, 170, 496, 1149, 496, 159, 457, 499, 459, 2302, + 164, 2842, 403, 374, 54, 2025, 2050, 2051, 23, 1948, + 2147, 495, 374, 2148, 29, 1171, 1822, 444, 1824, 374, + 135, 1177, 1178, 478, 170, 204, 566, 567, 219, 569, + 457, 991, 332, 407, 2134, 409, 23, 407, 169, 409, + 2816, 220, 29, 444, 215, 842, 407, 448, 409, 217, + 150, 230, 496, 2190, 481, 499, 457, 233, 204, 496, + 434, 340, 499, 860, 2146, 2986, 2148, 1223, 495, 233, + 441, 289, 36, 496, 220, 496, 499, 2931, 499, 441, + 481, 1237, 2948, 2949, 230, 264, 441, 13, 14, 2930, + 149, 55, 150, 149, 495, 360, 2950, 1253, 1923, 1924, + 1237, 150, 496, 403, 1886, 499, 282, 1236, 496, 150, + 1266, 499, 1268, 13, 14, 1271, 1272, 1894, 282, 287, + 135, 1263, 340, 1263, 496, 1281, 344, 1283, 1284, 1285, + 1286, 1287, 1288, 1289, 1263, 1263, 1263, 496, 2118, 3005, + 499, 495, 106, 198, 496, 270, 496, 499, 135, 499, + 450, 496, 36, 1309, 499, 1311, 374, 13, 14, 3013, + 1316, 1317, 1318, 1319, 1320, 1321, 1322, 13, 14, 434, + 1326, 1327, 351, 2343, 289, 1331, 2346, 13, 14, 1335, + 501, 1953, 1338, 1339, 1340, 1341, 1342, 1343, 1344, 1345, + 1346, 496, 496, 1349, 499, 499, 497, 175, 496, 496, + 1356, 499, 499, 1359, 496, 351, 1362, 499, 1277, 530, + 496, 450, 2515, 499, 13, 14, 496, 1177, 1178, 499, + 198, 496, 82, 441, 499, 1381, 461, 2165, 496, 344, + 495, 499, 496, 197, 496, 499, 496, 499, 496, 499, + 1396, 499, 1379, 496, 2635, 8, 499, 496, 11, 447, + 499, 1407, 1408, 2728, 2339, 1898, 2341, 8, 236, 374, + 11, 13, 14, 1223, 2028, 16, 17, 18, 589, 599, + 496, 601, 1948, 499, 289, 2410, 496, 145, 41, 499, + 496, 2381, 33, 499, 248, 48, 1442, 1429, 2133, 1898, + 2135, 159, 256, 2020, 495, 1451, 164, 1453, 314, 1368, + 13, 14, 289, 1942, 268, 360, 13, 14, 367, 495, + 73, 367, 290, 368, 482, 483, 484, 150, 486, 487, + 488, 489, 490, 491, 35, 340, 441, 2330, 1971, 344, + 13, 14, 36, 13, 14, 299, 1492, 13, 14, 1495, + 1496, 2344, 1498, 298, 403, 213, 1989, 403, 403, 13, + 14, 55, 495, 340, 13, 14, 1316, 344, 485, 374, + 1516, 2125, 1971, 13, 14, 233, 13, 14, 13, 14, + 2673, 1527, 2015, 13, 14, 355, 356, 1533, 2084, 2022, + 1989, 1523, 346, 355, 356, 444, 495, 374, 444, 258, + 259, 1547, 355, 356, 2166, 450, 2168, 495, 457, 2906, + 2907, 457, 106, 2046, 368, 150, 2015, 534, 535, 355, + 356, 174, 367, 2022, 282, 364, 365, 150, 1574, 924, + 925, 150, 481, 291, 388, 481, 441, 190, 2234, 407, + 2182, 409, 195, 1589, 285, 1591, 495, 1593, 342, 495, + 36, 403, 1598, 495, 231, 493, 5, 1603, 403, 495, + 577, 5, 495, 431, 441, 495, 434, 87, 2235, 89, + 495, 91, 164, 2401, 495, 495, 217, 495, 2512, 232, + 597, 495, 495, 5, 1641, 2982, 5, 495, 495, 5, + 5, 495, 1442, 1639, 1640, 1641, 495, 495, 1644, 444, + 495, 495, 495, 197, 495, 495, 1652, 1653, 1654, 1655, + 495, 9, 457, 146, 2641, 1574, 1662, 495, 458, 499, + 1666, 1580, 296, 1669, 215, 97, 499, 496, 36, 280, + 1589, 2912, 2165, 1690, 287, 164, 481, 282, 164, 1685, + 1686, 231, 496, 2198, 1690, 374, 287, 495, 414, 495, + 495, 86, 499, 414, 248, 54, 261, 54, 1704, 414, + 414, 1707, 256, 1709, 496, 414, 2165, 504, 2602, 457, + 8, 150, 430, 11, 268, 93, 497, 2506, 16, 17, + 18, 142, 270, 1729, 270, 36, 495, 495, 495, 9, + 35, 412, 412, 493, 1740, 1740, 2350, 1547, 2231, 414, + 493, 414, 414, 414, 496, 299, 453, 11, 499, 2441, + 495, 342, 494, 1759, 501, 2369, 499, 2413, 2414, 499, + 1740, 412, 1754, 504, 1754, 495, 379, 275, 1774, 1775, + 495, 414, 2231, 944, 160, 1754, 1754, 1754, 2672, 1796, + 178, 169, 495, 1593, 496, 1791, 1791, 213, 499, 377, + 286, 222, 346, 438, 307, 307, 499, 496, 36, 222, + 495, 270, 1808, 222, 291, 323, 283, 495, 450, 2302, + 495, 1791, 150, 150, 368, 36, 457, 270, 285, 1825, + 1826, 1827, 496, 478, 493, 478, 496, 285, 496, 806, + 496, 496, 496, 403, 388, 270, 36, 36, 496, 496, + 6, 169, 494, 2713, 169, 11, 496, 2635, 496, 15, + 496, 478, 496, 153, 20, 21, 22, 23, 24, 497, + 1866, 27, 454, 496, 30, 31, 479, 844, 34, 35, + 496, 496, 496, 486, 487, 488, 489, 490, 491, 496, + 499, 482, 483, 484, 496, 486, 487, 488, 489, 490, + 491, 495, 1898, 496, 414, 495, 62, 496, 495, 495, + 480, 286, 286, 286, 436, 882, 1912, 241, 444, 499, + 454, 285, 499, 1832, 270, 484, 414, 495, 150, 2412, + 198, 87, 88, 89, 90, 91, 289, 150, 150, 414, + 414, 414, 414, 277, 277, 494, 496, 36, 457, 495, + 342, 496, 1948, 283, 285, 36, 499, 1953, 2441, 150, + 141, 8, 494, 2412, 1946, 496, 494, 1876, 150, 16, + 17, 18, 1968, 275, 169, 1971, 11, 164, 496, 496, + 499, 1977, 1891, 496, 1980, 952, 953, 1983, 955, 2964, + 2506, 496, 169, 1989, 1990, 1991, 1992, 1993, 495, 287, + 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 454, 295, 496, 2009, 2010, 496, 486, 2013, 2025, 2015, + 2880, 403, 169, 481, 2020, 178, 2022, 2058, 499, 2025, + 496, 496, 2515, 495, 286, 348, 443, 150, 2034, 1948, + 84, 2037, 496, 2039, 499, 495, 1955, 173, 1957, 2056, + 2046, 2047, 1961, 1962, 2050, 2051, 496, 496, 425, 2055, + 2056, 496, 495, 36, 496, 499, 2073, 495, 1229, 79, + 1231, 494, 499, 499, 169, 2071, 2071, 2073, 2073, 438, + 405, 496, 496, 495, 220, 294, 496, 220, 496, 2085, + 496, 495, 292, 496, 495, 495, 54, 182, 1898, 145, + 496, 2071, 457, 2073, 484, 496, 496, 200, 188, 275, + 580, 275, 496, 159, 497, 2111, 497, 414, 164, 36, + 497, 2600, 414, 107, 270, 285, 497, 497, 2740, 36, + 169, 457, 2128, 2755, 2912, 497, 497, 497, 220, 484, + 497, 497, 456, 497, 86, 497, 497, 617, 8, 499, + 131, 11, 2635, 497, 497, 497, 16, 17, 18, 497, + 497, 497, 497, 334, 222, 497, 2162, 213, 497, 2165, + 2166, 1971, 2168, 33, 497, 497, 497, 497, 497, 495, + 650, 651, 652, 653, 495, 497, 2635, 233, 495, 1989, + 2673, 495, 495, 81, 482, 483, 484, 496, 486, 487, + 488, 489, 490, 491, 495, 115, 495, 36, 73, 2801, + 8, 150, 2194, 11, 496, 2015, 122, 150, 16, 17, + 18, 2704, 2022, 2845, 2707, 36, 356, 496, 356, 304, + 36, 495, 495, 499, 496, 2231, 282, 2219, 495, 2221, + 287, 325, 495, 41, 495, 291, 2046, 443, 73, 36, + 48, 187, 2248, 438, 495, 2704, 2165, 2824, 2707, 2826, + 425, 288, 67, 67, 54, 495, 499, 496, 495, 1236, + 36, 438, 374, 275, 484, 73, 1437, 246, 187, 495, + 425, 36, 2761, 2192, 288, 288, 1447, 495, 1449, 495, + 495, 1452, 496, 496, 496, 496, 1263, 1458, 358, 1460, + 2296, 2297, 2914, 268, 496, 2301, 2302, 285, 9, 2919, + 2306, 1472, 341, 2309, 2310, 200, 1477, 496, 2314, 285, + 1481, 1482, 1483, 1484, 285, 1486, 1487, 355, 496, 120, + 486, 436, 495, 33, 490, 9, 22, 493, 2334, 2334, + 2127, 496, 2338, 2338, 944, 501, 972, 597, 1759, 916, + 1424, 962, 2834, 961, 2813, 2946, 1396, 217, 1774, 2838, + 2089, 1328, 2893, 2828, 2334, 2165, 2356, 2726, 2338, 1423, + 2366, 2073, 528, 529, 530, 2325, 174, 1791, 2340, 2701, + 964, 2071, 2803, 2802, 430, 2820, 2368, 2821, 2370, 545, + 1277, 2572, 190, 1277, 2896, 1277, 2897, 195, 2394, 1277, + 1354, 2934, 1667, 1760, 1498, 1708, 1268, 2403, 564, 565, + 566, 567, 1599, 569, 1705, 2366, 2412, 565, 1743, 217, + 218, 2088, 1379, 1820, 580, 2149, 1459, 287, 2162, 2912, + 526, 2231, 1887, 589, 232, 482, 483, 484, 2916, 486, + 487, 488, 489, 490, 491, 2441, 2989, 493, 2357, 2747, + 496, 497, 2963, 2951, 978, 2658, 926, 1826, 1814, 615, + 2168, 617, 1429, 2912, 2212, 2961, 2914, 2911, 1811, 1225, + 1177, 2842, 270, 2126, 8, 273, 2371, 11, 2577, 2910, + 1380, 2204, 16, 17, 18, 1237, 1589, 2406, 2795, 287, + 1882, 1953, 2506, 2192, 650, 651, 652, 653, -1, -1, + 50, -1, 2302, 973, -1, 2487, -1, 977, 36, -1, + 2506, 67, -1, -1, -1, -1, 2512, 73, -1, 2515, + 990, -1, 2518, -1, -1, -1, -1, 55, -1, -1, + 86, 2527, 2528, -1, -1, 2531, -1, -1, -1, -1, + -1, 1011, -1, -1, -1, 95, -1, -1, 2544, 2544, + -1, -1, -1, -1, -1, -1, 1523, 2553, 2553, 115, + -1, 117, 2558, 2558, -1, 2561, 2561, -1, -1, -1, + -1, 121, 2568, 2569, 2544, 2484, -1, -1, 106, -1, + -1, 379, -1, 2553, -1, 2581, 2581, 2583, 2558, 139, + -1, 2561, -1, 143, -1, -1, -1, 2506, -1, -1, + -1, -1, -1, -1, -1, -1, 2602, -1, -1, 705, + -1, 2581, 2412, -1, -1, 165, -1, 173, 168, -1, + -1, -1, 482, 483, 484, 526, 486, 487, 488, 489, + 490, 491, -1, 183, -1, 175, -1, -1, -1, 2635, + -1, 2441, -1, -1, -1, 173, 202, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 198, -1, + 816, -1, 2571, -1, 2646, -1, -1, -1, -1, 197, + -1, -1, 2668, 2668, 1641, -1, 2672, 2673, -1, -1, + -1, 479, 1152, 217, 482, 483, 484, 2669, 486, 487, + 488, 489, 490, 491, -1, -1, 236, -1, 2668, -1, + 2696, -1, -1, -1, 2700, 2700, 2713, -1, 2704, -1, + -1, 2707, -1, 526, 270, 2515, 812, 2713, -1, 275, + 248, -1, -1, 1690, -1, 275, 2635, 883, 256, -1, + 2700, -1, 2728, 283, 1895, 2731, -1, -1, -1, -1, + 268, 1708, -1, -1, 2740, -1, -1, -1, 2744, 2745, + 290, -1, -1, 287, -1, -1, -1, 1724, -1, -1, + -1, -1, 318, -1, -1, 1235, -1, -1, -1, -1, + 926, 299, -1, 1740, -1, -1, 326, -1, 334, -1, + -1, -1, -1, -1, -1, -1, -1, 1754, 944, 945, + -1, -1, -1, -1, 2776, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 705, -1, -1, 2803, 2803, -1, + -1, -1, -1, -1, -1, -1, 972, 973, 346, 975, + 360, 977, 978, -1, 1791, -1, -1, -1, 2824, 1796, + 2826, -1, 2828, 2803, 990, 2635, 2832, -1, -1, -1, + 368, -1, -1, -1, -1, -1, 2842, 2842, -1, -1, + -1, 1007, -1, 2835, -1, 1011, -1, -1, -1, -1, + 388, 2770, -1, -1, 2860, -1, -1, 407, -1, 409, + -1, -1, 2842, 2673, -1, 431, -1, -1, -1, -1, + -1, 0, 438, -1, 2880, 425, -1, 1357, -1, -1, + -1, 431, 705, -1, 434, 991, -1, 2893, -1, -1, + -1, -1, -1, -1, 2704, -1, -1, 2707, 1378, -1, + 1380, 812, -1, -1, -1, -1, 2912, -1, 2914, 526, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 2882, -1, -1, -1, -1, 230, -1, 2298, - 2299, 2300, 2301, 2492, -1, -1, 2896, -1, -1, -1, - 1265, 893, 2902, -1, -1, -1, -1, -1, -1, 2492, - 1275, -1, 1277, 2282, -1, 1280, 1281, 1282, 1283, -1, - -1, -1, 2922, 2923, -1, 917, -1, 919, 920, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 1304, - 216, -1, 285, -1, -1, 1310, 1311, 1312, 1313, 109, - 110, -1, 2392, 1318, 1319, -1, -1, -1, 1323, -1, - -1, -1, 1327, -1, -1, 1330, 1331, 1332, 1333, 1334, - 1335, 1336, 1337, 1338, -1, -1, 1341, -1, -1, -1, - -1, 1346, 2422, -1, 1349, -1, 1351, -1, 1353, 1895, - -1, -1, -1, -1, 986, -1, -1, 989, 990, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 285, - -1, 1376, 2611, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 2392, 184, 185, -1, -1, 2611, -1, - -1, -1, -1, -1, 377, -1, -1, -1, -1, -1, - -1, -1, 1407, 1408, -1, -1, 1895, -1, 2647, -1, - -1, -1, 2492, 2422, -1, -1, 1962, -1, -1, -1, - -1, -1, -1, -1, 2647, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 1980, -1, -1, -1, -1, 2678, - -1, -1, 2681, -1, -1, -1, -1, -1, 248, 249, - 250, 251, 252, 253, -1, 2678, 256, 257, 2681, 2005, - -1, -1, -1, -1, -1, -1, 2012, -1, -1, -1, - -1, -1, -1, 1962, -1, -1, -1, -1, -1, -1, - -1, 1486, -1, 2492, 1489, 1490, -1, 1492, -1, 2035, - -1, 1980, -1, -1, 477, -1, -1, -1, -1, -1, - -1, 484, 485, 486, 487, 488, 489, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 2005, -1, 1523, -1, - -1, -1, -1, 2012, -1, -1, -1, -1, -1, -1, - -1, 2611, -1, -1, -1, -1, 2585, -1, 1170, -1, - -1, -1, -1, -1, -1, -1, 2035, -1, -1, 1181, - -1, 1183, -1, -1, -1, -1, -1, -1, -1, -1, - 1192, -1, 362, 363, 480, 481, 482, 2647, 484, 485, - 486, 487, 488, 489, -1, -1, -1, 1209, -1, -1, - 1585, -1, -1, -1, -1, -1, -1, 1592, -1, -1, - 2639, -1, 1597, -1, -1, -1, -1, -1, 2678, -1, - -1, 2681, 2611, -1, 1236, 1237, -1, -1, 2154, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 1635, -1, -1, -1, -1, -1, 1268, 1269, 2647, -1, - 1272, 1273, 1647, -1, 1649, 1650, -1, 2886, -1, -1, - -1, -1, 1657, -1, -1, -1, 1661, -1, -1, 1664, - 0, 2710, -1, 2886, -1, 2154, -1, 2213, -1, 2678, - -1, -1, 2681, 473, 474, -1, -1, -1, -1, 19, + -1, -1, -1, -1, 2930, 2930, -1, 2933, 2934, -1, + -1, 2923, -1, -1, -1, -1, -1, -1, 482, 483, + 484, 1421, 486, 487, 488, 489, 490, 491, -1, -1, + 2930, -1, -1, -1, -1, -1, -1, -1, 2129, -1, + -1, -1, 2968, -1, 93, -1, -1, -1, -1, 1946, + -1, -1, -1, -1, -1, -1, -1, -1, 1144, -1, + -1, -1, -1, 2154, -1, -1, 1152, -1, -1, 812, + -1, -1, -1, 2912, -1, 1161, -1, -1, 2169, 2170, + 2171, 2172, 2173, 2174, 2175, 2176, 2177, 2178, 3014, -1, + -1, -1, -1, -1, -1, -1, 145, -1, -1, -1, + -1, -1, -1, -1, 1190, -1, 1506, 1507, -1, -1, + 159, -1, -1, -1, -1, 164, -1, -1, -1, -1, + 169, -1, -1, -1, -1, -1, -1, -1, 2025, 178, + -1, -1, -1, 182, -1, -1, -1, -1, -1, 1225, + 1226, -1, 1228, 1229, -1, 1231, 1232, -1, -1, 1235, + -1, 1177, 1178, -1, -1, -1, -1, -1, -1, 2056, + 991, -1, -1, -1, 213, -1, -1, -1, 705, -1, + -1, -1, -1, -1, 2071, -1, 2073, -1, -1, -1, + -1, -1, 2912, -1, 233, -1, -1, -1, -1, -1, + 0, -1, -1, -1, -1, 2286, 1282, 1223, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 1293, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, - -1, 31, 32, 1698, -1, -1, 1701, 2746, 1703, -1, - -1, -1, -1, -1, -1, -1, -1, 47, -1, -1, - -1, -1, -1, -1, -1, -1, 56, -1, -1, -1, - -1, -1, -1, -1, 2213, -1, -1, -1, 68, -1, - -1, -1, -1, -1, -1, -1, 2282, -1, -1, 79, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 31, 32, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 282, -1, -1, 285, 47, -1, 1325, + -1, -1, 291, -1, -1, -1, 56, -1, 991, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 68, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, + 1356, 1357, -1, -1, -1, 812, 325, -1, -1, -1, -1, 91, -1, 93, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 1769, -1, -1, -1, -1, -1, - -1, 111, -1, -1, -1, 1407, 1408, -1, -1, 1784, - 1785, -1, -1, -1, -1, 125, -1, -1, -1, -1, - -1, -1, 894, 2282, -1, 135, -1, -1, 1803, -1, - -1, 141, -1, -1, -1, -1, 2886, -1, -1, 149, - -1, 151, 152, -1, -1, -1, -1, -1, 21, -1, - -1, -1, -1, -1, 164, -1, -1, 1459, -1, -1, - -1, -1, 934, -1, -1, -1, -1, 1469, -1, -1, - 1472, 8, -1, -1, 11, -1, 2392, -1, -1, 16, - 17, 18, -1, 193, -1, -1, 1861, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 208, -1, - -1, 74, -1, -1, 41, -1, 2422, 2886, -1, -1, - -1, 48, -1, -1, -1, -1, -1, 90, -1, -1, - -1, 8, -1, 233, 11, -1, -1, -1, -1, 16, - 17, 18, -1, 2392, -1, -1, 73, -1, -1, -1, - -1, -1, 1544, 1545, -1, -1, 33, -1, -1, -1, - -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, - -1, 48, -1, 2422, -1, -1, -1, -1, 1570, -1, - 1042, 144, -1, -1, -1, -1, 2492, 1049, -1, -1, - 153, 1583, -1, -1, 1959, -1, 73, -1, -1, -1, - -1, -1, 165, 1968, -1, -1, 1971, 170, -1, 1974, - 310, -1, -1, 313, 3, -1, -1, -1, -1, 8, - -1, -1, 11, -1, -1, -1, -1, 16, 17, 18, - -1, -1, -1, -1, 197, 2000, 2001, -1, -1, -1, - -1, -1, 342, 2492, 33, -1, 173, 36, -1, 2014, - -1, 351, 41, -1, -1, -1, -1, -1, 2023, 48, - -1, 2026, 189, 2028, -1, 365, -1, 194, -1, -1, - -1, 2036, 372, -1, -1, -1, 376, -1, 241, 2044, - 2045, -1, 245, -1, 73, -1, 386, -1, -1, 216, - 217, -1, -1, -1, -1, -1, 173, 397, -1, -1, - -1, 401, -1, 230, -1, 2611, -1, -1, 2073, -1, - -1, -1, 189, -1, -1, -1, -1, 194, 2083, -1, + 1316, -1, 1378, -1, 1380, -1, -1, 2194, -1, 348, + -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 125, -1, 0, -1, -1, + -1, -1, 2219, -1, 2221, 135, -1, -1, -1, -1, + -1, 141, -1, -1, 1734, 1421, -1, -1, -1, 149, + -1, 151, 152, -1, 1430, 1431, 1177, 1178, -1, -1, + 1436, 1437, -1, -1, 403, 165, -1, -1, -1, -1, + -1, 1447, 1448, 1449, 1450, -1, 1452, -1, -1, -1, + -1, -1, 1458, -1, 1460, -1, -1, -1, -1, -1, + -1, 430, -1, -1, 194, 1471, 1472, -1, -1, 438, + 1476, 1477, 1223, -1, -1, 1481, 1482, 1483, 1484, 209, + 1486, 1487, -1, -1, -1, 454, -1, 456, 457, -1, + 93, -1, -1, -1, -1, -1, 1442, -1, -1, -1, + 1506, 1507, 1508, -1, -1, 235, -1, -1, -1, -1, + -1, -1, -1, -1, 1177, 1178, -1, 2334, 1524, -1, + -1, 2338, -1, -1, 493, -1, -1, 496, 497, 498, + -1, -1, -1, -1, 991, -1, -1, -1, -1, -1, + -1, -1, 145, -1, -1, -1, -1, -1, -1, -1, + -1, 2368, -1, 2370, -1, -1, 159, -1, 526, -1, + 1223, 164, -1, 1883, -1, 1316, 169, -1, -1, -1, + -1, -1, -1, 1893, 1894, 178, -1, 1897, -1, 182, + -1, -1, 312, -1, -1, 315, -1, -1, -1, -1, + 2601, -1, -1, -1, 1914, -1, -1, -1, -1, -1, + -1, 1547, -1, 8, -1, -1, 11, -1, -1, -1, + 213, 16, 17, 18, 344, -1, -1, -1, -1, -1, + -1, -1, -1, 353, 1944, 2636, 2637, -1, -1, -1, + 233, -1, 8, -1, -1, 11, -1, 367, -1, -1, + -1, 2652, -1, -1, 374, -1, -1, 1593, 378, -1, + -1, -1, -1, 1316, 1660, -1, -1, -1, 388, -1, + -1, 1667, -1, -1, -1, 41, -1, -1, -1, 399, + 2487, -1, 48, 403, -1, -1, -1, -1, -1, 282, + -1, -1, 285, -1, -1, 36, -1, -1, 291, -1, + -1, 1442, -1, -1, -1, -1, 1702, 73, -1, -1, + -1, -1, -1, -1, 55, -1, -1, -1, -1, 439, + -1, -1, -1, -1, 444, -1, -1, -1, -1, 2730, + 1177, 1178, 325, -1, -1, -1, -1, 457, 1734, -1, + -1, -1, -1, -1, 1740, -1, 2553, 705, -1, -1, + -1, 2558, -1, -1, 2561, 348, 2757, -1, 2068, 2069, + 2070, 481, -1, -1, -1, 106, 107, -1, -1, -1, + 3, -1, 5, -1, 115, 495, 1223, 143, 498, 8, + -1, -1, 11, -1, -1, -1, -1, -1, -1, 1442, + -1, -1, -1, -1, -1, 1791, -1, 1793, 2108, -1, + 1796, -1, -1, 1799, -1, -1, 1547, -1, 174, -1, + 403, -1, 41, -1, -1, -1, -1, -1, -1, 48, + 1816, -1, 217, -1, 190, -1, -1, -1, -1, 195, + -1, -1, 173, -1, -1, -1, -1, 430, -1, 2646, + -1, -1, -1, -1, 73, 438, -1, -1, -1, -1, + -1, -1, 1593, -1, 812, -1, 197, -1, -1, -1, + -1, 454, 2669, 456, 457, -1, 232, -1, -1, 1316, + -1, -1, -1, -1, -1, -1, 109, 110, -1, -1, + -1, -1, 1878, -1, -1, -1, -1, 1883, -1, 2199, + -1, -1, 287, 2700, 1547, -1, 1892, 1893, 1894, 1895, + 493, 1897, -1, 496, 497, 498, 2713, 248, -1, -1, + -1, -1, -1, -1, 143, 256, -1, -1, 1914, -1, + -1, 287, -1, -1, -1, 2235, -1, 268, -1, 270, + 1926, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 1593, -1, -1, -1, -1, 174, 1942, -1, 1944, -1, + -1, -1, 185, 186, -1, -1, -1, -1, 299, -1, + -1, 190, 1898, 1959, 1960, -1, 195, -1, -1, 2776, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 2099, -1, -1, 437, -1, 216, - 217, 2647, 442, -1, 271, 308, -1, -1, -1, 1741, - -1, -1, -1, 230, -1, 455, -1, -1, 285, 322, - -1, -1, 2611, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 2678, -1, -1, 2681, -1, -1, -1, 479, - -1, -1, 1774, 1775, 173, -1, -1, -1, -1, -1, - -1, 268, 355, 493, 271, 358, 496, -1, 2647, -1, - 189, 1263, -1, 366, -1, 194, 369, -1, 285, -1, - -1, 288, 1274, -1, -1, -1, 1278, -1, -1, -1, - -1, -1, 1284, 1285, 1286, 388, -1, 216, 217, 2678, - -1, 1293, 2681, -1, -1, -1, -1, -1, 401, -1, - -1, 230, -1, -1, -1, 408, -1, -1, -1, -1, - 377, -1, -1, -1, 417, -1, -1, -1, -1, -1, - 423, -1, -1, -1, -1, 2230, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 268, - -1, -1, 271, -1, -1, 448, 1348, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 285, -1, 8, 288, - 377, 11, -1, -1, -1, -1, 16, 17, 18, -1, - -1, 2276, 2277, -1, -1, -1, 2281, -1, -1, -1, - 1912, 2286, -1, 33, 2289, 2290, 36, -1, -1, 2294, - 1392, 41, -1, -1, -1, -1, -1, -1, 48, -1, - -1, -1, -1, -1, 1406, -1, -1, -1, -1, 1411, - 477, -1, -1, 480, 481, 482, -1, 484, 485, 486, - 487, 488, 489, 73, 23, -1, -1, -1, -1, -1, - 29, -1, -1, -1, -1, -1, 2341, 36, -1, -1, - 2886, -1, -1, -1, -1, -1, -1, -1, 377, -1, - -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, - 477, -1, -1, 480, 481, 482, -1, 484, 485, 486, - 487, 488, 489, -1, -1, -1, -1, -1, 2383, -1, - 497, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 2886, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 106, -1, -1, + -1, -1, -1, -1, -1, -1, 1982, -1, -1, -1, + -1, -1, -1, -1, -1, 1442, -1, -1, -1, -1, + -1, -1, -1, 232, -1, 346, -1, 2317, 2318, 2319, + 2320, -1, -1, 379, -1, -1, -1, 250, 251, 252, + 253, 254, 255, -1, -1, 258, 259, 368, 2835, -1, + -1, -1, -1, 991, -1, 1971, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 388, -1, 390, + -1, -1, 393, 1989, -1, -1, -1, -1, 287, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 173, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 135, -1, -1, 189, - -1, -1, -1, -1, 194, -1, -1, -1, 477, -1, - -1, 480, 481, 482, -1, 484, 485, 486, 487, 488, - 489, -1, -1, -1, -1, -1, 216, 217, -1, -1, + -1, -1, 2068, 2069, 2070, 2071, -1, 2073, 2074, 2015, + -1, -1, -1, 2079, 2080, -1, 2022, 482, 483, 484, + -1, 486, 487, 488, 489, 490, 491, -1, -1, -1, + 1547, -1, -1, -1, 564, 565, -1, -1, -1, -1, + 2046, -1, 2108, 479, -1, -1, 2923, -1, -1, 803, + 486, 487, 488, 489, 490, 491, 810, -1, -1, -1, + 2126, 364, 365, 2129, 109, 110, -1, 2133, 2134, 2135, + -1, 2137, -1, -1, -1, -1, 1593, -1, -1, -1, + 379, -1, -1, -1, 495, -1, -1, 1898, 2154, -1, + 2156, -1, -1, -1, -1, -1, -1, 627, 628, -1, + -1, -1, -1, 2169, 2170, 2171, 2172, 2173, 2174, 2175, + 2176, 2177, 2178, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 2195, + -1, -1, -1, 2199, -1, -1, -1, -1, -1, -1, + 185, 186, -1, 897, -1, -1, 2212, -1, -1, 1177, + 1178, -1, -1, -1, -1, -1, -1, 2223, -1, 2165, + 1971, -1, -1, -1, -1, -1, -1, -1, 922, 2235, + 924, 925, 475, 476, -1, 1898, 2242, -1, 1989, -1, + 479, -1, -1, -1, -1, -1, -1, 486, 487, 488, + 489, 490, 491, -1, -1, 1223, -1, -1, -1, -1, + -1, -1, -1, -1, 2015, 250, 251, 252, 253, 254, + 255, 2022, -1, 258, 259, -1, -1, -1, -1, -1, + 2286, -1, -1, -1, -1, 2231, 2292, -1, -1, 2609, + -1, -1, -1, -1, -1, 2046, -1, -1, 992, -1, + -1, 995, 996, -1, -1, -1, -1, -1, 1971, 2315, + -1, 2317, 2318, 2319, 2320, -1, -1, -1, 2324, 2325, + -1, 2327, -1, -1, 2330, -1, 1989, 2647, 2334, -1, + -1, -1, 2338, -1, -1, -1, -1, -1, 2344, -1, + -1, 811, -1, -1, -1, 2665, -1, -1, 1316, -1, + -1, -1, 2015, -1, -1, 2361, 2302, -1, 828, 2022, + 2366, -1, -1, -1, -1, 2371, -1, -1, -1, 2375, + -1, -1, -1, -1, -1, 2381, -1, 109, 110, 364, + 365, 2387, -1, 2046, -1, -1, -1, 857, -1, 23, + -1, -1, -1, -1, -1, 29, -1, -1, -1, -1, + -1, 2407, 36, -1, -1, -1, -1, 877, 878, 879, + -1, -1, 882, -1, 2165, -1, -1, -1, 2738, -1, + -1, 55, -1, -1, -1, 23, -1, -1, -1, -1, + -1, 29, -1, -1, -1, 905, -1, -1, 36, -1, + -1, 1898, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 185, 186, 2775, -1, 55, -1, -1, + -1, -1, -1, -1, -1, -1, 2412, -1, -1, -1, + 2476, -1, 106, -1, 1442, -1, -1, -1, -1, -1, + 2231, 1175, 2488, -1, 954, -1, -1, -1, 958, 959, + 475, 476, 1186, 2499, 1188, 2441, -1, -1, -1, 1193, + -1, 135, 2165, -1, -1, -1, -1, -1, 106, -1, + 495, -1, -1, -1, 1971, -1, 1210, -1, 250, 251, + 252, 253, 254, 255, -1, -1, 258, 259, -1, 2535, + -1, -1, 1989, -1, -1, -1, -1, 135, 2544, 2545, + -1, -1, 2548, -1, -1, 2551, 1016, 2553, 1242, 1243, + -1, 2302, 2558, 1023, -1, 2561, -1, 2563, 2015, -1, + 2566, -1, -1, 197, -1, 2022, -1, -1, 2231, 2515, + -1, -1, -1, -1, 1044, 2581, -1, -1, -1, 1547, + 1274, 1275, -1, -1, 1278, 1279, -1, -1, -1, 2046, + -1, -1, -1, -1, 2600, 2601, -1, -1, -1, 197, + -1, -1, -1, 2609, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 248, -1, -1, -1, -1, -1, + -1, -1, 256, -1, -1, 1593, -1, -1, -1, -1, + 2636, 2637, 364, 365, 268, -1, -1, -1, -1, 2302, + -1, 2647, -1, 2649, -1, -1, 2652, -1, -1, -1, + 248, -1, -1, -1, -1, 289, -1, -1, 256, 2665, + -1, 2412, 2668, -1, -1, 299, -1, -1, -1, -1, + 268, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 2687, -1, -1, -1, -1, -1, -1, -1, 2635, + 2441, 289, -1, -1, 2700, -1, -1, -1, -1, 2705, + -1, 299, -1, -1, -1, -1, 340, -1, 2165, -1, + 344, -1, 346, 1407, 1408, -1, -1, 2723, -1, -1, + -1, -1, 2728, -1, 2730, -1, -1, 2673, -1, -1, + -1, -1, 2738, -1, 368, -1, -1, -1, -1, -1, + 374, -1, 340, 475, 476, -1, 344, -1, 346, 2412, + -1, 2757, -1, -1, 388, 2761, -1, -1, 2704, -1, + -1, 2707, -1, -1, 2515, -1, -1, -1, -1, 2775, + 368, 1465, -1, -1, 2231, -1, 374, -1, 2441, -1, + -1, 1475, -1, -1, 1478, -1, -1, -1, -1, -1, + 388, -1, -1, -1, -1, -1, -1, 2803, 0, -1, + -1, 1271, -1, -1, -1, -1, 2812, 441, -1, -1, + 2816, 1281, -1, 1283, 2820, -1, 1286, 1287, 1288, 1289, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 230, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 2496, -1, 1595, -1, -1, -1, 196, -1, 2504, - 2505, -1, -1, 2508, -1, -1, -1, -1, -1, -1, - -1, -1, 1614, -1, -1, -1, -1, -1, 268, -1, - -1, 271, 2154, -1, -1, -1, -1, -1, -1, 1631, - -1, 1633, 1634, -1, 1636, 285, 1638, -1, 288, 2544, - 2545, 1643, -1, -1, 1646, -1, -1, 246, -1, 1651, - -1, -1, 1654, 2558, -1, 254, -1, -1, -1, -1, - -1, -1, -1, -1, 1666, -1, -1, 266, 1670, 1671, - 1672, 1673, -1, -1, -1, -1, -1, 1679, 1680, -1, - 1682, 1683, -1, -1, -1, -1, -1, -1, 287, -1, - -1, -1, 1694, -1, -1, 1697, -1, -1, 297, -1, - -1, -1, -1, 1705, 1706, 1707, 1708, 1709, 1710, 1711, - 1712, 1713, 1714, -1, -1, -1, -1, -1, -1, -1, - 1722, -1, -1, -1, 1726, -1, -1, 377, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 338, - -1, -1, -1, 342, 8, 344, 1748, 11, -1, -1, - -1, -1, 16, 17, 18, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 2670, -1, 366, -1, 33, - -1, -1, -1, 372, -1, -1, -1, 41, -1, -1, - -1, -1, 2687, -1, 48, -1, -1, 386, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 2702, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, - -1, -1, 2717, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 477, -1, -1, - 480, 481, 482, -1, 484, 485, 486, 487, 488, 489, - 439, -1, -1, -1, 494, -1, -1, -1, -1, 2381, - -1, -1, -1, -1, 2386, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 1866, 1867, 1868, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 2799, -1, 2428, 2429, 2803, -1, - -1, -1, 1904, -1, -1, -1, -1, -1, -1, 173, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 189, 2831, -1, -1, -1, - 194, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 2851, 2852, -1, -1, - -1, -1, 216, 217, -1, -1, 1958, -1, -1, -1, - 2865, -1, 1964, -1, -1, -1, 230, -1, -1, -1, - -1, -1, -1, -1, -1, 1977, 1978, 1979, -1, 1981, - 1982, 1983, 1984, -1, -1, 1987, 1988, 1989, 1990, 1991, - 1992, 1993, 1994, 1995, 1996, 1997, -1, -1, -1, 2904, - -1, -1, -1, -1, 268, -1, -1, 271, -1, -1, - -1, -1, -1, 2015, -1, -1, 2018, -1, 2020, -1, - -1, 285, 2024, 2025, 288, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 2038, 2039, 2040, 2041, - -1, 2043, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 2971, -1, 2600, 2601, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 2611, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 8, -1, -1, 11, -1, -1, -1, - -1, 16, 17, 18, -1, -1, -1, -1, -1, -1, - -1, -1, 8, 377, -1, 11, 2118, -1, 33, -1, - 16, 17, 18, -1, -1, -1, 41, -1, -1, -1, - -1, -1, -1, 48, -1, -1, -1, 33, 8, -1, - -1, 11, -1, -1, -1, 41, 16, 17, 18, -1, - -1, -1, 48, -1, -1, -1, -1, -1, 73, -1, - -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, - -1, 41, -1, -1, -1, -1, -1, 73, 48, -1, + -1, -1, 2838, 2839, 2840, -1, 2842, -1, -1, -1, + -1, 1311, -1, 441, -1, 2302, -1, 1317, 1318, 1319, + 1320, 1321, 2515, -1, 1548, 1549, 1326, 1327, -1, -1, + -1, 1331, -1, 2869, -1, 1335, -1, -1, 1338, 1339, + 1340, 1341, 1342, 1343, 1344, 1345, 1346, -1, 2884, 1349, + 1574, -1, -1, -1, 2635, -1, 1356, -1, -1, 1359, + 2896, 93, -1, -1, -1, 1589, -1, -1, -1, -1, + -1, -1, -1, -1, 2910, -1, -1, -1, -1, -1, + -1, 1381, -1, -1, -1, -1, -1, -1, 2924, -1, + -1, -1, 2673, -1, 2930, -1, -1, -1, -1, -1, + 1898, -1, -1, -1, -1, -1, -1, 1407, 1408, -1, + 2946, 2947, -1, 145, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 2704, -1, 2412, 2707, 159, -1, -1, + -1, -1, 164, -1, -1, -1, 2912, 169, -1, -1, + -1, -1, 2635, -1, -1, -1, 178, -1, -1, -1, + 182, -1, -1, -1, 2441, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 1971, -1, -1, -1, -1, -1, -1, + 2673, 213, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 1989, 1492, -1, -1, 1495, 1496, -1, 1498, -1, + -1, 233, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 2704, -1, -1, 2707, -1, -1, 2015, -1, -1, + -1, 1745, -1, -1, 2022, -1, -1, 1527, 2515, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 477, -1, -1, 480, 481, 482, -1, - 484, 485, 486, 487, 488, 489, -1, -1, -1, 2231, - 494, -1, -1, 2235, 2236, 8, 2238, -1, 11, 2241, - 2242, 2243, 2244, 16, 17, 18, 2248, 2249, 2250, 2251, - 2252, 2253, 2254, 2255, 2256, 2257, 2258, 2259, 173, -1, - -1, -1, -1, -1, -1, -1, -1, 2269, 41, -1, - -1, -1, -1, 2275, 189, 48, 2278, 173, 2280, 194, - -1, -1, 2284, -1, -1, 2287, 2288, -1, -1, 2291, - 2292, -1, -1, 189, -1, -1, -1, -1, 194, -1, - 73, 216, 217, 173, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 230, -1, -1, -1, 189, - 216, 217, -1, -1, 194, -1, -1, -1, -1, -1, - 2332, -1, -1, -1, 230, -1, -1, -1, 2340, -1, - -1, -1, -1, -1, -1, -1, 216, 217, -1, -1, - -1, 2353, -1, 268, 2886, -1, 271, -1, -1, -1, - 230, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 285, -1, 268, 288, -1, 271, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 285, - -1, -1, 288, -1, -1, -1, -1, -1, 268, -1, - 173, 271, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 285, 189, -1, 288, -1, - -1, 194, -1, -1, -1, -1, -1, -1, -1, -1, + 1764, 1765, -1, -1, -1, -1, -1, -1, 2046, -1, + 282, -1, -1, 285, -1, -1, -1, -1, -1, 291, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 230, -1, -1, - -1, -1, 377, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 377, -1, 2485, -1, -1, -1, 2489, -1, -1, - -1, -1, -1, -1, -1, -1, 2498, 2499, 2500, -1, - -1, 2503, -1, -1, 2506, 2507, -1, 377, -1, 2511, - -1, -1, 285, -1, -1, -1, -1, -1, -1, -1, + -1, 1591, -1, 325, -1, -1, -1, -1, 1598, -1, + -1, -1, -1, 1603, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 348, -1, 8, -1, + -1, 11, -1, -1, -1, 15, 16, 17, 18, -1, + -1, 2912, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 1641, -1, 33, -1, -1, -1, -1, 2635, 898, + -1, 41, 1652, -1, 1654, 1655, -1, -1, 48, -1, + -1, -1, 1662, -1, -1, -1, 1666, 2165, -1, 1669, + -1, 403, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 73, -1, -1, 2673, -1, -1, -1, + 939, -1, -1, -1, -1, -1, 1920, -1, 430, -1, + -1, -1, -1, -1, 1704, -1, 438, 1707, -1, 1709, + -1, -1, -1, -1, -1, -1, -1, 2704, -1, 2912, + 2707, -1, 454, -1, 456, 457, -1, -1, -1, -1, + -1, -1, -1, 2231, -1, -1, -1, 8, -1, -1, + 11, -1, -1, -1, 15, 16, 17, 18, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 1759, + -1, 493, 33, -1, 496, 497, 498, -1, -1, -1, + 41, -1, -1, -1, 1774, 1775, -1, 48, -1, -1, + -1, -1, -1, 8, 174, -1, 11, -1, -1, -1, + -1, 16, 17, 18, -1, -1, -1, -1, -1, 1048, + 190, -1, 73, -1, 2302, 195, 1055, -1, 1808, -1, + -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, + -1, -1, -1, 48, -1, -1, -1, 217, 218, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 232, -1, -1, -1, -1, -1, 73, -1, + -1, -1, -1, -1, -1, -1, -1, 3, -1, -1, + -1, -1, 8, -1, -1, 11, 1866, -1, -1, 15, + 16, 17, 18, -1, -1, -1, -1, -1, -1, -1, + 270, -1, -1, 273, -1, -1, -1, 33, -1, -1, + 36, -1, -1, -1, -1, 41, -1, 287, -1, -1, + 290, -1, 48, 174, -1, -1, -1, -1, -1, -1, + -1, -1, 1912, -1, 2412, -1, -1, -1, -1, 190, + -1, -1, -1, -1, 195, 2912, -1, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 2165, -1, 2441, -1, -1, 217, 218, -1, 174, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 232, -1, -1, -1, 190, -1, -1, 1968, -1, + 195, -1, -1, -1, -1, -1, -1, 1977, -1, -1, + 1980, -1, -1, 1983, -1, -1, -1, -1, -1, 379, + -1, -1, 217, 218, -1, -1, -1, -1, -1, 270, + -1, -1, 273, -1, -1, 8, -1, 232, 11, 2009, + 2010, -1, -1, 2013, -1, -1, 287, 2515, -1, 290, + 1269, -1, -1, -1, -1, 2025, -1, -1, 174, -1, + -1, 1280, -1, -1, 2034, 1284, -1, 2037, 41, 2039, + -1, 1290, 1291, 1292, 190, 48, -1, 2047, 273, 195, + 1299, -1, -1, -1, -1, 2055, 2056, -1, -1, -1, + -1, -1, 287, -1, -1, -1, -1, -1, -1, -1, + 73, 217, 218, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 2085, 232, -1, -1, 479, + -1, -1, 482, 483, 484, -1, 486, 487, 488, 489, + 490, 491, -1, -1, -1, -1, 1355, -1, 379, 499, + -1, 2111, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 270, -1, -1, 273, 2128, -1, + -1, -1, -1, -1, -1, -1, 8, 2635, -1, 11, + 143, 287, -1, 1392, 290, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 379, -1, -1, 1406, -1, -1, + -1, -1, 1411, -1, -1, -1, -1, -1, -1, 41, + -1, 174, -1, -1, -1, 2673, 48, 2401, -1, -1, + -1, -1, 2406, -1, -1, -1, -1, 190, -1, -1, + -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, + -1, 73, -1, -1, -1, -1, 2704, -1, 479, 2707, + -1, 482, 483, 484, -1, 486, 487, 488, 489, 490, + 491, -1, -1, 2447, 2448, 496, -1, -1, -1, 232, + -1, -1, -1, 379, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 2248, -1, + -1, -1, -1, -1, 479, -1, -1, 482, 483, 484, + -1, 486, 487, 488, 489, 490, 491, -1, -1, -1, + -1, 143, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 287, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 2296, 2297, -1, -1, + -1, 2301, 174, -1, -1, -1, 2306, -1, -1, 2309, + 2310, -1, -1, -1, 2314, -1, -1, -1, 190, -1, + -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 479, -1, -1, 482, 483, 484, -1, + 486, 487, 488, 489, 490, 491, -1, -1, -1, -1, + -1, -1, 1601, -1, -1, -1, -1, -1, -1, -1, + 232, -1, -1, -1, -1, -1, 2366, -1, -1, -1, + -1, 1620, -1, -1, -1, -1, 379, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 1637, -1, + 1639, 1640, -1, 1642, -1, 1644, -1, -1, -1, 1648, + 2624, 2625, 1651, 2403, -1, -1, -1, 1656, -1, -1, + 1659, 2635, -1, -1, 2912, 287, -1, -1, -1, -1, + -1, -1, 1671, -1, -1, -1, 1675, 1676, 1677, 1678, + 1679, -1, -1, -1, -1, -1, 1685, 1686, -1, 1688, + 1689, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 1700, -1, -1, 1703, -1, -1, -1, -1, -1, + -1, -1, 1711, 1712, 1713, 1714, 1715, 1716, 1717, 1718, + 1719, 1720, -1, -1, -1, -1, 479, -1, -1, -1, + -1, -1, -1, 486, 487, 488, 489, 490, 491, -1, + -1, -1, -1, -1, -1, -1, 8, -1, -1, 11, + -1, -1, -1, 1752, -1, -1, -1, 379, -1, -1, + -1, -1, -1, -1, -1, -1, 8, -1, 2518, 11, + -1, -1, -1, 15, 16, 17, 18, 2527, 2528, 41, + -1, 2531, -1, -1, -1, -1, 48, -1, -1, -1, + -1, 33, -1, -1, -1, -1, -1, -1, -1, 41, + -1, -1, -1, -1, -1, -1, 48, -1, -1, -1, + -1, 73, -1, -1, -1, -1, -1, -1, 2568, 2569, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 477, -1, -1, 480, 481, 482, -1, 484, - 485, 486, 487, 488, 489, -1, 2578, -1, -1, 494, - -1, 477, -1, -1, 480, 481, 482, -1, 484, 485, - 486, 487, 488, 489, -1, 2597, -1, -1, 494, -1, - -1, -1, -1, -1, 377, -1, -1, 477, -1, -1, - 480, 481, 482, -1, 484, 485, 486, 487, 488, 489, - -1, -1, -1, -1, 494, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 2645, 2646, -1, -1, -1, -1, 2651, - 2652, 2653, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 73, -1, 2583, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 2694, 2695, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 477, -1, 2708, 480, 481, 482, - -1, 484, 485, 486, 487, 488, 489, -1, 2720, -1, + -1, 8, -1, -1, 11, -1, -1, 479, 15, 16, + 17, 18, -1, -1, 486, 487, 488, 489, 490, 491, + -1, -1, 1871, 1872, 1873, -1, 33, -1, -1, 36, + 8, 143, -1, 11, 41, -1, -1, 15, 16, 17, + 18, 48, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 33, -1, -1, -1, -1, + -1, -1, 174, 41, 8, -1, 73, 11, -1, -1, + 48, 15, 16, 17, 18, -1, -1, -1, 190, -1, + -1, -1, 174, 195, -1, -1, -1, -1, 2912, 33, + -1, -1, -1, -1, -1, 73, 2696, 41, 190, -1, + -1, -1, -1, 195, 48, -1, -1, -1, -1, -1, + -1, -1, -1, 2713, -1, -1, -1, -1, 1967, -1, + 232, -1, -1, -1, 1973, 217, 218, -1, 2728, 73, + -1, 2731, -1, -1, -1, -1, -1, 1986, 1987, 1988, + 232, 1990, 1991, 1992, 1993, 2745, -1, 1996, 1997, 1998, + 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 174, -1, -1, + -1, -1, -1, -1, -1, 287, -1, 2026, 270, -1, + 2029, 273, 2031, 190, -1, -1, 2035, 2036, 195, -1, + -1, -1, -1, -1, -1, 287, 174, -1, 290, -1, + 2049, 2050, 2051, 2052, -1, 2054, -1, -1, -1, -1, + 217, 218, 190, -1, -1, -1, -1, 195, -1, -1, + -1, -1, -1, -1, -1, 232, -1, -1, 2828, -1, + 174, -1, 2832, -1, -1, -1, -1, -1, -1, 217, + 218, -1, -1, -1, -1, -1, 190, -1, -1, 8, + -1, 195, 11, -1, 232, -1, -1, 16, 17, 18, + 2860, -1, -1, 270, -1, -1, 273, 379, -1, -1, + -1, -1, -1, 217, 218, -1, -1, -1, -1, -1, + 287, 2130, 41, 290, -1, -1, -1, 379, 232, 48, + -1, -1, 270, 2893, -1, 273, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 287, + -1, -1, 290, -1, 73, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 270, -1, -1, 273, + -1, -1, -1, 2933, 2934, -1, -1, -1, -1, -1, + -1, -1, -1, 287, -1, -1, 290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 479, 2968, -1, + -1, -1, 379, 2222, 486, 487, 488, 489, 490, 491, + -1, -1, -1, -1, -1, -1, -1, 479, -1, -1, + 482, 483, 484, -1, 486, 487, 488, 489, 490, 491, + 2249, 379, 494, -1, 2253, 2254, -1, 2256, -1, -1, + 2259, 2260, 2261, 2262, 3014, 174, -1, 2266, 2267, 2268, + 2269, 2270, 2271, 2272, 2273, 2274, 2275, 2276, 2277, -1, + -1, 190, -1, -1, 8, 379, 195, 11, -1, 2288, + -1, -1, -1, -1, -1, -1, 2295, -1, -1, 2298, + -1, 2300, -1, -1, -1, 2304, -1, -1, 2307, 2308, + -1, -1, 2311, 2312, -1, -1, -1, 41, -1, -1, + -1, -1, 479, 232, 48, 482, 483, 484, -1, 486, + 487, 488, 489, 490, 491, -1, -1, -1, -1, 496, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, + -1, 479, 2351, -1, 482, 483, 484, -1, 486, 487, + 488, 489, 490, 491, -1, -1, 2365, -1, 496, -1, + -1, 21, -1, -1, -1, -1, -1, -1, 287, 2378, + -1, -1, -1, -1, -1, 479, -1, -1, 482, 483, + 484, -1, 486, 487, 488, 489, 490, 491, -1, -1, + -1, -1, 496, 8, -1, -1, 11, -1, -1, -1, + 15, 16, 17, 18, -1, -1, -1, -1, -1, 143, + -1, -1, -1, -1, 74, -1, -1, -1, 33, -1, + -1, -1, 37, -1, -1, -1, 41, -1, -1, -1, + 90, -1, -1, 48, -1, -1, -1, -1, -1, -1, + 174, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 190, -1, 73, -1, + 379, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 144, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 154, -1, -1, -1, 232, 2508, + -1, -1, -1, 2512, -1, -1, 166, -1, -1, 124, + -1, 171, 2521, 2522, 2523, -1, -1, 2526, -1, -1, + 2529, 2530, -1, -1, -1, 2534, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 198, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 287, -1, -1, -1, -1, -1, 174, + 479, -1, -1, 482, 483, 484, -1, 486, 487, 488, + 489, 490, 491, -1, -1, 190, -1, -1, -1, -1, + 195, -1, -1, 243, -1, -1, -1, 247, -1, -1, + -1, -1, -1, 2602, -1, -1, -1, -1, -1, -1, + -1, -1, 217, 218, -1, -1, -1, -1, -1, -1, + -1, -1, 2621, -1, -1, -1, -1, 232, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 2768, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 2786, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 379, -1, -1, -1, -1, + 310, -1, -1, -1, -1, 270, -1, -1, 273, -1, + -1, -1, 2671, 2672, 324, -1, -1, -1, 2677, 2678, + 2679, -1, 287, -1, -1, 290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 2808, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 357, -1, -1, + 360, -1, -1, -1, -1, -1, -1, -1, 368, -1, + -1, 371, 2721, 2722, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 2737, -1, + 390, -1, -1, -1, -1, -1, -1, -1, -1, 2748, + -1, -1, -1, 403, -1, 479, -1, -1, -1, -1, + 410, -1, 486, 487, 488, 489, 490, 491, -1, 419, + -1, -1, -1, -1, 379, 425, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 2822, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 2797, -1, + 450, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 2815, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 438, -1, -1, -1, -1, 2837, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 2851, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 2870, -1, - -1, -1, -1, -1, -1, -1, 3, 4, 5, 6, - 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, - -1, 2893, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, -1, 2907, -1, -1, 35, -1, - -1, 38, 39, -1, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, -1, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - -1, 68, 69, 70, 71, 72, -1, 74, -1, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, - 87, 88, 89, 90, 91, 92, -1, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, - 127, 128, 129, 130, -1, 132, 133, 134, 135, 136, - -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, -1, 159, 160, 161, 162, -1, 164, -1, 166, - 167, -1, 169, 170, 171, 172, 173, 174, -1, 176, - -1, 178, 179, 180, -1, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, -1, 195, 196, - 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, -1, 213, -1, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, -1, -1, - 227, 228, 229, 230, -1, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, -1, 281, 282, -1, -1, 285, 286, - 287, -1, -1, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, - 307, 308, 309, 310, 311, 312, 313, 314, 315, -1, - 317, 318, 319, 320, 321, 322, -1, 324, 325, 326, - 327, 328, 329, 330, 331, -1, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, -1, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, -1, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, -1, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, -1, 399, 400, -1, 402, 403, 404, 405, 406, - 407, 408, -1, 410, 411, -1, -1, 414, 415, 416, - 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, - 427, -1, -1, 430, 431, 432, 433, 434, 435, -1, - 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, - 447, 448, 449, 450, -1, -1, 453, -1, -1, 456, - 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, - 477, -1, -1, -1, -1, -1, -1, 484, 485, 486, - -1, -1, -1, -1, 491, -1, 493, 494, -1, -1, - -1, 498, -1, 500, 501, 3, 4, 5, 6, 7, + -1, -1, -1, -1, 479, -1, -1, 482, 483, 484, + -1, 486, 487, 488, 489, 490, 491, -1, -1, 3, + 4, 5, 6, 7, 8, 9, 10, -1, -1, 2898, + -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, -1, -1, -1, + -1, 35, 2921, -1, 38, 39, -1, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, + 74, -1, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, 2971, 87, 88, 89, 90, 91, 92, -1, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, -1, 118, 119, 120, 121, 122, 123, + -1, 125, 126, 127, 128, 129, 130, -1, 132, 133, + 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, + 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, -1, 160, 161, 162, 163, + -1, 165, -1, 167, 168, -1, 170, 171, 172, 173, + 174, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, -1, -1, 229, 230, 231, 232, -1, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, -1, 283, + 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, -1, 319, 320, 321, 322, 323, + 324, -1, 326, 327, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, -1, + 404, 405, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, 421, 422, 423, + 424, 425, 426, 427, 428, 429, -1, -1, 432, 433, + 434, 435, 436, 437, -1, 439, 440, 441, 442, 443, + 444, 445, 446, 447, 448, 449, 450, 451, 452, -1, + -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 479, -1, -1, -1, -1, + -1, -1, 486, 487, 488, -1, -1, -1, -1, 493, + -1, 495, 496, -1, -1, -1, 500, -1, 502, 503, + 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, + -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, + 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, + -1, -1, 35, -1, -1, 38, 39, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + -1, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, -1, 68, 69, 70, 71, 72, + -1, 74, -1, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, + -1, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, -1, 118, 119, 120, 121, 122, + 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, + 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, + 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, -1, 160, 161, 162, + 163, -1, 165, -1, 167, 168, -1, 170, 171, 172, + 173, 174, 175, -1, 177, -1, 179, 180, 181, -1, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, -1, 196, 197, 198, 199, 200, 201, -1, + 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + -1, 214, -1, 216, 217, 218, 219, 220, 221, 222, + 223, 224, 225, 226, -1, -1, 229, 230, 231, 232, + -1, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, + 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, + 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, -1, + 283, 284, -1, -1, 287, 288, 289, -1, -1, 292, + 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, + 303, 304, 305, 306, 307, -1, 309, 310, 311, 312, + 313, 314, 315, 316, 317, -1, 319, 320, 321, 322, + 323, 324, -1, 326, 327, 328, 329, 330, 331, 332, + 333, -1, 335, 336, 337, 338, 339, 340, 341, 342, + 343, 344, 345, 346, 347, -1, 349, 350, 351, 352, + 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, + 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, + 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, + 393, 394, 395, 396, 397, 398, 399, -1, 401, 402, + 403, 404, 405, 406, 407, 408, 409, 410, -1, 412, + 413, -1, -1, 416, 417, 418, 419, 420, 421, 422, + 423, 424, 425, 426, 427, 428, 429, -1, -1, 432, + 433, 434, 435, 436, 437, -1, 439, 440, 441, 442, + 443, 444, 445, -1, 447, 448, 449, 450, 451, 452, + -1, -1, 455, -1, 457, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 476, 477, 478, 479, -1, 481, -1, + -1, -1, -1, 486, 487, -1, -1, -1, -1, -1, + 493, -1, 495, 496, -1, -1, -1, 500, -1, 502, + 503, 3, 4, 5, 6, 7, 8, 9, 10, -1, + -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, + 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, + -1, -1, -1, 35, -1, -1, 38, 39, -1, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, -1, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, + 72, -1, 74, -1, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, + 92, -1, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, -1, 118, 119, 120, 121, + 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, + 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, + 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, 168, -1, 170, 171, + 172, 173, 174, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, -1, -1, 229, 230, 231, + 232, -1, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, -1, 287, 288, 289, -1, -1, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, 403, 404, 405, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, 421, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, 437, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, 448, 449, 450, 451, + 452, -1, -1, 455, -1, 457, 458, 459, 460, 461, + 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + 472, 473, 474, 475, 476, 477, 478, 479, -1, 481, + -1, -1, -1, -1, 486, 487, -1, -1, -1, -1, + -1, 493, -1, 495, -1, -1, -1, -1, 500, -1, + 502, 503, 3, 4, 5, 6, 7, 8, 9, 10, + -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, + 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, + -1, -1, -1, -1, 35, -1, -1, 38, 39, -1, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, -1, 68, 69, 70, + 71, 72, -1, 74, -1, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, + 91, 92, -1, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 113, 114, 115, 116, -1, 118, 119, 120, + 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, + -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, + -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, + 151, 152, 153, 154, 155, 156, 157, 158, -1, 160, + 161, 162, 163, -1, 165, -1, 167, 168, 169, 170, + 171, 172, 173, 174, 175, -1, 177, -1, 179, 180, + 181, -1, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, -1, 196, 197, 198, 199, 200, + 201, -1, 203, 204, 205, 206, 207, 208, 209, 210, + 211, 212, -1, 214, -1, 216, 217, 218, 219, 220, + 221, 222, 223, 224, 225, 226, -1, 228, 229, 230, + 231, 232, -1, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, + 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, + 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, -1, 283, 284, -1, -1, 287, 288, 289, -1, + -1, 292, 293, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, -1, 309, 310, + 311, 312, 313, 314, 315, 316, 317, -1, 319, 320, + 321, 322, 323, 324, -1, 326, 327, 328, 329, 330, + 331, 332, 333, -1, 335, 336, 337, 338, 339, 340, + 341, 342, 343, 344, 345, 346, 347, -1, 349, 350, + 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, + 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, -1, + 401, 402, -1, 404, 405, 406, 407, 408, 409, 410, + -1, 412, 413, -1, 415, 416, 417, 418, 419, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, -1, + -1, 432, 433, 434, 435, 436, 437, -1, 439, 440, + 441, 442, 443, 444, 445, -1, 447, 448, 449, 450, + 451, 452, -1, -1, 455, -1, -1, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 476, 477, 478, 479, -1, + -1, -1, -1, -1, -1, 486, 487, -1, -1, -1, + -1, -1, 493, -1, 495, -1, -1, -1, -1, 500, + -1, 502, 503, 3, 4, 5, 6, 7, 8, 9, + 10, -1, -1, -1, -1, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, -1, -1, -1, 34, 35, -1, -1, 38, 39, + -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, -1, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, -1, 68, 69, + 70, 71, 72, -1, 74, -1, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, + 90, 91, 92, -1, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, -1, 118, 119, + 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, + -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, + 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, -1, + 160, 161, 162, 163, -1, 165, -1, 167, 168, -1, + 170, 171, 172, 173, 174, 175, -1, 177, -1, 179, + 180, 181, -1, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, -1, 196, 197, 198, 199, + 200, 201, -1, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, -1, 214, -1, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, -1, -1, 229, + 230, 231, 232, -1, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, -1, 283, 284, -1, -1, 287, 288, 289, + -1, -1, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, -1, 319, + 320, 321, 322, 323, 324, -1, 326, 327, 328, 329, + 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, -1, 349, + 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, + 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + -1, 401, 402, -1, 404, 405, 406, 407, 408, 409, + 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, + -1, -1, 432, 433, 434, 435, 436, 437, -1, 439, + 440, 441, 442, 443, 444, 445, -1, 447, 448, 449, + 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, + -1, -1, -1, -1, -1, -1, 486, 487, -1, -1, + -1, -1, -1, 493, -1, 495, -1, -1, -1, -1, + 500, -1, 502, 503, 3, 4, 5, 6, 7, 8, + 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, + 29, 30, -1, -1, -1, -1, 35, -1, -1, 38, + 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, -1, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, + 69, 70, 71, 72, -1, 74, -1, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, + 89, 90, 91, 92, -1, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, -1, 118, + 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, + 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, + 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + -1, 160, 161, 162, 163, -1, 165, -1, 167, 168, + -1, 170, 171, 172, 173, 174, 175, -1, 177, -1, + 179, 180, 181, -1, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, -1, 196, 197, 198, + 199, 200, 201, -1, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, -1, 214, -1, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, -1, -1, + 229, 230, 231, 232, -1, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, -1, 283, 284, -1, -1, 287, 288, + 289, -1, -1, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, -1, + 309, 310, 311, 312, 313, 314, 315, 316, 317, -1, + 319, 320, 321, 322, 323, 324, -1, 326, 327, 328, + 329, 330, 331, 332, 333, -1, 335, 336, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, -1, + 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, + 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 382, 383, -1, 385, 386, 387, 388, + 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, + 399, -1, 401, 402, -1, 404, 405, 406, 407, 408, + 409, 410, -1, 412, 413, -1, -1, 416, 417, 418, + 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, + 429, -1, -1, 432, 433, 434, 435, 436, 437, -1, + 439, 440, 441, 442, 443, 444, 445, -1, 447, 448, + 449, 450, 451, 452, -1, -1, 455, -1, -1, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, + 479, -1, -1, -1, -1, -1, -1, 486, 487, 488, + -1, -1, -1, -1, 493, -1, 495, -1, -1, -1, + -1, 500, -1, 502, 503, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, - -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, + -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, -1, -1, -1, -1, 35, -1, -1, 38, 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, 54, 55, 56, 57, @@ -240518,440 +251839,41 @@ static const yytype_int16 yycheck[] = 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - -1, 159, 160, 161, 162, -1, 164, -1, 166, 167, - -1, 169, 170, 171, 172, 173, 174, -1, 176, -1, - 178, 179, 180, -1, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, -1, 195, 196, 197, - 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, -1, 213, -1, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, -1, -1, 227, - 228, 229, 230, -1, 232, 233, 234, 235, 236, 237, + 158, -1, 160, 161, 162, 163, -1, 165, -1, 167, + 168, -1, 170, 171, 172, 173, 174, 175, -1, 177, + -1, 179, 180, 181, -1, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, -1, 196, 197, + 198, 199, 200, 201, -1, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, -1, 214, -1, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, -1, + -1, 229, 230, 231, 232, -1, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, -1, 281, 282, -1, -1, 285, 286, 287, - -1, -1, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, - 308, 309, 310, 311, 312, 313, 314, 315, -1, 317, - 318, 319, 320, 321, 322, -1, 324, 325, 326, 327, - 328, 329, 330, 331, -1, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 343, 344, 345, -1, 347, - 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, + 278, 279, 280, 281, -1, 283, 284, -1, -1, 287, + 288, 289, -1, -1, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, + -1, 319, 320, 321, 322, 323, 324, -1, 326, 327, + 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + -1, 349, 350, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 379, 380, 381, -1, 383, 384, 385, 386, 387, + 378, 379, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, - -1, 399, 400, 401, 402, 403, 404, 405, 406, 407, - 408, -1, 410, 411, -1, -1, 414, 415, 416, 417, + 398, 399, -1, 401, 402, -1, 404, 405, 406, 407, + 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, - -1, -1, 430, 431, 432, 433, 434, 435, -1, 437, - 438, 439, 440, 441, 442, 443, -1, 445, 446, 447, - 448, 449, 450, -1, -1, 453, -1, 455, 456, 457, + 428, 429, -1, -1, 432, 433, 434, 435, 436, 437, + -1, 439, 440, 441, 442, 443, 444, 445, -1, 447, + 448, 449, 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, - -1, 479, -1, -1, -1, -1, 484, 485, -1, -1, - -1, -1, -1, 491, -1, 493, 494, -1, -1, -1, - 498, -1, 500, 501, 3, 4, 5, 6, 7, 8, - 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, - 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, - 29, 30, -1, -1, -1, -1, 35, -1, -1, 38, - 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, -1, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, - 69, 70, 71, 72, -1, 74, -1, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, - 89, 90, 91, 92, -1, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, -1, 118, - 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, - 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, - 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, -1, - 159, 160, 161, 162, -1, 164, -1, 166, 167, -1, - 169, 170, 171, 172, 173, 174, -1, 176, -1, 178, - 179, 180, -1, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, -1, 195, 196, 197, 198, - 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, -1, 213, -1, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, -1, -1, 227, 228, - 229, 230, -1, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, -1, 281, 282, -1, -1, 285, 286, 287, -1, - -1, 290, 291, 292, 293, 294, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, - 309, 310, 311, 312, 313, 314, 315, -1, 317, 318, - 319, 320, 321, 322, -1, 324, 325, 326, 327, 328, - 329, 330, 331, -1, 333, 334, 335, 336, 337, 338, - 339, 340, 341, 342, 343, 344, 345, -1, 347, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, - 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, - 379, 380, 381, -1, 383, 384, 385, 386, 387, 388, - 389, 390, 391, 392, 393, 394, 395, 396, 397, -1, - 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - -1, 410, 411, -1, -1, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, 424, 425, 426, 427, -1, - -1, 430, 431, 432, 433, 434, 435, -1, 437, 438, - 439, 440, 441, 442, 443, -1, 445, 446, 447, 448, - 449, 450, -1, -1, 453, -1, 455, 456, 457, 458, - 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, - 469, 470, 471, 472, 473, 474, 475, 476, 477, -1, - 479, -1, -1, -1, -1, 484, 485, -1, -1, -1, - -1, -1, 491, -1, 493, -1, -1, -1, -1, 498, - -1, 500, 501, 3, 4, 5, 6, 7, 8, 9, - 10, -1, -1, -1, -1, -1, -1, -1, -1, 19, - 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, - 30, -1, -1, -1, -1, 35, -1, -1, 38, 39, - -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, -1, 68, 69, - 70, 71, 72, -1, 74, -1, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, - 90, 91, 92, -1, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, -1, 118, 119, - 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, - -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, - 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, -1, 159, - 160, 161, 162, -1, 164, -1, 166, 167, 168, 169, - 170, 171, 172, 173, 174, -1, 176, -1, 178, 179, - 180, -1, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, -1, 195, 196, 197, 198, 199, - 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, -1, 213, -1, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, -1, 226, 227, 228, 229, - 230, -1, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - -1, 281, 282, -1, -1, 285, 286, 287, -1, -1, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, -1, 307, 308, 309, - 310, 311, 312, 313, 314, 315, -1, 317, 318, 319, - 320, 321, 322, -1, 324, 325, 326, 327, 328, 329, - 330, 331, -1, 333, 334, 335, 336, 337, 338, 339, - 340, 341, 342, 343, 344, 345, -1, 347, 348, 349, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 361, 362, 363, 364, -1, 366, 367, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, - 380, 381, -1, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, 397, -1, 399, - 400, -1, 402, 403, 404, 405, 406, 407, 408, -1, - 410, 411, -1, 413, 414, 415, 416, 417, 418, 419, - 420, 421, 422, 423, 424, 425, 426, 427, -1, -1, - 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, - 440, 441, 442, 443, -1, 445, 446, 447, 448, 449, - 450, -1, -1, 453, -1, -1, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 473, 474, 475, 476, 477, -1, -1, - -1, -1, -1, -1, 484, 485, -1, -1, -1, -1, - -1, 491, -1, 493, -1, -1, -1, -1, 498, -1, - 500, 501, 3, 4, 5, 6, 7, 8, 9, 10, - -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, - -1, -1, -1, 34, 35, -1, -1, 38, 39, -1, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, -1, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, -1, 68, 69, 70, - 71, 72, -1, 74, -1, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, - 91, 92, -1, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, -1, 118, 119, 120, - 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, - -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, - -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, -1, 159, 160, - 161, 162, -1, 164, -1, 166, 167, -1, 169, 170, - 171, 172, 173, 174, -1, 176, -1, 178, 179, 180, - -1, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, -1, 195, 196, 197, 198, 199, 200, - -1, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, -1, 213, -1, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, -1, -1, 227, 228, 229, 230, - -1, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, -1, - 281, 282, -1, -1, 285, 286, 287, -1, -1, 290, - 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, - 301, 302, 303, 304, 305, -1, 307, 308, 309, 310, - 311, 312, 313, 314, 315, -1, 317, 318, 319, 320, - 321, 322, -1, 324, 325, 326, 327, 328, 329, 330, - 331, -1, 333, 334, 335, 336, 337, 338, 339, 340, - 341, 342, 343, 344, 345, -1, 347, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 361, 362, 363, 364, -1, 366, 367, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, - 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, - 391, 392, 393, 394, 395, 396, 397, -1, 399, 400, - -1, 402, 403, 404, 405, 406, 407, 408, -1, 410, - 411, -1, -1, 414, 415, 416, 417, 418, 419, 420, - 421, 422, 423, 424, 425, 426, 427, -1, -1, 430, - 431, 432, 433, 434, 435, -1, 437, 438, 439, 440, - 441, 442, 443, -1, 445, 446, 447, 448, 449, 450, - -1, -1, 453, -1, -1, 456, 457, 458, 459, 460, - 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, - 471, 472, 473, 474, 475, 476, 477, -1, -1, -1, - -1, -1, -1, 484, 485, -1, -1, -1, -1, -1, - 491, -1, 493, -1, -1, -1, -1, 498, -1, 500, - 501, 3, 4, 5, 6, 7, 8, 9, 10, -1, - -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, -1, - -1, -1, -1, 35, -1, -1, 38, 39, -1, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, -1, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, - 72, -1, 74, -1, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, - 92, -1, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, -1, 118, 119, 120, 121, - 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, - 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, - 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, 167, -1, 169, 170, 171, - 172, 173, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, -1, -1, 227, 228, 229, 230, -1, - 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, 403, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, 419, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, 435, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, 446, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, 477, -1, -1, -1, -1, - -1, -1, 484, 485, 486, -1, -1, -1, -1, 491, - -1, 493, -1, -1, -1, -1, 498, -1, 500, 501, - 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, - -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, -1, -1, - -1, -1, 35, -1, -1, 38, 39, -1, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - -1, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, -1, 68, 69, 70, 71, 72, - -1, 74, -1, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, - -1, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, -1, 118, 119, 120, 121, 122, - 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, - 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, - 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, -1, 159, 160, 161, 162, - -1, 164, -1, 166, 167, -1, 169, 170, 171, 172, - 173, 174, -1, 176, -1, 178, 179, 180, -1, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, -1, 195, 196, 197, 198, 199, 200, -1, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, -1, - 213, -1, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, -1, -1, 227, 228, 229, 230, -1, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, -1, 281, 282, - -1, -1, 285, 286, 287, -1, -1, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, -1, 307, 308, 309, 310, 311, 312, - 313, 314, 315, -1, 317, 318, 319, 320, 321, 322, - -1, 324, 325, 326, 327, 328, 329, 330, 331, -1, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, -1, 347, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, - 363, 364, -1, 366, 367, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 378, 379, 380, 381, -1, - 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, - 393, 394, 395, 396, 397, -1, 399, 400, -1, 402, - 403, 404, 405, 406, 407, 408, -1, 410, 411, -1, - -1, 414, 415, 416, 417, 418, 419, 420, 421, 422, - 423, 424, 425, 426, 427, -1, -1, 430, 431, 432, - 433, 434, 435, -1, 437, 438, 439, 440, 441, 442, - 443, -1, 445, 446, 447, 448, 449, 450, -1, -1, - 453, -1, -1, 456, 457, 458, 459, 460, 461, 462, - 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 473, 474, 475, 476, 477, -1, -1, -1, -1, -1, - -1, 484, 485, 486, -1, -1, -1, -1, 491, -1, - 493, -1, -1, -1, -1, 498, -1, 500, 501, 3, - 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, - -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, - 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, - -1, 35, -1, -1, 38, 39, -1, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, - 74, -1, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, -1, 118, 119, 120, 121, 122, 123, - -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, - 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, - 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, -1, 159, 160, 161, 162, -1, - 164, -1, 166, 167, -1, 169, 170, 171, 172, 173, - 174, -1, 176, -1, 178, 179, 180, -1, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - -1, 195, 196, 197, 198, 199, 200, -1, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, -1, 213, - -1, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, -1, -1, 227, 228, 229, 230, -1, 232, 233, - 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, -1, 281, 282, -1, - -1, 285, 286, 287, -1, -1, 290, 291, 292, 293, - 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, -1, 307, 308, 309, 310, 311, 312, 313, - 314, 315, -1, 317, 318, 319, 320, 321, 322, -1, - 324, 325, 326, 327, 328, 329, 330, 331, -1, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, -1, 347, 348, 349, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, -1, 366, 367, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 379, 380, 381, -1, 383, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 396, 397, -1, 399, 400, -1, 402, 403, - 404, 405, 406, 407, 408, -1, 410, 411, -1, -1, - 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 425, 426, 427, -1, -1, 430, 431, 432, 433, - 434, 435, -1, 437, 438, 439, 440, 441, 442, 443, - -1, 445, 446, 447, 448, 449, 450, -1, -1, 453, - -1, -1, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, - 474, 475, 476, 477, -1, -1, -1, -1, -1, -1, - 484, 485, 486, -1, -1, -1, -1, 491, -1, 493, - -1, -1, -1, -1, 498, -1, 500, 501, 3, 4, - 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, - -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, -1, -1, -1, -1, - 35, -1, -1, 38, 39, -1, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, -1, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, -1, 68, 69, 70, 71, 72, -1, 74, - -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, - 85, -1, 87, 88, 89, 90, 91, 92, -1, 94, - 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, -1, 118, 119, 120, 121, 122, 123, -1, - 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, - 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, - -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, -1, 159, 160, 161, 162, -1, 164, - -1, 166, 167, -1, 169, 170, 171, 172, 173, 174, - -1, 176, -1, 178, 179, 180, -1, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, -1, - 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, -1, 213, -1, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - -1, -1, 227, 228, 229, 230, -1, 232, 233, 234, - 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, - 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, -1, 281, 282, -1, -1, - 285, 286, 287, -1, -1, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, -1, 307, 308, 309, 310, 311, 312, 313, 314, - 315, -1, 317, 318, 319, 320, 321, 322, -1, 324, - 325, 326, 327, 328, 329, 330, 331, -1, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, -1, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - -1, 366, 367, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 379, 380, 381, -1, 383, 384, - 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 397, -1, 399, 400, -1, 402, 403, 404, - 405, 406, 407, 408, -1, 410, 411, -1, -1, 414, - 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, -1, -1, 430, 431, 432, 433, 434, - 435, -1, 437, 438, 439, 440, 441, 442, 443, -1, - 445, 446, 447, 448, 449, 450, -1, -1, 453, -1, - -1, 456, 457, 458, 459, 460, 461, 462, 463, 464, - 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, -1, -1, -1, -1, -1, -1, 484, - 485, -1, -1, -1, -1, -1, 491, -1, 493, -1, - -1, -1, -1, 498, -1, 500, 501, 3, 4, 5, - 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, - -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, - 26, -1, 28, 29, 30, -1, -1, -1, -1, 35, - -1, -1, 38, 39, -1, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, -1, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, -1, 68, 69, 70, 71, 72, -1, 74, -1, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - -1, 87, 88, 89, 90, 91, 92, -1, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, - 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, - 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, -1, 159, 160, 161, 162, -1, 164, -1, - 166, 167, -1, 169, 170, 171, 172, 173, 174, -1, - 176, -1, 178, 179, 180, -1, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, -1, 195, - 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, -1, 213, -1, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, -1, - -1, 227, 228, 229, 230, -1, 232, 233, 234, 235, - 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, - 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, - 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, -1, 281, 282, -1, -1, 285, - 286, 287, -1, -1, 290, 291, 292, 293, 294, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - -1, 307, 308, 309, 310, 311, 312, 313, 314, 315, - -1, 317, 318, 319, 320, 321, 322, -1, 324, 325, - 326, 327, 328, 329, 330, 331, -1, 333, 334, 335, - 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, - -1, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 362, 363, 364, -1, - 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 379, 380, 381, -1, 383, 384, 385, - 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, -1, 399, 400, -1, 402, 403, 404, 405, - 406, 407, 408, -1, 410, 411, -1, -1, 414, 415, - 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, - 426, 427, -1, -1, 430, 431, 432, 433, 434, 435, - -1, 437, 438, 439, 440, 441, 442, 443, -1, 445, - 446, 447, 448, 449, 450, -1, -1, 453, -1, -1, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 477, -1, -1, -1, -1, -1, -1, 484, 485, - -1, -1, -1, -1, -1, 491, -1, 493, 494, -1, - -1, -1, 498, -1, 500, 501, 3, 4, 5, 6, + 478, 479, -1, -1, -1, -1, -1, -1, 486, 487, + 488, -1, -1, -1, -1, 493, -1, 495, -1, -1, + -1, -1, 500, -1, 502, 503, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, 35, -1, @@ -240967,390 +251889,91 @@ static const yytype_int16 yycheck[] = 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, -1, 159, 160, 161, 162, -1, 164, -1, 166, - 167, -1, 169, 170, 171, 172, 173, 174, -1, 176, - -1, 178, 179, 180, -1, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, -1, 195, 196, - 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, -1, 213, -1, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, -1, -1, - 227, 228, 229, 230, -1, 232, 233, 234, 235, 236, + 157, 158, -1, 160, 161, 162, 163, -1, 165, -1, + 167, 168, -1, 170, 171, 172, 173, 174, 175, -1, + 177, -1, 179, 180, 181, -1, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, -1, 196, + 197, 198, 199, 200, 201, -1, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, -1, 214, -1, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + -1, -1, 229, 230, 231, 232, -1, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, -1, 281, 282, -1, -1, 285, 286, - 287, -1, -1, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, - 307, 308, 309, 310, 311, 312, 313, 314, 315, -1, - 317, 318, 319, 320, 321, 322, -1, 324, 325, 326, - 327, 328, 329, 330, 331, -1, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, -1, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, -1, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, -1, 383, 384, 385, 386, + 277, 278, 279, 280, 281, -1, 283, 284, -1, -1, + 287, 288, 289, -1, -1, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, -1, 309, 310, 311, 312, 313, 314, 315, 316, + 317, -1, 319, 320, 321, 322, 323, 324, -1, 326, + 327, 328, 329, 330, 331, 332, 333, -1, 335, 336, + 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, + 347, -1, 349, 350, 351, 352, 353, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, + -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, -1, 399, 400, -1, 402, 403, 404, 405, 406, - 407, 408, -1, 410, 411, -1, -1, 414, 415, 416, + 397, 398, 399, -1, 401, 402, -1, 404, 405, 406, + 407, 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, - 427, -1, -1, 430, 431, 432, 433, 434, 435, -1, - 437, 438, 439, 440, 441, 442, 443, -1, 445, 446, - 447, 448, 449, 450, -1, -1, 453, -1, -1, 456, - 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 427, 428, 429, -1, -1, 432, 433, 434, 435, 436, + 437, -1, 439, 440, 441, 442, 443, 444, 445, -1, + 447, 448, 449, 450, 451, 452, -1, -1, 455, -1, + -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, - 477, -1, -1, -1, -1, -1, -1, 484, 485, -1, - -1, -1, -1, -1, 491, -1, 493, 494, -1, -1, - -1, 498, -1, 500, 501, 3, 4, 5, 6, 7, - 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, - -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, - 28, 29, 30, -1, -1, -1, -1, 35, -1, -1, - 38, 39, -1, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, -1, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, -1, - 68, 69, 70, 71, 72, -1, 74, -1, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, - 88, 89, 90, 91, 92, -1, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, -1, - 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, - 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, - 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - -1, 159, 160, 161, 162, -1, 164, -1, 166, 167, - -1, 169, 170, 171, 172, 173, 174, -1, 176, -1, - 178, 179, 180, -1, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, -1, 195, 196, 197, - 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, -1, 213, -1, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, -1, -1, 227, - 228, 229, 230, -1, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, - 278, 279, -1, 281, 282, -1, -1, 285, 286, 287, - -1, -1, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, - 308, 309, 310, 311, 312, 313, 314, 315, -1, 317, - 318, 319, 320, 321, 322, -1, 324, 325, 326, 327, - 328, 329, 330, 331, -1, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 343, 344, 345, -1, 347, - 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, -1, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 379, 380, 381, -1, 383, 384, 385, 386, 387, - 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, - -1, 399, 400, -1, 402, 403, 404, 405, 406, 407, - 408, -1, 410, 411, -1, -1, 414, 415, 416, 417, - 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, - -1, -1, 430, 431, 432, 433, 434, 435, -1, 437, - 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, - 448, 449, 450, -1, -1, 453, -1, -1, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, - -1, -1, -1, -1, -1, -1, 484, 485, -1, -1, - -1, -1, -1, 491, -1, 493, -1, -1, -1, -1, - 498, -1, 500, 501, 3, 4, 5, 6, 7, 8, - 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, - 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, - 29, 30, -1, -1, -1, -1, 35, -1, -1, 38, - 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, -1, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, - 69, 70, 71, 72, -1, 74, -1, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, - 89, 90, 91, 92, -1, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, -1, 118, - 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, - 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, - 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, -1, - 159, 160, 161, 162, -1, 164, -1, 166, 167, 168, - 169, 170, 171, 172, 173, 174, -1, 176, -1, 178, - 179, 180, -1, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, -1, 195, 196, 197, 198, - 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, -1, 213, -1, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, -1, -1, 227, 228, - 229, 230, -1, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, -1, 281, 282, -1, -1, 285, 286, 287, -1, - -1, 290, 291, 292, 293, 294, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, - 309, 310, 311, 312, 313, 314, 315, -1, 317, 318, - 319, 320, 321, 322, -1, 324, 325, 326, 327, 328, - 329, 330, 331, -1, 333, 334, 335, 336, 337, 338, - 339, 340, 341, 342, 343, 344, 345, -1, 347, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, -1, 366, 367, 368, - 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, - 379, 380, 381, -1, 383, 384, 385, 386, 387, 388, - 389, 390, 391, 392, 393, 394, 395, 396, 397, -1, - 399, 400, -1, 402, 403, 404, 405, 406, 407, 408, - -1, 410, 411, -1, -1, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, 424, 425, 426, 427, -1, - -1, 430, 431, 432, 433, 434, 435, -1, 437, 438, - 439, 440, 441, 442, 443, -1, 445, 446, 447, 448, - 449, 450, -1, -1, 453, -1, -1, 456, 457, 458, - 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, - 469, 470, 471, 472, 473, 474, 475, 476, 477, -1, - -1, -1, -1, -1, -1, 484, 485, -1, -1, -1, - -1, -1, 491, -1, 493, -1, -1, -1, -1, 498, - -1, 500, 501, 3, 4, 5, 6, 7, 8, 9, - 10, -1, -1, -1, -1, -1, -1, -1, -1, 19, - 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, - 30, -1, -1, -1, -1, 35, -1, -1, 38, 39, - -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, -1, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 65, 66, -1, 68, 69, - 70, 71, 72, -1, 74, -1, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, - 90, 91, 92, -1, 94, 95, 96, 97, 98, 99, - 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, -1, 118, 119, - 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, - -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, - 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, 156, 157, -1, 159, - 160, 161, 162, -1, 164, -1, 166, 167, -1, 169, - 170, 171, 172, 173, 174, -1, 176, -1, 178, 179, - 180, -1, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, -1, 195, 196, 197, 198, 199, - 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, -1, 213, -1, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, -1, -1, 227, 228, 229, - 230, -1, 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, - -1, 281, 282, -1, -1, 285, 286, 287, -1, -1, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, -1, 307, 308, 309, - 310, 311, 312, 313, 314, 315, -1, 317, 318, 319, - 320, 321, 322, -1, 324, 325, 326, 327, 328, 329, - 330, 331, -1, 333, 334, 335, 336, 337, 338, 339, - 340, 341, 342, 343, 344, 345, -1, 347, 348, 349, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 361, 362, 363, 364, -1, 366, 367, 368, 369, - 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, - 380, 381, -1, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, 397, -1, 399, - 400, -1, 402, 403, 404, 405, 406, 407, 408, -1, - 410, 411, -1, -1, 414, 415, 416, 417, 418, 419, - 420, 421, 422, 423, 424, 425, 426, 427, -1, -1, - 430, 431, 432, 433, 434, 435, -1, 437, 438, 439, - 440, 441, 442, 443, -1, 445, 446, 447, 448, 449, - 450, -1, -1, 453, -1, -1, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 473, 474, 475, 476, 477, -1, -1, - -1, -1, -1, -1, 484, 485, -1, -1, -1, -1, - -1, 491, -1, 493, -1, -1, -1, -1, 498, -1, - 500, 501, 3, 4, 5, 6, 7, 8, 9, 10, - -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, - 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, - -1, -1, -1, -1, 35, -1, -1, 38, 39, -1, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, - 51, 52, -1, 54, 55, 56, 57, 58, 59, 60, - 61, 62, 63, 64, 65, 66, -1, 68, 69, 70, - 71, 72, -1, 74, -1, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, - 91, 92, -1, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, -1, 118, 119, 120, - 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, - -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, - -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, 156, 157, -1, 159, 160, - 161, 162, -1, 164, -1, 166, 167, -1, 169, 170, - 171, 172, 173, 174, -1, 176, -1, 178, 179, 180, - -1, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, -1, 195, 196, 197, 198, 199, 200, - -1, 202, 203, 204, 205, 206, 207, 208, 209, 210, - 211, -1, 213, -1, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, -1, -1, 227, 228, 229, 230, - -1, 232, 233, 234, 235, 236, 237, 238, 239, 240, - 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, - 271, 272, 273, 274, 275, 276, 277, 278, 279, -1, - 281, 282, -1, -1, 285, 286, 287, -1, -1, 290, - 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, - 301, 302, 303, 304, 305, -1, 307, 308, 309, 310, - 311, 312, 313, 314, 315, -1, 317, 318, 319, 320, - 321, 322, -1, 324, 325, 326, 327, 328, 329, 330, - 331, -1, 333, 334, 335, 336, 337, 338, 339, 340, - 341, 342, 343, 344, 345, -1, 347, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 361, 362, 363, 364, -1, 366, 367, 368, 369, 370, - 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, - 381, -1, 383, 384, 385, 386, 387, 388, 389, 390, - 391, 392, 393, 394, 395, 396, 397, -1, 399, 400, - -1, 402, 403, 404, 405, 406, 407, 408, -1, 410, - 411, -1, -1, 414, 415, 416, 417, 418, 419, 420, - 421, 422, 423, 424, 425, 426, 427, -1, -1, 430, - 431, 432, 433, 434, 435, -1, 437, 438, 439, 440, - 441, 442, 443, -1, 445, 446, 447, 448, 449, 450, - -1, -1, 453, -1, -1, 456, 457, 458, 459, 460, - 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, - 471, 472, 473, 474, 475, 476, 477, -1, -1, -1, - -1, -1, -1, 484, 485, -1, -1, -1, -1, -1, - 491, -1, 493, -1, -1, -1, -1, 498, -1, 500, - 501, 3, 4, 5, 6, 7, 8, 9, 10, -1, - -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, - 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, - -1, -1, -1, 35, -1, -1, 38, 39, -1, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, -1, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, - 72, -1, 74, -1, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, - 92, -1, 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, -1, 118, 119, 120, 121, - 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, - 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, - 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, 167, -1, 169, 170, 171, - 172, 173, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, -1, -1, 227, 228, 229, 230, -1, - 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, - 272, 273, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, 349, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, 403, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, 419, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, 435, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, 446, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, 477, -1, -1, -1, -1, - -1, -1, 484, 485, -1, -1, -1, -1, -1, 491, - -1, 493, -1, -1, -1, -1, 498, -1, 500, 501, - 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, - -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, - 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, - -1, -1, 35, -1, -1, 38, 39, -1, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - -1, 54, 55, 56, 57, 58, 59, 60, 61, 62, - 63, 64, 65, 66, -1, 68, 69, 70, 71, 72, - -1, 74, -1, 76, 77, 78, 79, 80, 81, 82, - 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, - -1, 94, 95, 96, 97, 98, 99, 100, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, -1, 118, 119, 120, 121, 122, - 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, - 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, - 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, -1, 159, 160, 161, 162, - -1, 164, -1, 166, 167, -1, 169, 170, 171, 172, - 173, 174, -1, 176, -1, 178, 179, 180, -1, 182, - 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, - 193, -1, 195, 196, 197, 198, 199, 200, -1, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, -1, - 213, -1, 215, 216, 217, 218, 219, 220, 221, 222, - 223, 224, -1, -1, 227, 228, 229, 230, -1, 232, - 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, - 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, - 273, 274, 275, 276, 277, 278, 279, -1, 281, 282, - -1, -1, 285, 286, 287, -1, -1, 290, 291, 292, - 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, -1, 307, 308, 309, 310, 311, 312, - 313, 314, 315, -1, 317, 318, 319, 320, 321, 322, - -1, 324, 325, 326, 327, 328, 329, 330, 331, -1, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, -1, 347, 348, 349, 350, 351, 352, - 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, - 363, 364, -1, 366, 367, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 378, 379, 380, 381, -1, - 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, - 393, 394, 395, 396, 397, -1, 399, 400, -1, 402, - 403, 404, 405, 406, 407, 408, -1, 410, 411, -1, - -1, 414, 415, 416, 417, 418, 419, 420, 421, 422, - 423, 424, 425, 426, 427, -1, -1, 430, 431, 432, - 433, 434, 435, -1, 437, 438, 439, 440, 441, 442, - 443, -1, 445, 446, 447, 448, 449, 450, -1, -1, - 453, -1, -1, 456, 457, 458, 459, 460, 461, 462, - 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 473, 474, 475, 476, 477, -1, -1, -1, -1, -1, - -1, 484, 485, -1, -1, -1, -1, -1, 491, -1, - 493, -1, -1, -1, -1, 498, -1, 500, 501, 3, - 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, - -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, - 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, - -1, 35, -1, -1, 38, 39, -1, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, - 74, -1, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, 115, 116, -1, 118, 119, 120, 121, 122, 123, - -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, - 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, - 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, -1, 159, 160, 161, 162, -1, - 164, -1, 166, 167, -1, 169, 170, 171, 172, 173, - 174, -1, 176, -1, 178, 179, 180, -1, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - -1, 195, 196, 197, 198, 199, 200, -1, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, -1, 213, - -1, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, -1, -1, 227, 228, 229, 230, -1, 232, 233, - 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, -1, 281, 282, -1, - -1, 285, 286, 287, -1, -1, 290, 291, 292, 293, - 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, -1, 307, 308, 309, 310, 311, 312, 313, - 314, 315, -1, 317, 318, 319, 320, 321, 322, -1, - 324, 325, 326, 327, 328, 329, 330, 331, -1, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, -1, 347, 348, 349, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, -1, 366, 367, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 379, 380, 381, -1, 383, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 396, 397, -1, 399, 400, -1, 402, 403, - 404, 405, 406, 407, 408, -1, 410, 411, -1, -1, - 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 425, 426, 427, -1, -1, 430, 431, 432, 433, - 434, 435, -1, 437, 438, 439, 440, 441, 442, 443, - -1, 445, 446, 447, 448, 449, 450, -1, -1, 453, - -1, -1, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, - 474, 475, 476, 477, -1, -1, -1, -1, -1, -1, - 484, 485, -1, -1, -1, -1, -1, 491, -1, 493, - -1, -1, -1, -1, 498, -1, 500, 501, 3, 4, + 477, 478, 479, -1, -1, -1, -1, -1, -1, 486, + 487, 488, -1, -1, -1, -1, 493, -1, 495, -1, + -1, -1, -1, 500, -1, 502, 503, 3, 4, 5, + 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, + -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, -1, -1, -1, -1, 35, + -1, -1, 38, 39, -1, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, -1, 54, 55, + 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, + 66, -1, 68, 69, 70, 71, 72, -1, 74, -1, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + -1, 87, 88, 89, 90, 91, 92, -1, 94, 95, + 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, + 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, + 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, + 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 157, 158, -1, 160, 161, 162, 163, -1, 165, + -1, 167, 168, -1, 170, 171, 172, 173, 174, 175, + -1, 177, -1, 179, 180, 181, -1, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, -1, + 196, 197, 198, 199, 200, 201, -1, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, -1, 214, -1, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, -1, -1, 229, 230, 231, 232, -1, 234, 235, + 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, + 276, 277, 278, 279, 280, 281, -1, 283, 284, -1, + -1, 287, 288, 289, -1, -1, 292, 293, 294, 295, + 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, + 316, 317, -1, 319, 320, 321, 322, 323, 324, -1, + 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, + 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, + 346, 347, -1, 349, 350, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, -1, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, -1, 401, 402, -1, 404, 405, + 406, 407, 408, 409, 410, -1, 412, 413, -1, -1, + 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, + 426, 427, 428, 429, -1, -1, 432, 433, 434, 435, + 436, 437, -1, 439, 440, 441, 442, 443, 444, 445, + -1, 447, 448, 449, 450, 451, 452, -1, -1, 455, + -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 479, -1, -1, -1, -1, -1, -1, + 486, 487, -1, -1, -1, -1, -1, 493, -1, 495, + -1, -1, -1, -1, 500, -1, 502, 503, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, @@ -241366,41 +251989,442 @@ static const yytype_int16 yycheck[] = 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, -1, 159, 160, 161, 162, -1, 164, - -1, 166, 167, -1, 169, 170, 171, 172, 173, 174, - -1, 176, -1, 178, 179, 180, -1, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, -1, - 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, -1, 213, -1, - 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, - -1, -1, 227, 228, 229, 230, -1, 232, 233, 234, + 155, 156, 157, 158, -1, 160, 161, 162, 163, -1, + 165, -1, 167, 168, -1, 170, 171, 172, 173, 174, + 175, -1, 177, -1, 179, 180, 181, -1, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + -1, 196, 197, 198, 199, 200, 201, -1, 203, 204, + 205, 206, 207, 208, 209, 210, 211, 212, -1, 214, + -1, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, -1, -1, 229, 230, 231, 232, -1, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, -1, 281, 282, -1, -1, - 285, 286, 287, -1, -1, 290, 291, 292, 293, 294, + 275, 276, 277, 278, 279, 280, 281, -1, 283, 284, + -1, -1, 287, 288, 289, -1, -1, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, -1, 307, 308, 309, 310, 311, 312, 313, 314, - 315, -1, 317, 318, 319, 320, 321, 322, -1, 324, - 325, 326, 327, 328, 329, 330, 331, -1, 333, 334, + 305, 306, 307, -1, 309, 310, 311, 312, 313, 314, + 315, 316, 317, -1, 319, 320, 321, 322, 323, 324, + -1, 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, -1, 347, 348, 349, 350, 351, 352, 353, 354, + 345, 346, 347, -1, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - -1, 366, 367, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 379, 380, 381, -1, 383, 384, + 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 397, -1, 399, 400, -1, 402, 403, 404, - 405, 406, 407, 408, -1, 410, 411, -1, -1, 414, - 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, -1, -1, 430, 431, 432, 433, 434, - 435, -1, 437, 438, 439, 440, 441, 442, 443, -1, - 445, 446, 447, 448, 449, 450, -1, -1, 453, -1, - -1, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 395, 396, 397, 398, 399, -1, 401, 402, -1, 404, + 405, 406, 407, 408, 409, 410, -1, 412, 413, -1, + -1, 416, 417, 418, 419, 420, 421, 422, 423, 424, + 425, 426, 427, 428, 429, -1, -1, 432, 433, 434, + 435, 436, 437, -1, 439, 440, 441, 442, 443, 444, + 445, -1, 447, 448, 449, 450, 451, 452, -1, -1, + 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 477, -1, -1, -1, -1, -1, -1, 484, - 485, -1, -1, -1, -1, -1, 491, -1, 493, -1, - -1, -1, -1, 498, -1, 500, 501, 3, 4, 5, + 475, 476, 477, 478, 479, -1, -1, -1, -1, -1, + -1, 486, 487, -1, -1, -1, -1, -1, 493, -1, + 495, 496, -1, -1, -1, 500, -1, 502, 503, 3, + 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, + -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, + -1, 35, -1, -1, 38, 39, -1, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, + 74, -1, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, -1, 118, 119, 120, 121, 122, 123, + -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, + 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, + 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, -1, 160, 161, 162, 163, + -1, 165, -1, 167, 168, -1, 170, 171, 172, 173, + 174, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, -1, -1, 229, 230, 231, 232, -1, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, -1, 283, + 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, -1, 319, 320, 321, 322, 323, + 324, -1, 326, 327, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, -1, + 404, 405, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, 421, 422, 423, + 424, 425, 426, 427, 428, 429, -1, -1, 432, 433, + 434, 435, 436, 437, -1, 439, 440, 441, 442, 443, + 444, 445, 446, 447, 448, 449, 450, 451, 452, -1, + -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 479, -1, -1, -1, -1, + -1, -1, 486, 487, -1, -1, -1, -1, -1, 493, + -1, 495, -1, -1, -1, -1, 500, -1, 502, 503, + 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, + -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, + 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, + -1, -1, 35, -1, -1, 38, 39, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + -1, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, -1, 68, 69, 70, 71, 72, + -1, 74, -1, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, + -1, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, -1, 118, 119, 120, 121, 122, + 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, + 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, + 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, -1, 160, 161, 162, + 163, -1, 165, -1, 167, 168, -1, 170, 171, 172, + 173, 174, 175, -1, 177, -1, 179, 180, 181, -1, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, -1, 196, 197, 198, 199, 200, 201, -1, + 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + -1, 214, -1, 216, 217, 218, 219, 220, 221, 222, + 223, 224, 225, 226, -1, -1, 229, 230, 231, 232, + -1, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, + 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, + 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, -1, + 283, 284, -1, -1, 287, 288, 289, -1, -1, 292, + 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, + 303, 304, 305, 306, 307, -1, 309, 310, 311, 312, + 313, 314, 315, 316, 317, -1, 319, 320, 321, 322, + 323, 324, -1, 326, 327, 328, 329, 330, 331, 332, + 333, -1, 335, 336, 337, 338, 339, 340, 341, 342, + 343, 344, 345, 346, 347, -1, 349, 350, 351, 352, + 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, + 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, + 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, + 393, 394, 395, 396, 397, 398, 399, -1, 401, 402, + -1, 404, 405, 406, 407, 408, 409, 410, -1, 412, + 413, -1, -1, 416, 417, 418, 419, 420, 421, 422, + 423, 424, 425, 426, 427, 428, 429, -1, -1, 432, + 433, 434, 435, 436, 437, -1, 439, 440, 441, 442, + 443, 444, 445, -1, 447, 448, 449, 450, 451, 452, + -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 476, 477, 478, 479, -1, -1, -1, + -1, -1, -1, 486, 487, -1, -1, -1, -1, -1, + 493, -1, 495, 496, -1, -1, -1, 500, -1, 502, + 503, 3, 4, 5, 6, 7, 8, 9, 10, -1, + -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, + 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, + -1, -1, -1, 35, -1, -1, 38, 39, -1, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, -1, 54, 55, 56, 57, 58, 59, 60, 61, + 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, + 72, -1, 74, -1, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, + 92, -1, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, 115, 116, -1, 118, 119, 120, 121, + 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, + 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, + 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, 168, 169, 170, 171, + 172, 173, 174, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, -1, -1, 229, 230, 231, + 232, -1, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, + 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, -1, 287, 288, 289, -1, -1, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, 405, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, 421, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, 437, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, 448, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, + 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + 472, 473, 474, 475, 476, 477, 478, 479, -1, -1, + -1, -1, -1, -1, 486, 487, -1, -1, -1, -1, + -1, 493, -1, 495, -1, -1, -1, -1, 500, -1, + 502, 503, 3, 4, 5, 6, 7, 8, 9, 10, + -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, + 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, + -1, -1, -1, -1, 35, -1, -1, 38, 39, -1, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, -1, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, -1, 68, 69, 70, + 71, 72, -1, 74, -1, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, + 91, 92, -1, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 113, 114, 115, 116, -1, 118, 119, 120, + 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, + -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, + -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, + 151, 152, 153, 154, 155, 156, 157, 158, -1, 160, + 161, 162, 163, -1, 165, -1, 167, 168, -1, 170, + 171, 172, 173, 174, 175, -1, 177, -1, 179, 180, + 181, -1, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, -1, 196, 197, 198, 199, 200, + 201, -1, 203, 204, 205, 206, 207, 208, 209, 210, + 211, 212, -1, 214, -1, 216, 217, 218, 219, 220, + 221, 222, 223, 224, 225, 226, -1, -1, 229, 230, + 231, 232, -1, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, + 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, + 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, + 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, -1, 283, 284, -1, -1, 287, 288, 289, -1, + -1, 292, 293, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, -1, 309, 310, + 311, 312, 313, 314, 315, 316, 317, -1, 319, 320, + 321, 322, 323, 324, -1, 326, 327, 328, 329, 330, + 331, 332, 333, -1, 335, 336, 337, 338, 339, 340, + 341, 342, 343, 344, 345, 346, 347, -1, 349, 350, + 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, + 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, -1, + 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, + -1, 412, 413, -1, -1, 416, 417, 418, 419, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, -1, + -1, 432, 433, 434, 435, 436, 437, -1, 439, 440, + 441, 442, 443, 444, 445, -1, 447, 448, 449, 450, + 451, 452, -1, -1, 455, -1, -1, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 476, 477, 478, 479, -1, + -1, -1, -1, -1, -1, 486, 487, -1, -1, -1, + -1, -1, 493, -1, 495, -1, -1, -1, -1, 500, + -1, 502, 503, 3, 4, 5, 6, 7, 8, 9, + 10, -1, -1, -1, -1, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, + 30, -1, -1, -1, -1, 35, -1, -1, 38, 39, + -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 52, -1, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, -1, 68, 69, + 70, 71, 72, -1, 74, -1, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, + 90, 91, 92, -1, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, -1, 118, 119, + 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, + -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, + 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, -1, + 160, 161, 162, 163, -1, 165, -1, 167, 168, -1, + 170, 171, 172, 173, 174, 175, -1, 177, -1, 179, + 180, 181, -1, 183, 184, 185, 186, 187, 188, 189, + 190, 191, 192, 193, 194, -1, 196, 197, 198, 199, + 200, 201, -1, 203, 204, 205, 206, 207, 208, 209, + 210, 211, 212, -1, 214, -1, 216, 217, 218, 219, + 220, 221, 222, 223, 224, 225, 226, -1, -1, 229, + 230, 231, 232, -1, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, + 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, + 280, 281, -1, 283, 284, -1, -1, 287, 288, 289, + -1, -1, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, -1, 319, + 320, 321, 322, 323, 324, -1, 326, 327, 328, 329, + 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, -1, 349, + 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, + 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, + 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + -1, 401, 402, -1, 404, 405, 406, 407, 408, 409, + 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, + -1, -1, 432, 433, 434, 435, 436, 437, -1, 439, + 440, 441, 442, 443, 444, 445, -1, 447, 448, 449, + 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, + -1, -1, -1, -1, -1, -1, 486, 487, -1, -1, + -1, -1, -1, 493, -1, 495, -1, -1, -1, -1, + 500, -1, 502, 503, 3, 4, 5, 6, 7, 8, + 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, + 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, + 29, 30, -1, -1, -1, -1, 35, -1, -1, 38, + 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, -1, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, + 69, 70, 71, 72, -1, 74, -1, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, + 89, 90, 91, 92, -1, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, 115, 116, -1, 118, + 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, + 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, + 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, + -1, 160, 161, 162, 163, -1, 165, -1, 167, 168, + -1, 170, 171, 172, 173, 174, 175, -1, 177, -1, + 179, 180, 181, -1, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, -1, 196, 197, 198, + 199, 200, 201, -1, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, -1, 214, -1, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, -1, -1, + 229, 230, 231, 232, -1, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, + 279, 280, 281, -1, 283, 284, -1, -1, 287, 288, + 289, -1, -1, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, -1, + 309, 310, 311, 312, 313, 314, 315, 316, 317, -1, + 319, 320, 321, 322, 323, 324, -1, 326, 327, 328, + 329, 330, 331, 332, 333, -1, 335, 336, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, -1, + 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, + 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 382, 383, -1, 385, 386, 387, 388, + 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, + 399, -1, 401, 402, -1, 404, 405, 406, 407, 408, + 409, 410, -1, 412, 413, -1, -1, 416, 417, 418, + 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, + 429, -1, -1, 432, 433, 434, 435, 436, 437, -1, + 439, 440, 441, 442, 443, 444, 445, -1, 447, 448, + 449, 450, 451, 452, -1, -1, 455, -1, -1, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, + 479, -1, -1, -1, -1, -1, -1, 486, 487, -1, + -1, -1, -1, -1, 493, -1, 495, -1, -1, -1, + -1, 500, -1, 502, 503, 3, 4, 5, 6, 7, + 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, + -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, + 28, 29, 30, -1, -1, -1, -1, 35, -1, -1, + 38, 39, -1, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, -1, 54, 55, 56, 57, + 58, 59, 60, 61, 62, 63, 64, 65, 66, -1, + 68, 69, 70, 71, 72, -1, 74, -1, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, + 88, 89, 90, 91, 92, -1, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, -1, + 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, + 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, + 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, -1, 160, 161, 162, 163, -1, 165, -1, 167, + 168, -1, 170, 171, 172, 173, 174, 175, -1, 177, + -1, 179, 180, 181, -1, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, -1, 196, 197, + 198, 199, 200, 201, -1, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, -1, 214, -1, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, -1, + -1, 229, 230, 231, 232, -1, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, + 278, 279, 280, 281, -1, 283, 284, -1, -1, 287, + 288, 289, -1, -1, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, + -1, 319, 320, 321, 322, 323, 324, -1, 326, 327, + 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + -1, 349, 350, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 382, 383, -1, 385, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, -1, 401, 402, -1, 404, 405, 406, 407, + 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, + 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, + 428, 429, -1, -1, 432, 433, 434, 435, 436, 437, + -1, 439, 440, 441, 442, 443, 444, 445, -1, 447, + 448, 449, 450, 451, 452, -1, -1, 455, -1, -1, + 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, + 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, + 478, 479, -1, -1, -1, -1, -1, -1, 486, 487, + -1, -1, -1, -1, -1, 493, -1, 495, -1, -1, + -1, -1, 500, -1, 502, 503, 3, 4, 5, 6, + 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, + -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, + -1, 28, 29, 30, -1, -1, -1, -1, 35, -1, + -1, 38, 39, -1, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, -1, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, + -1, 68, 69, 70, 71, 72, -1, 74, -1, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, + 87, 88, 89, 90, 91, 92, -1, 94, 95, 96, + 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, + 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, + -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, + 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, + 157, 158, -1, 160, 161, 162, 163, -1, 165, -1, + 167, 168, -1, 170, 171, 172, 173, 174, 175, -1, + 177, -1, 179, 180, 181, -1, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, -1, 196, + 197, 198, 199, 200, 201, -1, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, -1, 214, -1, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + -1, -1, 229, 230, 231, 232, -1, 234, 235, 236, + 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, + 277, 278, 279, 280, 281, -1, 283, 284, -1, -1, + 287, 288, 289, -1, -1, 292, 293, 294, 295, 296, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, -1, 309, 310, 311, 312, 313, 314, 315, 316, + 317, -1, 319, 320, 321, 322, 323, 324, -1, 326, + 327, 328, 329, 330, 331, 332, 333, -1, 335, 336, + 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, + 347, -1, 349, 350, 351, 352, 353, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, + -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, + 377, 378, 379, 380, 381, 382, 383, -1, 385, 386, + 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, + 397, 398, 399, -1, 401, 402, -1, 404, 405, 406, + 407, 408, 409, 410, -1, 412, 413, -1, -1, 416, + 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, + 427, 428, 429, -1, -1, 432, 433, 434, 435, 436, + 437, -1, 439, 440, 441, 442, 443, 444, 445, -1, + 447, 448, 449, 450, 451, 452, -1, -1, 455, -1, + -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, + 477, 478, 479, -1, -1, -1, -1, -1, -1, 486, + 487, -1, -1, -1, -1, -1, 493, -1, 495, -1, + -1, -1, -1, 500, -1, 502, 503, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, 35, @@ -241416,243 +252440,45 @@ static const yytype_int16 yycheck[] = 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, -1, 159, 160, 161, 162, -1, 164, -1, - 166, 167, -1, 169, 170, 171, 172, 173, 174, -1, - 176, -1, 178, 179, 180, -1, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 191, 192, 193, -1, 195, - 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, -1, 213, -1, 215, - 216, 217, 218, 219, 220, 221, 222, 223, 224, -1, - -1, 227, 228, 229, 230, -1, 232, 233, 234, 235, + 156, 157, 158, -1, 160, 161, 162, 163, -1, 165, + -1, 167, 168, -1, 170, 171, 172, 173, 174, 175, + -1, 177, -1, 179, 180, 181, -1, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, -1, + 196, 197, 198, 199, 200, 201, -1, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, -1, 214, -1, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, -1, -1, 229, 230, 231, 232, -1, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, - 276, 277, 278, 279, -1, 281, 282, -1, -1, 285, - 286, 287, -1, -1, 290, 291, 292, 293, 294, 295, + 276, 277, 278, 279, 280, 281, -1, 283, 284, -1, + -1, 287, 288, 289, -1, -1, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - -1, 307, 308, 309, 310, 311, 312, 313, 314, 315, - -1, 317, 318, 319, 320, 321, 322, -1, 324, 325, - 326, 327, 328, 329, 330, 331, -1, 333, 334, 335, + 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, + 316, 317, -1, 319, 320, 321, 322, 323, 324, -1, + 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, - -1, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 362, 363, 364, -1, - 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, 377, 378, 379, 380, 381, -1, 383, 384, 385, + 346, 347, -1, 349, 350, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, -1, 399, 400, -1, 402, 403, 404, 405, - 406, 407, 408, -1, 410, 411, -1, -1, 414, 415, + 396, 397, 398, 399, -1, 401, 402, -1, 404, 405, + 406, 407, 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, - 426, 427, -1, -1, 430, 431, 432, 433, 434, 435, - -1, 437, 438, 439, 440, 441, 442, 443, -1, 445, - 446, 447, 448, 449, 450, -1, -1, 453, -1, -1, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, + 426, 427, 428, 429, -1, -1, 432, 433, 434, 435, + 436, 437, -1, 439, 440, 441, 442, 443, 444, 445, + -1, 447, 448, 449, 450, 451, 452, -1, -1, 455, + -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 477, -1, -1, -1, -1, -1, -1, 484, 485, - -1, -1, -1, -1, -1, 491, -1, 493, -1, -1, - -1, -1, 498, -1, 500, 501, 3, 4, 5, 6, - 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, - -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, - -1, 28, 29, 30, -1, -1, -1, -1, 35, -1, - -1, 38, 39, -1, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, -1, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, - -1, 68, 69, 70, 71, 72, -1, 74, -1, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, - 87, 88, 89, 90, 91, 92, -1, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, - -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, - 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, - -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, -1, 159, 160, 161, 162, -1, 164, -1, 166, - 167, -1, 169, 170, 171, 172, 173, 174, -1, 176, - -1, 178, 179, 180, -1, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, -1, 195, 196, - 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, -1, 213, -1, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, -1, -1, - 227, 228, 229, 230, -1, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, -1, 281, 282, -1, -1, 285, 286, - 287, -1, -1, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, - 307, 308, 309, 310, 311, 312, 313, 314, 315, -1, - 317, 318, 319, 320, 321, 322, -1, 324, 325, 326, - 327, 328, 329, 330, 331, -1, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, -1, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, -1, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, -1, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, -1, 399, 400, -1, 402, 403, 404, 405, 406, - 407, 408, -1, 410, 411, -1, -1, 414, 415, 416, - 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, - 427, -1, -1, 430, 431, 432, 433, 434, 435, -1, - 437, 438, 439, 440, 441, 442, 443, -1, 445, 446, - 447, 448, 449, 450, -1, -1, 453, -1, -1, 456, - 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, - 477, -1, -1, -1, -1, -1, -1, 484, 485, -1, - -1, -1, -1, -1, 491, -1, 493, -1, -1, -1, - -1, 498, -1, 500, 501, 3, 4, 5, 6, 7, - 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, - -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, - 28, 29, 30, -1, -1, -1, -1, 35, -1, -1, - 38, 39, -1, 41, 42, 43, 44, 45, 46, 47, - 48, 49, 50, 51, 52, -1, 54, 55, 56, 57, - 58, 59, 60, 61, 62, 63, 64, 65, 66, -1, - 68, 69, 70, 71, 72, -1, 74, -1, 76, 77, - 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, - 88, 89, 90, 91, 92, -1, 94, 95, 96, 97, - 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, 116, -1, - 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, - 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, - 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - -1, 159, 160, 161, 162, -1, 164, -1, 166, 167, - -1, 169, 170, 171, 172, 173, 174, -1, 176, -1, - 178, 179, 180, -1, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, -1, 195, 196, 197, - 198, 199, 200, -1, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, -1, 213, -1, 215, -1, -1, - 218, 219, 220, 221, 222, 223, 224, -1, -1, 227, - 228, 229, 230, -1, 232, 233, 234, 235, 236, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, - -1, 269, 270, -1, 272, 273, 274, 275, 276, 277, - 278, 279, -1, 281, 282, -1, -1, 285, 286, 287, - -1, -1, 290, 291, 292, 293, 294, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, - 308, 309, 310, 311, 312, 313, 314, 315, -1, 317, - 318, 319, 320, 321, 322, -1, 324, 325, 326, 327, - 328, 329, 330, 331, -1, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 343, 344, 345, -1, 347, - 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, -1, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, - 378, 379, 380, 381, -1, 383, 384, 385, 386, 387, - 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, - -1, 399, 400, -1, 402, 403, 404, 405, 406, 407, - 408, -1, 410, 411, -1, -1, 414, 415, 416, 417, - 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, - -1, -1, 430, 431, 432, 433, 434, 435, -1, 437, - 438, 439, 440, 441, 442, 443, -1, 445, 446, 447, - 448, 449, 450, -1, -1, 453, -1, -1, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, - -1, -1, -1, -1, -1, -1, 484, 485, -1, -1, - -1, -1, -1, 491, -1, 493, -1, -1, -1, -1, - 498, -1, 500, 501, 3, 4, 5, 6, 7, 8, - 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, - 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, - 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, - 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 52, -1, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, - 69, 70, 71, 72, -1, 74, -1, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, - 89, 90, 91, 92, -1, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, -1, 116, -1, 118, - 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, - 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, - 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, -1, - 159, 160, 161, 162, -1, 164, -1, 166, 167, -1, - 169, 170, 171, 172, 173, 174, -1, 176, -1, 178, - 179, 180, -1, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, -1, 195, 196, 197, 198, - 199, 200, -1, 202, 203, 204, 205, 206, 207, 208, - 209, 210, 211, -1, 213, -1, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, -1, -1, 227, 228, - 229, 230, -1, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, -1, - 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, - 279, -1, 281, 282, -1, -1, 285, 286, 287, -1, - -1, 290, 291, 292, 293, 294, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, - 309, 310, 311, 312, 313, 314, 315, -1, 317, 318, - 319, 320, 321, 322, -1, 324, 325, 326, 327, 328, - 329, 330, 331, -1, 333, 334, 335, 336, 337, 338, - 339, 340, 341, 342, 343, 344, 345, -1, 347, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, -1, 366, 367, 368, - 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, - 379, 380, 381, -1, 383, 384, 385, 386, 387, 388, - 389, 390, 391, 392, 393, 394, 395, 396, 397, -1, - 399, 400, -1, 402, 403, 404, 405, 406, 407, 408, - -1, 410, 411, -1, -1, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, 424, 425, 426, 427, -1, - -1, 430, 431, 432, 433, 434, 435, -1, 437, 438, - 439, 440, 441, 442, 443, -1, 445, 446, 447, 448, - 449, 450, -1, -1, 453, -1, -1, 456, 457, 458, - 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, - 469, 470, 471, 472, 473, 474, 475, 476, -1, -1, - -1, -1, -1, -1, -1, 484, 485, -1, -1, 3, - 4, 5, 6, 7, 493, 9, 10, -1, -1, -1, - -1, 500, 501, -1, -1, 19, 20, 21, 22, 23, - 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, - -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, - 74, -1, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, - -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, - 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, - 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, 156, 157, -1, 159, 160, 161, 162, -1, - 164, -1, 166, 167, -1, 169, 170, 171, 172, 173, - 174, -1, 176, -1, 178, 179, 180, -1, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - -1, 195, 196, 197, 198, 199, 200, -1, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, -1, 213, - -1, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, -1, -1, 227, 228, 229, 230, -1, 232, 233, - 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, -1, 269, 270, 271, 272, 273, - 274, 275, 276, 277, 278, 279, -1, 281, 282, -1, - -1, 285, 286, 287, -1, -1, 290, 291, 292, 293, - 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, -1, 307, 308, 309, 310, 311, 312, 313, - 314, 315, -1, 317, 318, 319, 320, 321, 322, -1, - 324, 325, 326, 327, 328, 329, 330, 331, -1, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, -1, 347, 348, 349, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, -1, 366, 367, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 379, 380, 381, -1, 383, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 396, 397, -1, 399, 400, -1, 402, 403, - 404, 405, 406, 407, 408, -1, 410, 411, -1, -1, - 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, - 424, 425, 426, 427, -1, -1, 430, 431, 432, 433, - 434, 435, -1, 437, 438, 439, 440, 441, 442, 443, - -1, 445, 446, 447, 448, 449, 450, -1, -1, 453, - -1, -1, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, - 474, 475, 476, -1, -1, -1, -1, -1, -1, -1, - 484, 485, -1, -1, -1, -1, -1, -1, -1, 493, - -1, -1, -1, -1, -1, -1, 500, 501, 3, 4, + 476, 477, 478, 479, -1, -1, -1, -1, -1, -1, + 486, 487, -1, -1, -1, -1, -1, 493, -1, 495, + -1, -1, -1, -1, 500, -1, 502, 503, 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, - -1, -1, -1, 38, 39, -1, 41, 42, 43, 44, + 35, -1, -1, 38, 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, 74, @@ -241660,990 +252486,633 @@ static const yytype_int16 yycheck[] = 85, -1, 87, 88, 89, 90, 91, 92, -1, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - -1, 116, -1, 118, 119, 120, 121, 122, 123, -1, + 115, 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, -1, 159, 160, 161, 162, -1, 164, - -1, 166, 167, -1, 169, 170, 171, 172, 173, 174, - -1, 176, -1, 178, 179, 180, -1, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, -1, - 195, 196, 197, 198, 199, 200, -1, 202, 203, 204, - 205, 206, 207, 208, 209, 210, 211, -1, 213, -1, - 215, -1, 217, 218, 219, 220, 221, 222, 223, 224, - -1, -1, 227, 228, 229, 230, -1, 232, 233, 234, + 155, 156, 157, 158, -1, 160, 161, 162, 163, -1, + 165, -1, 167, 168, -1, 170, 171, 172, 173, 174, + 175, -1, 177, -1, 179, 180, 181, -1, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + -1, 196, 197, 198, 199, 200, 201, -1, 203, 204, + 205, 206, 207, 208, 209, 210, 211, 212, -1, 214, + -1, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, -1, -1, 229, 230, 231, 232, -1, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, -1, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, -1, 281, 282, -1, -1, - 285, 286, 287, -1, -1, 290, 291, 292, 293, 294, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, 276, 277, 278, 279, 280, 281, -1, 283, 284, + -1, -1, 287, 288, 289, -1, -1, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, -1, 307, 308, 309, 310, 311, 312, 313, 314, - 315, -1, 317, 318, 319, 320, 321, 322, -1, 324, - 325, 326, 327, 328, 329, 330, 331, -1, 333, 334, + 305, 306, 307, -1, 309, 310, 311, 312, 313, 314, + 315, 316, 317, -1, 319, 320, 321, 322, 323, 324, + -1, 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, -1, 347, 348, 349, 350, 351, 352, 353, 354, + 345, 346, 347, -1, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - -1, 366, 367, 368, 369, 370, 371, 372, 373, 374, - 375, 376, 377, 378, 379, 380, 381, -1, 383, 384, + 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 397, -1, 399, 400, -1, 402, 403, 404, - 405, 406, 407, 408, -1, 410, 411, -1, -1, 414, - 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, -1, -1, 430, 431, 432, 433, 434, - 435, -1, 437, 438, 439, 440, 441, 442, 443, -1, - 445, 446, 447, 448, 449, 450, -1, -1, 453, -1, - -1, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 395, 396, 397, 398, 399, -1, 401, 402, -1, 404, + 405, 406, 407, 408, 409, 410, -1, 412, 413, -1, + -1, 416, 417, 418, 419, 420, 421, 422, 423, 424, + 425, 426, 427, 428, 429, -1, -1, 432, 433, 434, + 435, 436, 437, -1, 439, 440, 441, 442, 443, 444, + 445, -1, 447, 448, 449, 450, 451, 452, -1, -1, + 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, -1, -1, -1, -1, -1, -1, -1, 484, - 485, -1, -1, -1, -1, -1, -1, -1, 493, -1, - -1, -1, -1, -1, -1, 500, 501, 3, 4, 5, - 6, 7, 8, 9, 10, -1, -1, -1, -1, -1, - -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, - 26, -1, 28, 29, 30, -1, -1, -1, -1, 35, - -1, -1, 38, 39, -1, 41, 42, 43, 44, 45, - 46, 47, -1, 49, 50, 51, 52, -1, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, - 66, -1, 68, 69, 70, 71, 72, -1, 74, -1, - 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, - -1, 87, 88, 89, 90, 91, 92, -1, 94, 95, - 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, - 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, - 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, - 136, -1, 138, 139, 140, -1, 142, -1, 144, -1, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - 156, 157, -1, 159, 160, 161, 162, -1, 164, -1, - 166, 167, -1, 169, 170, 171, 172, -1, 174, -1, - 176, -1, 178, 179, 180, -1, 182, 183, 184, 185, - 186, 187, 188, -1, 190, 191, 192, 193, -1, 195, - 196, 197, 198, 199, 200, -1, 202, 203, 204, 205, - 206, 207, 208, 209, 210, 211, -1, 213, -1, 215, - -1, -1, 218, 219, 220, 221, 222, 223, 224, -1, - -1, 227, 228, 229, -1, -1, 232, 233, 234, 235, - 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, - 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, - 266, 267, -1, 269, 270, -1, 272, 273, 274, 275, - 276, 277, 278, 279, -1, 281, 282, -1, -1, 285, - 286, 287, -1, -1, 290, 291, 292, 293, 294, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - -1, 307, 308, 309, 310, 311, 312, 313, 314, 315, - -1, 317, 318, 319, 320, 321, 322, -1, 324, 325, - 326, 327, 328, 329, 330, 331, -1, 333, 334, 335, - 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, - -1, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 362, 363, 364, -1, - 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, -1, 378, 379, 380, 381, -1, 383, 384, 385, - 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, -1, 399, 400, -1, 402, 403, 404, 405, - 406, 407, 408, -1, 410, 411, -1, -1, 414, 415, - 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, - 426, 427, -1, -1, 430, 431, 432, 433, 434, 435, - -1, 437, 438, 439, 440, 441, 442, 443, -1, 445, - 446, 447, 448, 449, 450, -1, -1, 453, -1, -1, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, -1, -1, -1, -1, -1, -1, -1, 484, 485, - 3, -1, -1, -1, -1, 491, -1, 493, -1, -1, - -1, -1, 498, -1, 500, 501, 19, 20, 21, 22, + 475, 476, 477, 478, 479, -1, -1, -1, -1, -1, + -1, 486, 487, -1, -1, -1, -1, -1, 493, -1, + 495, -1, -1, -1, -1, 500, -1, 502, 503, 3, + 4, 5, 6, 7, 8, 9, 10, -1, -1, -1, + -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, + -1, 35, -1, -1, 38, 39, -1, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, + 74, -1, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, -1, 118, 119, 120, 121, 122, 123, + -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, + 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, + 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, -1, 160, 161, 162, 163, + -1, 165, -1, 167, 168, -1, 170, 171, 172, 173, + 174, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, -1, -1, 229, 230, 231, 232, -1, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, -1, 283, + 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, -1, 319, 320, 321, 322, 323, + 324, -1, 326, 327, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, -1, + 404, 405, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, 421, 422, 423, + 424, 425, 426, 427, 428, 429, -1, -1, 432, 433, + 434, 435, 436, 437, -1, 439, 440, 441, 442, 443, + 444, 445, -1, 447, 448, 449, 450, 451, 452, -1, + -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 479, -1, -1, -1, -1, + -1, -1, 486, 487, -1, -1, -1, -1, -1, 493, + -1, 495, -1, -1, -1, -1, 500, -1, 502, 503, + 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, + -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, - -1, -1, -1, 36, -1, 38, 39, -1, 41, 42, - 43, -1, 45, 46, 47, 48, 49, -1, 51, 52, - -1, 54, 55, 56, 57, 58, 59, -1, -1, 62, + -1, -1, 35, -1, -1, 38, 39, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + -1, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, 72, - -1, -1, -1, 76, 77, 78, 79, 80, 81, -1, + -1, 74, -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, - -1, 94, 95, 96, 97, -1, -1, -1, -1, -1, - -1, -1, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, -1, 116, -1, 118, 119, 120, 121, 122, + -1, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, 115, 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, -1, 157, -1, 159, 160, 161, 162, - -1, 164, -1, 166, -1, -1, 169, 170, 171, 172, - -1, 174, -1, 176, -1, 178, 179, 180, -1, 182, - 183, 184, 185, 186, 187, 188, -1, 190, 191, 192, - 193, -1, 195, 196, 197, 198, 199, 200, -1, 202, - 203, 204, 205, 206, 207, 208, 209, 210, 211, -1, - 213, -1, 215, -1, -1, 218, 219, 220, 221, 222, - 223, 224, -1, -1, 227, 228, 229, -1, -1, 232, - 233, 234, -1, -1, 237, 238, 239, 240, 241, 242, + 153, 154, 155, 156, 157, 158, -1, 160, 161, 162, + 163, -1, 165, -1, 167, 168, -1, 170, 171, 172, + 173, 174, 175, -1, 177, -1, 179, 180, 181, -1, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, -1, 196, 197, 198, 199, 200, 201, -1, + 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + -1, 214, -1, 216, 217, 218, 219, 220, 221, 222, + 223, 224, 225, 226, -1, -1, 229, 230, 231, 232, + -1, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, -1, 269, 270, -1, 272, - -1, 274, 275, 276, 277, 278, 279, -1, 281, 282, - -1, -1, 285, 286, 287, -1, -1, 290, 291, -1, - 293, -1, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, -1, 307, 308, 309, 310, 311, 312, - 313, 314, 315, -1, 317, 318, 319, 320, 321, 322, - -1, 324, 325, 326, 327, 328, 329, 330, 331, -1, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, -1, 347, 348, 349, 350, 351, 352, + 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, -1, + 283, 284, -1, -1, 287, 288, 289, -1, -1, 292, + 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, + 303, 304, 305, 306, 307, -1, 309, 310, 311, 312, + 313, 314, 315, 316, 317, -1, 319, 320, 321, 322, + 323, 324, -1, 326, 327, 328, 329, 330, 331, 332, + 333, -1, 335, 336, 337, 338, 339, 340, 341, 342, + 343, 344, 345, 346, 347, -1, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, - 363, 364, -1, 366, 367, 368, 369, 370, -1, 372, - 373, 374, 375, 376, -1, 378, 379, 380, 381, -1, - 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, - 393, 394, 395, 396, 397, -1, 399, 400, -1, 402, - 403, 404, 405, 406, 407, 408, -1, 410, 411, -1, - -1, 414, 415, 416, 417, 418, -1, 420, 421, 422, - 423, 424, 425, 426, 427, -1, -1, 430, 431, 432, - 433, 434, -1, -1, 437, 438, 439, 440, 441, 442, - 443, -1, 445, -1, 447, 448, 449, 450, -1, -1, - 453, -1, -1, 456, 457, 458, 459, 460, 461, 462, + 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, + 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, + 393, 394, 395, 396, 397, 398, 399, -1, 401, 402, + -1, 404, 405, 406, 407, 408, 409, 410, -1, 412, + 413, -1, -1, 416, 417, 418, 419, 420, 421, 422, + 423, 424, 425, 426, 427, 428, 429, -1, -1, 432, + 433, 434, 435, 436, 437, -1, 439, 440, 441, 442, + 443, 444, 445, -1, 447, 448, 449, 450, 451, 452, + -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 473, 474, 475, 476, -1, -1, 3, -1, 5, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 494, 19, 20, 21, 22, 23, 24, 25, 26, - -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, - -1, 38, 39, -1, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, -1, 54, 55, 56, - 57, 58, 59, -1, 61, 62, 63, 64, 65, 66, - -1, 68, 69, 70, 71, 72, -1, 74, -1, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, - 87, 88, 89, 90, 91, 92, -1, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, -1, 116, - -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, - 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, - -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, -1, - 157, -1, 159, 160, 161, 162, -1, 164, -1, 166, - 167, -1, 169, 170, 171, 172, 173, 174, -1, 176, - -1, 178, 179, 180, -1, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, -1, 195, 196, - 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, -1, 213, -1, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, 225, -1, - 227, 228, 229, 230, -1, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, -1, 269, 270, 271, 272, -1, 274, 275, 276, - 277, 278, 279, -1, 281, 282, -1, 284, 285, 286, - 287, -1, -1, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, - 307, 308, 309, 310, 311, 312, 313, 314, 315, -1, - 317, 318, 319, 320, 321, 322, -1, 324, 325, 326, - 327, 328, 329, 330, 331, -1, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, -1, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, -1, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, -1, 399, 400, 401, 402, 403, 404, 405, 406, - 407, 408, -1, 410, 411, -1, -1, 414, 415, 416, - 417, 418, -1, 420, 421, 422, 423, 424, 425, 426, - 427, -1, -1, 430, 431, 432, 433, 434, 435, -1, - 437, 438, 439, 440, 441, 442, 443, -1, 445, 446, - 447, 448, 449, 450, -1, -1, 453, -1, 455, 456, - 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, - -1, 3, 479, 5, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 493, 19, 20, 21, + 473, 474, 475, 476, 477, 478, 479, -1, -1, -1, + -1, -1, -1, 486, 487, -1, -1, -1, -1, -1, + 493, -1, 495, -1, -1, -1, -1, 500, -1, 502, + 503, 3, 4, 5, 6, 7, 8, 9, 10, -1, + -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, - -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, + -1, -1, -1, 35, -1, -1, 38, 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, -1, 54, 55, 56, 57, 58, 59, -1, 61, + 52, -1, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, 74, -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, + 112, 113, 114, 115, 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, 167, -1, 169, 170, 171, - 172, 173, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, 225, -1, 227, 228, 229, 230, -1, - 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 152, 153, 154, 155, 156, 157, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, 168, -1, 170, 171, + 172, 173, 174, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, -1, -1, 219, 220, 221, + 222, 223, 224, 225, 226, -1, -1, 229, 230, 231, + 232, -1, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 265, 266, 267, -1, 269, 270, 271, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, 284, 285, 286, 287, -1, -1, 290, 291, + 262, 263, 264, 265, 266, 267, 268, 269, -1, 271, + 272, -1, 274, 275, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, 349, 350, 351, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, 371, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, 403, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, 435, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, 446, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, 405, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, 421, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, 437, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, 448, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, -1, 3, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 493, 19, 20, 21, 22, 23, 24, 25, 26, - -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, - -1, 38, 39, -1, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, -1, 54, 55, 56, - 57, 58, 59, -1, 61, 62, 63, 64, 65, 66, - -1, 68, 69, 70, 71, 72, -1, 74, -1, 76, - 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, - 87, 88, 89, 90, 91, 92, -1, 94, 95, 96, - 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, -1, 116, - -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, - 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, - -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, -1, - 157, -1, 159, 160, 161, 162, -1, 164, -1, 166, - 167, -1, 169, 170, 171, 172, 173, 174, -1, 176, - -1, 178, 179, 180, -1, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 192, 193, -1, 195, 196, - 197, 198, 199, 200, -1, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, -1, 213, -1, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, -1, -1, - 227, 228, 229, 230, -1, 232, 233, 234, 235, 236, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, - 267, -1, 269, 270, 271, 272, -1, 274, 275, 276, - 277, 278, 279, -1, 281, 282, -1, -1, 285, 286, - 287, -1, -1, 290, 291, 292, 293, 294, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, - 307, 308, 309, 310, 311, 312, 313, 314, 315, -1, - 317, 318, 319, 320, 321, 322, -1, 324, 325, 326, - 327, 328, 329, 330, 331, -1, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, -1, - 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, -1, 366, - 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, - 377, 378, 379, 380, 381, -1, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, -1, 399, 400, -1, 402, 403, 404, 405, 406, - 407, 408, -1, 410, 411, -1, -1, 414, 415, 416, - 417, 418, -1, 420, 421, 422, 423, 424, 425, 426, - 427, -1, -1, 430, 431, 432, 433, 434, 435, -1, - 437, 438, 439, 440, 441, 442, 443, -1, 445, 446, - 447, 448, 449, 450, -1, -1, 453, -1, -1, 456, - 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, - -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 493, 19, 20, 21, + 472, 473, 474, 475, 476, 477, 478, 479, -1, -1, + -1, -1, -1, -1, 486, 487, -1, -1, -1, -1, + -1, 493, -1, 495, -1, -1, -1, -1, 500, -1, + 502, 503, 3, 4, 5, 6, 7, 8, 9, 10, + -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, + 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, + -1, -1, -1, -1, -1, -1, -1, 38, 39, -1, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 52, -1, 54, 55, 56, 57, 58, 59, 60, + 61, 62, 63, 64, 65, 66, -1, 68, 69, 70, + 71, 72, -1, 74, -1, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, + 91, 92, -1, 94, 95, 96, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 113, 114, -1, 116, -1, 118, 119, 120, + 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, + -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, + -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, + 151, 152, 153, 154, 155, 156, 157, 158, -1, 160, + 161, 162, 163, -1, 165, -1, 167, 168, -1, 170, + 171, 172, 173, 174, 175, -1, 177, -1, 179, 180, + 181, -1, 183, 184, 185, 186, 187, 188, 189, 190, + 191, 192, 193, 194, -1, 196, 197, 198, 199, 200, + 201, -1, 203, 204, 205, 206, 207, 208, 209, 210, + 211, 212, -1, 214, -1, 216, 217, 218, 219, 220, + 221, 222, 223, 224, 225, 226, -1, -1, 229, 230, + 231, 232, -1, 234, 235, 236, 237, 238, 239, 240, + 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, + 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, + 261, 262, 263, 264, 265, 266, 267, 268, 269, -1, + 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, + 281, -1, 283, 284, -1, -1, 287, 288, 289, -1, + -1, 292, 293, 294, 295, 296, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, -1, 309, 310, + 311, 312, 313, 314, 315, 316, 317, -1, 319, 320, + 321, 322, 323, 324, -1, 326, 327, 328, 329, 330, + 331, 332, 333, -1, 335, 336, 337, 338, 339, 340, + 341, 342, 343, 344, 345, 346, 347, -1, 349, 350, + 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, + 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, + 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, + 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, -1, + 401, 402, -1, 404, 405, 406, 407, 408, 409, 410, + -1, 412, 413, -1, -1, 416, 417, 418, 419, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, -1, + -1, 432, 433, 434, 435, 436, 437, -1, 439, 440, + 441, 442, 443, 444, 445, -1, 447, 448, 449, 450, + 451, 452, -1, -1, 455, -1, -1, 458, 459, 460, + 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, + 471, 472, 473, 474, 475, 476, 477, 478, -1, -1, + -1, -1, -1, -1, -1, 486, 487, -1, -1, 3, + 4, 5, 6, 7, 495, 9, 10, -1, -1, -1, + -1, 502, 503, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, + -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, + 74, -1, 76, 77, 78, 79, 80, 81, 82, 83, + 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, + 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, + -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, + 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, + 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, -1, 160, 161, 162, 163, + -1, 165, -1, 167, 168, -1, 170, 171, 172, 173, + 174, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + 204, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, 217, 218, 219, 220, 221, 222, 223, + 224, 225, 226, -1, -1, 229, 230, 231, 232, -1, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + 264, 265, 266, 267, 268, 269, -1, 271, 272, 273, + 274, 275, 276, 277, 278, 279, 280, 281, -1, 283, + 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, + 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, -1, 319, 320, 321, 322, 323, + 324, -1, 326, 327, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, 351, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, -1, 368, 369, 370, 371, 372, 373, + 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, -1, + 404, 405, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, 421, 422, 423, + 424, 425, 426, 427, 428, 429, -1, -1, 432, 433, + 434, 435, 436, 437, -1, 439, 440, 441, 442, 443, + 444, 445, -1, 447, 448, 449, 450, 451, 452, -1, + -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, -1, -1, -1, -1, -1, + -1, -1, 486, 487, -1, -1, -1, -1, -1, -1, + -1, 495, -1, -1, -1, -1, -1, -1, 502, 503, + 3, 4, 5, 6, 7, 8, 9, 10, -1, -1, + -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, + 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, + -1, -1, -1, -1, -1, 38, 39, -1, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + -1, 54, 55, 56, 57, 58, 59, 60, 61, 62, + 63, 64, 65, 66, -1, 68, 69, 70, 71, 72, + -1, 74, -1, 76, 77, 78, 79, 80, 81, 82, + 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, + -1, 94, 95, 96, 97, 98, 99, 100, 101, 102, + 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, + 113, 114, -1, 116, -1, 118, 119, 120, 121, 122, + 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, + 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, + 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, + 153, 154, 155, 156, 157, 158, -1, 160, 161, 162, + 163, -1, 165, -1, 167, 168, -1, 170, 171, 172, + 173, 174, 175, -1, 177, -1, 179, 180, 181, -1, + 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, + 193, 194, -1, 196, 197, 198, 199, 200, 201, -1, + 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, + -1, 214, -1, 216, -1, 218, 219, 220, 221, 222, + 223, 224, 225, 226, -1, -1, 229, 230, 231, 232, + -1, 234, 235, 236, 237, 238, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, + 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, + 263, 264, 265, 266, 267, 268, 269, -1, 271, 272, + 273, 274, 275, 276, 277, 278, 279, 280, 281, -1, + 283, 284, -1, -1, 287, 288, 289, -1, -1, 292, + 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, + 303, 304, 305, 306, 307, -1, 309, 310, 311, 312, + 313, 314, 315, 316, 317, -1, 319, 320, 321, 322, + 323, 324, -1, 326, 327, 328, 329, 330, 331, 332, + 333, -1, 335, 336, 337, 338, 339, 340, 341, 342, + 343, 344, 345, 346, 347, -1, 349, 350, 351, 352, + 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, + 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, + 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, + 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, + 393, 394, 395, 396, 397, 398, 399, -1, 401, 402, + -1, 404, 405, 406, 407, 408, 409, 410, -1, 412, + 413, -1, -1, 416, 417, 418, 419, 420, 421, 422, + 423, 424, 425, 426, 427, 428, 429, -1, -1, 432, + 433, 434, 435, 436, 437, -1, 439, 440, 441, 442, + 443, 444, 445, -1, 447, 448, 449, 450, 451, 452, + -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 476, 477, 478, -1, -1, -1, -1, + -1, -1, -1, 486, 487, -1, -1, -1, -1, -1, + -1, -1, 495, -1, -1, -1, -1, -1, -1, 502, + 503, 3, 4, 5, 6, 7, 8, 9, 10, -1, + -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, - -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, -1, 54, 55, 56, 57, 58, 59, -1, 61, + -1, -1, -1, 35, -1, -1, 38, 39, -1, 41, + 42, 43, 44, 45, 46, 47, -1, 49, 50, 51, + 52, -1, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, 74, -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, + 112, 113, 114, 115, 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, - 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, 167, -1, 169, 170, 171, - 172, 173, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, 216, 217, 218, 219, 220, 221, - 222, 223, 224, -1, -1, 227, 228, 229, 230, -1, - 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 142, -1, 144, -1, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, 168, -1, 170, 171, + 172, 173, -1, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, -1, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, -1, -1, 219, 220, 221, + 222, 223, 224, 225, 226, -1, -1, 229, 230, 231, + -1, -1, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - 262, 263, 264, 265, 266, 267, -1, 269, 270, 271, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, + 262, 263, 264, 265, 266, 267, 268, 269, -1, 271, + 272, -1, 274, 275, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, 349, 350, 351, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, 403, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, 435, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, 446, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 372, 373, 374, 375, 376, 377, 378, -1, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, 405, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, 421, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, 437, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, 448, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, -1, 3, 4, 5, -1, - -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, - -1, 493, 19, 20, 21, 22, 23, 24, 25, 26, - -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, + 472, 473, 474, 475, 476, 477, 478, -1, -1, -1, + -1, -1, -1, -1, 486, 487, 3, -1, -1, -1, + -1, 493, -1, 495, -1, -1, -1, -1, 500, -1, + 502, 503, 19, 20, 21, 22, 23, 24, 25, 26, + -1, 28, 29, 30, -1, -1, -1, -1, -1, 36, -1, 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, 84, 85, -1, - 87, 88, 89, 90, 91, 92, -1, -1, 95, 96, + 87, 88, 89, 90, 91, 92, -1, 94, 95, 96, 97, -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, -1, 159, 160, 161, 162, -1, 164, -1, 166, - -1, -1, -1, 170, 171, 172, -1, 174, -1, 176, - -1, 178, 179, 180, -1, 182, 183, 184, 185, 186, - 187, 188, -1, 190, 191, 192, 193, -1, 195, 196, - 197, 198, 199, 200, -1, 202, -1, 204, 205, 206, - 207, 208, 209, 210, 211, -1, 213, -1, 215, -1, - -1, 218, -1, 220, 221, 222, 223, 224, -1, -1, - 227, -1, 229, -1, -1, 232, 233, 234, -1, -1, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, -1, 263, 264, 265, 266, - 267, -1, 269, 270, -1, 272, -1, 274, 275, 276, - 277, 278, 279, -1, 281, 282, 283, -1, 285, 286, - 287, -1, -1, 290, 291, -1, 293, -1, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, - 307, 308, 309, 310, 311, 312, 313, 314, 315, -1, - 317, 318, 319, 320, 321, 322, -1, 324, 325, 326, - 327, 328, 329, 330, 331, -1, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, -1, - 347, 348, -1, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, -1, 366, - 367, 368, 369, 370, -1, 372, 373, 374, 375, 376, - -1, 378, 379, 380, 381, -1, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, -1, 399, 400, -1, 402, -1, 404, 405, 406, - 407, 408, -1, 410, 411, -1, -1, 414, 415, 416, - 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, - 427, -1, -1, 430, 431, 432, 433, 434, -1, -1, - 437, 438, 439, 440, 441, 442, 443, -1, 445, -1, - 447, 448, 449, 450, -1, -1, 453, -1, -1, 456, - 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, - -1, 3, -1, -1, -1, -1, -1, 484, 485, 486, - -1, -1, -1, -1, -1, -1, 493, 19, 20, 21, - 22, 23, 24, 25, 26, -1, 28, 29, 30, 31, - 32, -1, -1, -1, -1, -1, 38, 39, -1, 41, - 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, - 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, - 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, - 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, - -1, 83, 84, 85, -1, 87, 88, 89, 90, 91, - 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, - -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, - 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, - 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, - 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, -1, -1, -1, 170, 171, - 172, -1, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, -1, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, -1, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, -1, -1, 218, -1, 220, 221, - 222, 223, 224, -1, -1, 227, -1, 229, -1, -1, - 232, 233, 234, -1, -1, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - -1, 263, 264, 265, 266, 267, -1, 269, 270, -1, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - -1, 293, -1, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, -1, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 370, -1, - 372, 373, 374, 375, 376, -1, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, 401, - 402, -1, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, -1, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, -1, 447, 448, 449, 450, -1, - -1, 453, -1, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, -1, 3, 479, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 493, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, -1, -1, -1, -1, -1, -1, - -1, 38, 39, -1, 41, 42, 43, -1, 45, 46, - 47, 48, 49, -1, 51, 52, -1, 54, 55, 56, - 57, 58, 59, -1, -1, 62, 63, 64, 65, 66, - -1, 68, 69, 70, 71, 72, -1, -1, -1, 76, - 77, 78, 79, 80, 81, -1, 83, 84, 85, -1, - 87, 88, 89, 90, 91, 92, -1, -1, 95, 96, - 97, -1, -1, -1, -1, -1, -1, -1, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, -1, 116, - -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, - 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, - -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, -1, - 157, -1, 159, 160, 161, 162, -1, 164, -1, 166, - -1, -1, -1, 170, 171, 172, -1, 174, -1, 176, - -1, 178, 179, 180, -1, 182, 183, 184, 185, 186, - 187, 188, -1, 190, 191, 192, 193, -1, 195, 196, - 197, 198, 199, 200, -1, 202, -1, 204, 205, 206, - 207, 208, 209, 210, 211, -1, 213, -1, 215, -1, - -1, 218, -1, 220, 221, 222, 223, 224, -1, -1, - 227, -1, 229, -1, -1, 232, 233, 234, -1, -1, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + -1, 158, -1, 160, 161, 162, 163, -1, 165, -1, + 167, -1, -1, 170, 171, 172, 173, -1, 175, -1, + 177, -1, 179, 180, 181, -1, 183, 184, 185, 186, + 187, 188, 189, -1, 191, 192, 193, 194, -1, 196, + 197, 198, 199, 200, 201, -1, 203, 204, 205, 206, + 207, 208, 209, 210, 211, 212, -1, 214, -1, 216, + -1, -1, 219, 220, 221, 222, 223, 224, 225, 226, + -1, -1, 229, 230, 231, -1, -1, 234, 235, 236, + -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, -1, 263, 264, 265, 266, - 267, -1, 269, 270, -1, 272, -1, 274, 275, 276, - 277, 278, 279, -1, 281, 282, -1, -1, 285, 286, - 287, -1, -1, 290, 291, -1, 293, -1, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, - 307, 308, 309, 310, 311, 312, 313, 314, 315, -1, - 317, 318, 319, 320, 321, 322, -1, 324, 325, 326, - 327, 328, 329, 330, 331, -1, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, -1, - 347, 348, -1, 350, 351, 352, 353, 354, 355, 356, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, 269, -1, 271, 272, -1, 274, -1, 276, + 277, 278, 279, 280, 281, -1, 283, 284, -1, -1, + 287, 288, 289, -1, -1, 292, 293, -1, 295, -1, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, -1, 309, 310, 311, 312, 313, 314, 315, 316, + 317, -1, 319, 320, 321, 322, 323, 324, -1, 326, + 327, 328, 329, 330, 331, 332, 333, -1, 335, 336, + 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, + 347, -1, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, - 367, 368, 369, 370, -1, 372, 373, 374, 375, 376, - -1, 378, 379, 380, 381, -1, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, -1, 399, 400, 401, 402, -1, 404, 405, 406, - 407, 408, -1, 410, 411, -1, -1, 414, 415, 416, - 417, 418, -1, 420, 421, 422, 423, 424, 425, 426, - 427, -1, -1, 430, 431, 432, 433, 434, -1, -1, - 437, 438, 439, 440, 441, 442, 443, -1, 445, -1, - 447, 448, 449, 450, -1, -1, 453, -1, 455, 456, - 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, - -1, 3, 479, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 493, 19, 20, 21, - 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, - -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, - 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, - 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, - 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, - 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, - -1, 83, 84, 85, -1, 87, 88, 89, 90, 91, - 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, - -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, - 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, - 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, - 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, -1, -1, -1, 170, 171, - 172, -1, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, -1, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, -1, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, -1, -1, 218, -1, 220, 221, - 222, 223, 224, -1, -1, 227, -1, 229, -1, -1, - 232, 233, 234, -1, -1, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - -1, 263, 264, 265, 266, 267, -1, 269, 270, -1, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - -1, 293, -1, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, -1, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 370, -1, - 372, 373, 374, 375, 376, -1, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, 401, - 402, -1, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, -1, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, -1, 447, 448, 449, 450, -1, - -1, 453, -1, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, -1, 3, 479, 5, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 493, 19, 20, 21, 22, 23, 24, 25, 26, - -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, - -1, 38, 39, -1, 41, 42, 43, -1, 45, 46, - 47, 48, 49, -1, 51, 52, -1, 54, 55, 56, - 57, 58, 59, -1, -1, 62, 63, 64, 65, 66, - -1, 68, 69, 70, 71, 72, -1, -1, -1, 76, - 77, 78, 79, 80, 81, -1, 83, 84, 85, -1, - 87, 88, 89, 90, 91, 92, -1, -1, 95, 96, - 97, -1, -1, -1, -1, -1, -1, -1, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, -1, 116, - -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, - 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, - -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, -1, - 157, -1, 159, 160, 161, 162, -1, 164, -1, 166, - -1, -1, -1, 170, 171, 172, -1, 174, -1, 176, - -1, 178, 179, 180, -1, 182, 183, 184, 185, 186, - 187, 188, -1, 190, 191, 192, 193, -1, 195, 196, - 197, 198, 199, 200, -1, 202, -1, 204, 205, 206, - 207, 208, 209, 210, 211, -1, 213, -1, 215, -1, - -1, 218, -1, 220, 221, 222, 223, 224, -1, -1, - 227, -1, 229, -1, -1, 232, 233, 234, -1, -1, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, -1, 263, 264, 265, 266, - 267, -1, 269, 270, -1, 272, -1, 274, 275, 276, - 277, 278, 279, -1, 281, 282, -1, -1, 285, 286, - 287, -1, -1, 290, 291, -1, 293, -1, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, - 307, 308, 309, 310, 311, 312, 313, 314, 315, -1, - 317, 318, 319, 320, 321, 322, -1, 324, 325, 326, - 327, 328, 329, 330, 331, -1, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, -1, - 347, 348, -1, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, -1, 366, - 367, 368, 369, 370, -1, 372, 373, 374, 375, 376, - -1, 378, 379, 380, 381, -1, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, -1, 399, 400, -1, 402, -1, 404, 405, 406, - 407, 408, -1, 410, 411, -1, -1, 414, 415, 416, - 417, 418, -1, 420, 421, 422, 423, 424, 425, 426, - 427, -1, -1, 430, 431, 432, 433, 434, -1, -1, - 437, 438, 439, 440, 441, 442, 443, -1, 445, -1, - 447, 448, 449, 450, -1, -1, 453, -1, -1, 456, - 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, - -1, 3, -1, 5, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 493, 19, 20, 21, - 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, - -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, - 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, - 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, - 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, - 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, - -1, 83, 84, 85, -1, 87, 88, 89, 90, 91, - 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, - -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, - 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, - 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, - 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, -1, -1, -1, 170, 171, - 172, -1, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, -1, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, -1, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, -1, -1, 218, -1, 220, 221, - 222, 223, 224, -1, -1, 227, -1, 229, -1, -1, - 232, 233, 234, -1, -1, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - -1, 263, 264, 265, 266, 267, -1, 269, 270, -1, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - -1, 293, -1, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, -1, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, -1, - 372, 373, 374, 375, 376, -1, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, -1, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, -1, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, -1, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, -1, 3, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 493, 19, 20, 21, 22, 23, 24, 25, 26, - -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, - -1, 38, 39, -1, 41, 42, 43, -1, 45, 46, - 47, 48, 49, -1, 51, 52, -1, 54, 55, 56, - 57, 58, 59, -1, -1, 62, 63, 64, 65, 66, - -1, 68, 69, 70, 71, 72, -1, -1, -1, 76, - 77, 78, 79, 80, 81, -1, 83, 84, 85, -1, - 87, 88, 89, 90, 91, 92, -1, -1, 95, 96, - 97, -1, -1, -1, -1, -1, -1, -1, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, -1, 116, - -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, - 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, - -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, -1, - 157, -1, 159, 160, 161, 162, -1, 164, -1, 166, - -1, -1, -1, 170, 171, 172, -1, 174, -1, 176, - -1, 178, 179, 180, -1, 182, 183, 184, 185, 186, - 187, 188, -1, 190, 191, 192, 193, -1, 195, 196, - 197, 198, 199, 200, -1, 202, -1, 204, 205, 206, - 207, 208, 209, 210, 211, -1, 213, -1, 215, -1, - -1, 218, -1, 220, 221, 222, 223, 224, -1, -1, - 227, -1, 229, -1, -1, 232, 233, 234, -1, -1, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, -1, 263, 264, 265, 266, - 267, -1, 269, 270, -1, 272, -1, 274, 275, 276, - 277, 278, 279, -1, 281, 282, -1, -1, 285, 286, - 287, -1, -1, 290, 291, -1, 293, -1, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, - 307, 308, 309, 310, 311, 312, 313, 314, 315, -1, - 317, 318, 319, 320, 321, 322, -1, 324, 325, 326, - 327, 328, 329, 330, 331, -1, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, -1, - 347, 348, -1, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, -1, 366, - 367, 368, 369, 370, -1, 372, 373, 374, 375, 376, - -1, 378, 379, 380, 381, -1, 383, 384, 385, 386, + -1, 368, 369, 370, 371, 372, -1, 374, 375, 376, + 377, 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, -1, 399, 400, -1, 402, -1, 404, 405, 406, - 407, 408, -1, 410, 411, -1, -1, 414, 415, 416, - 417, 418, -1, 420, 421, 422, 423, 424, 425, 426, - 427, -1, -1, 430, 431, 432, 433, 434, -1, -1, - 437, 438, 439, 440, 441, 442, 443, -1, 445, -1, - 447, 448, 449, 450, -1, -1, 453, -1, -1, 456, - 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, + 397, 398, 399, -1, 401, 402, -1, 404, 405, 406, + 407, 408, 409, 410, -1, 412, 413, -1, -1, 416, + 417, 418, 419, 420, -1, 422, 423, 424, 425, 426, + 427, 428, 429, -1, -1, 432, 433, 434, 435, 436, + -1, -1, 439, 440, 441, 442, 443, 444, 445, -1, + 447, -1, 449, 450, 451, 452, -1, -1, 455, -1, + -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, - -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 493, 19, 20, 21, + 477, 478, -1, -1, 3, -1, 5, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 496, + 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, + 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, + 39, -1, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, -1, 54, 55, 56, 57, 58, + 59, -1, 61, 62, 63, 64, 65, 66, -1, 68, + 69, 70, 71, 72, -1, 74, -1, 76, 77, 78, + 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, + 89, 90, 91, 92, -1, 94, 95, 96, 97, 98, + 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, + 109, 110, 111, 112, 113, 114, -1, 116, -1, 118, + 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, + 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, + 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, + 149, 150, 151, 152, 153, 154, 155, 156, -1, 158, + -1, 160, 161, 162, 163, -1, 165, -1, 167, 168, + -1, 170, 171, 172, 173, 174, 175, -1, 177, -1, + 179, 180, 181, -1, 183, 184, 185, 186, 187, 188, + 189, 190, 191, 192, 193, 194, -1, 196, 197, 198, + 199, 200, 201, -1, 203, 204, 205, 206, 207, 208, + 209, 210, 211, 212, -1, 214, -1, 216, 217, 218, + 219, 220, 221, 222, 223, 224, 225, 226, 227, -1, + 229, 230, 231, 232, -1, 234, 235, 236, 237, 238, + 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, + 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, + 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, + 269, -1, 271, 272, 273, 274, -1, 276, 277, 278, + 279, 280, 281, -1, 283, 284, -1, 286, 287, 288, + 289, -1, -1, 292, 293, 294, 295, 296, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, -1, + 309, 310, 311, 312, 313, 314, 315, 316, 317, -1, + 319, 320, 321, 322, 323, 324, -1, 326, 327, 328, + 329, 330, 331, 332, 333, -1, 335, 336, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, -1, + 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, + 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, + 379, 380, 381, 382, 383, -1, 385, 386, 387, 388, + 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, + 399, -1, 401, 402, 403, 404, 405, 406, 407, 408, + 409, 410, -1, 412, 413, -1, -1, 416, 417, 418, + 419, 420, -1, 422, 423, 424, 425, 426, 427, 428, + 429, -1, -1, 432, 433, 434, 435, 436, 437, -1, + 439, 440, 441, 442, 443, 444, 445, -1, 447, 448, + 449, 450, 451, 452, -1, -1, 455, -1, 457, 458, + 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, + 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, + -1, 3, 481, 5, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 495, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, - 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, - 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, -1, 54, 55, 56, 57, 58, 59, -1, 61, 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, - 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, - -1, 83, 84, 85, -1, 87, 88, 89, 90, 91, - 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, - -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, + 72, -1, 74, -1, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, + 92, -1, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, -1, -1, -1, 170, 171, - 172, -1, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, -1, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, -1, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, -1, -1, 218, -1, 220, 221, - 222, 223, 224, -1, -1, 227, -1, 229, -1, -1, - 232, 233, 234, -1, -1, 237, 238, 239, 240, 241, + 152, 153, 154, 155, 156, -1, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, 168, -1, 170, 171, + 172, 173, 174, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, 227, -1, 229, 230, 231, + 232, -1, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - -1, 263, 264, 265, 266, 267, -1, 269, 270, -1, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - -1, 293, -1, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, -1, 350, 351, + 262, 263, 264, 265, 266, 267, 268, 269, -1, 271, + 272, 273, 274, -1, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, 286, 287, 288, 289, -1, -1, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, -1, - 372, 373, 374, 375, 376, -1, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, -1, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, -1, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, -1, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, 405, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, -1, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, 437, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, 448, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, -1, 3, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 493, 19, 20, 21, 22, 23, 24, 25, 26, - -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, - -1, 38, 39, -1, 41, 42, 43, -1, 45, 46, - 47, 48, 49, -1, 51, 52, -1, 54, 55, 56, - 57, 58, 59, -1, -1, 62, 63, 64, 65, 66, - -1, 68, 69, 70, 71, 72, -1, -1, -1, 76, - 77, 78, 79, 80, 81, -1, 83, 84, 85, -1, - 87, 88, 89, 90, 91, 92, -1, -1, 95, 96, - 97, -1, -1, -1, -1, -1, -1, -1, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, -1, 116, - -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, - 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, - -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, -1, - 157, -1, 159, 160, 161, 162, -1, 164, -1, 166, - -1, -1, -1, 170, 171, 172, -1, 174, -1, 176, - -1, 178, 179, 180, -1, 182, 183, 184, 185, 186, - 187, 188, -1, 190, 191, 192, 193, -1, 195, 196, - 197, 198, 199, 200, -1, 202, -1, 204, 205, 206, - 207, 208, 209, 210, 211, -1, 213, -1, 215, -1, - -1, 218, -1, 220, 221, 222, 223, 224, -1, -1, - 227, -1, 229, -1, -1, 232, 233, 234, -1, -1, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, - 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, -1, 263, 264, 265, 266, - 267, -1, 269, 270, -1, 272, -1, 274, 275, 276, - 277, 278, 279, -1, 281, 282, -1, -1, 285, 286, - 287, -1, -1, 290, 291, -1, 293, -1, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, - 307, 308, 309, 310, 311, 312, 313, 314, 315, -1, - 317, 318, 319, 320, 321, 322, -1, 324, 325, 326, - 327, 328, 329, 330, 331, -1, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, -1, - 347, 348, -1, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, -1, 366, - 367, 368, 369, 370, -1, 372, 373, 374, 375, 376, - -1, 378, 379, 380, 381, -1, 383, 384, 385, 386, - 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, -1, 399, 400, -1, 402, -1, 404, 405, 406, - 407, 408, -1, 410, 411, -1, -1, 414, 415, 416, - 417, 418, -1, 420, 421, 422, 423, 424, 425, 426, - 427, -1, -1, 430, 431, 432, 433, 434, -1, -1, - 437, 438, 439, 440, 441, 442, 443, -1, 445, -1, - 447, 448, 449, 450, -1, -1, 453, -1, -1, 456, - 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, - 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, - -1, -1, -1, -1, 3, 4, 5, -1, -1, 8, - 9, -1, -1, -1, -1, -1, 493, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, - 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, - 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, - 69, 70, 71, -1, 73, 74, 75, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, - 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, - 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, - 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, - 149, -1, 151, 152, 153, 154, -1, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, 177, -1, - -1, 180, 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, - 199, 200, 201, 202, 203, -1, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, - 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, - 269, 270, 271, 272, 273, -1, 275, 276, 277, 278, - 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, - 289, 290, -1, 292, 293, 294, -1, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, - -1, 310, 311, -1, 313, 314, 315, 316, 317, 318, - 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, - 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, - 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, - 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, - 389, 390, 391, 392, 393, 394, 395, -1, 397, 398, - 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, - 409, 410, 411, 412, 413, 414, 415, -1, 417, -1, - 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, - 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, - 439, 440, 441, -1, 443, 444, 445, 446, 447, 448, - 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, - 459, 460, 461, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 473, 474, 475, 476, -1, 3, - -1, 480, 481, 482, 8, 484, 485, 486, 487, 488, - 489, -1, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, - -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, - -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, - 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, - 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, - -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, - 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, - -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, - -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, - -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, - 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, - 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, -1, 157, -1, 159, 160, 161, 162, -1, - 164, -1, 166, -1, -1, -1, 170, 171, 172, -1, - 174, -1, 176, -1, 178, 179, 180, -1, 182, 183, - 184, 185, 186, 187, 188, -1, 190, 191, 192, 193, - -1, 195, 196, 197, 198, 199, 200, -1, 202, -1, - 204, 205, 206, 207, 208, 209, 210, 211, -1, 213, - -1, 215, -1, -1, 218, -1, 220, 221, 222, 223, - 224, -1, -1, 227, -1, 229, -1, -1, 232, 233, - 234, -1, -1, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, -1, 263, - 264, 265, 266, 267, -1, 269, 270, -1, 272, -1, - 274, 275, 276, 277, 278, 279, -1, 281, 282, -1, - -1, 285, 286, 287, -1, -1, 290, 291, -1, 293, - -1, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, -1, 307, 308, 309, 310, 311, 312, 313, - 314, 315, -1, 317, 318, 319, 320, 321, 322, -1, - 324, 325, 326, 327, 328, 329, 330, 331, -1, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, -1, 347, 348, -1, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, -1, 366, 367, 368, 369, 370, -1, 372, 373, - 374, 375, 376, -1, 378, 379, 380, 381, -1, 383, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 396, 397, -1, 399, 400, -1, 402, -1, - 404, 405, 406, 407, 408, -1, 410, 411, -1, -1, - 414, 415, 416, 417, 418, -1, 420, 421, 422, 423, - 424, 425, 426, 427, -1, -1, 430, 431, 432, 433, - 434, -1, -1, 437, 438, 439, 440, 441, 442, 443, - -1, 445, -1, 447, 448, 449, 450, -1, -1, 453, - -1, -1, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, - 474, 475, 476, -1, -1, -1, 480, 481, 482, -1, - 484, 485, 486, 487, 488, 489, 8, -1, -1, 11, - -1, -1, -1, -1, 16, 17, 18, -1, -1, -1, - -1, -1, -1, -1, 8, -1, -1, 11, -1, -1, - -1, 33, 16, 17, 18, -1, -1, -1, -1, 41, - -1, -1, -1, -1, -1, -1, 48, -1, -1, 33, - -1, -1, -1, 8, -1, -1, 11, 41, -1, -1, - -1, 16, 17, 18, 48, -1, -1, -1, -1, -1, - -1, 73, 8, -1, -1, 11, -1, -1, 33, -1, - 16, 17, 18, -1, -1, -1, 41, -1, -1, 73, - -1, -1, -1, 48, -1, -1, -1, 33, -1, -1, - -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, - -1, -1, 48, -1, -1, -1, -1, -1, 73, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 8, -1, -1, 11, -1, - -1, -1, -1, 16, 17, 18, -1, -1, -1, -1, - -1, 173, -1, 8, -1, -1, 11, -1, -1, -1, - 33, 16, 17, 18, -1, -1, -1, 189, 41, 173, - -1, -1, 194, -1, -1, 48, -1, -1, 33, -1, - -1, -1, -1, -1, -1, 189, 41, -1, -1, -1, - 194, -1, -1, 48, 216, 217, -1, -1, 173, -1, - 73, -1, -1, -1, -1, -1, -1, -1, 230, -1, - -1, -1, 216, 217, 189, -1, -1, 173, 73, 194, - -1, -1, -1, -1, -1, -1, 230, -1, -1, -1, - -1, -1, -1, 189, -1, -1, -1, -1, 194, -1, - -1, 216, 217, -1, -1, -1, 268, -1, -1, 271, - -1, -1, -1, -1, -1, 230, -1, -1, -1, -1, - 216, 217, -1, 285, 268, -1, 288, 271, -1, -1, - -1, -1, -1, -1, 230, -1, -1, -1, -1, -1, - -1, 285, -1, -1, 288, -1, -1, -1, -1, -1, - -1, -1, -1, 268, -1, -1, 271, -1, -1, -1, - 173, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 285, -1, 268, 288, -1, 271, 189, -1, 173, -1, - -1, 194, -1, -1, -1, -1, -1, -1, -1, 285, - -1, -1, 288, -1, 189, -1, -1, -1, -1, 194, - -1, -1, -1, 216, 217, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 377, -1, 230, -1, -1, - -1, 216, 217, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 377, -1, 230, -1, -1, 8, -1, - -1, 11, -1, -1, -1, -1, 16, 17, 18, -1, - -1, -1, -1, -1, -1, 268, -1, -1, 271, -1, - -1, -1, 377, 33, -1, -1, -1, -1, -1, -1, - -1, 41, 285, 268, -1, 288, 271, -1, 48, -1, - -1, 377, -1, -1, -1, -1, -1, -1, -1, -1, - 285, -1, -1, 288, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 477, -1, -1, 480, 481, - 482, -1, 484, 485, 486, 487, 488, 489, -1, -1, - -1, -1, 494, 477, -1, -1, 480, 481, 482, -1, - 484, 485, 486, 487, 488, 489, -1, -1, -1, -1, - 494, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 477, -1, 377, 480, 481, 482, -1, 484, - 485, 486, 487, 488, 489, -1, -1, -1, -1, 494, - -1, 477, 377, -1, 480, 481, 482, -1, 484, 485, - 486, 487, 488, 489, -1, -1, -1, -1, 494, -1, - -1, -1, -1, 173, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 189, - -1, -1, -1, -1, 194, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 216, 217, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 230, -1, -1, -1, 477, -1, -1, 480, 481, 482, - -1, 484, 485, 486, 487, 488, 489, -1, -1, -1, - -1, 494, 477, -1, -1, 480, 481, 482, -1, 484, - 485, 486, 487, 488, 489, -1, -1, -1, 268, 494, - -1, 271, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 285, -1, -1, 288, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 472, 473, 474, 475, 476, 477, 478, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 377, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 477, 3, -1, - 480, 481, 482, -1, 484, 485, 486, 487, 488, 489, - -1, -1, 492, -1, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, 43, -1, - 45, 46, 47, 48, 49, -1, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, -1, - 75, 76, 77, 78, 79, 80, 81, -1, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, -1, - 95, 96, 97, 98, 99, 100, -1, 102, 103, 104, + -1, -1, -1, 495, 19, 20, 21, 22, 23, 24, + 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, + -1, -1, -1, 38, 39, -1, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, -1, 54, + 55, 56, 57, 58, 59, -1, 61, 62, 63, 64, + 65, 66, -1, 68, 69, 70, 71, 72, -1, 74, + -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, -1, 87, 88, 89, 90, 91, 92, -1, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, - 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, -1, 168, -1, 170, 171, 172, -1, 174, - 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, -1, 190, 191, 192, 193, 194, - 195, 196, 197, 198, 199, 200, 201, 202, -1, 204, - 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, - 215, -1, -1, 218, -1, 220, 221, 222, 223, 224, - 225, 226, 227, -1, 229, -1, 231, 232, 233, 234, + -1, 116, -1, 118, 119, 120, 121, 122, 123, -1, + 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, + 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, + -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, -1, 158, -1, 160, 161, 162, 163, -1, + 165, -1, 167, 168, -1, 170, 171, 172, 173, 174, + 175, -1, 177, -1, 179, 180, 181, -1, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + -1, 196, 197, 198, 199, 200, 201, -1, 203, 204, + 205, 206, 207, 208, 209, 210, 211, 212, -1, 214, + -1, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, -1, -1, 229, 230, 231, 232, -1, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, - 255, 256, 257, 258, 259, 260, 261, -1, 263, 264, - 265, 266, 267, 268, 269, 270, -1, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, -1, 293, -1, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, -1, 271, 272, 273, 274, + -1, 276, 277, 278, 279, 280, 281, -1, 283, 284, + -1, -1, 287, 288, 289, -1, -1, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 305, 306, 307, -1, 309, 310, 311, 312, 313, 314, + 315, 316, 317, -1, 319, 320, 321, 322, 323, 324, + -1, 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 346, 347, 348, -1, 350, 351, 352, 353, 354, + 345, 346, 347, -1, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, - 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, - 375, 376, -1, 378, 379, 380, 381, 382, 383, 384, + 365, 366, -1, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, - 395, 396, 397, 398, 399, 400, 401, 402, -1, 404, - 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, - 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, - 445, -1, 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, + 395, 396, 397, 398, 399, -1, 401, 402, -1, 404, + 405, 406, 407, 408, 409, 410, -1, 412, 413, -1, + -1, 416, 417, 418, 419, 420, -1, 422, 423, 424, + 425, 426, 427, 428, 429, -1, -1, 432, 433, 434, + 435, 436, 437, -1, 439, 440, 441, 442, 443, 444, + 445, -1, 447, 448, 449, 450, 451, 452, -1, -1, + 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, - 475, 476, 3, -1, -1, -1, -1, -1, -1, -1, - -1, 486, -1, -1, -1, -1, -1, -1, 19, 20, + 475, 476, 477, 478, -1, 3, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 495, 19, 20, 21, 22, 23, 24, 25, 26, -1, + 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, + 38, 39, -1, 41, 42, 43, 44, 45, 46, 47, + 48, 49, 50, 51, 52, -1, 54, 55, 56, 57, + 58, 59, -1, 61, 62, 63, 64, 65, 66, -1, + 68, 69, 70, 71, 72, -1, 74, -1, 76, 77, + 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, + 88, 89, 90, 91, 92, -1, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, + 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, + 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, + 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, -1, + 158, -1, 160, 161, 162, 163, -1, 165, -1, 167, + 168, -1, 170, 171, 172, 173, 174, 175, -1, 177, + -1, 179, 180, 181, -1, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, -1, 196, 197, + 198, 199, 200, 201, -1, 203, 204, 205, 206, 207, + 208, 209, 210, 211, 212, -1, 214, -1, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, -1, + -1, 229, 230, 231, 232, -1, 234, 235, 236, 237, + 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, 269, -1, 271, 272, 273, 274, -1, 276, 277, + 278, 279, 280, 281, -1, 283, 284, -1, -1, 287, + 288, 289, -1, -1, 292, 293, 294, 295, 296, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, + -1, 319, 320, 321, 322, 323, 324, -1, 326, 327, + 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + -1, 349, 350, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 382, 383, -1, 385, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, -1, 401, 402, -1, 404, 405, 406, 407, + 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, + 418, 419, 420, -1, 422, 423, 424, 425, 426, 427, + 428, 429, -1, -1, 432, 433, 434, 435, 436, 437, + -1, 439, 440, 441, 442, 443, 444, 445, -1, 447, + 448, 449, 450, 451, 452, -1, -1, 455, -1, -1, + 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, + 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, + 478, -1, 3, 4, 5, -1, -1, -1, 9, -1, + -1, -1, -1, -1, -1, -1, -1, 495, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, -1, @@ -242657,42 +253126,90 @@ static const yytype_int16 yycheck[] = 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, - 151, 152, 153, 154, 155, -1, 157, -1, 159, 160, - 161, 162, -1, 164, -1, 166, -1, -1, -1, 170, - 171, 172, -1, 174, -1, 176, -1, 178, 179, 180, - -1, 182, 183, 184, 185, 186, 187, 188, -1, 190, - 191, 192, 193, -1, 195, 196, 197, 198, 199, 200, - -1, 202, -1, 204, 205, 206, 207, 208, 209, 210, - 211, -1, 213, -1, 215, -1, -1, 218, -1, 220, - 221, 222, 223, 224, -1, -1, 227, -1, 229, -1, - -1, 232, 233, 234, -1, -1, 237, 238, 239, 240, + 151, 152, 153, 154, 155, 156, 157, 158, -1, 160, + 161, 162, 163, -1, 165, -1, 167, -1, -1, -1, + 171, 172, 173, -1, 175, -1, 177, -1, 179, 180, + 181, -1, 183, 184, 185, 186, 187, 188, 189, -1, + 191, 192, 193, 194, -1, 196, 197, 198, 199, 200, + 201, -1, 203, -1, 205, 206, 207, 208, 209, 210, + 211, 212, -1, 214, -1, 216, -1, -1, 219, -1, + 221, 222, 223, 224, 225, 226, -1, -1, 229, -1, + 231, -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - 261, -1, 263, 264, 265, 266, 267, -1, 269, 270, - -1, 272, -1, 274, 275, 276, 277, 278, 279, -1, - 281, 282, -1, -1, 285, 286, 287, -1, -1, 290, - 291, -1, 293, -1, 295, 296, 297, 298, 299, 300, - 301, 302, 303, 304, 305, -1, 307, 308, 309, 310, - 311, 312, 313, 314, 315, -1, 317, 318, 319, 320, - 321, 322, -1, 324, 325, 326, 327, 328, 329, 330, - 331, -1, 333, 334, 335, 336, 337, 338, 339, 340, - 341, 342, 343, 344, 345, -1, 347, 348, -1, 350, - 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, - 361, 362, 363, 364, -1, 366, 367, 368, 369, 370, - -1, 372, 373, 374, 375, 376, -1, 378, 379, 380, - 381, -1, 383, 384, 385, 386, 387, 388, 389, 390, - 391, 392, 393, 394, 395, 396, 397, -1, 399, 400, - -1, 402, -1, 404, 405, 406, 407, 408, -1, 410, - 411, -1, -1, 414, 415, 416, 417, 418, -1, 420, - 421, 422, 423, 424, 425, 426, 427, -1, -1, 430, - 431, 432, 433, 434, -1, -1, 437, 438, 439, 440, - 441, 442, 443, -1, 445, -1, 447, 448, 449, 450, - -1, -1, 453, -1, -1, 456, 457, 458, 459, 460, + 261, 262, 263, -1, 265, 266, 267, 268, 269, -1, + 271, 272, -1, 274, -1, 276, 277, 278, 279, 280, + 281, -1, 283, 284, 285, -1, 287, 288, 289, -1, + -1, 292, 293, -1, 295, -1, 297, 298, 299, 300, + 301, 302, 303, 304, 305, 306, 307, -1, 309, 310, + 311, 312, 313, 314, 315, 316, 317, -1, 319, 320, + 321, 322, 323, 324, -1, 326, 327, 328, 329, 330, + 331, 332, 333, -1, 335, 336, 337, 338, 339, 340, + 341, 342, 343, 344, 345, 346, 347, -1, 349, 350, + -1, 352, 353, 354, 355, 356, 357, 358, 359, 360, + 361, 362, 363, 364, 365, 366, -1, 368, 369, 370, + 371, 372, -1, 374, 375, 376, 377, 378, -1, 380, + 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, + 391, 392, 393, 394, 395, 396, 397, 398, 399, -1, + 401, 402, -1, 404, -1, 406, 407, 408, 409, 410, + -1, 412, 413, -1, -1, 416, 417, 418, 419, 420, + 421, 422, 423, 424, 425, 426, 427, 428, 429, -1, + -1, 432, 433, 434, 435, 436, -1, -1, 439, 440, + 441, 442, 443, 444, 445, -1, 447, -1, 449, 450, + 451, 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, - 471, 472, 473, 474, 475, 476, 3, 4, 5, -1, - -1, -1, 9, -1, -1, 486, -1, -1, -1, -1, - -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, - -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, + 471, 472, 473, 474, 475, 476, 477, 478, -1, 3, + -1, -1, -1, -1, -1, 486, 487, 488, -1, -1, + -1, -1, -1, -1, 495, 19, 20, 21, 22, 23, + 24, 25, 26, -1, 28, 29, 30, 31, 32, -1, + -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, + -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, + 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, + 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, + -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, + 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, + -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, + -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, + -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, + 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, + 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, -1, 158, -1, 160, 161, 162, 163, + -1, 165, -1, 167, -1, -1, -1, 171, 172, 173, + -1, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, -1, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + -1, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, -1, -1, 219, -1, 221, 222, 223, + 224, 225, 226, -1, -1, 229, -1, 231, -1, -1, + 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + -1, 265, 266, 267, 268, 269, -1, 271, 272, -1, + 274, -1, 276, 277, 278, 279, 280, 281, -1, 283, + 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, + -1, 295, -1, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, -1, 319, 320, 321, 322, 323, + 324, -1, 326, 327, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, 367, 368, 369, 370, 371, 372, -1, + 374, 375, 376, 377, 378, -1, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, 403, + 404, -1, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, -1, 422, 423, + 424, 425, 426, 427, 428, 429, -1, -1, 432, 433, + 434, 435, 436, -1, -1, 439, 440, 441, 442, 443, + 444, 445, -1, 447, -1, 449, 450, 451, 452, -1, + -1, 455, -1, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, -1, 3, 481, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 495, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, 66, @@ -242700,45 +253217,93 @@ static const yytype_int16 yycheck[] = 77, 78, 79, 80, 81, -1, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, -1, 105, 106, - 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, + 107, 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, - 157, -1, 159, 160, 161, 162, -1, 164, -1, 166, - -1, -1, -1, 170, 171, 172, -1, 174, -1, 176, - -1, 178, 179, 180, -1, 182, 183, 184, 185, 186, - 187, 188, -1, 190, 191, 192, 193, -1, 195, 196, - 197, 198, 199, 200, -1, 202, -1, 204, 205, 206, - 207, 208, 209, 210, 211, -1, 213, -1, 215, -1, - -1, 218, -1, 220, 221, 222, 223, 224, -1, -1, - 227, -1, 229, -1, -1, 232, 233, 234, -1, -1, - 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, + -1, 158, -1, 160, 161, 162, 163, -1, 165, -1, + 167, -1, -1, -1, 171, 172, 173, -1, 175, -1, + 177, -1, 179, 180, 181, -1, 183, 184, 185, 186, + 187, 188, 189, -1, 191, 192, 193, 194, -1, 196, + 197, 198, 199, 200, 201, -1, 203, -1, 205, 206, + 207, 208, 209, 210, 211, 212, -1, 214, -1, 216, + -1, -1, 219, -1, 221, 222, 223, 224, 225, 226, + -1, -1, 229, -1, 231, -1, -1, 234, 235, 236, + -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, -1, 263, 264, 265, 266, - 267, -1, 269, 270, -1, 272, -1, 274, 275, 276, - 277, 278, 279, -1, 281, 282, 283, -1, 285, 286, - 287, -1, -1, 290, 291, -1, 293, -1, 295, 296, - 297, 298, 299, 300, 301, 302, 303, 304, 305, -1, - 307, 308, 309, 310, 311, 312, 313, 314, 315, -1, - 317, 318, 319, 320, 321, 322, -1, 324, 325, 326, - 327, 328, 329, 330, 331, -1, 333, 334, 335, 336, - 337, 338, 339, 340, 341, 342, 343, 344, 345, -1, - 347, 348, -1, 350, 351, 352, 353, 354, 355, 356, - 357, 358, 359, 360, 361, 362, 363, 364, -1, 366, - 367, 368, 369, 370, -1, 372, 373, 374, 375, 376, - -1, 378, 379, 380, 381, -1, 383, 384, 385, 386, + 257, 258, 259, 260, 261, 262, 263, -1, 265, 266, + 267, 268, 269, -1, 271, 272, -1, 274, -1, 276, + 277, 278, 279, 280, 281, -1, 283, 284, -1, -1, + 287, 288, 289, -1, -1, 292, 293, -1, 295, -1, + 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, -1, 309, 310, 311, 312, 313, 314, 315, 316, + 317, -1, 319, 320, 321, 322, 323, 324, -1, 326, + 327, 328, 329, 330, 331, 332, 333, -1, 335, 336, + 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, + 347, -1, 349, 350, -1, 352, 353, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, + 367, 368, 369, 370, 371, 372, -1, 374, 375, 376, + 377, 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, - 397, -1, 399, 400, -1, 402, -1, 404, 405, 406, - 407, 408, -1, 410, 411, -1, -1, 414, 415, 416, - 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, - 427, -1, -1, 430, 431, 432, 433, 434, -1, -1, - 437, 438, 439, 440, 441, 442, 443, -1, 445, -1, - 447, 448, 449, 450, -1, -1, 453, -1, -1, 456, + 397, 398, 399, -1, 401, 402, 403, 404, -1, 406, + 407, 408, 409, 410, -1, 412, 413, -1, -1, 416, + 417, 418, 419, 420, -1, 422, 423, 424, 425, 426, + 427, 428, 429, -1, -1, 432, 433, 434, 435, 436, + -1, -1, 439, 440, 441, 442, 443, 444, 445, -1, + 447, -1, 449, 450, 451, 452, -1, -1, 455, -1, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, 476, - 3, 4, 5, -1, -1, -1, 9, 484, 485, -1, - -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, + 477, 478, -1, 3, 481, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 495, 19, + 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, + 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, + -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, + -1, 51, 52, -1, 54, 55, 56, 57, 58, 59, + -1, -1, 62, 63, 64, 65, 66, -1, 68, 69, + 70, 71, 72, -1, -1, -1, 76, 77, 78, 79, + 80, 81, -1, 83, 84, 85, -1, 87, 88, 89, + 90, 91, 92, -1, -1, 95, 96, 97, -1, -1, + -1, -1, -1, -1, -1, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, + 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, + -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, + 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, -1, 158, -1, + 160, 161, 162, 163, -1, 165, -1, 167, -1, -1, + -1, 171, 172, 173, -1, 175, -1, 177, -1, 179, + 180, 181, -1, 183, 184, 185, 186, 187, 188, 189, + -1, 191, 192, 193, 194, -1, 196, 197, 198, 199, + 200, 201, -1, 203, -1, 205, 206, 207, 208, 209, + 210, 211, 212, -1, 214, -1, 216, -1, -1, 219, + -1, 221, 222, 223, 224, 225, 226, -1, -1, 229, + -1, 231, -1, -1, 234, 235, 236, -1, -1, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, -1, 265, 266, 267, 268, 269, + -1, 271, 272, -1, 274, -1, 276, 277, 278, 279, + 280, 281, -1, 283, 284, -1, -1, 287, 288, 289, + -1, -1, 292, 293, -1, 295, -1, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, -1, 319, + 320, 321, 322, 323, 324, -1, 326, 327, 328, 329, + 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, -1, 349, + 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, + 370, 371, 372, -1, 374, 375, 376, 377, 378, -1, + 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + -1, 401, 402, 403, 404, -1, 406, 407, 408, 409, + 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, + 420, -1, 422, 423, 424, 425, 426, 427, 428, 429, + -1, -1, 432, 433, 434, 435, 436, -1, -1, 439, + 440, 441, 442, 443, 444, 445, -1, 447, -1, 449, + 450, 451, 452, -1, -1, 455, -1, 457, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 476, 477, 478, -1, + 3, 481, 5, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 495, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, 52, @@ -242748,44 +253313,92 @@ static const yytype_int16 yycheck[] = 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, 112, - 113, 114, 115, 116, -1, 118, 119, 120, 121, 122, + 113, 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, -1, 159, 160, 161, 162, - -1, 164, -1, 166, -1, -1, -1, 170, 171, 172, - -1, 174, -1, 176, -1, 178, 179, 180, -1, 182, - 183, 184, 185, 186, 187, 188, -1, 190, 191, 192, - 193, -1, 195, 196, 197, 198, 199, 200, -1, 202, - -1, 204, 205, 206, 207, 208, 209, 210, 211, -1, - 213, -1, 215, -1, -1, 218, -1, 220, 221, 222, - 223, 224, -1, -1, 227, -1, 229, -1, -1, 232, - 233, 234, -1, -1, 237, 238, 239, 240, 241, 242, + 153, 154, 155, 156, -1, 158, -1, 160, 161, 162, + 163, -1, 165, -1, 167, -1, -1, -1, 171, 172, + 173, -1, 175, -1, 177, -1, 179, 180, 181, -1, + 183, 184, 185, 186, 187, 188, 189, -1, 191, 192, + 193, 194, -1, 196, 197, 198, 199, 200, 201, -1, + 203, -1, 205, 206, 207, 208, 209, 210, 211, 212, + -1, 214, -1, 216, -1, -1, 219, -1, 221, 222, + 223, 224, 225, 226, -1, -1, 229, -1, 231, -1, + -1, 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, - 253, 254, 255, 256, 257, 258, 259, 260, 261, -1, - 263, 264, 265, 266, 267, -1, 269, 270, -1, 272, - -1, 274, 275, 276, 277, 278, 279, -1, 281, 282, - 283, -1, 285, 286, 287, -1, -1, 290, 291, -1, - 293, -1, 295, 296, 297, 298, 299, 300, 301, 302, - 303, 304, 305, -1, 307, 308, 309, 310, 311, 312, - 313, 314, 315, -1, 317, 318, 319, 320, 321, 322, - -1, 324, 325, 326, 327, 328, 329, 330, 331, -1, - 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, - 343, 344, 345, -1, 347, 348, -1, 350, 351, 352, + 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, + 263, -1, 265, 266, 267, 268, 269, -1, 271, 272, + -1, 274, -1, 276, 277, 278, 279, 280, 281, -1, + 283, 284, -1, -1, 287, 288, 289, -1, -1, 292, + 293, -1, 295, -1, 297, 298, 299, 300, 301, 302, + 303, 304, 305, 306, 307, -1, 309, 310, 311, 312, + 313, 314, 315, 316, 317, -1, 319, 320, 321, 322, + 323, 324, -1, 326, 327, 328, 329, 330, 331, 332, + 333, -1, 335, 336, 337, 338, 339, 340, 341, 342, + 343, 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, - 363, 364, -1, 366, 367, 368, 369, 370, -1, 372, - 373, 374, 375, 376, -1, 378, 379, 380, 381, -1, - 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, - 393, 394, 395, 396, 397, -1, 399, 400, -1, 402, - -1, 404, 405, 406, 407, 408, -1, 410, 411, -1, - -1, 414, 415, 416, 417, 418, 419, 420, 421, 422, - 423, 424, 425, 426, 427, -1, -1, 430, 431, 432, - 433, 434, -1, -1, 437, 438, 439, 440, 441, 442, - 443, -1, 445, -1, 447, 448, 449, 450, -1, -1, - 453, -1, -1, 456, 457, 458, 459, 460, 461, 462, + 363, 364, 365, 366, -1, 368, 369, 370, 371, 372, + -1, 374, 375, 376, 377, 378, -1, 380, 381, 382, + 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, + 393, 394, 395, 396, 397, 398, 399, -1, 401, 402, + -1, 404, -1, 406, 407, 408, 409, 410, -1, 412, + 413, -1, -1, 416, 417, 418, 419, 420, -1, 422, + 423, 424, 425, 426, 427, 428, 429, -1, -1, 432, + 433, 434, 435, 436, -1, -1, 439, 440, 441, 442, + 443, 444, 445, -1, 447, -1, 449, 450, 451, 452, + -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, - 473, 474, 475, 476, 3, 4, 5, -1, -1, -1, - 9, 484, 485, -1, -1, -1, -1, -1, -1, -1, + 473, 474, 475, 476, 477, 478, -1, 3, -1, 5, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 495, 19, 20, 21, 22, 23, 24, 25, + 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, + -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, + 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, + 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, + 66, -1, 68, 69, 70, 71, 72, -1, -1, -1, + 76, 77, 78, 79, 80, 81, -1, 83, 84, 85, + -1, 87, 88, 89, 90, 91, 92, -1, -1, 95, + 96, 97, -1, -1, -1, -1, -1, -1, -1, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, + 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, + 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, + 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, -1, 158, -1, 160, 161, 162, 163, -1, 165, + -1, 167, -1, -1, -1, 171, 172, 173, -1, 175, + -1, 177, -1, 179, 180, 181, -1, 183, 184, 185, + 186, 187, 188, 189, -1, 191, 192, 193, 194, -1, + 196, 197, 198, 199, 200, 201, -1, 203, -1, 205, + 206, 207, 208, 209, 210, 211, 212, -1, 214, -1, + 216, -1, -1, 219, -1, 221, 222, 223, 224, 225, + 226, -1, -1, 229, -1, 231, -1, -1, 234, 235, + 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, -1, 265, + 266, 267, 268, 269, -1, 271, 272, -1, 274, -1, + 276, 277, 278, 279, 280, 281, -1, 283, 284, -1, + -1, 287, 288, 289, -1, -1, 292, 293, -1, 295, + -1, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, + 316, 317, -1, 319, 320, 321, 322, 323, 324, -1, + 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, + 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, + 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, -1, 374, 375, + 376, 377, 378, -1, 380, 381, 382, 383, -1, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, -1, 401, 402, -1, 404, -1, + 406, 407, 408, 409, 410, -1, 412, 413, -1, -1, + 416, 417, 418, 419, 420, -1, 422, 423, 424, 425, + 426, 427, 428, 429, -1, -1, 432, 433, 434, 435, + 436, -1, -1, 439, 440, 441, 442, 443, 444, 445, + -1, 447, -1, 449, 450, 451, 452, -1, -1, 455, + -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, -1, 3, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 495, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, 48, @@ -242799,193 +253412,323 @@ static const yytype_int16 yycheck[] = 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, - 149, 150, 151, 152, 153, 154, 155, 156, 157, -1, - 159, 160, 161, 162, -1, 164, -1, 166, -1, -1, - -1, 170, 171, 172, -1, 174, -1, 176, -1, 178, - 179, 180, -1, 182, 183, 184, 185, 186, 187, 188, - -1, 190, 191, 192, 193, -1, 195, 196, 197, 198, - 199, 200, -1, 202, -1, 204, 205, 206, 207, 208, - 209, 210, 211, -1, 213, -1, 215, -1, -1, 218, - -1, 220, 221, 222, 223, 224, -1, -1, 227, -1, - 229, -1, -1, 232, 233, 234, -1, -1, 237, 238, + 149, 150, 151, 152, 153, 154, 155, 156, -1, 158, + -1, 160, 161, 162, 163, -1, 165, -1, 167, -1, + -1, -1, 171, 172, 173, -1, 175, -1, 177, -1, + 179, 180, 181, -1, 183, 184, 185, 186, 187, 188, + 189, -1, 191, 192, 193, 194, -1, 196, 197, 198, + 199, 200, 201, -1, 203, -1, 205, 206, 207, 208, + 209, 210, 211, 212, -1, 214, -1, 216, -1, -1, + 219, -1, 221, 222, 223, 224, 225, 226, -1, -1, + 229, -1, 231, -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, -1, 263, 264, 265, 266, 267, -1, - 269, 270, -1, 272, -1, 274, 275, 276, 277, 278, - 279, -1, 281, 282, 283, -1, 285, 286, 287, -1, - -1, 290, 291, -1, 293, -1, 295, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, - 309, 310, 311, 312, 313, 314, 315, -1, 317, 318, - 319, 320, 321, 322, -1, 324, 325, 326, 327, 328, - 329, 330, 331, -1, 333, 334, 335, 336, 337, 338, - 339, 340, 341, 342, 343, 344, 345, -1, 347, 348, - -1, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, -1, 366, 367, 368, - 369, 370, -1, 372, 373, 374, 375, 376, -1, 378, - 379, 380, 381, -1, 383, 384, 385, 386, 387, 388, - 389, 390, 391, 392, 393, 394, 395, 396, 397, -1, - 399, 400, -1, 402, -1, 404, 405, 406, 407, 408, - -1, 410, 411, -1, -1, 414, 415, 416, 417, 418, - 419, 420, 421, 422, 423, 424, 425, 426, 427, -1, - -1, 430, 431, 432, 433, 434, -1, -1, 437, 438, - 439, 440, 441, 442, 443, -1, 445, -1, 447, 448, - 449, 450, -1, -1, 453, -1, -1, 456, 457, 458, + 259, 260, 261, 262, 263, -1, 265, 266, 267, 268, + 269, -1, 271, 272, -1, 274, -1, 276, 277, 278, + 279, 280, 281, -1, 283, 284, -1, -1, 287, 288, + 289, -1, -1, 292, 293, -1, 295, -1, 297, 298, + 299, 300, 301, 302, 303, 304, 305, 306, 307, -1, + 309, 310, 311, 312, 313, 314, 315, 316, 317, -1, + 319, 320, 321, 322, 323, 324, -1, 326, 327, 328, + 329, 330, 331, 332, 333, -1, 335, 336, 337, 338, + 339, 340, 341, 342, 343, 344, 345, 346, 347, -1, + 349, 350, -1, 352, 353, 354, 355, 356, 357, 358, + 359, 360, 361, 362, 363, 364, 365, 366, -1, 368, + 369, 370, 371, 372, -1, 374, 375, 376, 377, 378, + -1, 380, 381, 382, 383, -1, 385, 386, 387, 388, + 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, + 399, -1, 401, 402, -1, 404, -1, 406, 407, 408, + 409, 410, -1, 412, 413, -1, -1, 416, 417, 418, + 419, 420, -1, 422, 423, 424, 425, 426, 427, 428, + 429, -1, -1, 432, 433, 434, 435, 436, -1, -1, + 439, 440, 441, 442, 443, 444, 445, -1, 447, -1, + 449, 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, - 469, 470, 471, 472, 473, 474, 475, 476, -1, 8, - -1, -1, 11, -1, -1, 484, 485, 16, 17, 18, - -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, - 11, -1, -1, -1, 33, 16, 17, 18, 37, -1, - -1, -1, 41, -1, -1, -1, -1, -1, -1, 48, - -1, -1, 33, -1, -1, -1, 8, -1, -1, 11, - 41, -1, -1, -1, 16, 17, 18, 48, -1, -1, - -1, -1, -1, -1, 73, 8, -1, -1, 11, -1, - -1, 33, -1, 16, 17, 18, -1, -1, -1, 41, - -1, -1, 73, -1, -1, -1, 48, -1, -1, -1, - 33, -1, -1, 36, -1, -1, -1, -1, 41, -1, - -1, -1, -1, -1, -1, 48, -1, -1, -1, -1, - -1, 73, -1, -1, -1, 124, -1, -1, -1, -1, + 469, 470, 471, 472, 473, 474, 475, 476, 477, 478, + -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 495, 19, 20, 21, + 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, + -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, + 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, + 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, + 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, + 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, + -1, 83, 84, 85, -1, 87, 88, 89, 90, 91, + 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, + -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, + 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, + 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, + 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, -1, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, -1, -1, -1, 171, + 172, 173, -1, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, -1, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, -1, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, -1, -1, 219, -1, 221, + 222, 223, 224, 225, 226, -1, -1, 229, -1, 231, + -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, -1, 265, 266, 267, 268, 269, -1, 271, + 272, -1, 274, -1, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, -1, 287, 288, 289, -1, -1, + 292, 293, -1, 295, -1, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, -1, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 372, -1, 374, 375, 376, 377, 378, -1, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, -1, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, -1, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, -1, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, -1, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, + 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + 472, 473, 474, 475, 476, 477, 478, -1, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, - -1, 11, -1, -1, -1, -1, 16, 17, 18, -1, - -1, -1, -1, -1, 173, -1, -1, -1, -1, -1, - -1, -1, 163, 33, -1, -1, -1, 168, -1, -1, - 189, 41, 173, -1, -1, 194, -1, -1, 48, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 189, -1, - 162, -1, -1, 194, -1, -1, -1, 216, 217, -1, - -1, 173, -1, 73, -1, -1, -1, -1, -1, -1, - -1, 230, -1, -1, -1, 216, 217, 189, -1, -1, - 173, -1, 194, -1, -1, -1, -1, -1, -1, 230, - -1, -1, -1, -1, -1, -1, 189, -1, -1, -1, - -1, 194, -1, -1, 216, 217, -1, -1, -1, 268, - -1, -1, 271, -1, -1, -1, -1, -1, 230, -1, - -1, -1, -1, 216, 217, -1, 285, 268, -1, 288, - 271, -1, -1, -1, -1, -1, -1, 230, -1, -1, - -1, -1, -1, -1, 285, -1, -1, 288, -1, -1, - -1, -1, -1, -1, -1, -1, 268, -1, -1, 271, - -1, -1, -1, 173, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 285, -1, 268, 288, 8, 271, 189, - 11, -1, -1, -1, 194, 16, 17, 18, -1, -1, - -1, -1, 285, -1, -1, 288, -1, -1, -1, 311, - -1, -1, 33, -1, -1, 36, 216, 217, -1, -1, - 41, -1, -1, -1, -1, -1, -1, 48, 377, -1, - 230, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 377, -1, -1, -1, - -1, 8, 73, -1, 11, -1, -1, -1, -1, 16, - 17, 18, -1, -1, -1, -1, -1, -1, 268, -1, - -1, 271, -1, -1, -1, 377, 33, -1, -1, -1, - -1, -1, -1, -1, 41, 285, -1, 436, 288, -1, - -1, 48, -1, -1, 377, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 306, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 477, -1, - -1, 480, 481, 482, -1, 484, 485, 486, 487, 488, - 489, -1, -1, -1, -1, -1, 477, -1, -1, 480, - 481, 482, 173, 484, 485, 486, 487, 488, 489, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 189, -1, - -1, -1, -1, 194, -1, 477, -1, 377, 480, 481, - 482, -1, 484, 485, 486, 487, 488, 489, -1, -1, - -1, -1, -1, -1, 477, 216, 217, 480, 481, 482, - -1, 484, 485, 486, 487, 488, 489, -1, -1, 230, - -1, 168, -1, -1, -1, -1, 173, -1, 8, -1, - -1, 11, -1, -1, -1, -1, 16, 17, 18, -1, - -1, -1, 189, -1, -1, -1, -1, 194, -1, -1, - -1, -1, -1, 33, -1, -1, 36, 268, -1, -1, - 271, 41, -1, -1, -1, -1, -1, -1, 48, 216, - 217, -1, -1, -1, 285, -1, -1, 288, -1, -1, - -1, -1, -1, 230, -1, -1, -1, 477, -1, -1, - 480, 481, 482, 73, 484, 485, 486, 487, 488, 489, - -1, -1, -1, 8, -1, -1, 11, -1, -1, -1, - -1, 16, 17, 18, -1, -1, -1, -1, -1, -1, - -1, 268, -1, -1, 271, -1, -1, -1, 33, -1, - -1, 36, -1, -1, -1, -1, 41, -1, 285, -1, - -1, 288, 8, 48, -1, 11, -1, -1, -1, -1, - 16, 17, 18, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 377, 33, 73, -1, - -1, -1, -1, -1, -1, 41, -1, -1, -1, -1, - -1, -1, 48, -1, -1, -1, -1, 8, -1, -1, - 11, -1, -1, 173, -1, 16, 17, 18, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 73, -1, 189, - -1, -1, 33, -1, 194, -1, -1, -1, -1, -1, - 41, -1, -1, -1, -1, -1, -1, 48, -1, -1, - 377, -1, -1, -1, -1, -1, 216, 217, -1, -1, + -1, -1, -1, 495, 19, 20, 21, 22, 23, 24, + 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, + -1, -1, -1, 38, 39, -1, 41, 42, 43, -1, + 45, 46, 47, 48, 49, -1, 51, 52, -1, 54, + 55, 56, 57, 58, 59, -1, -1, 62, 63, 64, + 65, 66, -1, 68, 69, 70, 71, 72, -1, -1, + -1, 76, 77, 78, 79, 80, 81, -1, 83, 84, + 85, -1, 87, 88, 89, 90, 91, 92, -1, -1, + 95, 96, 97, -1, -1, -1, -1, -1, -1, -1, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + -1, 116, -1, 118, 119, 120, 121, 122, 123, -1, + 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, + 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, + -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 155, 156, -1, 158, -1, 160, 161, 162, 163, -1, + 165, -1, 167, -1, -1, -1, 171, 172, 173, -1, + 175, -1, 177, -1, 179, 180, 181, -1, 183, 184, + 185, 186, 187, 188, 189, -1, 191, 192, 193, 194, + -1, 196, 197, 198, 199, 200, 201, -1, 203, -1, + 205, 206, 207, 208, 209, 210, 211, 212, -1, 214, + -1, 216, -1, -1, 219, -1, 221, 222, 223, 224, + 225, 226, -1, -1, 229, -1, 231, -1, -1, 234, + 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 263, -1, + 265, 266, 267, 268, 269, -1, 271, 272, -1, 274, + -1, 276, 277, 278, 279, 280, 281, -1, 283, 284, + -1, -1, 287, 288, 289, -1, -1, 292, 293, -1, + 295, -1, 297, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, -1, 309, 310, 311, 312, 313, 314, + 315, 316, 317, -1, 319, 320, 321, 322, 323, 324, + -1, 326, 327, 328, 329, 330, 331, 332, 333, -1, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, -1, 349, 350, -1, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, -1, 368, 369, 370, 371, 372, -1, 374, + 375, 376, 377, 378, -1, 380, 381, 382, 383, -1, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, 398, 399, -1, 401, 402, -1, 404, + -1, 406, 407, 408, 409, 410, -1, 412, 413, -1, + -1, 416, 417, 418, 419, 420, -1, 422, 423, 424, + 425, 426, 427, 428, 429, -1, -1, 432, 433, 434, + 435, 436, -1, -1, 439, 440, 441, 442, 443, 444, + 445, -1, 447, -1, 449, 450, 451, 452, -1, -1, + 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, + 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, + 475, 476, 477, 478, -1, -1, -1, -1, 3, 4, + 5, -1, -1, 8, 9, -1, -1, -1, -1, -1, + 495, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, -1, 49, 50, 51, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, + 65, 66, 67, 68, 69, 70, 71, -1, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, -1, 151, 152, 153, 154, + 155, -1, 157, 158, 159, 160, 161, 162, 163, 164, + 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, + 175, 176, 177, 178, -1, -1, 181, 182, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, + -1, 206, 207, 208, 209, 210, 211, 212, 213, 214, + 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, + 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, + 275, -1, 277, 278, 279, 280, 281, 282, 283, 284, + 285, 286, 287, 288, 289, 290, 291, 292, -1, 294, + 295, 296, -1, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, 308, 309, 310, -1, 312, 313, -1, + 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, + 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, + 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, 396, 397, -1, 399, 400, 401, 402, 403, 404, + 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, + 415, 416, 417, -1, 419, -1, 421, 422, 423, 424, + 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, + 435, 436, 437, 438, 439, 440, 441, 442, 443, -1, + 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, + 455, 456, 457, 458, 459, 460, 461, 462, 463, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 475, 476, 477, 478, -1, 3, -1, 482, 483, 484, + 8, 486, 487, 488, 489, 490, 491, -1, 16, 17, + 18, 19, 20, 21, 22, 23, 24, 25, 26, -1, + 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, + 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, + 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, + 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, + 68, 69, 70, 71, 72, -1, -1, -1, 76, 77, + 78, 79, 80, 81, -1, 83, 84, 85, -1, 87, + 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, + -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, + 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, + 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, + 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, -1, + 158, -1, 160, 161, 162, 163, -1, 165, -1, 167, + -1, -1, -1, 171, 172, 173, -1, 175, -1, 177, + -1, 179, 180, 181, -1, 183, 184, 185, 186, 187, + 188, 189, -1, 191, 192, 193, 194, -1, 196, 197, + 198, 199, 200, 201, -1, 203, -1, 205, 206, 207, + 208, 209, 210, 211, 212, -1, 214, -1, 216, -1, + -1, 219, -1, 221, 222, 223, 224, 225, 226, -1, + -1, 229, -1, 231, -1, -1, 234, 235, 236, -1, + -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, -1, 265, 266, 267, + 268, 269, -1, 271, 272, -1, 274, -1, 276, 277, + 278, 279, 280, 281, -1, 283, 284, -1, -1, 287, + 288, 289, -1, -1, 292, 293, -1, 295, -1, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, + -1, 319, 320, 321, 322, 323, 324, -1, 326, 327, + 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 368, 369, 370, 371, 372, -1, 374, 375, 376, 377, + 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, -1, 401, 402, -1, 404, -1, 406, 407, + 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, + 418, 419, 420, -1, 422, 423, 424, 425, 426, 427, + 428, 429, -1, -1, 432, 433, 434, 435, 436, -1, + -1, 439, 440, 441, 442, 443, 444, 445, -1, 447, + -1, 449, 450, 451, 452, -1, -1, 455, -1, -1, + 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, + 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, + 478, -1, -1, -1, 482, 483, 484, -1, 486, 487, + 488, 489, 490, 491, 8, -1, -1, 11, -1, -1, + -1, 15, 16, 17, 18, -1, -1, -1, -1, -1, + -1, -1, -1, 8, -1, -1, 11, -1, -1, 33, + 15, 16, 17, 18, -1, -1, -1, 41, -1, -1, + -1, -1, -1, -1, 48, -1, -1, -1, 33, -1, + -1, -1, 8, -1, -1, 11, 41, -1, -1, 15, + 16, 17, 18, 48, -1, -1, -1, -1, -1, 73, + -1, 8, -1, -1, 11, -1, -1, 33, 15, 16, + 17, 18, -1, -1, -1, 41, -1, -1, 73, -1, + -1, -1, 48, -1, -1, -1, 33, -1, -1, -1, + -1, -1, -1, -1, 41, -1, -1, -1, -1, -1, + -1, 48, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 230, -1, 73, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 477, -1, 173, 480, - 481, 482, -1, 484, 485, 486, 487, 488, 489, -1, - -1, -1, -1, -1, 189, -1, -1, -1, 268, 194, - -1, 271, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 285, -1, 173, 288, -1, - -1, 216, 217, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 189, -1, 230, -1, -1, 194, -1, - 477, -1, -1, 480, 481, 482, -1, 484, 485, 486, - 487, 488, 489, -1, -1, -1, -1, -1, -1, -1, - 216, 217, 173, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 268, 230, -1, 271, -1, 189, -1, - -1, -1, -1, 194, -1, -1, -1, -1, -1, -1, - 285, 8, -1, 288, 11, -1, -1, -1, -1, 16, - 17, 18, -1, -1, -1, 216, 217, 377, -1, -1, - -1, -1, 268, -1, -1, 271, 33, -1, -1, 230, - -1, -1, -1, -1, 41, -1, -1, -1, -1, 285, - 8, 48, 288, 11, -1, -1, -1, -1, 16, 17, - 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 33, 73, 268, -1, -1, - 271, -1, -1, 41, -1, -1, -1, -1, -1, -1, - 48, -1, -1, -1, 285, -1, -1, 288, -1, -1, - -1, -1, 377, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 477, -1, -1, - 480, 481, 482, -1, 484, 485, 486, 487, 488, 489, - -1, 377, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 8, -1, -1, 11, -1, -1, -1, -1, 16, - 17, 18, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 409, -1, -1, 173, -1, -1, -1, - -1, -1, -1, -1, 41, -1, 377, -1, -1, -1, - -1, 48, 189, -1, -1, -1, -1, 194, -1, -1, - -1, -1, 477, -1, -1, 480, 481, 482, -1, 484, - 485, 486, 487, 488, 489, 173, 73, -1, -1, 216, - 217, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 189, -1, 230, -1, -1, 194, -1, -1, -1, - -1, 477, -1, -1, 480, 481, 482, -1, 484, 485, - 486, 487, 488, 489, -1, -1, -1, -1, 216, 217, + -1, -1, -1, -1, -1, -1, 73, -1, 8, -1, + -1, 11, -1, -1, -1, 15, 16, 17, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 268, 230, -1, 271, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 477, -1, 285, 480, - 481, 482, -1, 484, 485, 486, 487, 488, 489, -1, + -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, + 174, 41, -1, -1, -1, -1, -1, -1, 48, -1, + -1, -1, -1, -1, -1, -1, 190, -1, -1, 174, + -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 73, -1, 190, -1, -1, -1, -1, + 195, -1, -1, 217, 218, -1, -1, -1, 174, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 232, -1, + -1, -1, 217, 218, 190, -1, -1, 174, -1, 195, + -1, -1, -1, -1, -1, -1, -1, 232, -1, -1, + -1, -1, -1, 190, -1, -1, -1, -1, 195, -1, + -1, 217, 218, -1, -1, -1, 270, -1, -1, 273, + -1, -1, -1, -1, -1, -1, 232, -1, -1, -1, + 217, 218, -1, 287, -1, 270, 290, -1, 273, -1, + -1, -1, -1, -1, -1, 232, -1, -1, -1, -1, + -1, -1, 287, -1, 174, 290, -1, -1, -1, -1, + -1, -1, -1, -1, 270, -1, -1, 273, -1, -1, + 190, -1, -1, -1, -1, 195, -1, -1, -1, -1, + -1, 287, -1, 270, 290, -1, 273, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 217, 218, -1, + 287, -1, -1, 290, -1, -1, -1, -1, -1, -1, + -1, -1, 232, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 8, -1, 379, 11, -1, -1, -1, + 15, 16, 17, 18, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 379, -1, -1, -1, 33, -1, + 270, -1, -1, 273, -1, -1, 41, -1, -1, -1, + -1, -1, -1, 48, -1, -1, -1, 287, -1, -1, + 290, -1, -1, 379, 8, -1, -1, 11, -1, -1, + -1, 15, 16, 17, 18, -1, -1, -1, 73, -1, + -1, -1, 379, -1, -1, -1, -1, -1, -1, 33, + -1, -1, -1, -1, -1, -1, -1, 41, -1, -1, + -1, -1, -1, -1, 48, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 479, -1, -1, 482, 483, + 484, -1, 486, 487, 488, 489, 490, 491, -1, 73, + -1, -1, 496, -1, 479, -1, -1, 482, 483, 484, + -1, 486, 487, 488, 489, 490, 491, -1, -1, 379, + -1, 496, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 479, -1, -1, 482, 483, 484, -1, + 486, 487, 488, 489, 490, 491, -1, -1, -1, 174, + 496, -1, 479, -1, -1, 482, 483, 484, -1, 486, + 487, 488, 489, 490, 491, 190, -1, -1, -1, 496, + 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 268, -1, -1, 271, -1, -1, 173, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 285, -1, -1, - 288, -1, 189, -1, -1, -1, -1, 194, -1, -1, + -1, -1, 217, 218, -1, -1, -1, -1, -1, -1, + 174, -1, -1, -1, -1, -1, -1, 232, -1, -1, + -1, -1, -1, -1, -1, -1, 190, -1, -1, 479, + -1, 195, 482, 483, 484, -1, 486, 487, 488, 489, + 490, 491, -1, -1, -1, -1, 496, -1, -1, -1, + -1, -1, -1, 217, 218, 270, -1, -1, 273, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 232, -1, + -1, -1, 287, -1, -1, 290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 216, - 217, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 230, -1, -1, -1, -1, -1, -1, - 377, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 270, -1, -1, 273, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 268, -1, -1, 271, -1, -1, -1, -1, 377, - -1, -1, -1, -1, -1, -1, -1, -1, 285, -1, + -1, -1, -1, 287, -1, -1, 290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 379, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 477, -1, -1, 480, 481, 482, -1, 484, 485, 486, - 487, 488, 489, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 477, - 377, -1, 480, 481, 482, -1, 484, 485, 486, 487, - 488, 489, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 379, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 479, -1, -1, 482, 483, 484, + -1, 486, 487, 488, 489, 490, 491, -1, -1, -1, + -1, 496, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 3, -1, 5, - 477, -1, -1, 480, 481, 482, -1, 484, 485, 486, - 487, 488, 489, 19, 20, 21, 22, 23, 24, 25, + -1, -1, -1, -1, -1, 479, -1, 3, 482, 483, + 484, -1, 486, 487, 488, 489, 490, 491, -1, -1, + -1, -1, 496, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, 52, 53, 54, 55, @@ -243000,85 +253743,468 @@ static const yytype_int16 yycheck[] = 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, - 166, -1, 168, -1, 170, 171, 172, -1, 174, 175, + 166, 167, -1, 169, -1, 171, 172, 173, -1, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, -1, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, -1, 204, 205, + 186, 187, 188, 189, -1, 191, 192, 193, 194, 195, + 196, 197, 198, 199, 200, 201, 202, 203, -1, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, - -1, -1, 218, -1, 220, 221, 222, 223, 224, 225, - 226, 227, -1, 229, -1, 231, 232, 233, 234, 235, + 216, -1, -1, 219, -1, 221, 222, 223, 224, 225, + 226, 227, 228, 229, -1, 231, -1, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, -1, 263, 264, 265, - 266, 267, 268, 269, 270, -1, 272, 273, 274, 275, + 256, 257, 258, 259, 260, 261, 262, 263, -1, 265, + 266, 267, 268, 269, 270, 271, 272, -1, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 288, 289, 290, 291, -1, 293, -1, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 286, 287, 288, 289, 290, 291, 292, 293, -1, 295, + -1, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, - 346, 347, 348, -1, 350, 351, 352, 353, 354, 355, + 346, 347, 348, 349, 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, - 376, -1, 378, 379, 380, 381, 382, 383, 384, 385, + 376, 377, 378, -1, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, 398, 399, 400, 401, 402, -1, 404, 405, + 396, 397, 398, 399, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, - -1, 447, 448, 449, 450, 451, 452, 453, 454, 455, + 446, 447, -1, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 3, -1, -1, -1, -1, -1, -1, -1, -1, + 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, + -1, -1, 488, -1, -1, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, + 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, + -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, + -1, 51, 52, -1, 54, 55, 56, 57, 58, 59, + -1, -1, 62, 63, 64, 65, 66, -1, 68, 69, + 70, 71, 72, -1, -1, -1, 76, 77, 78, 79, + 80, 81, -1, 83, 84, 85, -1, 87, 88, 89, + 90, 91, 92, -1, -1, 95, 96, 97, -1, -1, + -1, -1, -1, -1, -1, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, + 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, + -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, + 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, -1, 158, -1, + 160, 161, 162, 163, -1, 165, -1, 167, -1, -1, + -1, 171, 172, 173, -1, 175, -1, 177, -1, 179, + 180, 181, -1, 183, 184, 185, 186, 187, 188, 189, + -1, 191, 192, 193, 194, -1, 196, 197, 198, 199, + 200, 201, -1, 203, -1, 205, 206, 207, 208, 209, + 210, 211, 212, -1, 214, -1, 216, -1, -1, 219, + -1, 221, 222, 223, 224, 225, 226, -1, -1, 229, + -1, 231, -1, -1, 234, 235, 236, -1, -1, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, -1, 265, 266, 267, 268, 269, + -1, 271, 272, -1, 274, -1, 276, 277, 278, 279, + 280, 281, -1, 283, 284, -1, -1, 287, 288, 289, + -1, -1, 292, 293, -1, 295, -1, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, -1, 319, + 320, 321, 322, 323, 324, -1, 326, 327, 328, 329, + 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, -1, 349, + 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, + 370, 371, 372, -1, 374, 375, 376, 377, 378, -1, + 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + -1, 401, 402, -1, 404, -1, 406, 407, 408, 409, + 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, + 420, -1, 422, 423, 424, 425, 426, 427, 428, 429, + -1, -1, 432, 433, 434, 435, 436, -1, -1, 439, + 440, 441, 442, 443, 444, 445, -1, 447, -1, 449, + 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 476, 477, 478, 3, + 4, 5, -1, -1, -1, 9, -1, -1, 488, -1, + -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, + -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, + -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, + 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, + 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, + -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, + 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, + -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, + -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, -1, 118, 119, 120, 121, 122, 123, + -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, + 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, + 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, -1, 160, 161, 162, 163, + -1, 165, -1, 167, -1, -1, -1, 171, 172, 173, + -1, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, -1, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + -1, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, -1, -1, 219, -1, 221, 222, 223, + 224, 225, 226, -1, -1, 229, -1, 231, -1, -1, + 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + -1, 265, 266, 267, 268, 269, -1, 271, 272, -1, + 274, -1, 276, 277, 278, 279, 280, 281, -1, 283, + 284, 285, -1, 287, 288, 289, -1, -1, 292, 293, + -1, 295, -1, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, -1, 319, 320, 321, 322, 323, + 324, -1, 326, 327, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, -1, 368, 369, 370, 371, 372, -1, + 374, 375, 376, 377, 378, -1, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, -1, + 404, -1, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, 421, 422, 423, + 424, 425, 426, 427, 428, 429, -1, -1, 432, 433, + 434, 435, 436, -1, -1, 439, 440, 441, 442, 443, + 444, 445, -1, 447, -1, 449, 450, 451, 452, -1, + -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 3, 4, 5, -1, -1, + -1, 9, 486, 487, -1, -1, -1, -1, -1, -1, + -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, + 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, + 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, + 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, + 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, + 68, 69, 70, 71, 72, -1, -1, -1, 76, 77, + 78, 79, 80, 81, -1, 83, 84, 85, -1, 87, + 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, + -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 115, 116, -1, + 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, + 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, + 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, + 158, -1, 160, 161, 162, 163, -1, 165, -1, 167, + -1, -1, -1, 171, 172, 173, -1, 175, -1, 177, + -1, 179, 180, 181, -1, 183, 184, 185, 186, 187, + 188, 189, -1, 191, 192, 193, 194, -1, 196, 197, + 198, 199, 200, 201, -1, 203, -1, 205, 206, 207, + 208, 209, 210, 211, 212, -1, 214, -1, 216, -1, + -1, 219, -1, 221, 222, 223, 224, 225, 226, -1, + -1, 229, -1, 231, -1, -1, 234, 235, 236, -1, + -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, -1, 265, 266, 267, + 268, 269, -1, 271, 272, -1, 274, -1, 276, 277, + 278, 279, 280, 281, -1, 283, 284, 285, -1, 287, + 288, 289, -1, -1, 292, 293, -1, 295, -1, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, + -1, 319, 320, 321, 322, 323, 324, -1, 326, 327, + 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 368, 369, 370, 371, 372, -1, 374, 375, 376, 377, + 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, -1, 401, 402, -1, 404, -1, 406, 407, + 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, + 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, + 428, 429, -1, -1, 432, 433, 434, 435, 436, -1, + -1, 439, 440, 441, 442, 443, 444, 445, -1, 447, + -1, 449, 450, 451, 452, -1, -1, 455, -1, -1, + 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, + 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, + 478, 3, 4, 5, -1, -1, -1, 9, 486, 487, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, + -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, -1, 75, 76, 77, 78, 79, 80, 81, - -1, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, -1, 95, 96, 97, 98, 99, 100, -1, - 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, - 162, 163, 164, 165, 166, -1, 168, -1, 170, 171, - 172, -1, 174, 175, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, -1, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, - 202, -1, 204, 205, 206, 207, 208, 209, 210, 211, - 212, 213, 214, 215, -1, -1, 218, -1, 220, 221, - 222, 223, 224, 225, 226, 227, -1, 229, -1, 231, - 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, + 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, + 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, + 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, + -1, 83, 84, 85, -1, 87, 88, 89, 90, 91, + 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, + -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, + 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, + 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, + 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, 157, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, -1, -1, -1, 171, + 172, 173, -1, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, -1, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, -1, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, -1, -1, 219, -1, 221, + 222, 223, 224, 225, 226, -1, -1, 229, -1, 231, + -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - -1, 263, 264, 265, 266, 267, 268, 269, 270, -1, - 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, - 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, - -1, 293, -1, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, - 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, 346, 347, 348, -1, 350, 351, + 262, 263, -1, 265, 266, 267, 268, 269, -1, 271, + 272, -1, 274, -1, 276, 277, 278, 279, 280, 281, + -1, 283, 284, 285, -1, 287, 288, 289, -1, -1, + 292, 293, -1, 295, -1, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, - 372, 373, 374, 375, 376, -1, 378, 379, 380, 381, - 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, - 402, -1, 404, 405, 406, 407, 408, 409, 410, 411, - 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, - 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, - 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, - 442, 443, 444, 445, -1, 447, 448, 449, 450, 451, - 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 372, -1, 374, 375, 376, 377, 378, -1, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, -1, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, 421, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, -1, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, -1, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, 3, -1, -1, -1, -1, + 472, 473, 474, 475, 476, 477, 478, -1, -1, 8, + -1, -1, 11, -1, 486, 487, 15, 16, 17, 18, + -1, -1, 8, -1, -1, 11, -1, -1, -1, 15, + 16, 17, 18, -1, 33, -1, -1, -1, -1, -1, + -1, -1, 41, -1, -1, -1, -1, 33, -1, 48, + -1, -1, -1, -1, -1, 41, 8, -1, -1, 11, + -1, -1, 48, 15, 16, 17, 18, -1, -1, 8, + -1, -1, 11, -1, 73, -1, 15, 16, 17, 18, + -1, 33, -1, -1, 36, -1, -1, 73, -1, 41, + -1, -1, -1, -1, 33, -1, 48, -1, -1, -1, + -1, -1, 41, -1, -1, -1, -1, -1, -1, 48, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 73, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 73, -1, -1, -1, -1, -1, + -1, -1, -1, 8, -1, -1, 11, -1, -1, -1, + 15, 16, 17, 18, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 164, -1, -1, 33, -1, + 169, 36, -1, -1, -1, 174, 41, 163, -1, -1, + -1, -1, -1, 48, -1, -1, -1, -1, 174, -1, + -1, 190, -1, -1, -1, -1, 195, -1, -1, -1, + -1, -1, -1, -1, 190, -1, -1, -1, 73, 195, + -1, -1, -1, -1, -1, -1, -1, -1, 217, 218, + -1, -1, 174, -1, -1, -1, -1, -1, -1, -1, + -1, 217, 218, 232, -1, 174, -1, -1, 190, -1, + -1, -1, -1, 195, -1, -1, 232, -1, -1, -1, + -1, 190, -1, -1, -1, -1, 195, -1, -1, -1, + -1, -1, -1, -1, -1, 217, 218, -1, -1, -1, + -1, 270, -1, -1, 273, -1, -1, -1, 217, 218, + 232, -1, -1, -1, 270, -1, -1, 273, 287, -1, + -1, 290, -1, 232, -1, -1, -1, -1, -1, -1, + -1, 287, -1, -1, 290, -1, -1, -1, -1, 174, + -1, -1, -1, -1, -1, -1, -1, -1, 270, -1, + -1, 273, -1, -1, -1, 190, -1, 313, -1, -1, + 195, 270, -1, -1, 273, 287, -1, -1, 290, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 287, -1, + -1, 290, 217, 218, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 232, -1, 308, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 379, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 379, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 8, -1, 270, 11, -1, 273, -1, + 15, 16, 17, 18, -1, -1, -1, -1, -1, -1, + -1, -1, 287, -1, -1, 290, -1, 379, 33, -1, + -1, -1, -1, -1, -1, -1, 41, -1, -1, -1, + 379, -1, -1, 48, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 479, -1, -1, 482, 483, 484, -1, 486, 487, 488, + 489, 490, 491, 479, -1, -1, 482, 483, 484, -1, + 486, 487, 488, 489, 490, 491, -1, -1, -1, -1, + -1, -1, -1, -1, 379, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 479, -1, -1, + 482, 483, 484, -1, 486, 487, 488, 489, 490, 491, + 479, -1, -1, 482, 483, 484, -1, 486, 487, 488, + 489, 490, 491, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 8, 169, -1, 11, -1, -1, 174, + 15, 16, 17, 18, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 190, -1, -1, 33, -1, + 195, 36, -1, -1, -1, -1, 41, -1, -1, -1, + -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, + -1, -1, 217, 218, 479, -1, -1, 482, 483, 484, + -1, 486, 487, 488, 489, 490, 491, 232, 73, 8, + -1, -1, 11, -1, -1, -1, 15, 16, 17, 18, + -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, + -1, 11, -1, -1, 33, 15, 16, 17, 18, -1, + -1, -1, 41, -1, -1, 270, -1, -1, 273, 48, + -1, -1, -1, 33, -1, -1, 36, -1, -1, -1, + -1, 41, 287, 8, -1, 290, 11, -1, 48, -1, + 15, 16, 17, 18, 73, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 33, -1, + -1, -1, -1, 73, -1, -1, 41, -1, -1, -1, + -1, -1, -1, 48, -1, -1, -1, -1, -1, 174, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 190, -1, -1, 73, -1, + 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 217, 218, 379, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 232, -1, -1, + -1, -1, -1, -1, -1, 174, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 190, -1, -1, 174, -1, 195, -1, -1, -1, + -1, -1, -1, -1, -1, 270, -1, -1, 273, -1, + 190, -1, -1, -1, -1, 195, -1, -1, 217, 218, + -1, -1, 287, -1, -1, 290, -1, -1, -1, 174, + -1, -1, -1, 232, -1, -1, -1, 217, 218, -1, + -1, -1, -1, -1, -1, 190, -1, -1, -1, -1, + 195, -1, 232, -1, 479, -1, -1, 482, 483, 484, + -1, 486, 487, 488, 489, 490, 491, -1, -1, -1, + -1, 270, 217, 218, 273, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 232, 287, -1, + 270, 290, -1, 273, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 287, -1, -1, + 290, -1, -1, -1, 379, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 270, -1, -1, 273, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 287, -1, -1, 290, 8, -1, -1, 11, + -1, -1, -1, 15, 16, 17, 18, -1, -1, -1, + -1, -1, -1, -1, -1, 8, -1, -1, 11, -1, + -1, 33, -1, 16, 17, 18, -1, -1, -1, 41, + 379, -1, -1, -1, -1, -1, 48, -1, -1, -1, + 33, -1, -1, -1, -1, -1, -1, -1, 41, 379, + -1, -1, -1, -1, -1, 48, -1, -1, -1, -1, + -1, 73, 411, -1, 479, -1, -1, 482, 483, 484, + -1, 486, 487, 488, 489, 490, 491, -1, -1, -1, + 73, -1, -1, -1, 379, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 479, -1, -1, 482, 483, 484, -1, 486, 487, 488, + 489, 490, 491, -1, -1, -1, -1, -1, -1, 479, + -1, -1, 482, 483, 484, -1, 486, 487, 488, 489, + 490, 491, 174, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 190, -1, + -1, 174, -1, 195, 479, -1, -1, 482, 483, 484, + -1, 486, 487, 488, 489, 490, 491, 190, -1, -1, + -1, -1, 195, -1, -1, 217, 218, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 232, -1, -1, -1, 217, 218, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 232, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 270, -1, + -1, 273, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 287, -1, 270, 290, -1, + 273, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 287, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 379, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 379, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 479, -1, -1, + 482, 483, 484, -1, 486, 487, 488, 489, 490, 491, + -1, -1, -1, 3, -1, 5, 479, -1, -1, 482, + 483, 484, -1, 486, 487, 488, 489, 490, 491, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, -1, 45, 46, 47, 48, 49, + -1, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, 73, -1, 75, 76, 77, 78, 79, + 80, 81, -1, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, -1, 95, 96, 97, 98, 99, + 100, -1, 102, 103, 104, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, + 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, + 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, + 160, 161, 162, 163, 164, 165, 166, 167, -1, 169, + -1, 171, 172, 173, -1, 175, 176, 177, 178, 179, + 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, + -1, 191, 192, 193, 194, 195, 196, 197, 198, 199, + 200, 201, 202, 203, -1, 205, 206, 207, 208, 209, + 210, 211, 212, 213, 214, 215, 216, -1, -1, 219, + -1, 221, 222, 223, 224, 225, 226, 227, 228, 229, + -1, 231, -1, 233, 234, 235, 236, 237, 238, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, -1, 265, 266, 267, 268, 269, + 270, 271, 272, -1, 274, 275, 276, 277, 278, 279, + 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, + 290, 291, 292, 293, -1, 295, -1, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, + 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, + 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, + 370, 371, 372, 373, 374, 375, 376, 377, 378, -1, + 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, + 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, + 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, + 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, + 440, 441, 442, 443, 444, 445, 446, 447, -1, 449, + 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 476, 477, 478, 3, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, + 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, + -1, 45, 46, 47, 48, 49, -1, 51, 52, 53, + 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + -1, 75, 76, 77, 78, 79, 80, 81, -1, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, + -1, 95, 96, 97, 98, 99, 100, -1, 102, 103, + 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, + 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, -1, 169, -1, 171, 172, 173, + -1, 175, 176, 177, 178, 179, 180, 181, 182, 183, + 184, 185, 186, 187, 188, 189, -1, 191, 192, 193, + 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, + -1, 205, 206, 207, 208, 209, 210, 211, 212, 213, + 214, 215, 216, -1, -1, 219, -1, 221, 222, 223, + 224, 225, 226, 227, 228, 229, -1, 231, -1, 233, + 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + -1, 265, 266, 267, 268, 269, 270, 271, 272, -1, + 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, + 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, + -1, 295, -1, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, + 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, 348, 349, 350, -1, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, + 374, 375, 376, 377, 378, -1, 380, 381, 382, 383, + 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, + 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, + 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, + 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, + 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, + 444, 445, 446, 447, -1, 449, 450, 451, 452, 453, + 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, @@ -243094,228 +254220,229 @@ static const yytype_int16 yycheck[] = 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, 166, -1, - 168, -1, 170, 171, 172, -1, 174, 175, 176, 177, + 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, + -1, 169, -1, 171, 172, 173, -1, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, - 188, -1, 190, 191, 192, 193, 194, 195, 196, 197, - 198, 199, 200, 201, 202, -1, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, -1, -1, - 218, -1, 220, 221, 222, 223, 224, 225, 226, 227, - -1, 229, -1, 231, 232, 233, 234, 235, 236, 237, + 188, 189, -1, 191, 192, 193, 194, 195, 196, 197, + 198, 199, 200, 201, 202, 203, -1, 205, 206, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, -1, + -1, 219, -1, 221, 222, 223, 224, 225, 226, 227, + 228, 229, -1, 231, -1, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, -1, 263, 264, 265, 266, 267, - 268, 269, 270, -1, 272, 273, 274, 275, 276, 277, + 258, 259, 260, 261, 262, 263, -1, 265, 266, 267, + 268, 269, 270, 271, 272, -1, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, - 288, 289, 290, 291, -1, 293, -1, 295, 296, 297, + 288, 289, 290, 291, 292, 293, -1, 295, -1, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, - 348, -1, 350, 351, 352, 353, 354, 355, 356, 357, + 348, 349, 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 373, 374, 375, 376, -1, - 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, + 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, + 378, -1, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, - 398, 399, 400, 401, 402, -1, 404, 405, 406, 407, + 398, 399, 400, 401, 402, 403, 404, -1, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, - 438, 439, 440, 441, 442, 443, 444, 445, -1, 447, - 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, + 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, + -1, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 473, 474, 475, 476, 3, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, - 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, - -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, -1, - 54, 55, 56, 57, 58, 59, -1, 61, 62, 63, - 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, - 74, -1, 76, 77, 78, 79, 80, 81, 82, 83, - 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, - 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, - 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, - -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, - 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, - 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, -1, 157, -1, 159, 160, 161, 162, -1, - 164, -1, 166, 167, -1, 169, 170, 171, 172, 173, - 174, -1, 176, -1, 178, 179, 180, -1, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, - -1, 195, 196, 197, 198, 199, 200, -1, 202, 203, - 204, 205, 206, 207, 208, 209, 210, 211, -1, 213, - -1, 215, 216, 217, 218, 219, 220, 221, 222, 223, - 224, -1, -1, 227, 228, 229, 230, -1, 232, 233, - 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, -1, 269, 270, 271, 272, -1, - 274, 275, 276, 277, 278, 279, -1, 281, 282, -1, - -1, 285, 286, 287, -1, -1, 290, 291, 292, 293, - 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, -1, 307, 308, 309, 310, 311, 312, 313, - 314, 315, -1, 317, 318, 319, 320, 321, 322, -1, - 324, 325, 326, 327, 328, 329, 330, 331, -1, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, -1, 347, 348, 349, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, -1, 366, 367, 368, 369, 370, 371, 372, 373, - 374, 375, 376, 377, 378, 379, 380, 381, -1, 383, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 396, 397, -1, 399, 400, -1, 402, 403, - 404, 405, 406, 407, 408, -1, 410, 411, -1, -1, - 414, 415, 416, 417, 418, -1, 420, 421, 422, 423, - 424, 425, 426, 427, -1, -1, 430, 431, 432, 433, - 434, 435, -1, 437, 438, 439, 440, 441, 442, 443, - -1, 445, 446, 447, 448, 449, 450, -1, -1, 453, - -1, -1, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, - 474, 475, 476, 3, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, - 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, - 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, - -1, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, -1, 54, 55, 56, 57, 58, 59, - -1, -1, 62, 63, 64, 65, 66, -1, 68, 69, - 70, 71, 72, -1, 74, -1, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, - 90, 91, 92, -1, 94, 95, 96, 97, -1, -1, - -1, 101, -1, -1, -1, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, - 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, - -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, - 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, -1, 157, -1, 159, - 160, 161, 162, -1, 164, -1, 166, 167, -1, 169, - 170, 171, 172, 173, 174, -1, 176, -1, 178, 179, - 180, -1, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, -1, 195, 196, 197, 198, 199, - 200, -1, 202, 203, 204, 205, 206, 207, 208, 209, - 210, 211, -1, 213, -1, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, -1, -1, 227, 228, 229, - 230, -1, 232, 233, 234, -1, -1, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 267, -1, 269, - 270, 271, 272, -1, 274, 275, 276, 277, 278, 279, - -1, 281, 282, -1, -1, 285, 286, 287, -1, -1, - 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, -1, 307, 308, 309, - 310, 311, 312, 313, 314, 315, -1, 317, 318, 319, - 320, 321, 322, -1, 324, 325, 326, 327, 328, 329, - 330, 331, -1, 333, 334, 335, 336, 337, 338, 339, - 340, 341, 342, 343, 344, 345, -1, 347, 348, 349, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 361, 362, 363, 364, -1, 366, 367, 368, 369, - 370, -1, 372, 373, 374, 375, 376, 377, 378, 379, - 380, 381, -1, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, 397, -1, 399, - 400, -1, 402, 403, 404, 405, 406, 407, 408, -1, - 410, 411, -1, -1, 414, 415, 416, 417, 418, -1, - 420, 421, 422, 423, 424, 425, 426, 427, -1, -1, - 430, 431, 432, 433, 434, -1, -1, 437, 438, 439, - 440, 441, 442, 443, -1, 445, 446, 447, 448, 449, - 450, -1, -1, 453, -1, -1, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 473, 474, 475, 476, 3, -1, -1, + 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, + 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, + 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, + -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, -1, 54, 55, 56, 57, 58, 59, -1, 61, + 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, + 72, -1, 74, -1, 76, 77, 78, 79, 80, 81, + 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, + 92, -1, 94, 95, 96, 97, 98, 99, 100, 101, + 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, + 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, + 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, + 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, -1, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, 168, -1, 170, 171, + 172, 173, 174, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, 190, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, 204, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, 217, 218, 219, 220, 221, + 222, 223, 224, 225, 226, -1, -1, 229, 230, 231, + 232, -1, 234, 235, 236, 237, 238, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, 264, 265, 266, 267, 268, 269, -1, 271, + 272, 273, 274, -1, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, -1, 287, 288, 289, -1, -1, + 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, 351, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, 405, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, -1, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, 437, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, 448, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, + 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + 472, 473, 474, 475, 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, - -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, - 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, + -1, -1, 38, 39, -1, 41, 42, 43, 44, 45, + 46, 47, 48, 49, 50, 51, 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, - 66, 67, 68, 69, 70, 71, 72, -1, -1, 75, - 76, 77, 78, 79, 80, 81, -1, 83, 84, 85, - 86, 87, 88, 89, 90, 91, 92, -1, -1, 95, - 96, 97, -1, -1, -1, -1, -1, -1, -1, 105, + 66, -1, 68, 69, 70, 71, 72, -1, 74, -1, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + -1, 87, 88, 89, 90, 91, 92, -1, 94, 95, + 96, 97, -1, -1, -1, 101, -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - -1, 157, -1, 159, 160, 161, 162, -1, 164, 165, - 166, -1, -1, -1, 170, 171, 172, -1, 174, -1, - 176, -1, 178, 179, 180, -1, 182, 183, 184, 185, - 186, 187, 188, -1, 190, 191, 192, 193, -1, 195, - 196, 197, 198, 199, 200, -1, 202, -1, 204, 205, - 206, 207, 208, 209, 210, 211, -1, 213, -1, 215, - -1, -1, 218, -1, 220, 221, 222, 223, 224, -1, - -1, 227, -1, 229, -1, -1, 232, 233, 234, -1, - -1, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 156, -1, 158, -1, 160, 161, 162, 163, -1, 165, + -1, 167, 168, -1, 170, 171, 172, 173, 174, 175, + -1, 177, -1, 179, 180, 181, -1, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, -1, + 196, 197, 198, 199, 200, 201, -1, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, -1, 214, -1, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, -1, -1, 229, 230, 231, 232, -1, 234, 235, + 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, -1, 263, 264, 265, - 266, 267, -1, 269, 270, -1, 272, -1, 274, 275, - 276, 277, 278, 279, -1, 281, 282, -1, -1, 285, - 286, 287, -1, -1, 290, 291, -1, 293, -1, 295, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, 269, -1, 271, 272, 273, 274, -1, + 276, 277, 278, 279, 280, 281, -1, 283, 284, -1, + -1, 287, 288, 289, -1, -1, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - -1, 307, 308, 309, 310, 311, 312, 313, 314, 315, - 316, 317, 318, 319, 320, 321, 322, -1, 324, 325, - 326, 327, 328, 329, 330, 331, -1, 333, 334, 335, + 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, + 316, 317, -1, 319, 320, 321, 322, 323, 324, -1, + 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, - -1, 347, 348, -1, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 362, 363, 364, -1, - 366, 367, 368, 369, 370, -1, 372, 373, 374, 375, - 376, -1, 378, 379, 380, 381, -1, 383, 384, 385, + 346, 347, -1, 349, 350, 351, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, -1, 374, 375, + 376, 377, 378, 379, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, -1, 399, 400, -1, 402, -1, 404, 405, - 406, 407, 408, -1, 410, 411, -1, -1, 414, 415, - 416, 417, 418, -1, 420, 421, 422, 423, 424, 425, - 426, 427, -1, 429, 430, 431, 432, 433, 434, -1, - -1, 437, 438, 439, 440, 441, 442, 443, -1, 445, - -1, 447, 448, 449, 450, -1, -1, 453, -1, -1, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, + 396, 397, 398, 399, -1, 401, 402, -1, 404, 405, + 406, 407, 408, 409, 410, -1, 412, 413, -1, -1, + 416, 417, 418, 419, 420, -1, 422, 423, 424, 425, + 426, 427, 428, 429, -1, -1, 432, 433, 434, 435, + 436, -1, -1, 439, 440, 441, 442, 443, 444, 445, + -1, 447, 448, 449, 450, 451, 452, -1, -1, 455, + -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 3, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, - 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, - -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, - 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, - 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, - -1, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, - -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, - 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, - 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, - 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, 165, 166, -1, -1, -1, 170, 171, - 172, -1, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, -1, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, -1, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, -1, -1, 218, -1, 220, 221, - 222, 223, 224, -1, -1, 227, -1, 229, 230, -1, - 232, 233, 234, -1, -1, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - -1, 263, 264, 265, 266, 267, -1, 269, 270, -1, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - -1, 293, -1, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, -1, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, -1, - 372, 373, 374, 375, 376, -1, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, -1, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, 429, 430, 431, - 432, 433, 434, -1, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, -1, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, 3, -1, 5, -1, -1, + 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, + 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, + -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, + -1, 51, 52, -1, 54, 55, 56, 57, 58, 59, + -1, -1, 62, 63, 64, 65, 66, 67, 68, 69, + 70, 71, 72, -1, -1, 75, 76, 77, 78, 79, + 80, 81, -1, 83, 84, 85, 86, 87, 88, 89, + 90, 91, 92, -1, -1, 95, 96, 97, -1, -1, + -1, -1, -1, -1, -1, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, + 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, + -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, + 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, -1, 158, -1, + 160, 161, 162, 163, -1, 165, 166, 167, -1, -1, + -1, 171, 172, 173, -1, 175, -1, 177, -1, 179, + 180, 181, -1, 183, 184, 185, 186, 187, 188, 189, + -1, 191, 192, 193, 194, -1, 196, 197, 198, 199, + 200, 201, -1, 203, -1, 205, 206, 207, 208, 209, + 210, 211, 212, -1, 214, -1, 216, -1, -1, 219, + -1, 221, 222, 223, 224, 225, 226, -1, -1, 229, + -1, 231, -1, -1, 234, 235, 236, -1, -1, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, -1, 265, 266, 267, 268, 269, + -1, 271, 272, -1, 274, -1, 276, 277, 278, 279, + 280, 281, -1, 283, 284, -1, -1, 287, 288, 289, + -1, -1, 292, 293, -1, 295, -1, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, + 320, 321, 322, 323, 324, -1, 326, 327, 328, 329, + 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, -1, 349, + 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, + 370, 371, 372, -1, 374, 375, 376, 377, 378, -1, + 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + -1, 401, 402, -1, 404, -1, 406, 407, 408, 409, + 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, + 420, -1, 422, 423, 424, 425, 426, 427, 428, 429, + -1, 431, 432, 433, 434, 435, 436, -1, -1, 439, + 440, 441, 442, 443, 444, 445, -1, 447, -1, 449, + 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 476, 477, 478, 3, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, + -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, + -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, + 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, -1, + -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, + 84, 85, 86, 87, 88, 89, 90, 91, 92, -1, + -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, + -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, + -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, + 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, + 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, -1, 158, -1, 160, 161, 162, 163, + -1, 165, 166, 167, -1, -1, -1, 171, 172, 173, + -1, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, -1, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + -1, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, -1, -1, 219, -1, 221, 222, 223, + 224, 225, 226, -1, -1, 229, -1, 231, 232, -1, + 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + -1, 265, 266, 267, 268, 269, -1, 271, 272, -1, + 274, -1, 276, 277, 278, 279, 280, 281, -1, 283, + 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, + -1, 295, -1, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, + 324, -1, 326, 327, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, -1, 368, 369, 370, 371, 372, -1, + 374, 375, 376, 377, 378, -1, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, -1, + 404, -1, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, -1, 422, 423, + 424, 425, 426, 427, 428, 429, -1, 431, 432, 433, + 434, 435, 436, -1, -1, 439, 440, 441, 442, 443, + 444, 445, -1, 447, -1, 449, 450, 451, 452, -1, + -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, @@ -243331,181 +254458,39 @@ static const yytype_int16 yycheck[] = 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, - -1, 159, 160, 161, 162, -1, 164, -1, 166, -1, - -1, -1, 170, 171, 172, -1, 174, -1, 176, -1, - 178, 179, 180, -1, 182, 183, 184, 185, 186, 187, - 188, -1, 190, 191, 192, 193, -1, 195, 196, 197, - 198, 199, 200, -1, 202, -1, 204, 205, 206, 207, - 208, 209, 210, 211, -1, 213, -1, 215, -1, -1, - 218, -1, 220, 221, 222, 223, 224, -1, -1, 227, - -1, 229, -1, -1, 232, 233, 234, -1, -1, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 158, -1, 160, 161, 162, 163, -1, 165, -1, 167, + -1, -1, -1, 171, 172, 173, -1, 175, -1, 177, + -1, 179, 180, 181, -1, 183, 184, 185, 186, 187, + 188, 189, -1, 191, 192, 193, 194, -1, 196, 197, + 198, 199, 200, 201, -1, 203, -1, 205, 206, 207, + 208, 209, 210, 211, 212, -1, 214, -1, 216, -1, + -1, 219, -1, 221, 222, 223, 224, 225, 226, -1, + -1, 229, -1, 231, -1, -1, 234, 235, 236, -1, + -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, -1, 263, 264, 265, 266, 267, - -1, 269, 270, -1, 272, -1, 274, 275, 276, 277, - 278, 279, -1, 281, 282, 283, -1, 285, 286, 287, - -1, -1, 290, 291, -1, 293, -1, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, - 308, 309, 310, 311, 312, 313, 314, 315, -1, 317, - 318, 319, 320, 321, 322, -1, 324, 325, 326, 327, - 328, 329, 330, 331, -1, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 343, 344, 345, -1, 347, - 348, -1, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, -1, 366, 367, - 368, 369, 370, -1, 372, 373, 374, 375, 376, -1, - 378, 379, 380, 381, -1, 383, 384, 385, 386, 387, + 258, 259, 260, 261, 262, 263, -1, 265, 266, 267, + 268, 269, -1, 271, 272, -1, 274, -1, 276, 277, + 278, 279, 280, 281, -1, 283, 284, 285, -1, 287, + 288, 289, -1, -1, 292, 293, -1, 295, -1, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, + -1, 319, 320, 321, 322, 323, 324, -1, 326, 327, + 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 368, 369, 370, 371, 372, -1, 374, 375, 376, 377, + 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, - -1, 399, 400, -1, 402, -1, 404, 405, 406, 407, - 408, -1, 410, 411, -1, -1, 414, 415, 416, 417, + 398, 399, -1, 401, 402, -1, 404, -1, 406, 407, + 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, - -1, -1, 430, 431, 432, 433, 434, -1, -1, 437, - 438, 439, 440, 441, 442, 443, -1, 445, -1, 447, - 448, 449, 450, -1, -1, 453, -1, -1, 456, 457, + 428, 429, -1, -1, 432, 433, 434, 435, 436, -1, + -1, 439, 440, 441, 442, 443, 444, 445, -1, 447, + -1, 449, 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 473, 474, 475, 476, 3, - -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, - 24, 25, 26, -1, 28, 29, 30, 31, 32, -1, - -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, - -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, - 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, - 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, - -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, - 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, - -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, - -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, - -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, - 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, - 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, -1, 157, -1, 159, 160, 161, 162, -1, - 164, -1, 166, -1, -1, -1, 170, 171, 172, -1, - 174, -1, 176, -1, 178, 179, 180, -1, 182, 183, - 184, 185, 186, 187, 188, -1, 190, 191, 192, 193, - -1, 195, 196, 197, 198, 199, 200, -1, 202, -1, - 204, 205, 206, 207, 208, 209, 210, 211, -1, 213, - -1, 215, -1, -1, 218, -1, 220, 221, 222, 223, - 224, -1, -1, 227, -1, 229, -1, -1, 232, 233, - 234, -1, -1, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, -1, 263, - 264, 265, 266, 267, -1, 269, 270, -1, 272, -1, - 274, 275, 276, 277, 278, 279, -1, 281, 282, -1, - -1, 285, 286, 287, -1, -1, 290, 291, -1, 293, - -1, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, -1, 307, 308, 309, 310, 311, 312, 313, - 314, 315, -1, 317, 318, 319, 320, 321, 322, -1, - 324, 325, 326, 327, 328, 329, 330, 331, -1, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, -1, 347, 348, -1, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, -1, 366, 367, 368, 369, 370, -1, 372, 373, - 374, 375, 376, -1, 378, 379, 380, 381, -1, 383, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 396, 397, -1, 399, 400, -1, 402, -1, - 404, 405, 406, 407, 408, -1, 410, 411, -1, -1, - 414, 415, 416, 417, 418, -1, 420, 421, 422, 423, - 424, 425, 426, 427, -1, -1, 430, 431, 432, 433, - 434, -1, -1, 437, 438, 439, 440, 441, 442, 443, - -1, 445, -1, 447, 448, 449, 450, -1, -1, 453, - -1, -1, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, - 474, 475, 476, 3, -1, 5, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, - 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, - 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, - -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, - -1, 51, 52, -1, 54, 55, 56, 57, 58, 59, - -1, -1, 62, 63, 64, 65, 66, -1, 68, 69, - 70, 71, 72, -1, -1, -1, 76, 77, 78, 79, - 80, 81, -1, 83, 84, 85, -1, 87, 88, 89, - 90, 91, 92, -1, -1, 95, 96, 97, -1, -1, - -1, -1, -1, -1, -1, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, - 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, - -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, - 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, -1, 157, -1, 159, - 160, 161, 162, -1, 164, -1, 166, -1, -1, -1, - 170, 171, 172, -1, 174, -1, 176, -1, 178, 179, - 180, -1, 182, 183, 184, 185, 186, 187, 188, -1, - 190, 191, 192, 193, -1, 195, 196, 197, 198, 199, - 200, -1, 202, -1, 204, 205, 206, 207, 208, 209, - 210, 211, -1, 213, -1, 215, -1, -1, 218, -1, - 220, 221, 222, 223, 224, -1, -1, 227, -1, 229, - -1, -1, 232, 233, 234, -1, -1, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, -1, 263, 264, 265, 266, 267, -1, 269, - 270, -1, 272, -1, 274, 275, 276, 277, 278, 279, - -1, 281, 282, -1, 284, 285, 286, 287, -1, -1, - 290, 291, -1, 293, -1, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, -1, 307, 308, 309, - 310, 311, 312, 313, 314, 315, -1, 317, 318, 319, - 320, 321, 322, -1, 324, 325, 326, 327, 328, 329, - 330, 331, -1, 333, 334, 335, 336, 337, 338, 339, - 340, 341, 342, 343, 344, 345, -1, 347, 348, -1, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 361, 362, 363, 364, -1, 366, 367, 368, 369, - 370, -1, 372, 373, 374, 375, 376, -1, 378, 379, - 380, 381, -1, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, 397, -1, 399, - 400, -1, 402, -1, 404, 405, 406, 407, 408, -1, - 410, 411, -1, -1, 414, 415, 416, 417, 418, -1, - 420, 421, 422, 423, 424, 425, 426, 427, -1, -1, - 430, 431, 432, 433, 434, -1, -1, 437, 438, 439, - 440, 441, 442, 443, -1, 445, -1, 447, 448, 449, - 450, -1, -1, 453, -1, -1, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 473, 474, 475, 476, 3, -1, 5, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, - 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, - -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, - 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, - 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, - 66, -1, 68, 69, 70, 71, 72, -1, -1, -1, - 76, 77, 78, 79, 80, 81, -1, 83, 84, 85, - -1, 87, 88, 89, 90, 91, 92, -1, -1, 95, - 96, 97, -1, -1, -1, -1, -1, -1, -1, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, - 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, - 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, - 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - -1, 157, -1, 159, 160, 161, 162, -1, 164, -1, - 166, -1, -1, -1, 170, 171, 172, -1, 174, -1, - 176, -1, 178, 179, 180, -1, 182, 183, 184, 185, - 186, 187, 188, -1, 190, 191, 192, 193, -1, 195, - 196, 197, 198, 199, 200, -1, 202, -1, 204, 205, - 206, 207, 208, 209, 210, 211, -1, 213, -1, 215, - -1, -1, 218, -1, 220, 221, 222, 223, 224, -1, - -1, 227, -1, 229, -1, -1, 232, 233, 234, -1, - -1, 237, 238, 239, 240, 241, 242, 243, 244, 245, - 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, -1, 263, 264, 265, - 266, 267, -1, 269, 270, -1, 272, -1, 274, 275, - 276, 277, 278, 279, -1, 281, 282, -1, 284, 285, - 286, 287, -1, -1, 290, 291, -1, 293, -1, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - -1, 307, 308, 309, 310, 311, 312, 313, 314, 315, - -1, 317, 318, 319, 320, 321, 322, -1, 324, 325, - 326, 327, 328, 329, 330, 331, -1, 333, 334, 335, - 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, - -1, 347, 348, -1, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 362, 363, 364, -1, - 366, 367, 368, 369, 370, -1, 372, 373, 374, 375, - 376, -1, 378, 379, 380, 381, -1, 383, 384, 385, - 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, -1, 399, 400, -1, 402, -1, 404, 405, - 406, 407, 408, -1, 410, 411, -1, -1, 414, 415, - 416, 417, 418, -1, 420, 421, 422, 423, 424, 425, - 426, 427, -1, -1, 430, 431, 432, 433, 434, -1, - -1, 437, 438, 439, 440, 441, 442, 443, -1, 445, - -1, 447, 448, 449, 450, -1, -1, 453, -1, -1, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 3, -1, -1, -1, -1, -1, -1, -1, -1, + 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, + 478, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, 31, 32, -1, -1, -1, -1, -1, 38, 39, -1, 41, @@ -243520,181 +254505,39 @@ static const yytype_int16 yycheck[] = 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, -1, -1, -1, 170, 171, - 172, -1, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, -1, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, -1, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, -1, -1, 218, -1, 220, 221, - 222, 223, 224, -1, -1, 227, -1, 229, -1, -1, - 232, 233, 234, -1, -1, 237, 238, 239, 240, 241, + 152, 153, 154, 155, 156, -1, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, -1, -1, -1, 171, + 172, 173, -1, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, -1, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, -1, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, -1, -1, 219, -1, 221, + 222, 223, 224, 225, 226, -1, -1, 229, -1, 231, + -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - -1, 263, 264, 265, 266, 267, -1, 269, 270, -1, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - -1, 293, -1, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, -1, 350, 351, + 262, 263, -1, 265, 266, 267, 268, 269, -1, 271, + 272, -1, 274, -1, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, -1, 287, 288, 289, -1, -1, + 292, 293, -1, 295, -1, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, -1, - 372, 373, 374, 375, 376, -1, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, -1, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, -1, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, -1, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 372, -1, 374, 375, 376, 377, 378, -1, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, -1, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, -1, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, -1, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, -1, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, 3, -1, 5, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, - 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, - 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, - 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, - 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, - 68, 69, 70, 71, 72, -1, -1, -1, 76, 77, - 78, 79, 80, 81, -1, 83, 84, 85, -1, 87, - 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, - -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, - 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, - 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, - 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, -1, 157, - -1, 159, 160, 161, 162, -1, 164, -1, 166, -1, - -1, -1, 170, 171, 172, -1, 174, -1, 176, -1, - 178, 179, 180, -1, 182, 183, 184, 185, 186, 187, - 188, -1, 190, 191, 192, 193, -1, 195, 196, 197, - 198, 199, 200, -1, 202, -1, 204, 205, 206, 207, - 208, 209, 210, 211, -1, 213, -1, 215, -1, -1, - 218, -1, 220, 221, 222, 223, 224, -1, -1, 227, - -1, 229, -1, -1, 232, 233, 234, -1, -1, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, -1, 263, 264, 265, 266, 267, - -1, 269, 270, -1, 272, -1, 274, 275, 276, 277, - 278, 279, -1, 281, 282, -1, -1, 285, 286, 287, - -1, -1, 290, 291, -1, 293, -1, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, - 308, 309, 310, 311, 312, 313, 314, 315, -1, 317, - 318, 319, 320, 321, 322, -1, 324, 325, 326, 327, - 328, 329, 330, 331, -1, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 343, 344, 345, -1, 347, - 348, -1, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, -1, 366, 367, - 368, 369, 370, -1, 372, 373, 374, 375, 376, -1, - 378, 379, 380, 381, -1, 383, 384, 385, 386, 387, - 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, - -1, 399, 400, 401, 402, -1, 404, 405, 406, 407, - 408, -1, 410, 411, -1, -1, 414, 415, 416, 417, - 418, -1, 420, 421, 422, 423, 424, 425, 426, 427, - -1, -1, 430, 431, 432, 433, 434, -1, -1, 437, - 438, 439, 440, 441, 442, 443, -1, 445, -1, 447, - 448, 449, 450, -1, -1, 453, -1, -1, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 473, 474, 475, 476, 3, - 4, -1, -1, -1, -1, 9, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, - 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, - -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, - -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, - 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, - 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, - -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, - 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, - -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, - -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, - -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, - 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, - 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, -1, 157, -1, 159, 160, 161, 162, -1, - 164, -1, 166, -1, -1, -1, 170, 171, 172, -1, - 174, -1, 176, -1, 178, 179, 180, -1, 182, 183, - 184, 185, 186, 187, 188, -1, 190, 191, 192, 193, - -1, 195, 196, 197, 198, 199, 200, -1, 202, -1, - 204, 205, 206, 207, 208, 209, 210, 211, -1, 213, - -1, 215, -1, -1, 218, -1, 220, 221, 222, 223, - 224, -1, -1, 227, -1, 229, -1, -1, 232, 233, - 234, -1, -1, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, -1, 263, - 264, 265, 266, 267, -1, 269, 270, -1, 272, -1, - 274, 275, 276, 277, 278, 279, -1, 281, 282, -1, - -1, 285, 286, 287, -1, -1, 290, 291, -1, 293, - -1, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, -1, 307, 308, 309, 310, 311, 312, 313, - 314, 315, -1, 317, 318, 319, 320, 321, 322, -1, - 324, 325, 326, 327, 328, 329, 330, 331, -1, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, -1, 347, 348, -1, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, -1, 366, 367, 368, 369, 370, -1, 372, 373, - 374, 375, 376, -1, 378, 379, 380, 381, -1, 383, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 396, 397, -1, 399, 400, -1, 402, -1, - 404, 405, 406, 407, 408, -1, 410, 411, -1, -1, - 414, 415, 416, 417, 418, -1, 420, 421, 422, 423, - 424, 425, 426, 427, -1, -1, 430, 431, 432, 433, - 434, -1, -1, 437, 438, 439, 440, 441, 442, 443, - -1, 445, -1, 447, 448, 449, 450, -1, -1, 453, - -1, -1, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, - 474, 475, 476, 3, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, - 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, - 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, - -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, - -1, 51, 52, -1, 54, 55, 56, 57, 58, 59, - -1, -1, 62, 63, 64, 65, 66, -1, 68, 69, - 70, 71, 72, -1, -1, -1, 76, 77, 78, 79, - 80, 81, -1, 83, 84, 85, -1, 87, 88, 89, - 90, 91, 92, -1, -1, 95, 96, 97, -1, -1, - -1, -1, -1, -1, -1, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, - 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, - -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, - 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, -1, 157, -1, 159, - 160, 161, 162, -1, 164, -1, 166, -1, -1, -1, - 170, 171, 172, -1, 174, -1, 176, -1, 178, 179, - 180, -1, 182, 183, 184, 185, 186, 187, 188, -1, - 190, 191, 192, 193, -1, 195, 196, 197, 198, 199, - 200, -1, 202, -1, 204, 205, 206, 207, 208, 209, - 210, 211, -1, 213, -1, 215, -1, -1, 218, -1, - 220, 221, 222, 223, 224, -1, -1, 227, -1, 229, - -1, -1, 232, 233, 234, -1, -1, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, -1, 263, 264, 265, 266, 267, -1, 269, - 270, -1, 272, -1, 274, 275, 276, 277, 278, 279, - -1, 281, 282, -1, -1, 285, 286, 287, -1, -1, - 290, 291, -1, 293, -1, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, -1, 307, 308, 309, - 310, 311, 312, 313, 314, 315, -1, 317, 318, 319, - 320, 321, 322, -1, 324, 325, 326, 327, 328, 329, - 330, 331, -1, 333, 334, 335, 336, 337, 338, 339, - 340, 341, 342, 343, 344, 345, -1, 347, 348, -1, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 361, 362, 363, 364, -1, 366, 367, 368, 369, - 370, -1, 372, 373, 374, 375, 376, -1, 378, 379, - 380, 381, -1, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, 397, -1, 399, - 400, -1, 402, -1, 404, 405, 406, 407, 408, -1, - 410, 411, -1, -1, 414, 415, 416, 417, 418, -1, - 420, 421, 422, 423, 424, 425, 426, 427, -1, -1, - 430, 431, 432, 433, 434, -1, -1, 437, 438, 439, - 440, 441, 442, 443, -1, 445, -1, 447, 448, 449, - 450, -1, -1, 453, -1, -1, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 473, 474, 475, 476, 3, -1, 5, + 472, 473, 474, 475, 476, 477, 478, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, @@ -243710,181 +254553,39 @@ static const yytype_int16 yycheck[] = 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - -1, 157, -1, 159, 160, 161, 162, -1, 164, -1, - 166, -1, -1, -1, 170, 171, 172, -1, 174, -1, - 176, -1, 178, 179, 180, -1, 182, 183, 184, 185, - 186, 187, 188, -1, 190, 191, 192, 193, -1, 195, - 196, 197, 198, 199, 200, -1, 202, -1, 204, 205, - 206, 207, 208, 209, 210, 211, -1, 213, -1, 215, - -1, -1, 218, -1, 220, 221, 222, 223, 224, -1, - -1, 227, -1, 229, -1, -1, 232, 233, 234, -1, - -1, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 156, -1, 158, -1, 160, 161, 162, 163, -1, 165, + -1, 167, -1, -1, -1, 171, 172, 173, -1, 175, + -1, 177, -1, 179, 180, 181, -1, 183, 184, 185, + 186, 187, 188, 189, -1, 191, 192, 193, 194, -1, + 196, 197, 198, 199, 200, 201, -1, 203, -1, 205, + 206, 207, 208, 209, 210, 211, 212, -1, 214, -1, + 216, -1, -1, 219, -1, 221, 222, 223, 224, 225, + 226, -1, -1, 229, -1, 231, -1, -1, 234, 235, + 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, -1, 263, 264, 265, - 266, 267, -1, 269, 270, -1, 272, -1, 274, 275, - 276, 277, 278, 279, -1, 281, 282, -1, -1, 285, - 286, 287, -1, -1, 290, 291, -1, 293, -1, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - -1, 307, 308, 309, 310, 311, 312, 313, 314, 315, - -1, 317, 318, 319, 320, 321, 322, -1, 324, 325, - 326, 327, 328, 329, 330, 331, -1, 333, 334, 335, + 256, 257, 258, 259, 260, 261, 262, 263, -1, 265, + 266, 267, 268, 269, -1, 271, 272, -1, 274, -1, + 276, 277, 278, 279, 280, 281, -1, 283, 284, -1, + 286, 287, 288, 289, -1, -1, 292, 293, -1, 295, + -1, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, + 316, 317, -1, 319, 320, 321, 322, 323, 324, -1, + 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, - -1, 347, 348, -1, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 362, 363, 364, -1, - 366, 367, 368, 369, 370, -1, 372, 373, 374, 375, - 376, -1, 378, 379, 380, 381, -1, 383, 384, 385, + 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, -1, 374, 375, + 376, 377, 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, -1, 399, 400, -1, 402, -1, 404, 405, - 406, 407, 408, -1, 410, 411, -1, -1, 414, 415, - 416, 417, 418, -1, 420, 421, 422, 423, 424, 425, - 426, 427, -1, -1, 430, 431, 432, 433, 434, -1, - -1, 437, 438, 439, 440, 441, 442, 443, -1, 445, - -1, 447, 448, 449, 450, -1, -1, 453, -1, -1, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, + 396, 397, 398, 399, -1, 401, 402, -1, 404, -1, + 406, 407, 408, 409, 410, -1, 412, 413, -1, -1, + 416, 417, 418, 419, 420, -1, 422, 423, 424, 425, + 426, 427, 428, 429, -1, -1, 432, 433, 434, 435, + 436, -1, -1, 439, 440, 441, 442, 443, 444, 445, + -1, 447, -1, 449, 450, 451, 452, -1, -1, 455, + -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 3, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, -1, - -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, - 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, - 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, - 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, - 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, - -1, 83, 84, 85, -1, 87, 88, 89, 90, 91, - 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, - -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, - 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, - 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, - 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, -1, -1, -1, 170, 171, - 172, -1, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, -1, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, -1, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, -1, -1, 218, -1, 220, 221, - 222, 223, 224, -1, -1, 227, -1, 229, -1, -1, - 232, 233, 234, -1, -1, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - -1, 263, 264, 265, 266, 267, -1, 269, 270, -1, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - -1, 293, -1, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, -1, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, -1, - 372, 373, 374, 375, 376, -1, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, -1, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, -1, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, -1, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, 3, -1, 5, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, - 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, - 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, - 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, - 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, - 68, 69, 70, 71, 72, -1, -1, -1, 76, 77, - 78, 79, 80, 81, -1, 83, 84, 85, -1, 87, - 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, - -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, - 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, - 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, - 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, -1, 157, - -1, 159, 160, 161, 162, -1, 164, -1, 166, -1, - -1, -1, 170, 171, 172, -1, 174, -1, 176, -1, - 178, 179, 180, -1, 182, 183, 184, 185, 186, 187, - 188, -1, 190, 191, 192, 193, -1, 195, 196, 197, - 198, 199, 200, -1, 202, -1, 204, 205, 206, 207, - 208, 209, 210, 211, -1, 213, -1, 215, -1, -1, - 218, -1, 220, 221, 222, 223, 224, -1, -1, 227, - -1, 229, -1, -1, 232, 233, 234, -1, -1, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, -1, 263, 264, 265, 266, 267, - -1, 269, 270, -1, 272, -1, 274, 275, 276, 277, - 278, 279, -1, 281, 282, -1, -1, 285, 286, 287, - -1, -1, 290, 291, -1, 293, -1, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, - 308, 309, 310, 311, 312, 313, 314, 315, -1, 317, - 318, 319, 320, 321, 322, -1, 324, 325, 326, 327, - 328, 329, 330, 331, -1, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 343, 344, 345, -1, 347, - 348, -1, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, -1, 366, 367, - 368, 369, 370, -1, 372, 373, 374, 375, 376, -1, - 378, 379, 380, 381, -1, 383, 384, 385, 386, 387, - 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, - -1, 399, 400, -1, 402, -1, 404, 405, 406, 407, - 408, -1, 410, 411, -1, -1, 414, 415, 416, 417, - 418, -1, 420, 421, 422, 423, 424, 425, 426, 427, - -1, -1, 430, 431, 432, 433, 434, -1, -1, 437, - 438, 439, 440, 441, 442, 443, -1, 445, -1, 447, - 448, 449, 450, -1, -1, 453, -1, -1, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 473, 474, 475, 476, 3, - -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, - 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, - -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, - -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, - 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, - 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, - -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, - 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, - -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, - -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, - -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, - 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, - 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, -1, 157, -1, 159, 160, 161, 162, -1, - 164, -1, 166, -1, -1, -1, 170, 171, 172, -1, - 174, -1, 176, -1, 178, 179, 180, -1, 182, 183, - 184, 185, 186, 187, 188, -1, 190, 191, 192, 193, - -1, 195, 196, 197, 198, 199, 200, -1, 202, -1, - 204, 205, 206, 207, 208, 209, 210, 211, -1, 213, - -1, 215, -1, -1, 218, -1, 220, 221, 222, 223, - 224, -1, -1, 227, -1, 229, -1, -1, 232, 233, - 234, -1, -1, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, -1, 263, - 264, 265, 266, 267, -1, 269, 270, -1, 272, -1, - 274, 275, 276, 277, 278, 279, -1, 281, 282, -1, - -1, 285, 286, 287, -1, -1, 290, 291, -1, 293, - -1, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, -1, 307, 308, 309, 310, 311, 312, 313, - 314, 315, -1, 317, 318, 319, 320, 321, 322, -1, - 324, 325, 326, 327, 328, 329, 330, 331, -1, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, -1, 347, 348, -1, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, -1, 366, 367, 368, 369, 370, -1, 372, 373, - 374, 375, 376, -1, 378, 379, 380, 381, -1, 383, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 396, 397, -1, 399, 400, -1, 402, -1, - 404, 405, 406, 407, 408, -1, 410, 411, -1, -1, - 414, 415, 416, 417, 418, -1, 420, 421, 422, 423, - 424, 425, 426, 427, -1, -1, 430, 431, 432, 433, - 434, -1, -1, 437, 438, 439, 440, 441, 442, 443, - -1, 445, -1, 447, 448, 449, 450, -1, -1, 453, - -1, -1, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, - 474, 475, 476, 3, -1, 5, -1, -1, -1, -1, + 476, 477, 478, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, @@ -243899,89 +254600,137 @@ static const yytype_int16 yycheck[] = 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, -1, 157, -1, 159, - 160, 161, 162, -1, 164, -1, 166, -1, -1, -1, - 170, 171, 172, -1, 174, -1, 176, -1, 178, 179, - 180, -1, 182, 183, 184, 185, 186, 187, 188, -1, - 190, 191, 192, 193, -1, 195, 196, 197, 198, 199, - 200, -1, 202, -1, 204, 205, 206, 207, 208, 209, - 210, 211, -1, 213, -1, 215, -1, -1, 218, -1, - 220, 221, 222, 223, 224, -1, -1, 227, -1, 229, - -1, -1, 232, 233, 234, -1, -1, 237, 238, 239, + 150, 151, 152, 153, 154, 155, 156, -1, 158, -1, + 160, 161, 162, 163, -1, 165, -1, 167, -1, -1, + -1, 171, 172, 173, -1, 175, -1, 177, -1, 179, + 180, 181, -1, 183, 184, 185, 186, 187, 188, 189, + -1, 191, 192, 193, 194, -1, 196, 197, 198, 199, + 200, 201, -1, 203, -1, 205, 206, 207, 208, 209, + 210, 211, 212, -1, 214, -1, 216, -1, -1, 219, + -1, 221, 222, 223, 224, 225, 226, -1, -1, 229, + -1, 231, -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, -1, 263, 264, 265, 266, 267, -1, 269, - 270, -1, 272, -1, 274, 275, 276, 277, 278, 279, - -1, 281, 282, -1, -1, 285, 286, 287, -1, -1, - 290, 291, -1, 293, -1, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, -1, 307, 308, 309, - 310, 311, 312, 313, 314, 315, -1, 317, 318, 319, - 320, 321, 322, -1, 324, 325, 326, 327, 328, 329, - 330, 331, -1, 333, 334, 335, 336, 337, 338, 339, - 340, 341, 342, 343, 344, 345, -1, 347, 348, -1, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 361, 362, 363, 364, -1, 366, 367, 368, 369, - 370, -1, 372, 373, 374, 375, 376, -1, 378, 379, - 380, 381, -1, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, 397, -1, 399, - 400, -1, 402, -1, 404, 405, 406, 407, 408, -1, - 410, 411, -1, -1, 414, 415, 416, 417, 418, -1, - 420, 421, 422, 423, 424, 425, 426, 427, -1, -1, - 430, 431, 432, 433, 434, -1, -1, 437, 438, 439, - 440, 441, 442, 443, -1, 445, -1, 447, 448, 449, - 450, -1, -1, 453, -1, -1, 456, 457, 458, 459, + 260, 261, 262, 263, -1, 265, 266, 267, 268, 269, + -1, 271, 272, -1, 274, -1, 276, 277, 278, 279, + 280, 281, -1, 283, 284, -1, 286, 287, 288, 289, + -1, -1, 292, 293, -1, 295, -1, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, -1, 319, + 320, 321, 322, 323, 324, -1, 326, 327, 328, 329, + 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, -1, 349, + 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, + 370, 371, 372, -1, 374, 375, 376, 377, 378, -1, + 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + -1, 401, 402, -1, 404, -1, 406, 407, 408, 409, + 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, + 420, -1, 422, 423, 424, 425, 426, 427, 428, 429, + -1, -1, 432, 433, 434, 435, 436, -1, -1, 439, + 440, 441, 442, 443, 444, 445, -1, 447, -1, 449, + 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 473, 474, 475, 476, 3, -1, 5, + 470, 471, 472, 473, 474, 475, 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, - 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, - -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, - 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, - 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, - 66, -1, 68, 69, 70, 71, 72, -1, -1, -1, - 76, 77, 78, 79, 80, 81, -1, 83, 84, 85, - -1, 87, 88, 89, 90, 91, 92, -1, -1, 95, - 96, 97, -1, -1, -1, -1, -1, -1, -1, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, - 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, - 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, - 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - -1, 157, -1, 159, 160, 161, 162, -1, 164, -1, - 166, -1, -1, -1, 170, 171, 172, -1, 174, -1, - 176, -1, 178, 179, 180, -1, 182, 183, 184, 185, - 186, 187, 188, -1, 190, 191, 192, 193, -1, 195, - 196, 197, 198, 199, 200, -1, 202, -1, 204, 205, - 206, 207, 208, 209, 210, 211, -1, 213, -1, 215, - -1, -1, 218, -1, 220, 221, 222, 223, 224, -1, - -1, 227, -1, 229, -1, -1, 232, 233, 234, -1, - -1, 237, 238, 239, 240, 241, 242, 243, 244, 245, - 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, -1, 263, 264, 265, - 266, 267, -1, 269, 270, -1, 272, -1, 274, 275, - 276, 277, 278, 279, -1, 281, 282, -1, -1, 285, - 286, 287, -1, -1, 290, 291, -1, 293, -1, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - -1, 307, 308, 309, 310, 311, 312, 313, 314, 315, - -1, 317, 318, 319, 320, 321, 322, -1, 324, 325, - 326, 327, 328, 329, 330, 331, -1, 333, 334, 335, - 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, - -1, 347, 348, -1, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 362, 363, 364, -1, - 366, 367, 368, 369, 370, -1, 372, 373, 374, 375, - 376, -1, 378, 379, 380, 381, -1, 383, 384, 385, - 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, -1, 399, 400, -1, 402, -1, 404, 405, - 406, 407, 408, -1, 410, 411, -1, -1, 414, 415, - 416, 417, 418, -1, 420, 421, 422, 423, 424, 425, - 426, 427, -1, -1, 430, 431, 432, 433, 434, -1, - -1, 437, 438, 439, 440, 441, 442, 443, -1, 445, - -1, 447, 448, 449, 450, -1, -1, 453, -1, -1, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 3, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, -1, 28, 29, 30, 31, 32, -1, + -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, + -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, + 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, + 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, + -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, + 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, + -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, + -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, + -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, + 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, + 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, -1, 158, -1, 160, 161, 162, 163, + -1, 165, -1, 167, -1, -1, -1, 171, 172, 173, + -1, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, -1, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + -1, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, -1, -1, 219, -1, 221, 222, 223, + 224, 225, 226, -1, -1, 229, -1, 231, -1, -1, + 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + -1, 265, 266, 267, 268, 269, -1, 271, 272, -1, + 274, -1, 276, 277, 278, 279, 280, 281, -1, 283, + 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, + -1, 295, -1, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, -1, 319, 320, 321, 322, 323, + 324, -1, 326, 327, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, -1, 368, 369, 370, 371, 372, -1, + 374, 375, 376, 377, 378, -1, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, -1, + 404, -1, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, -1, 422, 423, + 424, 425, 426, 427, 428, 429, -1, -1, 432, 433, + 434, 435, 436, -1, -1, 439, 440, 441, 442, 443, + 444, 445, -1, 447, -1, 449, 450, 451, 452, -1, + -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 3, -1, 5, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, + 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, + 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, + 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, + 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, + 68, 69, 70, 71, 72, -1, -1, -1, 76, 77, + 78, 79, 80, 81, -1, 83, 84, 85, -1, 87, + 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, + -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, + 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, + 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, + 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, -1, + 158, -1, 160, 161, 162, 163, -1, 165, -1, 167, + -1, -1, -1, 171, 172, 173, -1, 175, -1, 177, + -1, 179, 180, 181, -1, 183, 184, 185, 186, 187, + 188, 189, -1, 191, 192, 193, 194, -1, 196, 197, + 198, 199, 200, 201, -1, 203, -1, 205, 206, 207, + 208, 209, 210, 211, 212, -1, 214, -1, 216, -1, + -1, 219, -1, 221, 222, 223, 224, 225, 226, -1, + -1, 229, -1, 231, -1, -1, 234, 235, 236, -1, + -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, -1, 265, 266, 267, + 268, 269, -1, 271, 272, -1, 274, -1, 276, 277, + 278, 279, 280, 281, -1, 283, 284, -1, -1, 287, + 288, 289, -1, -1, 292, 293, -1, 295, -1, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, + -1, 319, 320, 321, 322, 323, 324, -1, 326, 327, + 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 368, 369, 370, 371, 372, -1, 374, 375, 376, 377, + 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, -1, 401, 402, 403, 404, -1, 406, 407, + 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, + 418, 419, 420, -1, 422, 423, 424, 425, 426, 427, + 428, 429, -1, -1, 432, 433, 434, 435, 436, -1, + -1, 439, 440, 441, 442, 443, 444, 445, -1, 447, + -1, 449, 450, 451, 452, -1, -1, 455, -1, -1, + 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, + 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, + 478, 3, 4, -1, -1, -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, -1, + 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, @@ -243994,134 +254743,87 @@ static const yytype_int16 yycheck[] = 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, -1, -1, -1, 170, 171, - 172, -1, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, -1, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, -1, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, -1, -1, 218, -1, 220, 221, - 222, 223, 224, -1, -1, 227, -1, 229, -1, -1, - 232, 233, 234, -1, -1, 237, 238, 239, 240, 241, + 152, 153, 154, 155, 156, -1, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, -1, -1, -1, 171, + 172, 173, -1, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, -1, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, -1, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, -1, -1, 219, -1, 221, + 222, 223, 224, 225, 226, -1, -1, 229, -1, 231, + -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - -1, 263, 264, 265, 266, 267, -1, 269, 270, -1, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - -1, 293, -1, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, -1, 350, 351, + 262, 263, -1, 265, 266, 267, 268, 269, -1, 271, + 272, -1, 274, -1, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, -1, 287, 288, 289, -1, -1, + 292, 293, -1, 295, -1, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, -1, - 372, 373, 374, 375, 376, -1, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, -1, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, -1, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, -1, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 372, -1, 374, 375, 376, 377, 378, -1, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, -1, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, -1, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, -1, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, -1, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, 3, -1, 5, -1, -1, + 472, 473, 474, 475, 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, - 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, - 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, - 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, - 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, - 68, 69, 70, 71, 72, -1, -1, -1, 76, 77, - 78, 79, 80, 81, -1, 83, 84, 85, -1, 87, - 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, - -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, - 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, - 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, - 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, -1, 157, - -1, 159, 160, 161, 162, -1, 164, -1, 166, -1, - -1, -1, 170, 171, 172, -1, 174, -1, 176, -1, - 178, 179, 180, -1, 182, 183, 184, 185, 186, 187, - 188, -1, 190, 191, 192, 193, -1, 195, 196, 197, - 198, 199, 200, -1, 202, -1, 204, 205, 206, 207, - 208, 209, 210, 211, -1, 213, -1, 215, -1, -1, - 218, -1, 220, 221, 222, 223, 224, -1, -1, 227, - -1, 229, -1, -1, 232, 233, 234, -1, -1, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, -1, 263, 264, 265, 266, 267, - -1, 269, 270, -1, 272, -1, 274, 275, 276, 277, - 278, 279, -1, 281, 282, -1, -1, 285, 286, 287, - -1, -1, 290, 291, -1, 293, -1, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, - 308, 309, 310, 311, 312, 313, 314, 315, -1, 317, - 318, 319, 320, 321, 322, -1, 324, 325, 326, 327, - 328, 329, 330, 331, -1, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 343, 344, 345, -1, 347, - 348, -1, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, -1, 366, 367, - 368, 369, 370, -1, 372, 373, 374, 375, 376, -1, - 378, 379, 380, 381, -1, 383, 384, 385, 386, 387, - 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, - -1, 399, 400, -1, 402, -1, 404, 405, 406, 407, - 408, -1, 410, 411, -1, -1, 414, 415, 416, 417, - 418, -1, 420, 421, 422, 423, 424, 425, 426, 427, - -1, -1, 430, 431, 432, 433, 434, -1, -1, 437, - 438, 439, 440, 441, 442, 443, -1, 445, -1, 447, - 448, 449, 450, -1, -1, 453, -1, -1, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 473, 474, 475, 476, 3, - -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, - 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, - -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, - -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, - 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, - 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, - -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, - 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, - -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, - -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, - -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, - 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, - 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, -1, 157, -1, 159, 160, 161, 162, -1, - 164, -1, 166, -1, -1, -1, 170, 171, 172, -1, - 174, -1, 176, -1, 178, 179, 180, -1, 182, 183, - 184, 185, 186, 187, 188, -1, 190, 191, 192, 193, - -1, 195, 196, 197, 198, 199, 200, -1, 202, -1, - 204, 205, 206, 207, 208, 209, 210, 211, -1, 213, - -1, 215, -1, -1, 218, -1, 220, 221, 222, 223, - 224, -1, -1, 227, -1, 229, -1, -1, 232, 233, - 234, -1, -1, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, -1, 263, - 264, 265, 266, 267, -1, 269, 270, -1, 272, -1, - 274, 275, 276, 277, 278, 279, -1, 281, 282, -1, - -1, 285, 286, 287, -1, -1, 290, 291, -1, 293, - -1, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, -1, 307, 308, 309, 310, 311, 312, 313, - 314, 315, -1, 317, 318, 319, 320, 321, 322, -1, - 324, 325, 326, 327, 328, 329, 330, 331, -1, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, -1, 347, 348, -1, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, -1, 366, 367, 368, 369, 370, -1, 372, 373, - 374, 375, 376, -1, 378, 379, 380, 381, -1, 383, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 396, 397, -1, 399, 400, -1, 402, -1, - 404, 405, 406, 407, 408, -1, 410, 411, -1, -1, - 414, 415, 416, 417, 418, -1, 420, 421, 422, 423, - 424, 425, 426, 427, -1, -1, 430, 431, 432, 433, - 434, -1, -1, 437, 438, 439, 440, 441, 442, 443, - -1, 445, -1, 447, 448, 449, 450, -1, -1, 453, - -1, -1, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, - 474, 475, 476, 3, -1, 5, -1, -1, -1, -1, + -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 28, 29, 30, -1, -1, -1, -1, -1, + -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, + 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, + 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, + 66, -1, 68, 69, 70, 71, 72, -1, -1, -1, + 76, 77, 78, 79, 80, 81, -1, 83, 84, 85, + -1, 87, 88, 89, 90, 91, 92, -1, -1, 95, + 96, 97, -1, -1, -1, -1, -1, -1, -1, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, + 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, + 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, + 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, -1, 158, -1, 160, 161, 162, 163, -1, 165, + -1, 167, -1, -1, -1, 171, 172, 173, -1, 175, + -1, 177, -1, 179, 180, 181, -1, 183, 184, 185, + 186, 187, 188, 189, -1, 191, 192, 193, 194, -1, + 196, 197, 198, 199, 200, 201, -1, 203, -1, 205, + 206, 207, 208, 209, 210, 211, 212, -1, 214, -1, + 216, -1, -1, 219, -1, 221, 222, 223, 224, 225, + 226, -1, -1, 229, -1, 231, -1, -1, 234, 235, + 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, -1, 265, + 266, 267, 268, 269, -1, 271, 272, -1, 274, -1, + 276, 277, 278, 279, 280, 281, -1, 283, 284, -1, + -1, 287, 288, 289, -1, -1, 292, 293, -1, 295, + -1, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, + 316, 317, -1, 319, 320, 321, 322, 323, 324, -1, + 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, + 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, + 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, -1, 374, 375, + 376, 377, 378, -1, 380, 381, 382, 383, -1, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, -1, 401, 402, -1, 404, -1, + 406, 407, 408, 409, 410, -1, 412, 413, -1, -1, + 416, 417, 418, 419, 420, -1, 422, 423, 424, 425, + 426, 427, 428, 429, -1, -1, 432, 433, 434, 435, + 436, -1, -1, 439, 440, 441, 442, 443, 444, 445, + -1, 447, -1, 449, 450, 451, 452, -1, -1, 455, + -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, @@ -244136,134 +254838,87 @@ static const yytype_int16 yycheck[] = 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, -1, 157, -1, 159, - 160, 161, 162, -1, 164, -1, 166, -1, -1, -1, - 170, 171, 172, -1, 174, -1, 176, -1, 178, 179, - 180, -1, 182, 183, 184, 185, 186, 187, 188, -1, - 190, 191, 192, 193, -1, 195, 196, 197, 198, 199, - 200, -1, 202, -1, 204, 205, 206, 207, 208, 209, - 210, 211, -1, 213, -1, 215, -1, -1, 218, -1, - 220, 221, 222, 223, 224, -1, -1, 227, -1, 229, - -1, -1, 232, 233, 234, -1, -1, 237, 238, 239, + 150, 151, 152, 153, 154, 155, 156, -1, 158, -1, + 160, 161, 162, 163, -1, 165, -1, 167, -1, -1, + -1, 171, 172, 173, -1, 175, -1, 177, -1, 179, + 180, 181, -1, 183, 184, 185, 186, 187, 188, 189, + -1, 191, 192, 193, 194, -1, 196, 197, 198, 199, + 200, 201, -1, 203, -1, 205, 206, 207, 208, 209, + 210, 211, 212, -1, 214, -1, 216, -1, -1, 219, + -1, 221, 222, 223, 224, 225, 226, -1, -1, 229, + -1, 231, -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, -1, 263, 264, 265, 266, 267, -1, 269, - 270, -1, 272, -1, 274, 275, 276, 277, 278, 279, - -1, 281, 282, -1, -1, 285, 286, 287, -1, -1, - 290, 291, -1, 293, -1, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, -1, 307, 308, 309, - 310, 311, 312, 313, 314, 315, -1, 317, 318, 319, - 320, 321, 322, -1, 324, 325, 326, 327, 328, 329, - 330, 331, -1, 333, 334, 335, 336, 337, 338, 339, - 340, 341, 342, 343, 344, 345, -1, 347, 348, -1, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 361, 362, 363, 364, -1, 366, 367, 368, 369, - 370, -1, 372, 373, 374, 375, 376, -1, 378, 379, - 380, 381, -1, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, 397, -1, 399, - 400, -1, 402, -1, 404, 405, 406, 407, 408, -1, - 410, 411, -1, -1, 414, 415, 416, 417, 418, -1, - 420, 421, 422, 423, 424, 425, 426, 427, -1, -1, - 430, 431, 432, 433, 434, -1, -1, 437, 438, 439, - 440, 441, 442, 443, -1, 445, -1, 447, 448, 449, - 450, -1, -1, 453, -1, -1, 456, 457, 458, 459, + 260, 261, 262, 263, -1, 265, 266, 267, 268, 269, + -1, 271, 272, -1, 274, -1, 276, 277, 278, 279, + 280, 281, -1, 283, 284, -1, -1, 287, 288, 289, + -1, -1, 292, 293, -1, 295, -1, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, -1, 319, + 320, 321, 322, 323, 324, -1, 326, 327, 328, 329, + 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, -1, 349, + 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, + 370, 371, 372, -1, 374, 375, 376, 377, 378, -1, + 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + -1, 401, 402, -1, 404, -1, 406, 407, 408, 409, + 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, + 420, -1, 422, 423, 424, 425, 426, 427, 428, 429, + -1, -1, 432, 433, 434, 435, 436, -1, -1, 439, + 440, 441, 442, 443, 444, 445, -1, 447, -1, 449, + 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 473, 474, 475, 476, 3, -1, -1, + 470, 471, 472, 473, 474, 475, 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, - 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, - 36, -1, 38, 39, -1, 41, 42, 43, -1, 45, - 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, - 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, - 66, -1, 68, 69, 70, 71, 72, -1, -1, -1, - 76, 77, 78, 79, 80, 81, -1, 83, 84, 85, - -1, 87, 88, 89, 90, 91, 92, -1, -1, 95, - 96, 97, -1, -1, -1, -1, -1, -1, -1, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, - 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, - 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, - 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - -1, 157, -1, 159, 160, 161, 162, -1, 164, -1, - 166, -1, -1, -1, 170, 171, 172, -1, 174, -1, - 176, -1, 178, 179, 180, -1, 182, 183, 184, 185, - 186, 187, 188, -1, 190, 191, 192, 193, -1, 195, - 196, 197, 198, 199, 200, -1, 202, -1, 204, 205, - 206, 207, 208, 209, 210, 211, -1, 213, -1, 215, - -1, -1, 218, -1, 220, 221, 222, 223, 224, -1, - -1, 227, -1, 229, -1, -1, 232, 233, 234, -1, - -1, 237, 238, 239, 240, 241, 242, 243, 244, 245, - 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, -1, 263, 264, 265, - 266, 267, -1, 269, 270, -1, 272, -1, 274, 275, - 276, 277, 278, 279, -1, 281, 282, -1, -1, 285, - 286, 287, -1, -1, 290, 291, -1, 293, -1, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - -1, 307, 308, 309, 310, 311, 312, 313, 314, 315, - -1, 317, 318, 319, 320, 321, 322, -1, 324, 325, - 326, 327, 328, 329, 330, 331, -1, 333, 334, 335, - 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, - -1, 347, 348, -1, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 362, 363, 364, -1, - 366, 367, 368, 369, 370, -1, 372, 373, 374, 375, - 376, -1, 378, 379, 380, 381, -1, 383, 384, 385, - 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, -1, 399, 400, -1, 402, -1, 404, 405, - 406, 407, 408, -1, 410, 411, -1, -1, 414, 415, - 416, 417, 418, -1, 420, 421, 422, 423, 424, 425, - 426, 427, -1, -1, 430, 431, 432, 433, 434, -1, - -1, 437, 438, 439, 440, 441, 442, 443, -1, 445, - -1, 447, 448, 449, 450, -1, -1, 453, -1, -1, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 3, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, - 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, - -1, -1, -1, -1, 36, -1, 38, 39, -1, 41, - 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, - 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, - 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, - 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, - -1, 83, 84, 85, -1, 87, 88, 89, 90, 91, - 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, - -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, - 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, - 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, - 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, -1, -1, -1, 170, 171, - 172, -1, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, -1, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, -1, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, -1, -1, 218, -1, 220, 221, - 222, 223, 224, -1, -1, 227, -1, 229, -1, -1, - 232, 233, 234, -1, -1, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - -1, 263, 264, 265, 266, 267, -1, 269, 270, -1, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - -1, 293, -1, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, -1, 350, 351, - 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, -1, - 372, 373, 374, 375, 376, -1, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, -1, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, -1, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, -1, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, 3, -1, 5, -1, -1, + -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, -1, -1, -1, + -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, + -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, + 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, + 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, + -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, + 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, + -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, + -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, + -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, + 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, + 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, -1, 158, -1, 160, 161, 162, 163, + -1, 165, -1, 167, -1, -1, -1, 171, 172, 173, + -1, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, -1, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + -1, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, -1, -1, 219, -1, 221, 222, 223, + 224, 225, 226, -1, -1, 229, -1, 231, -1, -1, + 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + -1, 265, 266, 267, 268, 269, -1, 271, 272, -1, + 274, -1, 276, 277, 278, 279, 280, 281, -1, 283, + 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, + -1, 295, -1, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, -1, 319, 320, 321, 322, 323, + 324, -1, 326, 327, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, -1, 368, 369, 370, 371, 372, -1, + 374, 375, 376, 377, 378, -1, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, -1, + 404, -1, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, -1, 422, 423, + 424, 425, 426, 427, 428, 429, -1, -1, 432, 433, + 434, 435, 436, -1, -1, 439, 440, 441, 442, 443, + 444, 445, -1, 447, -1, 449, 450, 451, 452, -1, + -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, @@ -244278,87 +254933,135 @@ static const yytype_int16 yycheck[] = 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, -1, 157, - -1, 159, 160, 161, 162, -1, 164, -1, 166, -1, - -1, -1, 170, 171, 172, -1, 174, -1, 176, -1, - 178, 179, 180, -1, 182, 183, 184, 185, 186, 187, - 188, -1, 190, 191, 192, 193, -1, 195, 196, 197, - 198, 199, 200, -1, 202, -1, 204, 205, 206, 207, - 208, 209, 210, 211, -1, 213, -1, 215, -1, -1, - 218, -1, 220, 221, 222, 223, 224, -1, -1, 227, - -1, 229, -1, -1, 232, 233, 234, -1, -1, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 148, 149, 150, 151, 152, 153, 154, 155, 156, -1, + 158, -1, 160, 161, 162, 163, -1, 165, -1, 167, + -1, -1, -1, 171, 172, 173, -1, 175, -1, 177, + -1, 179, 180, 181, -1, 183, 184, 185, 186, 187, + 188, 189, -1, 191, 192, 193, 194, -1, 196, 197, + 198, 199, 200, 201, -1, 203, -1, 205, 206, 207, + 208, 209, 210, 211, 212, -1, 214, -1, 216, -1, + -1, 219, -1, 221, 222, 223, 224, 225, 226, -1, + -1, 229, -1, 231, -1, -1, 234, 235, 236, -1, + -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, -1, 263, 264, 265, 266, 267, - -1, 269, 270, -1, 272, -1, 274, 275, 276, 277, - 278, 279, -1, 281, 282, -1, -1, 285, 286, 287, - -1, -1, 290, 291, -1, 293, -1, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, - 308, 309, 310, 311, 312, 313, 314, 315, -1, 317, - 318, 319, 320, 321, 322, -1, 324, 325, 326, 327, - 328, 329, 330, 331, -1, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 343, 344, 345, -1, 347, - 348, -1, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, -1, 366, 367, - 368, 369, 370, -1, 372, 373, 374, 375, 376, -1, - 378, 379, 380, 381, -1, 383, 384, 385, 386, 387, + 258, 259, 260, 261, 262, 263, -1, 265, 266, 267, + 268, 269, -1, 271, 272, -1, 274, -1, 276, 277, + 278, 279, 280, 281, -1, 283, 284, -1, -1, 287, + 288, 289, -1, -1, 292, 293, -1, 295, -1, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, + -1, 319, 320, 321, 322, 323, 324, -1, 326, 327, + 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 368, 369, 370, 371, 372, -1, 374, 375, 376, 377, + 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, - -1, 399, 400, -1, 402, -1, 404, 405, 406, 407, - 408, -1, 410, 411, -1, -1, 414, 415, 416, 417, - 418, -1, 420, 421, 422, 423, 424, 425, 426, 427, - -1, -1, 430, 431, 432, 433, 434, -1, -1, 437, - 438, 439, 440, 441, 442, 443, -1, 445, -1, 447, - 448, 449, 450, -1, -1, 453, -1, -1, 456, 457, + 398, 399, -1, 401, 402, -1, 404, -1, 406, 407, + 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, + 418, 419, 420, -1, 422, 423, 424, 425, 426, 427, + 428, 429, -1, -1, 432, 433, 434, 435, 436, -1, + -1, 439, 440, 441, 442, 443, 444, 445, -1, 447, + -1, 449, 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 473, 474, 475, 476, 3, + 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, + 478, 3, -1, 5, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, + 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, + -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, + 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, + 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, + 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, + 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, + -1, 83, 84, 85, -1, 87, 88, 89, 90, 91, + 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, + -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, + 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, + 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, + 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, -1, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, -1, -1, -1, 171, + 172, 173, -1, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, -1, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, -1, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, -1, -1, 219, -1, 221, + 222, 223, 224, 225, 226, -1, -1, 229, -1, 231, + -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, -1, 265, 266, 267, 268, 269, -1, 271, + 272, -1, 274, -1, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, -1, 287, 288, 289, -1, -1, + 292, 293, -1, 295, -1, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, -1, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 372, -1, 374, 375, 376, 377, 378, -1, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, -1, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, -1, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, -1, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, -1, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, + 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + 472, 473, 474, 475, 476, 477, 478, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, - 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, - -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, - -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, - 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, - 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, - -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, - 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, - -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, - -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, - -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, - 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, - 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, -1, 157, -1, 159, 160, 161, 162, -1, - 164, -1, 166, -1, -1, -1, 170, 171, 172, -1, - 174, -1, 176, -1, 178, 179, 180, -1, 182, 183, - 184, 185, 186, 187, 188, -1, 190, 191, 192, 193, - -1, 195, 196, 197, 198, 199, 200, -1, 202, -1, - 204, 205, 206, 207, 208, 209, 210, 211, -1, 213, - -1, 215, -1, -1, 218, -1, 220, 221, 222, 223, - 224, -1, -1, 227, -1, 229, -1, -1, 232, 233, - 234, -1, -1, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, -1, 263, - 264, 265, 266, 267, -1, 269, 270, -1, 272, -1, - 274, 275, 276, 277, 278, 279, -1, 281, 282, -1, - -1, 285, 286, 287, -1, -1, 290, 291, -1, 293, - -1, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, -1, 307, 308, 309, 310, 311, 312, 313, - 314, 315, -1, 317, 318, 319, 320, 321, 322, -1, - 324, 325, 326, 327, 328, 329, 330, 331, -1, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, -1, 347, 348, -1, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, -1, 366, 367, 368, 369, 370, -1, 372, 373, - 374, 375, 376, -1, 378, 379, 380, 381, -1, 383, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 396, 397, -1, 399, 400, -1, 402, -1, - 404, 405, 406, 407, 408, -1, 410, 411, -1, -1, - 414, 415, 416, 417, 418, -1, 420, 421, 422, 423, - 424, 425, 426, 427, -1, -1, 430, 431, 432, 433, - 434, -1, -1, 437, 438, 439, 440, 441, 442, 443, - -1, 445, -1, 447, 448, 449, 450, -1, -1, 453, - -1, -1, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, - 474, 475, 476, 3, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, + 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, + -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, + 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, + 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, + 66, -1, 68, 69, 70, 71, 72, -1, -1, -1, + 76, 77, 78, 79, 80, 81, -1, 83, 84, 85, + -1, 87, 88, 89, 90, 91, 92, -1, -1, 95, + 96, 97, -1, -1, -1, -1, -1, -1, -1, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, + 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, + 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, + 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, -1, 158, -1, 160, 161, 162, 163, -1, 165, + -1, 167, -1, -1, -1, 171, 172, 173, -1, 175, + -1, 177, -1, 179, 180, 181, -1, 183, 184, 185, + 186, 187, 188, 189, -1, 191, 192, 193, 194, -1, + 196, 197, 198, 199, 200, 201, -1, 203, -1, 205, + 206, 207, 208, 209, 210, 211, 212, -1, 214, -1, + 216, -1, -1, 219, -1, 221, 222, 223, 224, 225, + 226, -1, -1, 229, -1, 231, -1, -1, 234, 235, + 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, -1, 265, + 266, 267, 268, 269, -1, 271, 272, -1, 274, -1, + 276, 277, 278, 279, 280, 281, -1, 283, 284, -1, + -1, 287, 288, 289, -1, -1, 292, 293, -1, 295, + -1, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, + 316, 317, -1, 319, 320, 321, 322, 323, 324, -1, + 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, + 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, + 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, -1, 374, 375, + 376, 377, 378, -1, 380, 381, 382, 383, -1, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, -1, 401, 402, -1, 404, -1, + 406, 407, 408, 409, 410, -1, 412, 413, -1, -1, + 416, 417, 418, 419, 420, -1, 422, 423, 424, 425, + 426, 427, 428, 429, -1, -1, 432, 433, 434, 435, + 436, -1, -1, 439, 440, 441, 442, 443, 444, 445, + -1, 447, -1, 449, 450, 451, 452, -1, -1, 455, + -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, @@ -244373,39 +255076,182 @@ static const yytype_int16 yycheck[] = 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, -1, 157, -1, 159, - 160, 161, 162, -1, 164, -1, 166, -1, -1, -1, - 170, 171, 172, -1, 174, -1, 176, -1, 178, 179, - 180, -1, 182, 183, 184, 185, 186, 187, 188, -1, - 190, 191, 192, 193, -1, 195, 196, 197, 198, 199, - 200, -1, 202, -1, 204, 205, 206, 207, 208, 209, - 210, 211, -1, 213, -1, 215, -1, -1, 218, -1, - 220, 221, 222, 223, 224, -1, -1, 227, -1, 229, - -1, -1, 232, 233, 234, -1, -1, 237, 238, 239, + 150, 151, 152, 153, 154, 155, 156, -1, 158, -1, + 160, 161, 162, 163, -1, 165, -1, 167, -1, -1, + -1, 171, 172, 173, -1, 175, -1, 177, -1, 179, + 180, 181, -1, 183, 184, 185, 186, 187, 188, 189, + -1, 191, 192, 193, 194, -1, 196, 197, 198, 199, + 200, 201, -1, 203, -1, 205, 206, 207, 208, 209, + 210, 211, 212, -1, 214, -1, 216, -1, -1, 219, + -1, 221, 222, 223, 224, 225, 226, -1, -1, 229, + -1, 231, -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, -1, 263, 264, 265, 266, 267, -1, 269, - 270, -1, 272, -1, 274, 275, 276, 277, 278, 279, - -1, 281, 282, -1, -1, 285, 286, 287, -1, -1, - 290, 291, -1, 293, -1, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, -1, 307, 308, 309, - 310, 311, 312, 313, 314, 315, -1, 317, 318, 319, - 320, 321, 322, -1, 324, 325, 326, 327, 328, 329, - 330, 331, -1, 333, 334, 335, 336, 337, 338, 339, - 340, 341, 342, 343, 344, 345, -1, 347, 348, -1, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 361, 362, 363, 364, -1, 366, 367, 368, 369, - 370, -1, 372, 373, 374, 375, 376, -1, 378, 379, - 380, 381, -1, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, 397, -1, 399, - 400, -1, 402, -1, 404, 405, 406, 407, 408, -1, - 410, 411, -1, -1, 414, 415, 416, 417, 418, -1, - 420, 421, 422, 423, 424, 425, 426, 427, -1, -1, - 430, 431, 432, 433, 434, -1, -1, 437, 438, 439, - 440, 441, 442, 443, -1, 445, -1, 447, 448, 449, - 450, -1, -1, 453, -1, -1, 456, 457, 458, 459, + 260, 261, 262, 263, -1, 265, 266, 267, 268, 269, + -1, 271, 272, -1, 274, -1, 276, 277, 278, 279, + 280, 281, -1, 283, 284, -1, -1, 287, 288, 289, + -1, -1, 292, 293, -1, 295, -1, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, -1, 319, + 320, 321, 322, 323, 324, -1, 326, 327, 328, 329, + 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, -1, 349, + 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, + 370, 371, 372, -1, 374, 375, 376, 377, 378, -1, + 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + -1, 401, 402, -1, 404, -1, 406, 407, 408, 409, + 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, + 420, -1, 422, 423, 424, 425, 426, 427, 428, 429, + -1, -1, 432, 433, 434, 435, 436, -1, -1, 439, + 440, 441, 442, 443, 444, 445, -1, 447, -1, 449, + 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 473, 474, 475, 476, 3, -1, -1, + 470, 471, 472, 473, 474, 475, 476, 477, 478, 3, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 28, 29, 30, -1, -1, -1, + -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, + -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, + 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, + 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, + -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, + 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, + -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, + -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, + -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, + 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, + 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, -1, 158, -1, 160, 161, 162, 163, + -1, 165, -1, 167, -1, -1, -1, 171, 172, 173, + -1, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, -1, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + -1, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, -1, -1, 219, -1, 221, 222, 223, + 224, 225, 226, -1, -1, 229, -1, 231, -1, -1, + 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + -1, 265, 266, 267, 268, 269, -1, 271, 272, -1, + 274, -1, 276, 277, 278, 279, 280, 281, -1, 283, + 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, + -1, 295, -1, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, -1, 319, 320, 321, 322, 323, + 324, -1, 326, 327, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, -1, 368, 369, 370, 371, 372, -1, + 374, 375, 376, 377, 378, -1, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, -1, + 404, -1, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, -1, 422, 423, + 424, 425, 426, 427, 428, 429, -1, -1, 432, 433, + 434, 435, 436, -1, -1, 439, 440, 441, 442, 443, + 444, 445, -1, 447, -1, 449, 450, 451, 452, -1, + -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 3, -1, 5, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, + 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, + 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, + 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, + 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, + 68, 69, 70, 71, 72, -1, -1, -1, 76, 77, + 78, 79, 80, 81, -1, 83, 84, 85, -1, 87, + 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, + -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, + 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, + 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, + 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, -1, + 158, -1, 160, 161, 162, 163, -1, 165, -1, 167, + -1, -1, -1, 171, 172, 173, -1, 175, -1, 177, + -1, 179, 180, 181, -1, 183, 184, 185, 186, 187, + 188, 189, -1, 191, 192, 193, 194, -1, 196, 197, + 198, 199, 200, 201, -1, 203, -1, 205, 206, 207, + 208, 209, 210, 211, 212, -1, 214, -1, 216, -1, + -1, 219, -1, 221, 222, 223, 224, 225, 226, -1, + -1, 229, -1, 231, -1, -1, 234, 235, 236, -1, + -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, -1, 265, 266, 267, + 268, 269, -1, 271, 272, -1, 274, -1, 276, 277, + 278, 279, 280, 281, -1, 283, 284, -1, -1, 287, + 288, 289, -1, -1, 292, 293, -1, 295, -1, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, + -1, 319, 320, 321, 322, 323, 324, -1, 326, 327, + 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 368, 369, 370, 371, 372, -1, 374, 375, 376, 377, + 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, -1, 401, 402, -1, 404, -1, 406, 407, + 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, + 418, 419, 420, -1, 422, 423, 424, 425, 426, 427, + 428, 429, -1, -1, 432, 433, 434, 435, 436, -1, + -1, 439, 440, 441, 442, 443, 444, 445, -1, 447, + -1, 449, 450, 451, 452, -1, -1, 455, -1, -1, + 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, + 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, + 478, 3, -1, 5, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, + 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, + -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, + 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, + 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, + 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, + 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, + -1, 83, 84, 85, -1, 87, 88, 89, 90, 91, + 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, + -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, + 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, + 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, + 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, -1, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, -1, -1, -1, 171, + 172, 173, -1, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, -1, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, -1, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, -1, -1, 219, -1, 221, + 222, 223, 224, 225, 226, -1, -1, 229, -1, 231, + -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, -1, 265, 266, 267, 268, 269, -1, 271, + 272, -1, 274, -1, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, -1, 287, 288, 289, -1, -1, + 292, 293, -1, 295, -1, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, -1, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 372, -1, 374, 375, 376, 377, 378, -1, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, -1, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, -1, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, -1, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, -1, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, + 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + 472, 473, 474, 475, 476, 477, 478, 3, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, @@ -244421,39 +255267,182 @@ static const yytype_int16 yycheck[] = 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - -1, 157, -1, 159, 160, 161, 162, -1, 164, -1, - 166, -1, -1, -1, 170, 171, 172, -1, 174, -1, - 176, -1, 178, 179, 180, -1, 182, 183, 184, 185, - 186, 187, 188, -1, 190, 191, 192, 193, -1, 195, - 196, 197, 198, 199, 200, -1, 202, -1, 204, 205, - 206, 207, 208, 209, 210, 211, -1, 213, -1, 215, - -1, -1, 218, -1, 220, 221, 222, 223, 224, -1, - -1, 227, -1, 229, -1, -1, 232, 233, 234, -1, - -1, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 156, -1, 158, -1, 160, 161, 162, 163, -1, 165, + -1, 167, -1, -1, -1, 171, 172, 173, -1, 175, + -1, 177, -1, 179, 180, 181, -1, 183, 184, 185, + 186, 187, 188, 189, -1, 191, 192, 193, 194, -1, + 196, 197, 198, 199, 200, 201, -1, 203, -1, 205, + 206, 207, 208, 209, 210, 211, 212, -1, 214, -1, + 216, -1, -1, 219, -1, 221, 222, 223, 224, 225, + 226, -1, -1, 229, -1, 231, -1, -1, 234, 235, + 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, -1, 263, 264, 265, - 266, 267, -1, 269, 270, -1, 272, -1, 274, 275, - 276, 277, 278, 279, -1, 281, 282, -1, -1, 285, - 286, 287, -1, -1, 290, 291, -1, 293, -1, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - -1, 307, 308, 309, 310, 311, 312, 313, 314, 315, - -1, 317, 318, 319, 320, 321, 322, -1, 324, 325, - 326, 327, 328, 329, 330, 331, -1, 333, 334, 335, + 256, 257, 258, 259, 260, 261, 262, 263, -1, 265, + 266, 267, 268, 269, -1, 271, 272, -1, 274, -1, + 276, 277, 278, 279, 280, 281, -1, 283, 284, -1, + -1, 287, 288, 289, -1, -1, 292, 293, -1, 295, + -1, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, + 316, 317, -1, 319, 320, 321, 322, 323, 324, -1, + 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, - -1, 347, 348, -1, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 362, 363, 364, -1, - 366, 367, 368, 369, 370, -1, 372, 373, 374, 375, - 376, -1, 378, 379, 380, 381, -1, 383, 384, 385, + 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, -1, 374, 375, + 376, 377, 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, -1, 399, 400, -1, 402, -1, 404, 405, - 406, 407, 408, -1, 410, 411, -1, -1, 414, 415, - 416, 417, 418, -1, 420, 421, 422, 423, 424, 425, - 426, 427, -1, -1, 430, 431, 432, 433, 434, -1, - -1, 437, 438, 439, 440, 441, 442, 443, -1, 445, - -1, 447, 448, 449, 450, -1, -1, 453, -1, -1, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, + 396, 397, 398, 399, -1, 401, 402, -1, 404, -1, + 406, 407, 408, 409, 410, -1, 412, 413, -1, -1, + 416, 417, 418, 419, 420, -1, 422, 423, 424, 425, + 426, 427, 428, 429, -1, -1, 432, 433, 434, 435, + 436, -1, -1, 439, 440, 441, 442, 443, 444, 445, + -1, 447, -1, 449, 450, 451, 452, -1, -1, 455, + -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 3, -1, -1, -1, -1, -1, -1, -1, -1, + 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, + 30, -1, -1, -1, -1, -1, 36, -1, 38, 39, + -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, + -1, 51, 52, -1, 54, 55, 56, 57, 58, 59, + -1, -1, 62, 63, 64, 65, 66, -1, 68, 69, + 70, 71, 72, -1, -1, -1, 76, 77, 78, 79, + 80, 81, -1, 83, 84, 85, -1, 87, 88, 89, + 90, 91, 92, -1, -1, 95, 96, 97, -1, -1, + -1, -1, -1, -1, -1, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, + 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, + -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, + 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, -1, 158, -1, + 160, 161, 162, 163, -1, 165, -1, 167, -1, -1, + -1, 171, 172, 173, -1, 175, -1, 177, -1, 179, + 180, 181, -1, 183, 184, 185, 186, 187, 188, 189, + -1, 191, 192, 193, 194, -1, 196, 197, 198, 199, + 200, 201, -1, 203, -1, 205, 206, 207, 208, 209, + 210, 211, 212, -1, 214, -1, 216, -1, -1, 219, + -1, 221, 222, 223, 224, 225, 226, -1, -1, 229, + -1, 231, -1, -1, 234, 235, 236, -1, -1, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, -1, 265, 266, 267, 268, 269, + -1, 271, 272, -1, 274, -1, 276, 277, 278, 279, + 280, 281, -1, 283, 284, -1, -1, 287, 288, 289, + -1, -1, 292, 293, -1, 295, -1, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, -1, 319, + 320, 321, 322, 323, 324, -1, 326, 327, 328, 329, + 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, -1, 349, + 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, + 370, 371, 372, -1, 374, 375, 376, 377, 378, -1, + 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + -1, 401, 402, -1, 404, -1, 406, 407, 408, 409, + 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, + 420, -1, 422, 423, 424, 425, 426, 427, 428, 429, + -1, -1, 432, 433, 434, 435, 436, -1, -1, 439, + 440, 441, 442, 443, 444, 445, -1, 447, -1, 449, + 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 476, 477, 478, 3, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, + -1, -1, 36, -1, 38, 39, -1, 41, 42, 43, + -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, + 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, + 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, + -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, + 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, + -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, + -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, + -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, + 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, + 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, -1, 158, -1, 160, 161, 162, 163, + -1, 165, -1, 167, -1, -1, -1, 171, 172, 173, + -1, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, -1, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + -1, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, -1, -1, 219, -1, 221, 222, 223, + 224, 225, 226, -1, -1, 229, -1, 231, -1, -1, + 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + -1, 265, 266, 267, 268, 269, -1, 271, 272, -1, + 274, -1, 276, 277, 278, 279, 280, 281, -1, 283, + 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, + -1, 295, -1, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, -1, 319, 320, 321, 322, 323, + 324, -1, 326, 327, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, -1, 368, 369, 370, 371, 372, -1, + 374, 375, 376, 377, 378, -1, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, -1, + 404, -1, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, -1, 422, 423, + 424, 425, 426, 427, 428, 429, -1, -1, 432, 433, + 434, 435, 436, -1, -1, 439, 440, 441, 442, 443, + 444, 445, -1, 447, -1, 449, 450, 451, 452, -1, + -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 3, -1, 5, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, + 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, + 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, + 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, + 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, + 68, 69, 70, 71, 72, -1, -1, -1, 76, 77, + 78, 79, 80, 81, -1, 83, 84, 85, -1, 87, + 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, + -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, + 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, + 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, + 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, -1, + 158, -1, 160, 161, 162, 163, -1, 165, -1, 167, + -1, -1, -1, 171, 172, 173, -1, 175, -1, 177, + -1, 179, 180, 181, -1, 183, 184, 185, 186, 187, + 188, 189, -1, 191, 192, 193, 194, -1, 196, 197, + 198, 199, 200, 201, -1, 203, -1, 205, 206, 207, + 208, 209, 210, 211, 212, -1, 214, -1, 216, -1, + -1, 219, -1, 221, 222, 223, 224, 225, 226, -1, + -1, 229, -1, 231, -1, -1, 234, 235, 236, -1, + -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, -1, 265, 266, 267, + 268, 269, -1, 271, 272, -1, 274, -1, 276, 277, + 278, 279, 280, 281, -1, 283, 284, -1, -1, 287, + 288, 289, -1, -1, 292, 293, -1, 295, -1, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, + -1, 319, 320, 321, 322, 323, 324, -1, 326, 327, + 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 368, 369, 370, 371, 372, -1, 374, 375, 376, 377, + 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, -1, 401, 402, -1, 404, -1, 406, 407, + 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, + 418, 419, 420, -1, 422, 423, 424, 425, 426, 427, + 428, 429, -1, -1, 432, 433, 434, 435, 436, -1, + -1, 439, 440, 441, 442, 443, 444, 445, -1, 447, + -1, 449, 450, 451, 452, -1, -1, 455, -1, -1, + 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, + 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, + 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, @@ -244468,86 +255457,134 @@ static const yytype_int16 yycheck[] = 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, -1, -1, -1, 170, 171, - 172, -1, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, -1, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, -1, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, -1, -1, 218, -1, 220, 221, - 222, 223, 224, -1, -1, 227, -1, 229, -1, -1, - 232, 233, 234, -1, -1, 237, 238, 239, 240, 241, + 152, 153, 154, 155, 156, -1, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, -1, -1, -1, 171, + 172, 173, -1, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, -1, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, -1, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, -1, -1, 219, -1, 221, + 222, 223, 224, 225, 226, -1, -1, 229, -1, 231, + -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - -1, 263, 264, 265, 266, 267, -1, 269, 270, -1, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - -1, 293, -1, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, -1, 350, 351, + 262, 263, -1, 265, 266, 267, 268, 269, -1, 271, + 272, -1, 274, -1, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, -1, 287, 288, 289, -1, -1, + 292, 293, -1, 295, -1, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, -1, - 372, 373, 374, 375, 376, -1, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, -1, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, -1, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, -1, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 372, -1, 374, 375, 376, 377, 378, -1, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, -1, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, -1, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, -1, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, -1, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, 3, -1, -1, -1, -1, + 472, 473, 474, 475, 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, - 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, - 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, - 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, - 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, - 68, 69, 70, 71, 72, -1, -1, -1, 76, 77, - 78, 79, 80, 81, -1, 83, 84, 85, -1, 87, - 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, - -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, - 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, - 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, - 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, -1, 157, - -1, 159, 160, 161, 162, -1, 164, -1, 166, -1, - -1, -1, 170, 171, 172, -1, 174, -1, 176, -1, - 178, 179, 180, -1, 182, 183, 184, 185, 186, 187, - 188, -1, 190, 191, 192, 193, -1, 195, 196, 197, - 198, 199, 200, -1, 202, -1, 204, 205, 206, 207, - 208, 209, 210, 211, -1, 213, -1, 215, -1, -1, - 218, -1, 220, 221, 222, 223, 224, -1, -1, 227, - -1, 229, -1, -1, 232, 233, 234, -1, -1, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, -1, 263, 264, 265, 266, 267, - -1, 269, 270, -1, 272, -1, 274, 275, 276, 277, - 278, 279, -1, 281, 282, -1, -1, 285, 286, 287, - -1, -1, 290, 291, -1, 293, -1, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, - 308, 309, 310, 311, 312, 313, 314, 315, -1, 317, - 318, 319, 320, 321, 322, -1, 324, 325, 326, 327, - 328, 329, 330, 331, -1, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 343, 344, 345, -1, 347, - 348, -1, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, -1, 366, 367, - 368, 369, 370, -1, 372, 373, 374, 375, 376, -1, - 378, 379, 380, 381, -1, 383, 384, 385, 386, 387, - 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, - -1, 399, 400, -1, 402, -1, 404, 405, 406, 407, - 408, -1, 410, 411, -1, -1, 414, 415, 416, 417, - 418, -1, 420, 421, 422, 423, 424, 425, 426, 427, - -1, -1, 430, 431, 432, 433, 434, -1, -1, 437, - 438, 439, 440, 441, 442, 443, -1, 445, -1, 447, - 448, 449, 450, -1, -1, 453, -1, -1, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 473, 474, 475, 476, 3, + -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, + 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, + -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, + 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, + 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, + 66, -1, 68, 69, 70, 71, 72, -1, -1, -1, + 76, 77, 78, 79, 80, 81, -1, 83, 84, 85, + -1, 87, 88, 89, 90, 91, 92, -1, -1, 95, + 96, 97, -1, -1, -1, -1, -1, -1, -1, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, + 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, + 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, + 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, -1, 158, -1, 160, 161, 162, 163, -1, 165, + -1, 167, -1, -1, -1, 171, 172, 173, -1, 175, + -1, 177, -1, 179, 180, 181, -1, 183, 184, 185, + 186, 187, 188, 189, -1, 191, 192, 193, 194, -1, + 196, 197, 198, 199, 200, 201, -1, 203, -1, 205, + 206, 207, 208, 209, 210, 211, 212, -1, 214, -1, + 216, -1, -1, 219, -1, 221, 222, 223, 224, 225, + 226, -1, -1, 229, -1, 231, -1, -1, 234, 235, + 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, -1, 265, + 266, 267, 268, 269, -1, 271, 272, -1, 274, -1, + 276, 277, 278, 279, 280, 281, -1, 283, 284, -1, + -1, 287, 288, 289, -1, -1, 292, 293, -1, 295, + -1, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, + 316, 317, -1, 319, 320, 321, 322, 323, 324, -1, + 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, + 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, + 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, -1, 374, 375, + 376, 377, 378, -1, 380, 381, 382, 383, -1, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, -1, 401, 402, -1, 404, -1, + 406, 407, 408, 409, 410, -1, 412, 413, -1, -1, + 416, 417, 418, 419, 420, -1, 422, 423, 424, 425, + 426, 427, 428, 429, -1, -1, 432, 433, 434, 435, + 436, -1, -1, 439, 440, 441, 442, 443, 444, 445, + -1, 447, -1, 449, 450, 451, 452, -1, -1, 455, + -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, + 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, + -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, + -1, 51, 52, -1, 54, 55, 56, 57, 58, 59, + -1, -1, 62, 63, 64, 65, 66, -1, 68, 69, + 70, 71, 72, -1, -1, -1, 76, 77, 78, 79, + 80, 81, -1, 83, 84, 85, -1, 87, 88, 89, + 90, 91, 92, -1, -1, 95, 96, 97, -1, -1, + -1, -1, -1, -1, -1, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, + 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, + -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, + 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, -1, 158, -1, + 160, 161, 162, 163, -1, 165, -1, 167, -1, -1, + -1, 171, 172, 173, -1, 175, -1, 177, -1, 179, + 180, 181, -1, 183, 184, 185, 186, 187, 188, 189, + -1, 191, 192, 193, 194, -1, 196, 197, 198, 199, + 200, 201, -1, 203, -1, 205, 206, 207, 208, 209, + 210, 211, 212, -1, 214, -1, 216, -1, -1, 219, + -1, 221, 222, 223, 224, 225, 226, -1, -1, 229, + -1, 231, -1, -1, 234, 235, 236, -1, -1, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, -1, 265, 266, 267, 268, 269, + -1, 271, 272, -1, 274, -1, 276, 277, 278, 279, + 280, 281, -1, 283, 284, -1, -1, 287, 288, 289, + -1, -1, 292, 293, -1, 295, -1, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, -1, 319, + 320, 321, 322, 323, 324, -1, 326, 327, 328, 329, + 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, -1, 349, + 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, + 370, 371, 372, -1, 374, 375, 376, 377, 378, -1, + 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + -1, 401, 402, -1, 404, -1, 406, 407, 408, 409, + 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, + 420, -1, 422, 423, 424, 425, 426, 427, 428, 429, + -1, -1, 432, 433, 434, 435, 436, -1, -1, 439, + 440, 441, 442, 443, 444, 445, -1, 447, -1, 449, + 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, @@ -244563,137 +255600,90 @@ static const yytype_int16 yycheck[] = -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, -1, 157, -1, 159, 160, 161, 162, -1, - 164, -1, 166, -1, -1, -1, 170, 171, 172, -1, - 174, -1, 176, -1, 178, 179, 180, -1, 182, 183, - 184, 185, 186, 187, 188, -1, 190, 191, 192, 193, - -1, 195, 196, 197, 198, 199, 200, -1, 202, -1, - 204, 205, 206, 207, 208, 209, 210, 211, -1, 213, - -1, 215, -1, -1, 218, -1, 220, 221, 222, 223, - 224, -1, -1, 227, -1, 229, -1, -1, 232, 233, - 234, -1, -1, 237, 238, 239, 240, 241, 242, 243, + 154, 155, 156, -1, 158, -1, 160, 161, 162, 163, + -1, 165, -1, 167, -1, -1, -1, 171, 172, 173, + -1, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, -1, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + -1, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, -1, -1, 219, -1, 221, 222, 223, + 224, 225, 226, -1, -1, 229, -1, 231, -1, -1, + 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, -1, 263, - 264, 265, 266, 267, -1, 269, 270, -1, 272, -1, - 274, 275, 276, 277, 278, 279, -1, 281, 282, -1, - -1, 285, 286, 287, -1, -1, 290, 291, -1, 293, - -1, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, -1, 307, 308, 309, 310, 311, 312, 313, - 314, 315, -1, 317, 318, 319, 320, 321, 322, -1, - 324, 325, 326, 327, 328, 329, 330, 331, -1, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, -1, 347, 348, -1, 350, 351, 352, 353, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + -1, 265, 266, 267, 268, 269, -1, 271, 272, -1, + 274, -1, 276, 277, 278, 279, 280, 281, -1, 283, + 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, + -1, 295, -1, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, -1, 319, 320, 321, 322, 323, + 324, -1, 326, 327, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, -1, 366, 367, 368, 369, 370, -1, 372, 373, - 374, 375, 376, -1, 378, 379, 380, 381, -1, 383, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 396, 397, -1, 399, 400, -1, 402, -1, - 404, 405, 406, 407, 408, -1, 410, 411, -1, -1, - 414, 415, 416, 417, 418, -1, 420, 421, 422, 423, - 424, 425, 426, 427, -1, -1, 430, 431, 432, 433, - 434, -1, -1, 437, 438, 439, 440, 441, 442, 443, - -1, 445, -1, 447, 448, 449, 450, -1, -1, 453, - -1, -1, 456, 457, 458, 459, 460, 461, 462, 463, + 364, 365, 366, -1, 368, 369, 370, 371, 372, -1, + 374, 375, 376, 377, 378, -1, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, -1, + 404, -1, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, -1, 422, 423, + 424, 425, 426, 427, 428, 429, -1, -1, 432, 433, + 434, 435, 436, -1, -1, 439, 440, 441, 442, 443, + 444, 445, -1, 447, -1, 449, 450, 451, 452, -1, + -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, - 474, 475, 476, 3, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, - 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, - 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, - -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, - -1, 51, 52, -1, 54, 55, 56, 57, 58, 59, - -1, -1, 62, 63, 64, 65, 66, -1, 68, 69, - 70, 71, 72, -1, -1, -1, 76, 77, 78, 79, - 80, 81, -1, 83, 84, 85, -1, 87, 88, 89, - 90, 91, 92, -1, -1, 95, 96, 97, -1, -1, - -1, -1, -1, -1, -1, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, - 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, - -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, - 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, -1, 157, -1, 159, - 160, 161, 162, -1, 164, -1, 166, -1, -1, -1, - 170, 171, 172, -1, 174, -1, 176, -1, 178, 179, - 180, -1, 182, 183, 184, 185, 186, 187, 188, -1, - 190, 191, 192, 193, -1, 195, 196, 197, 198, 199, - 200, -1, 202, -1, 204, 205, 206, 207, 208, 209, - 210, 211, -1, 213, -1, 215, -1, -1, 218, -1, - 220, 221, 222, 223, 224, -1, -1, 227, -1, 229, - -1, -1, 232, 233, 234, -1, -1, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, -1, 263, 264, 265, 266, 267, -1, 269, - 270, -1, 272, -1, 274, 275, 276, 277, 278, 279, - -1, 281, 282, -1, -1, 285, 286, 287, -1, -1, - 290, 291, -1, 293, -1, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, -1, 307, 308, 309, - 310, 311, 312, 313, 314, 315, -1, 317, 318, 319, - 320, 321, 322, -1, 324, 325, 326, 327, 328, 329, - 330, 331, -1, 333, 334, 335, 336, 337, 338, 339, - 340, 341, 342, 343, 344, 345, -1, 347, 348, -1, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 361, 362, 363, 364, -1, 366, 367, 368, 369, - 370, -1, 372, 373, 374, 375, 376, -1, 378, 379, - 380, 381, -1, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, 397, -1, 399, - 400, -1, 402, -1, 404, 405, 406, 407, 408, -1, - 410, 411, -1, -1, 414, 415, 416, 417, 418, -1, - 420, 421, 422, 423, 424, 425, 426, 427, -1, -1, - 430, 431, 432, 433, 434, -1, -1, 437, 438, 439, - 440, 441, 442, 443, -1, 445, -1, 447, 448, 449, - 450, -1, -1, 453, -1, -1, 456, 457, 458, 459, - 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 473, 474, 475, 476, 3, -1, -1, + 474, 475, 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, - 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, - -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, - 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, - 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, - 66, -1, 68, 69, 70, 71, 72, -1, -1, -1, - 76, 77, 78, 79, 80, 81, -1, 83, 84, 85, - -1, 87, 88, 89, 90, 91, 92, -1, -1, 95, - 96, 97, -1, -1, -1, -1, -1, -1, -1, 105, - 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, - 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, - 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, - 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, - 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - -1, 157, -1, 159, 160, 161, 162, -1, 164, -1, - 166, -1, -1, -1, 170, 171, 172, -1, 174, -1, - 176, -1, 178, 179, 180, -1, 182, 183, 184, 185, - 186, 187, 188, -1, 190, 191, 192, 193, -1, 195, - 196, 197, 198, 199, 200, -1, 202, -1, 204, 205, - 206, 207, 208, 209, 210, 211, -1, 213, -1, 215, - -1, -1, 218, -1, 220, 221, 222, 223, 224, -1, - -1, 227, -1, 229, -1, -1, 232, 233, 234, -1, - -1, 237, 238, 239, 240, 241, 242, 243, 244, 245, - 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, -1, 263, 264, 265, - 266, 267, -1, 269, 270, -1, 272, -1, 274, 275, - 276, 277, 278, 279, -1, 281, 282, -1, -1, 285, - 286, 287, -1, -1, 290, 291, -1, 293, -1, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - -1, 307, 308, 309, 310, 311, 312, 313, 314, 315, - -1, 317, 318, 319, 320, 321, 322, -1, 324, 325, - 326, 327, 328, 329, 330, 331, -1, 333, 334, 335, - 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, - -1, 347, 348, -1, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 362, 363, 364, -1, - 366, 367, 368, 369, 370, -1, 372, 373, 374, 375, - 376, -1, 378, 379, 380, 381, -1, 383, 384, 385, - 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, -1, 399, 400, -1, 402, -1, 404, 405, - 406, 407, 408, -1, 410, 411, -1, -1, 414, 415, - 416, 417, 418, -1, 420, 421, 422, 423, 424, 425, - 426, 427, -1, -1, 430, 431, 432, 433, 434, -1, - -1, 437, 438, 439, 440, 441, 442, 443, -1, 445, - -1, 447, 448, 449, 450, -1, -1, 453, -1, -1, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, - 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 3, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, + 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, + 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, + 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, + 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, + 68, 69, 70, 71, 72, -1, -1, -1, 76, 77, + 78, 79, 80, 81, -1, 83, 84, 85, -1, 87, + 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, + -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, + 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, + 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, + 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, -1, + 158, -1, 160, 161, 162, 163, -1, 165, -1, 167, + -1, -1, -1, 171, 172, 173, -1, 175, -1, 177, + -1, 179, 180, 181, -1, 183, 184, 185, 186, 187, + 188, 189, -1, 191, 192, 193, 194, -1, 196, 197, + 198, 199, 200, 201, -1, 203, -1, 205, 206, 207, + 208, 209, 210, 211, 212, -1, 214, -1, 216, -1, + -1, 219, -1, 221, 222, 223, 224, 225, 226, -1, + -1, 229, -1, 231, -1, -1, 234, 235, 236, -1, + -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, -1, 265, 266, 267, + 268, 269, -1, 271, 272, -1, 274, -1, 276, 277, + 278, 279, 280, 281, -1, 283, 284, -1, -1, 287, + 288, 289, -1, -1, 292, 293, -1, 295, -1, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, + -1, 319, 320, 321, 322, 323, 324, -1, 326, 327, + 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 368, 369, 370, 371, 372, -1, 374, 375, 376, 377, + 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, -1, 401, 402, -1, 404, -1, 406, 407, + 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, + 418, 419, 420, -1, 422, 423, 424, 425, 426, 427, + 428, 429, -1, -1, 432, 433, 434, 435, 436, -1, + -1, 439, 440, 441, 442, 443, 444, 445, -1, 447, + -1, 449, 450, 451, 452, -1, -1, 455, -1, -1, + 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, + 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, + 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, - -1, -1, -1, -1, 36, -1, 38, 39, -1, 41, + -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, @@ -244705,134 +255695,87 @@ static const yytype_int16 yycheck[] = 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, -1, -1, -1, 170, 171, - 172, -1, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, -1, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, -1, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, -1, -1, 218, -1, 220, 221, - 222, 223, 224, -1, -1, 227, -1, 229, -1, -1, - 232, 233, 234, -1, -1, 237, 238, 239, 240, 241, + 152, 153, 154, 155, 156, -1, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, -1, -1, -1, 171, + 172, 173, -1, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, -1, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, -1, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, -1, -1, 219, -1, 221, + 222, 223, 224, 225, 226, -1, -1, 229, -1, 231, + -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - -1, 263, 264, 265, 266, 267, -1, 269, 270, -1, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - -1, 293, -1, 295, 296, 297, 298, 299, 300, 301, - 302, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, 325, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, -1, 350, 351, + 262, 263, -1, 265, 266, 267, 268, 269, -1, 271, + 272, -1, 274, -1, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, -1, 287, 288, 289, -1, -1, + 292, 293, -1, 295, -1, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, -1, - -1, 373, 374, 375, 376, -1, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, -1, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, -1, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, -1, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 372, -1, 374, 375, 376, 377, 378, -1, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, -1, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, -1, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, -1, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, -1, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, 3, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, - 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, - 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, - 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, - 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, - 68, 69, 70, 71, 72, -1, -1, -1, 76, 77, - 78, 79, 80, 81, -1, 83, 84, 85, -1, 87, - 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, - -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, - 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, - 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, - 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, - 148, 149, 150, 151, 152, 153, 154, 155, -1, 157, - -1, 159, 160, 161, 162, -1, 164, -1, 166, -1, - -1, -1, 170, 171, 172, -1, 174, -1, 176, -1, - 178, 179, 180, -1, 182, 183, 184, 185, 186, 187, - 188, -1, 190, 191, 192, 193, -1, 195, 196, 197, - 198, 199, 200, -1, 202, -1, 204, 205, 206, 207, - 208, 209, 210, 211, -1, 213, -1, 215, -1, -1, - 218, -1, 220, 221, 222, 223, 224, -1, -1, 227, - -1, 229, -1, -1, 232, 233, 234, -1, -1, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, -1, 263, 264, 265, 266, 267, - -1, 269, 270, -1, 272, -1, 274, 275, 276, 277, - 278, 279, -1, 281, 282, -1, -1, 285, 286, 287, - -1, -1, 290, 291, -1, 293, -1, 295, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, - 308, 309, 310, 311, 312, 313, 314, 315, -1, 317, - 318, 319, 320, 321, 322, -1, 324, 325, 326, 327, - 328, 329, 330, 331, -1, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 343, 344, 345, -1, 347, - 348, -1, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, -1, 366, 367, - 368, 369, 370, -1, 372, 373, 374, 375, 376, -1, - 378, 379, 380, 381, -1, 383, 384, 385, 386, 387, - 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, - -1, 399, 400, -1, 402, -1, 404, 405, 406, 407, - 408, -1, 410, 411, -1, -1, 414, 415, 416, 417, - 418, -1, 420, 421, 422, 423, 424, 425, 426, 427, - -1, -1, 430, 431, 432, 433, 434, -1, -1, 437, - 438, 439, 440, 441, 442, 443, -1, 445, -1, 447, - 448, 449, 450, -1, -1, 453, -1, -1, 456, 457, - 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 473, 474, 475, 476, 3, + 472, 473, 474, 475, 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, - 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, - -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, - -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, - 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, - 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, - -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, - 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, - -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, - -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, - 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, - -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, - 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, - 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, - 154, 155, -1, 157, -1, 159, 160, 161, 162, -1, - 164, -1, 166, -1, -1, -1, 170, 171, 172, -1, - 174, -1, 176, -1, 178, 179, 180, -1, 182, 183, - 184, 185, 186, 187, 188, -1, 190, 191, 192, 193, - -1, 195, 196, 197, 198, 199, 200, -1, 202, -1, - 204, 205, 206, 207, 208, 209, 210, 211, -1, 213, - -1, 215, -1, -1, 218, -1, 220, 221, 222, 223, - 224, -1, -1, 227, -1, 229, -1, -1, 232, 233, - 234, -1, -1, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, -1, 263, - 264, 265, 266, 267, -1, 269, 270, -1, 272, -1, - 274, 275, 276, 277, 278, 279, -1, 281, 282, -1, - -1, 285, 286, 287, -1, -1, 290, 291, -1, 293, - -1, 295, 296, 297, 298, 299, 300, 301, 302, 303, - 304, 305, -1, 307, 308, 309, 310, 311, 312, 313, - 314, 315, -1, 317, 318, 319, 320, 321, 322, -1, - 324, 325, 326, 327, 328, 329, 330, 331, -1, 333, - 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, - 344, 345, -1, 347, 348, -1, 350, 351, 352, 353, - 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, - 364, -1, 366, 367, 368, 369, 370, -1, 372, 373, - 374, 375, 376, -1, 378, 379, 380, 381, -1, 383, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 395, 396, 397, -1, 399, 400, -1, 402, -1, - 404, 405, 406, 407, 408, -1, 410, 411, -1, -1, - 414, 415, 416, 417, 418, -1, 420, 421, 422, 423, - 424, 425, 426, 427, -1, -1, 430, 431, 432, 433, - 434, -1, -1, 437, 438, 439, 440, 441, 442, 443, - -1, 445, -1, 447, 448, 449, 450, -1, -1, 453, - -1, -1, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, - 474, 475, 476, 3, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, + 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, + -1, -1, 38, 39, -1, 41, 42, 43, -1, 45, + 46, 47, 48, 49, -1, 51, 52, -1, 54, 55, + 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, + 66, -1, 68, 69, 70, 71, 72, -1, -1, -1, + 76, 77, 78, 79, 80, 81, -1, 83, 84, 85, + -1, 87, 88, 89, 90, 91, 92, -1, -1, 95, + 96, 97, -1, -1, -1, -1, -1, -1, -1, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, + 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, + 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, + 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, -1, 158, -1, 160, 161, 162, 163, -1, 165, + -1, 167, -1, -1, -1, 171, 172, 173, -1, 175, + -1, 177, -1, 179, 180, 181, -1, 183, 184, 185, + 186, 187, 188, 189, -1, 191, 192, 193, 194, -1, + 196, 197, 198, 199, 200, 201, -1, 203, -1, 205, + 206, 207, 208, 209, 210, 211, 212, -1, 214, -1, + 216, -1, -1, 219, -1, 221, 222, 223, 224, 225, + 226, -1, -1, 229, -1, 231, -1, -1, 234, 235, + 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, -1, 265, + 266, 267, 268, 269, -1, 271, 272, -1, 274, -1, + 276, 277, 278, 279, 280, 281, -1, 283, 284, -1, + -1, 287, 288, 289, -1, -1, 292, 293, -1, 295, + -1, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, + 316, 317, -1, 319, 320, 321, 322, 323, 324, -1, + 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, + 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, + 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, -1, 374, 375, + 376, 377, 378, -1, 380, 381, 382, 383, -1, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, 398, 399, -1, 401, 402, -1, 404, -1, + 406, 407, 408, 409, 410, -1, 412, 413, -1, -1, + 416, 417, 418, 419, 420, -1, 422, 423, 424, 425, + 426, 427, 428, 429, -1, -1, 432, 433, 434, 435, + 436, -1, -1, 439, 440, 441, 442, 443, 444, 445, + -1, 447, -1, 449, 450, 451, 452, -1, -1, 455, + -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, + 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, @@ -244847,39 +255790,182 @@ static const yytype_int16 yycheck[] = 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, - 150, 151, 152, 153, 154, 155, -1, 157, -1, 159, - 160, 161, 162, -1, 164, -1, 166, -1, -1, -1, - 170, 171, 172, -1, 174, -1, 176, -1, 178, 179, - 180, -1, 182, 183, 184, 185, 186, 187, 188, -1, - 190, 191, 192, 193, -1, 195, 196, 197, 198, 199, - 200, -1, 202, -1, 204, 205, 206, 207, 208, 209, - 210, 211, -1, 213, -1, 215, -1, -1, 218, -1, - 220, 221, 222, 223, 224, -1, -1, 227, -1, 229, - -1, -1, 232, 233, 234, -1, -1, 237, 238, 239, + 150, 151, 152, 153, 154, 155, 156, -1, 158, -1, + 160, 161, 162, 163, -1, 165, -1, 167, -1, -1, + -1, 171, 172, 173, -1, 175, -1, 177, -1, 179, + 180, 181, -1, 183, 184, 185, 186, 187, 188, 189, + -1, 191, 192, 193, 194, -1, 196, 197, 198, 199, + 200, 201, -1, 203, -1, 205, 206, 207, 208, 209, + 210, 211, 212, -1, 214, -1, 216, -1, -1, 219, + -1, 221, 222, 223, 224, 225, 226, -1, -1, 229, + -1, 231, -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, -1, 263, 264, 265, 266, 267, -1, 269, - 270, -1, 272, -1, 274, 275, 276, 277, 278, 279, - -1, 281, 282, -1, -1, 285, 286, 287, -1, -1, - 290, 291, -1, 293, -1, 295, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, -1, 307, 308, 309, - 310, 311, 312, 313, 314, 315, -1, 317, 318, 319, - 320, 321, 322, -1, 324, 325, 326, 327, 328, 329, - 330, 331, -1, 333, 334, 335, 336, 337, 338, 339, - 340, 341, 342, 343, 344, 345, -1, 347, 348, -1, - 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, - 360, 361, 362, 363, 364, -1, 366, 367, 368, 369, - 370, -1, 372, 373, 374, 375, 376, -1, 378, 379, - 380, 381, -1, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, 396, 397, -1, 399, - 400, -1, 402, -1, 404, 405, 406, 407, 408, -1, - 410, 411, -1, -1, 414, 415, 416, 417, 418, -1, - 420, 421, 422, 423, 424, 425, 426, 427, -1, -1, - 430, 431, 432, 433, 434, -1, -1, 437, 438, 439, - 440, 441, 442, 443, -1, 445, -1, 447, 448, 449, - 450, -1, -1, 453, -1, -1, 456, 457, 458, 459, + 260, 261, 262, 263, -1, 265, 266, 267, 268, 269, + -1, 271, 272, -1, 274, -1, 276, 277, 278, 279, + 280, 281, -1, 283, 284, -1, -1, 287, 288, 289, + -1, -1, 292, 293, -1, 295, -1, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, -1, 319, + 320, 321, 322, 323, 324, -1, 326, 327, 328, 329, + 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, -1, 349, + 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, + 370, 371, 372, -1, 374, 375, 376, 377, 378, -1, + 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + -1, 401, 402, -1, 404, -1, 406, 407, 408, 409, + 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, + 420, -1, 422, 423, 424, 425, 426, 427, 428, 429, + -1, -1, 432, 433, 434, 435, 436, -1, -1, 439, + 440, 441, 442, 443, 444, 445, -1, 447, -1, 449, + 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 473, 474, 475, 476, 3, -1, -1, + 470, 471, 472, 473, 474, 475, 476, 477, 478, 3, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, + -1, -1, 36, -1, 38, 39, -1, 41, 42, 43, + -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, + 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, + 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, + -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, + 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, + -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, + -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, + -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, + 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, + 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, -1, 158, -1, 160, 161, 162, 163, + -1, 165, -1, 167, -1, -1, -1, 171, 172, 173, + -1, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, -1, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + -1, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, -1, -1, 219, -1, 221, 222, 223, + 224, 225, 226, -1, -1, 229, -1, 231, -1, -1, + 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + -1, 265, 266, 267, 268, 269, -1, 271, 272, -1, + 274, -1, 276, 277, 278, 279, 280, 281, -1, 283, + 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, + -1, 295, -1, 297, 298, 299, 300, 301, 302, 303, + 304, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, -1, 319, 320, 321, 322, 323, + 324, -1, 326, 327, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, + 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, -1, 368, 369, 370, 371, 372, -1, + -1, 375, 376, 377, 378, -1, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, -1, + 404, -1, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, -1, 422, 423, + 424, 425, 426, 427, 428, 429, -1, -1, 432, 433, + 434, 435, 436, -1, -1, 439, 440, 441, 442, 443, + 444, 445, -1, 447, -1, 449, 450, 451, 452, -1, + -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 3, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, + 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, + 38, 39, -1, 41, 42, 43, -1, 45, 46, 47, + 48, 49, -1, 51, 52, -1, 54, 55, 56, 57, + 58, 59, -1, -1, 62, 63, 64, 65, 66, -1, + 68, 69, 70, 71, 72, -1, -1, -1, 76, 77, + 78, 79, 80, 81, -1, 83, 84, 85, -1, 87, + 88, 89, 90, 91, 92, -1, -1, 95, 96, 97, + -1, -1, -1, -1, -1, -1, -1, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, -1, 116, -1, + 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, + 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, + 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, + 148, 149, 150, 151, 152, 153, 154, 155, 156, -1, + 158, -1, 160, 161, 162, 163, -1, 165, -1, 167, + -1, -1, -1, 171, 172, 173, -1, 175, -1, 177, + -1, 179, 180, 181, -1, 183, 184, 185, 186, 187, + 188, 189, -1, 191, 192, 193, 194, -1, 196, 197, + 198, 199, 200, 201, -1, 203, -1, 205, 206, 207, + 208, 209, 210, 211, 212, -1, 214, -1, 216, -1, + -1, 219, -1, 221, 222, 223, 224, 225, 226, -1, + -1, 229, -1, 231, -1, -1, 234, 235, 236, -1, + -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, + 258, 259, 260, 261, 262, 263, -1, 265, 266, 267, + 268, 269, -1, 271, 272, -1, 274, -1, 276, 277, + 278, 279, 280, 281, -1, 283, 284, -1, -1, 287, + 288, 289, -1, -1, 292, 293, -1, 295, -1, 297, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + -1, 309, 310, 311, 312, 313, 314, 315, 316, 317, + -1, 319, 320, 321, 322, 323, 324, -1, 326, 327, + 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + -1, 349, 350, -1, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 368, 369, 370, 371, 372, -1, 374, 375, 376, 377, + 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, -1, 401, 402, -1, 404, -1, 406, 407, + 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, + 418, 419, 420, -1, 422, 423, 424, 425, 426, 427, + 428, 429, -1, -1, 432, 433, 434, 435, 436, -1, + -1, 439, 440, 441, 442, 443, 444, 445, -1, 447, + -1, 449, 450, 451, 452, -1, -1, 455, -1, -1, + 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, + 468, 469, 470, 471, 472, 473, 474, 475, 476, 477, + 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, + 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, + -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, + 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, + 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, + 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, + 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, + -1, 83, 84, 85, -1, 87, 88, 89, 90, 91, + 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, + -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, + 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, + 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, + 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, + 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, + 152, 153, 154, 155, 156, -1, 158, -1, 160, 161, + 162, 163, -1, 165, -1, 167, -1, -1, -1, 171, + 172, 173, -1, 175, -1, 177, -1, 179, 180, 181, + -1, 183, 184, 185, 186, 187, 188, 189, -1, 191, + 192, 193, 194, -1, 196, 197, 198, 199, 200, 201, + -1, 203, -1, 205, 206, 207, 208, 209, 210, 211, + 212, -1, 214, -1, 216, -1, -1, 219, -1, 221, + 222, 223, 224, 225, 226, -1, -1, 229, -1, 231, + -1, -1, 234, 235, 236, -1, -1, 239, 240, 241, + 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, + 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, + 262, 263, -1, 265, 266, 267, 268, 269, -1, 271, + 272, -1, 274, -1, 276, 277, 278, 279, 280, 281, + -1, 283, 284, -1, -1, 287, 288, 289, -1, -1, + 292, 293, -1, 295, -1, 297, 298, 299, 300, 301, + 302, 303, 304, 305, 306, 307, -1, 309, 310, 311, + 312, 313, 314, 315, 316, 317, -1, 319, 320, 321, + 322, 323, 324, -1, 326, 327, 328, 329, 330, 331, + 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, + 342, 343, 344, 345, 346, 347, -1, 349, 350, -1, + 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, + 362, 363, 364, 365, 366, -1, 368, 369, 370, 371, + 372, -1, 374, 375, 376, 377, 378, -1, 380, 381, + 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, + 392, 393, 394, 395, 396, 397, 398, 399, -1, 401, + 402, -1, 404, -1, 406, 407, 408, 409, 410, -1, + 412, 413, -1, -1, 416, 417, 418, 419, 420, -1, + 422, 423, 424, 425, 426, 427, 428, 429, -1, -1, + 432, 433, 434, 435, 436, -1, -1, 439, 440, 441, + 442, 443, 444, 445, -1, 447, -1, 449, 450, 451, + 452, -1, -1, 455, -1, -1, 458, 459, 460, 461, + 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, + 472, 473, 474, 475, 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, @@ -244895,86 +255981,134 @@ static const yytype_int16 yycheck[] = 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, - -1, 157, -1, 159, 160, 161, 162, -1, 164, -1, - 166, -1, -1, -1, 170, 171, 172, -1, 174, -1, - 176, -1, 178, 179, 180, -1, 182, 183, 184, 185, - 186, 187, 188, -1, 190, 191, 192, 193, -1, 195, - 196, 197, 198, 199, 200, -1, 202, -1, 204, 205, - 206, 207, 208, 209, 210, 211, -1, 213, -1, 215, - -1, -1, 218, -1, 220, 221, 222, 223, 224, -1, - -1, 227, -1, 229, -1, -1, 232, 233, 234, -1, - -1, 237, 238, 239, 240, 241, 242, 243, 244, 245, + 156, -1, 158, -1, 160, 161, 162, 163, -1, 165, + -1, 167, -1, -1, -1, 171, 172, 173, -1, 175, + -1, 177, -1, 179, 180, 181, -1, 183, 184, 185, + 186, 187, 188, 189, -1, 191, 192, 193, 194, -1, + 196, 197, 198, 199, 200, 201, -1, 203, -1, 205, + 206, 207, 208, 209, 210, 211, 212, -1, 214, -1, + 216, -1, -1, 219, -1, 221, 222, 223, 224, 225, + 226, -1, -1, 229, -1, 231, -1, -1, 234, 235, + 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, - 256, 257, 258, 259, 260, 261, -1, 263, 264, 265, - 266, 267, -1, 269, 270, -1, 272, -1, 274, 275, - 276, 277, 278, 279, -1, 281, 282, -1, -1, 285, - 286, 287, -1, -1, 290, 291, -1, 293, -1, 295, - 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, - -1, 307, 308, 309, 310, 311, 312, 313, 314, 315, - -1, 317, 318, 319, 320, 321, 322, -1, 324, 325, - 326, 327, 328, 329, 330, 331, -1, 333, 334, 335, + 256, 257, 258, 259, 260, 261, 262, 263, -1, 265, + 266, 267, 268, 269, -1, 271, 272, -1, 274, -1, + 276, 277, 278, 279, 280, 281, -1, 283, 284, -1, + -1, 287, 288, 289, -1, -1, 292, 293, -1, 295, + -1, 297, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, -1, 309, 310, 311, 312, 313, 314, 315, + 316, 317, -1, 319, 320, 321, 322, 323, 324, -1, + 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, - -1, 347, 348, -1, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 362, 363, 364, -1, - 366, 367, 368, 369, 370, -1, 372, 373, 374, 375, - 376, -1, 378, 379, 380, 381, -1, 383, 384, 385, + 346, 347, -1, 349, 350, -1, 352, 353, 354, 355, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, -1, 374, 375, + 376, 377, 378, -1, 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 397, -1, 399, 400, -1, 402, -1, 404, 405, - 406, 407, 408, -1, 410, 411, -1, -1, 414, 415, - 416, 417, 418, -1, 420, 421, 422, 423, 424, 425, - 426, 427, -1, -1, 430, 431, 432, 433, 434, -1, - -1, 437, 438, 439, 440, 441, 442, 443, -1, 445, - -1, 447, 448, 449, 450, -1, -1, 453, -1, -1, - 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, + 396, 397, 398, 399, -1, 401, 402, -1, 404, -1, + 406, 407, 408, 409, 410, -1, 412, 413, -1, -1, + 416, 417, 418, 419, 420, -1, 422, 423, 424, 425, + 426, 427, 428, 429, -1, -1, 432, 433, 434, 435, + 436, -1, -1, 439, 440, 441, 442, 443, 444, 445, + -1, 447, -1, 449, 450, 451, 452, -1, -1, 455, + -1, -1, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 474, 475, - 476, 3, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, - 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, - -1, -1, -1, -1, -1, -1, 38, 39, -1, 41, - 42, 43, -1, 45, 46, 47, 48, 49, -1, 51, - 52, -1, 54, 55, 56, 57, 58, 59, -1, -1, - 62, 63, 64, 65, 66, -1, 68, 69, 70, 71, - 72, -1, -1, -1, 76, 77, 78, 79, 80, 81, - -1, 83, 84, 85, -1, 87, 88, 89, 90, 91, - 92, -1, -1, 95, 96, 97, -1, -1, -1, -1, - -1, -1, -1, 105, 106, 107, 108, 109, 110, 111, - 112, 113, 114, -1, 116, -1, 118, 119, 120, 121, - 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, - 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, - 142, 143, 144, -1, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, -1, 157, -1, 159, 160, 161, - 162, -1, 164, -1, 166, -1, -1, -1, 170, 171, - 172, -1, 174, -1, 176, -1, 178, 179, 180, -1, - 182, 183, 184, 185, 186, 187, 188, -1, 190, 191, - 192, 193, -1, 195, 196, 197, 198, 199, 200, -1, - 202, -1, 204, 205, 206, 207, 208, 209, 210, 211, - -1, 213, -1, 215, -1, -1, 218, -1, 220, 221, - 222, 223, 224, -1, -1, 227, -1, 229, -1, -1, - 232, 233, 234, -1, -1, 237, 238, 239, 240, 241, - 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, - -1, 263, 264, 265, 266, 267, -1, 269, 270, -1, - 272, -1, 274, 275, 276, 277, 278, 279, -1, 281, - 282, -1, -1, 285, 286, 287, -1, -1, 290, 291, - -1, 293, -1, 295, 296, 297, 298, 299, 300, 301, - -1, 303, 304, 305, -1, 307, 308, 309, 310, 311, - 312, 313, 314, 315, -1, 317, 318, 319, 320, 321, - 322, -1, 324, -1, 326, 327, 328, 329, 330, 331, - -1, 333, 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, -1, 347, 348, -1, 350, 351, - 352, 353, -1, 355, 356, 357, 358, 359, 360, 361, - 362, 363, 364, -1, 366, 367, 368, 369, 370, -1, - 372, 373, 374, 375, 376, -1, 378, 379, 380, 381, - -1, 383, 384, 385, 386, 387, 388, 389, 390, 391, - 392, 393, 394, 395, 396, 397, -1, 399, 400, -1, - 402, -1, 404, 405, 406, 407, 408, -1, 410, 411, - -1, -1, 414, 415, 416, 417, 418, -1, 420, 421, - 422, 423, 424, 425, 426, 427, -1, -1, 430, 431, - 432, 433, 434, -1, -1, 437, 438, 439, 440, 441, - 442, 443, -1, 445, -1, 447, 448, 449, 450, -1, - -1, 453, -1, -1, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, 470, 471, - 472, 473, 474, 475, 476, 3, -1, -1, -1, -1, + 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, + 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, + 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, + -1, 41, 42, 43, -1, 45, 46, 47, 48, 49, + -1, 51, 52, -1, 54, 55, 56, 57, 58, 59, + -1, -1, 62, 63, 64, 65, 66, -1, 68, 69, + 70, 71, 72, -1, -1, -1, 76, 77, 78, 79, + 80, 81, -1, 83, 84, 85, -1, 87, 88, 89, + 90, 91, 92, -1, -1, 95, 96, 97, -1, -1, + -1, -1, -1, -1, -1, 105, 106, 107, 108, 109, + 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, + 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, + -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, + 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, + 150, 151, 152, 153, 154, 155, 156, -1, 158, -1, + 160, 161, 162, 163, -1, 165, -1, 167, -1, -1, + -1, 171, 172, 173, -1, 175, -1, 177, -1, 179, + 180, 181, -1, 183, 184, 185, 186, 187, 188, 189, + -1, 191, 192, 193, 194, -1, 196, 197, 198, 199, + 200, 201, -1, 203, -1, 205, 206, 207, 208, 209, + 210, 211, 212, -1, 214, -1, 216, -1, -1, 219, + -1, 221, 222, 223, 224, 225, 226, -1, -1, 229, + -1, 231, -1, -1, 234, 235, 236, -1, -1, 239, + 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, + 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, + 260, 261, 262, 263, -1, 265, 266, 267, 268, 269, + -1, 271, 272, -1, 274, -1, 276, 277, 278, 279, + 280, 281, -1, 283, 284, -1, -1, 287, 288, 289, + -1, -1, 292, 293, -1, 295, -1, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, -1, 309, + 310, 311, 312, 313, 314, 315, 316, 317, -1, 319, + 320, 321, 322, 323, 324, -1, 326, 327, 328, 329, + 330, 331, 332, 333, -1, 335, 336, 337, 338, 339, + 340, 341, 342, 343, 344, 345, 346, 347, -1, 349, + 350, -1, 352, 353, 354, 355, 356, 357, 358, 359, + 360, 361, 362, 363, 364, 365, 366, -1, 368, 369, + 370, 371, 372, -1, 374, 375, 376, 377, 378, -1, + 380, 381, 382, 383, -1, 385, 386, 387, 388, 389, + 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, + -1, 401, 402, -1, 404, -1, 406, 407, 408, 409, + 410, -1, 412, 413, -1, -1, 416, 417, 418, 419, + 420, -1, 422, 423, 424, 425, 426, 427, 428, 429, + -1, -1, 432, 433, 434, 435, 436, -1, -1, 439, + 440, 441, 442, 443, 444, 445, -1, 447, -1, 449, + 450, 451, 452, -1, -1, 455, -1, -1, 458, 459, + 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, + 470, 471, 472, 473, 474, 475, 476, 477, 478, 3, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, + 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, + -1, -1, -1, -1, 38, 39, -1, 41, 42, 43, + -1, 45, 46, 47, 48, 49, -1, 51, 52, -1, + 54, 55, 56, 57, 58, 59, -1, -1, 62, 63, + 64, 65, 66, -1, 68, 69, 70, 71, 72, -1, + -1, -1, 76, 77, 78, 79, 80, 81, -1, 83, + 84, 85, -1, 87, 88, 89, 90, 91, 92, -1, + -1, 95, 96, 97, -1, -1, -1, -1, -1, -1, + -1, 105, 106, 107, 108, 109, 110, 111, 112, 113, + 114, -1, 116, -1, 118, 119, 120, 121, 122, 123, + -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, + 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, + 144, -1, 146, 147, 148, 149, 150, 151, 152, 153, + 154, 155, 156, -1, 158, -1, 160, 161, 162, 163, + -1, 165, -1, 167, -1, -1, -1, 171, 172, 173, + -1, 175, -1, 177, -1, 179, 180, 181, -1, 183, + 184, 185, 186, 187, 188, 189, -1, 191, 192, 193, + 194, -1, 196, 197, 198, 199, 200, 201, -1, 203, + -1, 205, 206, 207, 208, 209, 210, 211, 212, -1, + 214, -1, 216, -1, -1, 219, -1, 221, 222, 223, + 224, 225, 226, -1, -1, 229, -1, 231, -1, -1, + 234, 235, 236, -1, -1, 239, 240, 241, 242, 243, + 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, + 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, + -1, 265, 266, 267, 268, 269, -1, 271, 272, -1, + 274, -1, 276, 277, 278, 279, 280, 281, -1, 283, + 284, -1, -1, 287, 288, 289, -1, -1, 292, 293, + -1, 295, -1, 297, 298, 299, 300, 301, 302, 303, + -1, 305, 306, 307, -1, 309, 310, 311, 312, 313, + 314, 315, 316, 317, -1, 319, 320, 321, 322, 323, + 324, -1, 326, -1, 328, 329, 330, 331, 332, 333, + -1, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, -1, 349, 350, -1, 352, 353, + 354, 355, -1, 357, 358, 359, 360, 361, 362, 363, + 364, 365, 366, -1, 368, 369, 370, 371, 372, -1, + 374, 375, 376, 377, 378, -1, 380, 381, 382, 383, + -1, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 395, 396, 397, 398, 399, -1, 401, 402, -1, + 404, -1, 406, 407, 408, 409, 410, -1, 412, 413, + -1, -1, 416, 417, 418, 419, 420, -1, 422, 423, + 424, 425, 426, 427, 428, 429, -1, -1, 432, 433, + 434, 435, 436, -1, -1, 439, 440, 441, 442, 443, + 444, 445, -1, 447, -1, 449, 450, 451, 452, -1, + -1, 455, -1, -1, 458, 459, 460, 461, 462, 463, + 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, + 474, 475, 476, 477, 478, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, -1, @@ -244989,177 +256123,178 @@ static const yytype_int16 yycheck[] = 118, 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, 147, - 148, 149, -1, 151, 152, 153, 154, -1, -1, 157, - -1, 159, 160, 161, 162, -1, 164, -1, 166, 167, - -1, 169, 170, 171, 172, 173, 174, -1, 176, -1, - -1, -1, 180, -1, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 192, 193, -1, 195, 196, 197, - 198, 199, 200, -1, 202, 203, -1, 205, 206, 207, - 208, 209, 210, 211, -1, 213, -1, 215, 216, 217, - 218, 219, 220, 221, 222, 223, 224, -1, -1, 227, - 228, 229, 230, -1, 232, 233, 234, -1, -1, 237, - 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, + 148, 149, -1, 151, 152, 153, 154, 155, -1, -1, + 158, -1, 160, 161, 162, 163, -1, 165, -1, 167, + 168, -1, 170, 171, 172, 173, 174, 175, -1, 177, + -1, -1, -1, 181, -1, 183, 184, 185, 186, 187, + 188, 189, 190, 191, 192, 193, 194, -1, 196, 197, + 198, 199, 200, 201, -1, 203, 204, -1, 206, 207, + 208, 209, 210, 211, 212, -1, 214, -1, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, -1, + -1, 229, 230, 231, 232, -1, 234, 235, 236, -1, + -1, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, - 258, 259, 260, 261, 262, 263, 264, 265, 266, -1, - -1, 269, 270, 271, 272, -1, -1, 275, 276, 277, - 278, 279, -1, 281, 282, -1, -1, 285, 286, 287, - -1, -1, 290, -1, 292, 293, 294, -1, 296, 297, - 298, 299, 300, 301, 302, 303, 304, 305, -1, 307, - 308, -1, 310, 311, -1, 313, 314, 315, -1, 317, - 318, 319, 320, 321, 322, -1, 324, 325, 326, 327, - 328, 329, 330, 331, -1, 333, 334, 335, 336, 337, - 338, 339, 340, 341, 342, 343, 344, 345, -1, 347, - 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, - 358, 359, 360, 361, 362, 363, 364, -1, 366, 367, - 368, 369, 370, -1, 372, 373, 374, 375, 376, 377, - 378, 379, 380, 381, -1, 383, 384, 385, 386, 387, - 388, 389, 390, 391, 392, 393, 394, 395, -1, 397, - -1, 399, 400, -1, 402, 403, 404, 405, 406, 407, - 408, -1, 410, 411, -1, -1, 414, 415, -1, 417, - -1, -1, 420, 421, 422, 423, 424, 425, 426, 427, - -1, -1, 430, 431, 432, 433, 434, -1, -1, 437, - 438, 439, 440, 441, -1, 443, -1, 445, 446, 447, - 448, 449, 450, -1, -1, 453, -1, -1, 456, 457, - 458, 459, 460, 461, 3, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 473, 474, 475, 476, -1, - 19, 20, 21, 22, 23, 24, 25, 26, -1, 28, - 29, 30, -1, -1, -1, -1, -1, -1, -1, 38, - 39, -1, 41, 42, 43, 44, 45, 46, 47, -1, - 49, 50, 51, 52, -1, 54, 55, 56, 57, 58, - 59, -1, -1, 62, 63, 64, 65, 66, -1, 68, - 69, 70, 71, -1, -1, 74, -1, 76, 77, 78, - 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, - 89, 90, 91, 92, -1, 94, 95, 96, 97, -1, - -1, -1, 101, -1, -1, -1, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, -1, 116, -1, 118, - 119, 120, 121, 122, 123, -1, 125, 126, 127, 128, - 129, -1, -1, 132, 133, 134, 135, 136, -1, 138, - 139, 140, -1, 142, 143, 144, -1, 146, 147, 148, - 149, -1, 151, 152, 153, 154, -1, -1, 157, -1, - 159, 160, 161, 162, -1, 164, -1, 166, 167, -1, - 169, 170, 171, 172, 173, 174, -1, 176, -1, -1, - -1, 180, -1, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 192, 193, -1, 195, 196, 197, 198, - 199, 200, -1, 202, 203, -1, 205, 206, 207, 208, - 209, 210, 211, -1, 213, -1, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, -1, -1, 227, 228, - 229, 230, -1, 232, 233, 234, -1, -1, 237, 238, - 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, - 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, - 259, 260, 261, 262, 263, 264, 265, 266, -1, -1, - 269, 270, 271, 272, -1, -1, 275, 276, 277, 278, - 279, -1, 281, 282, -1, -1, 285, 286, 287, -1, - -1, 290, -1, 292, 293, 294, -1, 296, 297, 298, - 299, 300, 301, 302, 303, 304, 305, -1, 307, 308, - -1, 310, 311, -1, 313, 314, 315, -1, 317, 318, - 319, 320, 321, 322, -1, 324, 325, 326, 327, 328, - 329, 330, 331, -1, 333, 334, 335, 336, 337, 338, - 339, 340, 341, 342, 343, 344, 345, -1, 347, 348, - 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, -1, 366, 367, 368, - 369, 370, -1, 372, 373, 374, 375, 376, 377, 378, - 379, 380, 381, -1, 383, 384, 385, 386, 387, 388, - 389, 390, 391, 392, 393, 394, 395, -1, 397, -1, - 399, 400, -1, 402, 403, 404, 405, 406, 407, 408, - -1, 410, 411, -1, -1, 414, 415, -1, 417, -1, - -1, 420, 421, 422, 423, 424, 425, 426, 427, -1, - -1, 430, 431, 432, 433, 434, -1, -1, 437, 438, - 439, 440, 441, -1, 443, -1, 445, 446, 447, 448, - 449, 450, -1, -1, 453, -1, -1, 456, 457, 458, - 459, 460, 461, 3, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 473, 474, 475, 476, -1, 19, - 20, 21, 22, 23, 24, 25, 26, -1, 28, 29, - 30, -1, -1, -1, -1, -1, -1, -1, 38, 39, - -1, 41, 42, 43, 44, 45, 46, 47, -1, 49, - 50, 51, 52, -1, 54, 55, 56, 57, 58, 59, - -1, -1, 62, 63, 64, 65, 66, -1, 68, 69, - 70, 71, -1, -1, 74, -1, 76, 77, 78, 79, - 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, - 90, 91, 92, -1, 94, 95, 96, 97, -1, -1, - -1, 101, -1, -1, -1, 105, 106, 107, 108, 109, - 110, 111, 112, 113, 114, -1, 116, -1, 118, 119, - 120, 121, 122, 123, -1, 125, 126, 127, 128, 129, - -1, -1, 132, 133, 134, 135, 136, -1, 138, 139, - 140, -1, 142, 143, 144, -1, 146, 147, 148, 149, - -1, 151, 152, 153, 154, -1, -1, 157, -1, 159, - 160, 161, 162, -1, 164, -1, 166, 167, -1, 169, - 170, 171, 172, 173, 174, -1, 176, -1, -1, -1, - 180, -1, 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 192, 193, -1, 195, 196, 197, 198, 199, - 200, -1, 202, 203, -1, 205, 206, 207, 208, 209, - 210, 211, -1, 213, -1, 215, 216, 217, 218, 219, - 220, 221, 222, 223, 224, -1, -1, 227, 228, 229, - 230, -1, 232, 233, 234, -1, -1, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, - 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, -1, -1, 269, - 270, 271, 272, -1, -1, 275, 276, 277, 278, 279, - -1, 281, 282, -1, -1, 285, 286, 287, -1, -1, - 290, -1, 292, 293, 294, -1, 296, 297, 298, 299, - 300, 301, 302, 303, 304, 305, -1, 307, 308, -1, - 310, 311, -1, 313, 314, 315, -1, 317, 318, 319, - 320, 321, 322, -1, 324, 325, 326, 327, 328, 329, - 330, 331, -1, 333, 334, 335, 336, 337, 338, 339, - 340, 341, 342, 343, 344, 345, -1, 347, 348, 349, - 350, 351, 352, -1, 354, 355, 356, 357, 358, 359, - 360, 361, 362, 363, 364, -1, 366, 367, 368, 369, - 370, -1, 372, -1, 374, 375, 376, 377, 378, 379, - 380, 381, -1, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 393, 394, 395, -1, 397, -1, 399, - 400, -1, 402, 403, 404, 405, 406, 407, 408, -1, - 410, 411, -1, -1, 414, 415, -1, 417, -1, -1, - 420, 421, 422, 423, 424, 425, 426, 427, -1, -1, - 430, 431, 432, 433, 434, -1, -1, 437, 438, 439, - 440, 441, -1, 443, -1, 445, 446, 447, 448, 449, - 450, -1, -1, 453, -1, -1, 456, 457, 458, 459, - 460, 461, 3, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 473, 474, 475, 476, -1, 19, 20, - 21, 22, 23, 24, 25, 26, -1, 28, 29, 30, - -1, -1, -1, -1, -1, -1, -1, 38, 39, -1, - 41, 42, 43, 44, 45, 46, 47, -1, 49, 50, - 51, 52, -1, 54, 55, 56, 57, 58, 59, -1, - -1, 62, 63, 64, 65, 66, -1, 68, 69, 70, - 71, -1, -1, 74, -1, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, - 91, 92, -1, 94, 95, 96, 97, -1, -1, -1, - 101, -1, -1, -1, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, -1, 116, -1, 118, 119, 120, - 121, 122, 123, -1, 125, 126, 127, 128, 129, -1, - -1, 132, 133, 134, 135, 136, -1, 138, 139, 140, - -1, 142, 143, 144, -1, 146, 147, 148, 149, -1, - 151, 152, 153, 154, -1, -1, 157, -1, 159, 160, - 161, 162, -1, 164, -1, 166, 167, -1, 169, 170, - 171, 172, 173, 174, -1, 176, -1, -1, -1, 180, - -1, 182, 183, 184, 185, 186, 187, 188, 189, 190, - 191, 192, 193, -1, 195, 196, 197, 198, 199, 200, - -1, 202, 203, -1, 205, 206, 207, 208, 209, 210, - 211, -1, 213, -1, 215, 216, 217, 218, 219, 220, - 221, 222, 223, 224, -1, -1, 227, 228, 229, 230, - -1, 232, 233, 234, -1, -1, 237, 238, 239, 240, - 241, -1, 243, 244, 245, 246, 247, 248, 249, 250, - 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, - 261, 262, 263, 264, 265, 266, -1, -1, 269, 270, - 271, 272, -1, -1, 275, 276, 277, 278, 279, -1, - 281, 282, -1, -1, 285, 286, 287, -1, -1, 290, - -1, 292, 293, 294, -1, 296, 297, 298, 299, 300, - 301, 302, 303, 304, 305, -1, 307, 308, -1, 310, - 311, -1, 313, 314, 315, -1, 317, 318, 319, 320, - 321, 322, -1, 324, 325, 326, 327, 328, 329, 330, - 331, -1, 333, 334, 335, 336, 337, 338, 339, 340, - 341, 342, 343, 344, 345, -1, 347, 348, 349, 350, - 351, 352, -1, 354, 355, 356, 357, 358, 359, 360, - 361, 362, 363, 364, -1, 366, 367, 368, 369, 370, - -1, 372, -1, 374, 375, 376, 377, 378, 379, 380, - 381, -1, 383, 384, 385, 386, 387, 388, 389, 390, - 391, 392, 393, -1, 395, -1, 397, -1, 399, 400, - -1, 402, 403, 404, 405, 406, 407, 408, -1, 410, - 411, -1, -1, 414, 415, -1, 417, -1, -1, 420, - 421, 422, 423, 424, 425, 426, 427, -1, -1, 430, - 431, 432, 433, 434, -1, -1, 437, 438, 439, 440, - 441, -1, 443, -1, 445, 446, 447, 448, 449, 450, - -1, -1, 453, -1, -1, 456, 457, 458, 459, 460, - 461, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 473, 474, 475, 476 + 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, + 268, -1, -1, 271, 272, 273, 274, -1, -1, 277, + 278, 279, 280, 281, -1, 283, 284, -1, -1, 287, + 288, 289, -1, -1, 292, -1, 294, 295, 296, -1, + 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, + -1, 309, 310, -1, 312, 313, -1, 315, 316, 317, + -1, 319, 320, 321, 322, 323, 324, -1, 326, 327, + 328, 329, 330, 331, 332, 333, -1, 335, 336, 337, + 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, + -1, 349, 350, 351, 352, 353, 354, 355, 356, 357, + 358, 359, 360, 361, 362, 363, 364, 365, 366, -1, + 368, 369, 370, 371, 372, -1, 374, 375, 376, 377, + 378, 379, 380, 381, 382, 383, -1, 385, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + -1, 399, -1, 401, 402, -1, 404, 405, 406, 407, + 408, 409, 410, -1, 412, 413, -1, -1, 416, 417, + -1, 419, -1, -1, 422, 423, 424, 425, 426, 427, + 428, 429, -1, -1, 432, 433, 434, 435, 436, -1, + -1, 439, 440, 441, 442, 443, -1, 445, -1, 447, + 448, 449, 450, 451, 452, -1, -1, 455, -1, -1, + 458, 459, 460, 461, 462, 463, 3, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 475, 476, 477, + 478, -1, 19, 20, 21, 22, 23, 24, 25, 26, + -1, 28, 29, 30, -1, -1, -1, -1, -1, -1, + -1, 38, 39, -1, 41, 42, 43, 44, 45, 46, + 47, -1, 49, 50, 51, 52, -1, 54, 55, 56, + 57, 58, 59, -1, -1, 62, 63, 64, 65, 66, + -1, 68, 69, 70, 71, -1, -1, 74, -1, 76, + 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, + 87, 88, 89, 90, 91, 92, -1, 94, 95, 96, + 97, -1, -1, -1, 101, -1, -1, -1, 105, 106, + 107, 108, 109, 110, 111, 112, 113, 114, -1, 116, + -1, 118, 119, 120, 121, 122, 123, -1, 125, 126, + 127, 128, 129, -1, -1, 132, 133, 134, 135, 136, + -1, 138, 139, 140, -1, 142, 143, 144, -1, 146, + 147, 148, 149, -1, 151, 152, 153, 154, 155, -1, + -1, 158, -1, 160, 161, 162, 163, -1, 165, -1, + 167, 168, -1, 170, 171, 172, 173, 174, 175, -1, + 177, -1, -1, -1, 181, -1, 183, 184, 185, 186, + 187, 188, 189, 190, 191, 192, 193, 194, -1, 196, + 197, 198, 199, 200, 201, -1, 203, 204, -1, 206, + 207, 208, 209, 210, 211, 212, -1, 214, -1, 216, + 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, + -1, -1, 229, 230, 231, 232, -1, 234, 235, 236, + -1, -1, 239, 240, 241, 242, 243, 244, 245, 246, + 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, + 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, + 267, 268, -1, -1, 271, 272, 273, 274, -1, -1, + 277, 278, 279, 280, 281, -1, 283, 284, -1, -1, + 287, 288, 289, -1, -1, 292, -1, 294, 295, 296, + -1, 298, 299, 300, 301, 302, 303, 304, 305, 306, + 307, -1, 309, 310, -1, 312, 313, -1, 315, 316, + 317, -1, 319, 320, 321, 322, 323, 324, -1, 326, + 327, 328, 329, 330, 331, 332, 333, -1, 335, 336, + 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, + 347, -1, 349, 350, 351, 352, 353, 354, 355, 356, + 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, + -1, 368, 369, 370, 371, 372, -1, 374, 375, 376, + 377, 378, 379, 380, 381, 382, 383, -1, 385, 386, + 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, + 397, -1, 399, -1, 401, 402, -1, 404, 405, 406, + 407, 408, 409, 410, -1, 412, 413, -1, -1, 416, + 417, -1, 419, -1, -1, 422, 423, 424, 425, 426, + 427, 428, 429, -1, -1, 432, 433, 434, 435, 436, + -1, -1, 439, 440, 441, 442, 443, -1, 445, -1, + 447, 448, 449, 450, 451, 452, -1, -1, 455, -1, + -1, 458, 459, 460, 461, 462, 463, 3, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 475, 476, + 477, 478, -1, 19, 20, 21, 22, 23, 24, 25, + 26, -1, 28, 29, 30, -1, -1, -1, -1, -1, + -1, -1, 38, 39, -1, 41, 42, 43, 44, 45, + 46, 47, -1, 49, 50, 51, 52, -1, 54, 55, + 56, 57, 58, 59, -1, -1, 62, 63, 64, 65, + 66, -1, 68, 69, 70, 71, -1, -1, 74, -1, + 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, + -1, 87, 88, 89, 90, 91, 92, -1, 94, 95, + 96, 97, -1, -1, -1, 101, -1, -1, -1, 105, + 106, 107, 108, 109, 110, 111, 112, 113, 114, -1, + 116, -1, 118, 119, 120, 121, 122, 123, -1, 125, + 126, 127, 128, 129, -1, -1, 132, 133, 134, 135, + 136, -1, 138, 139, 140, -1, 142, 143, 144, -1, + 146, 147, 148, 149, -1, 151, 152, 153, 154, 155, + -1, -1, 158, -1, 160, 161, 162, 163, -1, 165, + -1, 167, 168, -1, 170, 171, 172, 173, 174, 175, + -1, 177, -1, -1, -1, 181, -1, 183, 184, 185, + 186, 187, 188, 189, 190, 191, 192, 193, 194, -1, + 196, 197, 198, 199, 200, 201, -1, 203, 204, -1, + 206, 207, 208, 209, 210, 211, 212, -1, 214, -1, + 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, + 226, -1, -1, 229, 230, 231, 232, -1, 234, 235, + 236, -1, -1, 239, 240, 241, 242, 243, 244, 245, + 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, + 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, + 266, 267, 268, -1, -1, 271, 272, 273, 274, -1, + -1, 277, 278, 279, 280, 281, -1, 283, 284, -1, + -1, 287, 288, 289, -1, -1, 292, -1, 294, 295, + 296, -1, 298, 299, 300, 301, 302, 303, 304, 305, + 306, 307, -1, 309, 310, -1, 312, 313, -1, 315, + 316, 317, -1, 319, 320, 321, 322, 323, 324, -1, + 326, 327, 328, 329, 330, 331, 332, 333, -1, 335, + 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, + 346, 347, -1, 349, 350, 351, 352, 353, 354, -1, + 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, + 366, -1, 368, 369, 370, 371, 372, -1, 374, -1, + 376, 377, 378, 379, 380, 381, 382, 383, -1, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 397, -1, 399, -1, 401, 402, -1, 404, 405, + 406, 407, 408, 409, 410, -1, 412, 413, -1, -1, + 416, 417, -1, 419, -1, -1, 422, 423, 424, 425, + 426, 427, 428, 429, -1, -1, 432, 433, 434, 435, + 436, -1, -1, 439, 440, 441, 442, 443, -1, 445, + -1, 447, 448, 449, 450, 451, 452, -1, -1, 455, + -1, -1, 458, 459, 460, 461, 462, 463, 3, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 475, + 476, 477, 478, -1, 19, 20, 21, 22, 23, 24, + 25, 26, -1, 28, 29, 30, -1, -1, -1, -1, + -1, -1, -1, 38, 39, -1, 41, 42, 43, 44, + 45, 46, 47, -1, 49, 50, 51, 52, -1, 54, + 55, 56, 57, 58, 59, -1, -1, 62, 63, 64, + 65, 66, -1, 68, 69, 70, 71, -1, -1, 74, + -1, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, -1, 87, 88, 89, 90, 91, 92, -1, 94, + 95, 96, 97, -1, -1, -1, 101, -1, -1, -1, + 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, + -1, 116, -1, 118, 119, 120, 121, 122, 123, -1, + 125, 126, 127, 128, 129, -1, -1, 132, 133, 134, + 135, 136, -1, 138, 139, 140, -1, 142, 143, 144, + -1, 146, 147, 148, 149, -1, 151, 152, 153, 154, + 155, -1, -1, 158, -1, 160, 161, 162, 163, -1, + 165, -1, 167, 168, -1, 170, 171, 172, 173, 174, + 175, -1, 177, -1, -1, -1, 181, -1, 183, 184, + 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, + -1, 196, 197, 198, 199, 200, 201, -1, 203, 204, + -1, 206, 207, 208, 209, 210, 211, 212, -1, 214, + -1, 216, 217, 218, 219, 220, 221, 222, 223, 224, + 225, 226, -1, -1, 229, 230, 231, 232, -1, 234, + 235, 236, -1, -1, 239, 240, 241, 242, 243, -1, + 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, + 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, -1, -1, 271, 272, 273, 274, + -1, -1, 277, 278, 279, 280, 281, -1, 283, 284, + -1, -1, 287, 288, 289, -1, -1, 292, -1, 294, + 295, 296, -1, 298, 299, 300, 301, 302, 303, 304, + 305, 306, 307, -1, 309, 310, -1, 312, 313, -1, + 315, 316, 317, -1, 319, 320, 321, 322, 323, 324, + -1, 326, 327, 328, 329, 330, 331, 332, 333, -1, + 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, + 345, 346, 347, -1, 349, 350, 351, 352, 353, 354, + -1, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, -1, 368, 369, 370, 371, 372, -1, 374, + -1, 376, 377, 378, 379, 380, 381, 382, 383, -1, + 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, + 395, -1, 397, -1, 399, -1, 401, 402, -1, 404, + 405, 406, 407, 408, 409, 410, -1, 412, 413, -1, + -1, 416, 417, -1, 419, -1, -1, 422, 423, 424, + 425, 426, 427, 428, 429, -1, -1, 432, 433, 434, + 435, 436, -1, -1, 439, 440, 441, 442, 443, -1, + 445, -1, 447, 448, 449, 450, 451, 452, -1, -1, + 455, -1, -1, 458, 459, 460, 461, 462, 463, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 475, 476, 477, 478 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -245167,305 +256302,308 @@ static const yytype_int16 yycheck[] = static const yytype_uint16 yystos[] = { 0, 19, 29, 31, 32, 47, 56, 68, 79, 91, - 93, 111, 125, 135, 141, 149, 151, 152, 164, 193, - 208, 233, 310, 313, 342, 351, 365, 372, 376, 386, - 397, 401, 437, 442, 455, 479, 493, 504, 505, 506, - 507, 518, 519, 522, 524, 528, 542, 543, 545, 547, - 554, 556, 602, 609, 612, 613, 630, 631, 632, 633, - 634, 635, 685, 822, 825, 828, 835, 836, 837, 838, - 839, 846, 850, 856, 858, 863, 867, 868, 871, 872, - 874, 875, 877, 414, 458, 555, 197, 358, 366, 401, - 448, 555, 3, 19, 20, 21, 22, 23, 24, 25, - 26, 28, 29, 30, 38, 39, 41, 42, 43, 44, - 45, 46, 47, 48, 49, 50, 51, 52, 54, 55, - 56, 57, 58, 59, 62, 63, 64, 65, 66, 68, - 69, 70, 71, 72, 74, 76, 77, 78, 79, 80, - 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, - 92, 94, 95, 96, 97, 101, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 116, 118, 119, 120, - 121, 122, 123, 125, 126, 127, 128, 129, 132, 133, - 134, 135, 136, 138, 139, 140, 142, 143, 144, 146, - 147, 148, 149, 150, 151, 152, 153, 154, 155, 157, - 159, 160, 161, 162, 164, 166, 167, 169, 170, 171, - 172, 173, 174, 176, 178, 179, 180, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 192, 193, 195, - 196, 197, 198, 199, 200, 202, 203, 204, 205, 206, - 207, 208, 209, 210, 211, 213, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 224, 227, 228, 229, 230, - 232, 233, 234, 237, 238, 239, 240, 241, 242, 243, - 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, - 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, - 264, 265, 266, 267, 269, 270, 271, 272, 274, 275, - 276, 277, 278, 279, 281, 282, 285, 286, 287, 290, - 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, - 301, 302, 303, 304, 305, 307, 308, 309, 310, 311, - 312, 313, 314, 315, 317, 318, 319, 320, 321, 322, - 324, 325, 326, 327, 328, 329, 330, 331, 333, 334, - 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, - 345, 347, 348, 349, 350, 351, 352, 353, 354, 355, - 356, 357, 358, 359, 360, 361, 362, 363, 364, 366, - 367, 368, 369, 370, 372, 373, 374, 375, 376, 377, - 378, 379, 380, 381, 383, 384, 385, 386, 387, 388, - 389, 390, 391, 392, 393, 394, 395, 396, 397, 399, - 400, 402, 403, 404, 405, 406, 407, 408, 410, 411, - 414, 415, 416, 417, 418, 420, 421, 422, 423, 424, - 425, 426, 427, 430, 431, 432, 433, 434, 437, 438, - 439, 440, 441, 442, 443, 445, 446, 447, 448, 449, - 450, 453, 456, 457, 458, 459, 460, 461, 462, 463, - 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, - 474, 475, 476, 741, 807, 811, 814, 880, 881, 882, - 555, 50, 493, 625, 170, 174, 234, 241, 288, 358, - 405, 407, 423, 429, 432, 600, 610, 834, 3, 27, - 242, 313, 394, 805, 811, 880, 21, 74, 90, 144, - 153, 165, 170, 197, 241, 245, 308, 322, 355, 358, - 366, 369, 388, 401, 408, 417, 423, 448, 603, 604, - 607, 555, 805, 93, 446, 493, 524, 612, 630, 842, - 846, 863, 877, 108, 68, 208, 108, 5, 810, 811, - 857, 857, 811, 805, 27, 410, 414, 811, 869, 870, - 873, 555, 27, 130, 642, 643, 174, 234, 358, 370, - 410, 851, 852, 873, 555, 442, 630, 635, 873, 5, - 284, 696, 803, 811, 812, 169, 493, 860, 493, 330, - 636, 637, 805, 636, 631, 632, 0, 496, 120, 207, - 434, 145, 212, 289, 428, 645, 646, 631, 633, 634, - 497, 446, 840, 27, 410, 414, 630, 873, 187, 803, - 805, 187, 803, 187, 696, 187, 803, 493, 491, 495, - 789, 791, 524, 612, 630, 824, 863, 803, 405, 407, - 405, 407, 340, 187, 811, 811, 816, 330, 366, 401, - 448, 803, 197, 27, 805, 247, 417, 107, 401, 448, - 361, 3, 44, 49, 50, 51, 52, 64, 65, 74, - 82, 94, 101, 112, 113, 134, 161, 167, 169, 173, - 187, 189, 203, 210, 211, 213, 216, 217, 219, 228, - 230, 242, 261, 262, 263, 271, 276, 292, 294, 327, - 349, 353, 373, 377, 380, 394, 403, 410, 411, 422, - 443, 446, 608, 707, 708, 710, 712, 714, 716, 718, - 719, 720, 722, 723, 724, 726, 727, 815, 880, 883, - 187, 605, 816, 187, 804, 805, 187, 805, 493, 546, - 600, 842, 3, 48, 49, 51, 52, 64, 65, 72, - 112, 113, 150, 155, 161, 178, 179, 204, 210, 211, - 213, 242, 261, 263, 267, 274, 276, 291, 295, 309, - 312, 327, 353, 373, 380, 394, 396, 410, 411, 416, - 418, 422, 442, 443, 462, 463, 464, 465, 466, 467, - 468, 469, 470, 471, 472, 843, 845, 846, 848, 849, - 880, 884, 840, 810, 857, 810, 482, 493, 493, 823, - 476, 218, 495, 283, 4, 6, 7, 8, 9, 10, - 35, 49, 51, 52, 60, 61, 64, 65, 72, 74, - 98, 99, 100, 101, 102, 103, 104, 112, 113, 115, - 150, 155, 156, 161, 178, 179, 210, 211, 213, 235, - 236, 261, 263, 268, 273, 274, 276, 285, 295, 309, - 327, 353, 371, 380, 396, 410, 411, 416, 418, 419, - 422, 435, 443, 477, 484, 485, 486, 491, 493, 498, - 500, 501, 631, 675, 711, 714, 717, 718, 719, 721, - 722, 723, 726, 727, 738, 740, 741, 742, 744, 757, - 758, 764, 783, 788, 795, 796, 807, 808, 809, 810, - 811, 794, 795, 851, 851, 810, 851, 476, 168, 412, - 482, 493, 803, 486, 791, 3, 167, 169, 446, 846, - 859, 861, 167, 862, 738, 768, 811, 636, 497, 493, - 818, 494, 494, 506, 168, 214, 696, 864, 27, 130, - 641, 641, 54, 641, 158, 163, 231, 280, 651, 653, - 654, 678, 680, 681, 682, 645, 646, 493, 803, 476, - 218, 150, 23, 29, 135, 287, 338, 342, 372, 439, - 512, 515, 516, 338, 150, 36, 55, 106, 196, 246, - 254, 266, 297, 338, 344, 366, 372, 386, 515, 548, - 551, 150, 338, 372, 515, 150, 338, 372, 515, 3, - 27, 44, 50, 74, 82, 94, 101, 130, 167, 169, - 173, 189, 203, 216, 217, 219, 228, 230, 242, 262, - 271, 292, 294, 349, 377, 394, 403, 422, 444, 446, - 486, 494, 738, 770, 771, 813, 819, 880, 885, 738, - 790, 3, 27, 31, 32, 33, 34, 35, 36, 37, - 40, 53, 60, 61, 67, 73, 75, 86, 93, 98, - 99, 100, 102, 103, 104, 115, 117, 124, 130, 131, - 137, 141, 145, 156, 158, 163, 165, 168, 175, 177, - 181, 194, 201, 212, 214, 225, 226, 231, 235, 236, - 268, 273, 280, 283, 284, 288, 289, 306, 316, 323, - 332, 346, 365, 371, 382, 398, 401, 409, 412, 413, - 419, 428, 429, 435, 436, 442, 444, 451, 452, 454, - 455, 806, 820, 880, 884, 886, 789, 494, 493, 590, - 600, 268, 826, 495, 817, 36, 448, 187, 803, 187, - 803, 879, 803, 493, 611, 82, 831, 459, 83, 127, - 300, 406, 445, 725, 725, 725, 493, 713, 713, 312, - 493, 715, 150, 493, 64, 65, 725, 713, 710, 457, - 479, 493, 728, 493, 728, 58, 345, 497, 606, 493, - 35, 709, 493, 109, 110, 184, 185, 248, 249, 250, - 251, 252, 253, 256, 257, 362, 363, 473, 474, 493, - 729, 730, 731, 732, 733, 734, 735, 736, 737, 713, - 150, 497, 606, 150, 497, 606, 150, 283, 768, 401, - 494, 497, 4, 156, 283, 419, 484, 485, 550, 553, - 809, 810, 841, 843, 844, 847, 842, 493, 620, 624, - 550, 847, 853, 855, 770, 708, 772, 36, 229, 811, - 493, 792, 491, 738, 787, 493, 493, 163, 493, 493, - 631, 493, 493, 493, 738, 493, 493, 493, 493, 493, - 493, 493, 493, 493, 738, 738, 738, 146, 797, 798, - 768, 769, 631, 738, 768, 759, 760, 811, 812, 9, - 792, 791, 493, 810, 493, 809, 810, 3, 8, 11, - 16, 17, 18, 33, 36, 41, 48, 73, 173, 189, - 194, 216, 217, 230, 268, 271, 285, 288, 377, 477, - 480, 481, 482, 484, 485, 486, 487, 488, 489, 762, - 763, 764, 766, 456, 745, 792, 15, 294, 738, 15, - 214, 497, 638, 493, 810, 792, 495, 791, 638, 3, - 115, 234, 550, 727, 810, 854, 97, 115, 855, 115, - 855, 803, 494, 497, 840, 494, 497, 637, 804, 36, - 864, 526, 803, 36, 811, 372, 633, 633, 27, 486, - 647, 648, 738, 633, 160, 265, 667, 220, 266, 326, - 375, 434, 4, 9, 27, 662, 738, 484, 485, 663, - 664, 738, 740, 678, 679, 654, 653, 651, 652, 163, - 681, 278, 683, 651, 678, 768, 818, 229, 803, 67, - 75, 86, 165, 187, 316, 429, 571, 581, 596, 811, - 75, 86, 523, 86, 523, 493, 412, 493, 569, 240, - 432, 569, 86, 497, 412, 803, 710, 550, 54, 552, - 550, 550, 106, 246, 254, 54, 412, 455, 479, 549, - 259, 358, 549, 551, 696, 86, 412, 523, 358, 803, - 412, 358, 770, 770, 771, 494, 497, 645, 646, 13, - 14, 492, 502, 412, 589, 594, 811, 455, 623, 330, - 401, 448, 150, 93, 543, 556, 827, 828, 875, 806, - 495, 142, 803, 268, 544, 548, 268, 493, 590, 36, - 590, 494, 770, 36, 187, 584, 811, 832, 493, 768, - 809, 608, 772, 725, 725, 35, 709, 410, 410, 809, - 809, 708, 706, 811, 491, 491, 809, 809, 412, 412, - 412, 412, 605, 816, 804, 805, 805, 816, 494, 187, - 803, 879, 842, 848, 4, 809, 4, 809, 622, 629, - 820, 50, 95, 121, 139, 143, 164, 167, 182, 273, - 281, 324, 626, 497, 494, 497, 494, 497, 824, 768, - 789, 769, 451, 784, 785, 738, 768, 493, 809, 809, - 3, 729, 730, 731, 732, 733, 734, 735, 736, 773, - 774, 810, 809, 809, 738, 8, 16, 17, 18, 480, - 481, 482, 484, 485, 486, 487, 488, 489, 762, 767, - 811, 738, 775, 484, 485, 493, 739, 740, 764, 777, - 788, 494, 768, 738, 768, 778, 738, 53, 168, 226, - 413, 738, 768, 781, 738, 493, 811, 340, 801, 492, - 494, 497, 497, 499, 502, 768, 738, 737, 737, 708, - 738, 738, 738, 738, 5, 820, 821, 410, 40, 398, - 793, 816, 738, 738, 493, 631, 782, 130, 156, 268, - 273, 278, 419, 430, 738, 273, 493, 738, 412, 48, - 173, 189, 194, 230, 377, 738, 738, 738, 738, 738, - 738, 738, 738, 738, 738, 27, 34, 382, 761, 177, - 159, 746, 738, 353, 493, 758, 738, 174, 234, 401, - 405, 407, 432, 639, 803, 796, 168, 686, 770, 486, - 686, 493, 810, 494, 803, 859, 803, 867, 738, 494, - 493, 436, 866, 115, 296, 493, 525, 630, 36, 811, - 493, 530, 539, 541, 811, 37, 124, 649, 649, 497, - 436, 649, 353, 354, 484, 485, 664, 666, 740, 375, - 220, 284, 305, 305, 497, 488, 4, 665, 809, 665, - 353, 354, 666, 802, 803, 272, 379, 684, 679, 652, - 494, 338, 515, 493, 187, 581, 805, 220, 268, 220, - 436, 493, 574, 708, 805, 811, 187, 805, 187, 811, - 23, 135, 372, 511, 514, 564, 579, 820, 805, 573, - 593, 820, 805, 512, 805, 338, 372, 515, 548, 550, - 816, 805, 550, 816, 805, 550, 338, 372, 515, 805, - 805, 805, 805, 338, 372, 515, 805, 805, 645, 645, - 645, 444, 771, 188, 343, 644, 738, 738, 738, 790, - 321, 619, 494, 497, 281, 168, 412, 614, 448, 803, - 803, 811, 600, 806, 493, 493, 150, 150, 230, 571, - 581, 585, 588, 597, 599, 811, 455, 457, 576, 149, - 630, 455, 833, 494, 738, 268, 283, 768, 494, 494, - 606, 494, 491, 476, 476, 494, 494, 494, 497, 708, - 809, 492, 809, 494, 494, 730, 732, 733, 734, 733, - 734, 734, 606, 606, 283, 606, 268, 36, 494, 497, - 486, 493, 550, 621, 847, 36, 618, 810, 618, 268, - 273, 324, 618, 618, 853, 708, 494, 492, 738, 137, - 785, 786, 36, 494, 738, 494, 494, 494, 168, 494, - 494, 497, 494, 495, 306, 776, 494, 739, 739, 738, - 11, 16, 17, 18, 194, 216, 285, 480, 481, 482, - 484, 485, 486, 487, 488, 489, 764, 739, 494, 494, - 163, 168, 779, 780, 494, 36, 781, 768, 781, 781, - 168, 494, 36, 804, 493, 738, 799, 792, 738, 759, - 738, 494, 494, 476, 739, 739, 143, 768, 168, 130, - 156, 273, 278, 419, 430, 493, 143, 767, 738, 398, - 793, 738, 782, 738, 412, 493, 631, 493, 493, 293, - 750, 405, 407, 405, 407, 803, 401, 640, 640, 640, - 225, 354, 493, 631, 687, 688, 689, 696, 697, 741, - 743, 744, 811, 452, 702, 645, 798, 702, 809, 737, - 818, 824, 687, 452, 865, 442, 400, 435, 534, 529, - 538, 811, 283, 531, 811, 535, 541, 497, 686, 482, - 792, 478, 650, 650, 648, 285, 762, 765, 650, 4, - 809, 666, 284, 434, 663, 497, 239, 412, 738, 268, - 596, 493, 150, 493, 574, 197, 594, 557, 287, 567, - 557, 23, 135, 342, 344, 372, 508, 509, 510, 516, - 517, 150, 606, 150, 606, 564, 579, 564, 494, 497, - 560, 810, 494, 497, 482, 495, 412, 358, 86, 412, - 523, 358, 412, 412, 412, 358, 644, 644, 644, 771, - 275, 275, 494, 492, 389, 390, 628, 810, 589, 619, - 803, 493, 590, 826, 401, 520, 521, 810, 594, 803, - 803, 879, 803, 494, 497, 281, 569, 281, 283, 568, - 805, 455, 878, 569, 36, 150, 803, 494, 709, 809, - 728, 728, 709, 811, 492, 492, 816, 150, 622, 616, - 627, 847, 810, 810, 273, 594, 486, 594, 810, 810, - 409, 738, 141, 708, 494, 738, 738, 767, 738, 779, - 708, 739, 739, 739, 739, 130, 268, 278, 739, 739, - 739, 739, 739, 739, 739, 739, 739, 739, 738, 738, - 780, 779, 708, 494, 494, 494, 768, 708, 494, 738, - 799, 800, 36, 494, 737, 738, 33, 33, 738, 494, - 738, 168, 493, 772, 738, 494, 143, 739, 739, 143, - 143, 738, 738, 646, 452, 493, 751, 811, 640, 640, - 640, 640, 803, 803, 803, 631, 697, 168, 631, 688, - 689, 36, 690, 691, 811, 497, 94, 169, 203, 219, - 228, 262, 349, 693, 691, 36, 690, 692, 811, 479, - 701, 791, 738, 177, 668, 644, 801, 668, 494, 494, - 738, 346, 533, 441, 494, 497, 792, 84, 533, 494, - 497, 530, 865, 738, 160, 224, 493, 650, 284, 803, - 805, 494, 150, 594, 581, 594, 557, 584, 494, 117, - 201, 266, 268, 580, 493, 591, 172, 115, 186, 268, - 569, 549, 107, 115, 172, 268, 388, 391, 551, 569, - 372, 510, 423, 805, 811, 514, 593, 3, 44, 50, - 74, 82, 94, 101, 167, 169, 173, 189, 203, 216, - 217, 219, 228, 230, 242, 262, 267, 271, 285, 292, - 294, 349, 373, 377, 394, 403, 422, 446, 484, 485, - 550, 558, 595, 708, 765, 810, 813, 880, 886, 820, - 805, 805, 805, 805, 805, 805, 805, 805, 805, 805, - 494, 494, 494, 645, 549, 628, 493, 588, 833, 187, - 803, 494, 497, 494, 544, 493, 36, 578, 576, 585, - 79, 546, 107, 266, 630, 584, 436, 830, 492, 708, - 606, 879, 494, 497, 594, 738, 494, 494, 780, 168, - 130, 278, 493, 494, 494, 494, 497, 811, 738, 738, - 738, 772, 494, 738, 33, 33, 738, 738, 143, 494, - 494, 738, 752, 811, 803, 803, 803, 803, 691, 692, - 493, 494, 811, 812, 403, 659, 660, 493, 688, 219, - 292, 694, 688, 694, 219, 693, 694, 219, 660, 493, - 811, 660, 493, 290, 54, 181, 676, 494, 676, 810, - 795, 630, 296, 630, 529, 283, 493, 527, 482, 541, - 533, 767, 557, 581, 494, 494, 455, 587, 118, 190, - 199, 117, 438, 564, 582, 67, 73, 86, 115, 117, - 172, 201, 268, 273, 316, 332, 429, 436, 562, 563, - 575, 30, 54, 601, 187, 273, 550, 738, 601, 273, - 484, 485, 553, 811, 708, 606, 606, 242, 394, 813, - 817, 482, 412, 412, 644, 620, 436, 615, 617, 594, - 494, 36, 268, 493, 810, 833, 588, 149, 630, 147, - 195, 568, 120, 135, 315, 878, 107, 455, 876, 283, - 811, 829, 493, 36, 627, 739, 168, 493, 772, 799, - 494, 738, 738, 738, 494, 302, 753, 698, 699, 743, - 690, 493, 4, 9, 655, 657, 658, 811, 804, 688, - 283, 436, 695, 688, 219, 688, 703, 704, 811, 493, - 703, 811, 27, 96, 178, 352, 486, 493, 669, 670, - 671, 672, 673, 674, 738, 738, 454, 747, 810, 747, - 534, 86, 493, 532, 540, 743, 811, 131, 738, 494, - 332, 587, 493, 577, 557, 494, 497, 493, 816, 805, - 739, 601, 118, 190, 117, 273, 220, 803, 587, 81, - 115, 36, 150, 73, 705, 817, 488, 558, 805, 805, - 494, 549, 122, 494, 576, 630, 150, 36, 494, 805, - 878, 27, 78, 87, 116, 186, 198, 388, 391, 572, - 572, 354, 354, 59, 67, 234, 803, 540, 739, 772, - 494, 54, 645, 494, 497, 36, 700, 804, 305, 488, - 305, 354, 488, 493, 493, 494, 738, 493, 688, 695, - 494, 497, 708, 703, 494, 493, 374, 493, 494, 497, - 748, 749, 811, 323, 677, 677, 441, 805, 738, 494, - 497, 73, 536, 536, 269, 434, 803, 557, 583, 586, - 820, 564, 738, 268, 563, 36, 587, 590, 805, 186, - 816, 436, 513, 488, 423, 620, 810, 833, 568, 876, - 803, 630, 576, 546, 67, 286, 67, 830, 494, 494, - 768, 325, 354, 754, 701, 698, 493, 494, 811, 655, - 804, 704, 705, 494, 768, 493, 768, 670, 497, 36, - 738, 436, 656, 656, 630, 494, 702, 532, 816, 537, - 816, 537, 372, 590, 494, 497, 482, 494, 186, 244, - 598, 493, 559, 738, 423, 36, 493, 876, 568, 878, - 286, 286, 493, 833, 48, 97, 425, 738, 755, 756, - 755, 494, 703, 494, 497, 494, 494, 494, 669, 494, - 749, 751, 356, 536, 649, 649, 539, 598, 586, 558, - 266, 570, 559, 169, 301, 378, 283, 565, 566, 592, - 548, 630, 540, 702, 756, 353, 162, 311, 162, 311, - 494, 9, 339, 661, 494, 658, 537, 650, 650, 702, - 566, 199, 120, 434, 283, 592, 283, 565, 494, 876, - 494, 33, 494, 493, 649, 557, 58, 266, 345, 372, - 561, 561, 833, 756, 9, 650, 22, 115, 273, 702, - 494 + 93, 111, 125, 135, 141, 149, 151, 152, 165, 194, + 209, 235, 312, 315, 344, 353, 367, 374, 378, 388, + 399, 403, 439, 444, 457, 481, 495, 506, 507, 508, + 509, 513, 516, 518, 521, 522, 523, 524, 525, 526, + 577, 578, 722, 727, 729, 732, 733, 734, 735, 738, + 749, 752, 753, 755, 802, 804, 811, 813, 817, 832, + 834, 835, 836, 837, 844, 848, 850, 857, 858, 861, + 867, 874, 875, 876, 416, 460, 728, 198, 360, 368, + 403, 450, 728, 3, 19, 20, 21, 22, 23, 24, + 25, 26, 28, 29, 30, 38, 39, 41, 42, 43, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 54, + 55, 56, 57, 58, 59, 62, 63, 64, 65, 66, + 68, 69, 70, 71, 72, 74, 76, 77, 78, 79, + 80, 81, 82, 83, 84, 85, 87, 88, 89, 90, + 91, 92, 94, 95, 96, 97, 101, 105, 106, 107, + 108, 109, 110, 111, 112, 113, 114, 116, 118, 119, + 120, 121, 122, 123, 125, 126, 127, 128, 129, 132, + 133, 134, 135, 136, 138, 139, 140, 142, 143, 144, + 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, + 156, 158, 160, 161, 162, 163, 165, 167, 168, 170, + 171, 172, 173, 174, 175, 177, 179, 180, 181, 183, + 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, + 194, 196, 197, 198, 199, 200, 201, 203, 204, 205, + 206, 207, 208, 209, 210, 211, 212, 214, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 225, 226, 229, + 230, 231, 232, 234, 235, 236, 239, 240, 241, 242, + 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, + 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, + 263, 264, 265, 266, 267, 268, 269, 271, 272, 273, + 274, 276, 277, 278, 279, 280, 281, 283, 284, 287, + 288, 289, 292, 293, 294, 295, 296, 297, 298, 299, + 300, 301, 302, 303, 304, 305, 306, 307, 309, 310, + 311, 312, 313, 314, 315, 316, 317, 319, 320, 321, + 322, 323, 324, 326, 327, 328, 329, 330, 331, 332, + 333, 335, 336, 337, 338, 339, 340, 341, 342, 343, + 344, 345, 346, 347, 349, 350, 351, 352, 353, 354, + 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, + 365, 366, 368, 369, 370, 371, 372, 374, 375, 376, + 377, 378, 379, 380, 381, 382, 383, 385, 386, 387, + 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, + 398, 399, 401, 402, 404, 405, 406, 407, 408, 409, + 410, 412, 413, 416, 417, 418, 419, 420, 422, 423, + 424, 425, 426, 427, 428, 429, 432, 433, 434, 435, + 436, 439, 440, 441, 442, 443, 444, 445, 447, 448, + 449, 450, 451, 452, 455, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 467, 468, 469, 470, 471, 472, + 473, 474, 475, 476, 477, 478, 635, 707, 711, 714, + 893, 894, 895, 728, 50, 495, 888, 175, 236, 290, + 360, 407, 409, 425, 431, 434, 800, 873, 3, 27, + 244, 315, 396, 705, 711, 893, 21, 74, 90, 144, + 154, 166, 171, 198, 243, 247, 310, 324, 357, 360, + 368, 371, 390, 403, 410, 419, 425, 450, 805, 806, + 809, 728, 705, 93, 448, 495, 509, 513, 521, 732, + 813, 840, 844, 108, 68, 209, 108, 5, 710, 711, + 812, 812, 711, 705, 27, 412, 416, 711, 730, 731, + 754, 728, 27, 130, 533, 534, 175, 236, 360, 372, + 412, 754, 862, 863, 728, 444, 521, 526, 754, 5, + 286, 590, 702, 711, 712, 170, 495, 724, 495, 332, + 527, 528, 705, 527, 522, 523, 0, 498, 145, 213, + 291, 430, 536, 537, 522, 524, 525, 499, 27, 412, + 416, 521, 754, 120, 208, 436, 448, 838, 188, 702, + 705, 188, 702, 188, 590, 188, 702, 495, 493, 497, + 686, 688, 509, 520, 521, 732, 813, 702, 407, 409, + 407, 409, 342, 188, 711, 711, 716, 171, 243, 332, + 368, 403, 450, 736, 198, 27, 705, 249, 419, 107, + 403, 403, 450, 363, 3, 44, 49, 50, 51, 52, + 64, 65, 74, 82, 94, 101, 112, 113, 134, 162, + 168, 170, 174, 188, 190, 204, 211, 212, 214, 217, + 218, 220, 230, 232, 244, 263, 264, 265, 273, 278, + 294, 296, 329, 351, 355, 375, 379, 382, 396, 405, + 412, 413, 424, 445, 448, 601, 602, 604, 606, 608, + 610, 612, 613, 614, 616, 617, 618, 620, 621, 715, + 810, 893, 896, 188, 716, 807, 188, 703, 705, 188, + 705, 495, 833, 290, 800, 840, 3, 48, 49, 51, + 52, 64, 65, 72, 112, 113, 150, 156, 162, 179, + 180, 205, 211, 212, 214, 244, 263, 265, 269, 276, + 278, 293, 297, 311, 314, 329, 355, 375, 382, 396, + 398, 412, 413, 418, 420, 424, 444, 445, 464, 465, + 466, 467, 468, 469, 470, 471, 472, 473, 474, 841, + 843, 844, 846, 847, 893, 897, 838, 710, 812, 710, + 484, 495, 495, 519, 478, 219, 497, 285, 4, 6, + 7, 8, 9, 10, 35, 49, 51, 52, 60, 61, + 64, 65, 72, 74, 98, 99, 100, 101, 102, 103, + 104, 112, 113, 115, 150, 156, 157, 162, 179, 180, + 211, 212, 214, 237, 238, 263, 265, 270, 275, 276, + 278, 287, 297, 311, 329, 355, 373, 382, 398, 412, + 413, 418, 420, 421, 424, 437, 445, 479, 486, 487, + 488, 493, 495, 500, 502, 503, 522, 567, 605, 608, + 611, 612, 613, 615, 616, 617, 620, 621, 632, 634, + 635, 636, 638, 652, 653, 660, 680, 685, 692, 693, + 694, 707, 708, 709, 710, 711, 691, 693, 862, 862, + 710, 862, 478, 169, 414, 484, 495, 702, 488, 688, + 3, 168, 170, 448, 723, 725, 844, 168, 726, 632, + 664, 665, 711, 527, 499, 495, 718, 496, 496, 508, + 27, 130, 532, 532, 54, 532, 159, 164, 233, 282, + 542, 544, 545, 570, 572, 573, 574, 536, 537, 495, + 478, 219, 169, 215, 510, 590, 702, 150, 23, 29, + 135, 289, 340, 344, 374, 441, 743, 746, 747, 340, + 150, 36, 55, 106, 197, 248, 256, 268, 299, 340, + 346, 368, 374, 388, 746, 851, 854, 150, 340, 374, + 746, 150, 340, 374, 746, 3, 27, 44, 50, 74, + 82, 94, 101, 130, 168, 170, 174, 190, 204, 217, + 218, 220, 230, 232, 244, 264, 273, 294, 296, 351, + 379, 396, 405, 424, 446, 448, 488, 496, 632, 667, + 668, 713, 719, 893, 898, 632, 687, 3, 27, 31, + 32, 33, 34, 35, 36, 37, 40, 53, 60, 61, + 67, 73, 75, 86, 93, 98, 99, 100, 102, 103, + 104, 115, 117, 124, 130, 131, 137, 141, 145, 157, + 159, 164, 166, 169, 176, 178, 182, 195, 202, 213, + 215, 227, 228, 233, 237, 238, 270, 275, 282, 285, + 286, 290, 291, 308, 318, 325, 334, 348, 367, 373, + 384, 400, 403, 411, 414, 415, 421, 430, 431, 437, + 438, 444, 446, 453, 454, 456, 457, 706, 720, 893, + 897, 899, 686, 496, 495, 789, 800, 270, 750, 497, + 717, 36, 450, 188, 702, 188, 515, 702, 702, 702, + 82, 870, 461, 83, 127, 302, 408, 447, 619, 619, + 619, 495, 607, 607, 314, 495, 609, 150, 495, 64, + 65, 619, 607, 604, 459, 481, 495, 622, 495, 622, + 495, 35, 603, 495, 109, 110, 185, 186, 250, 251, + 252, 253, 254, 255, 258, 259, 364, 365, 475, 476, + 495, 623, 624, 625, 626, 627, 628, 629, 630, 631, + 607, 58, 347, 499, 808, 150, 499, 808, 150, 499, + 808, 150, 285, 665, 342, 403, 496, 499, 4, 157, + 285, 421, 486, 487, 709, 710, 839, 841, 842, 845, + 853, 856, 840, 495, 883, 887, 845, 853, 864, 866, + 667, 602, 669, 36, 231, 711, 495, 689, 493, 632, + 684, 495, 495, 164, 495, 495, 522, 495, 495, 495, + 632, 495, 495, 495, 495, 495, 495, 495, 495, 495, + 632, 632, 632, 146, 695, 696, 665, 666, 522, 632, + 664, 654, 655, 656, 711, 712, 9, 689, 688, 495, + 710, 495, 709, 710, 3, 8, 11, 15, 16, 17, + 18, 33, 36, 41, 48, 73, 174, 190, 195, 217, + 218, 232, 270, 273, 287, 290, 379, 479, 482, 483, + 484, 486, 487, 488, 489, 490, 491, 658, 659, 660, + 662, 458, 639, 689, 296, 632, 499, 215, 529, 495, + 710, 689, 497, 688, 529, 3, 115, 236, 621, 710, + 853, 865, 97, 115, 866, 115, 866, 702, 496, 499, + 838, 499, 496, 528, 703, 36, 524, 524, 27, 488, + 538, 539, 632, 524, 161, 267, 558, 222, 268, 328, + 377, 436, 4, 9, 27, 553, 632, 486, 487, 554, + 555, 632, 634, 570, 571, 545, 544, 542, 543, 164, + 573, 280, 575, 542, 570, 665, 231, 510, 702, 815, + 374, 36, 711, 718, 702, 67, 75, 86, 166, 188, + 318, 431, 711, 770, 780, 796, 75, 86, 803, 86, + 803, 495, 414, 495, 768, 242, 434, 768, 86, 499, + 414, 702, 604, 853, 54, 855, 853, 853, 106, 248, + 256, 54, 414, 457, 481, 852, 261, 360, 852, 854, + 590, 86, 414, 803, 360, 702, 414, 360, 667, 667, + 668, 496, 499, 536, 537, 13, 14, 494, 504, 414, + 711, 788, 793, 457, 886, 332, 403, 450, 150, 93, + 516, 751, 755, 848, 867, 706, 497, 142, 702, 270, + 849, 851, 270, 36, 495, 789, 789, 495, 737, 188, + 711, 783, 871, 495, 665, 709, 810, 669, 619, 619, + 35, 603, 412, 412, 709, 709, 600, 711, 493, 493, + 709, 709, 414, 414, 414, 414, 602, 807, 716, 703, + 705, 705, 716, 496, 800, 188, 515, 702, 840, 846, + 4, 709, 4, 709, 720, 885, 892, 50, 95, 121, + 139, 143, 165, 168, 183, 275, 283, 326, 889, 499, + 496, 499, 496, 499, 520, 665, 686, 666, 453, 681, + 682, 632, 665, 495, 709, 709, 3, 623, 624, 625, + 626, 627, 628, 629, 630, 670, 671, 710, 709, 709, + 632, 8, 16, 17, 18, 482, 483, 484, 486, 487, + 488, 489, 490, 491, 658, 663, 711, 632, 672, 486, + 487, 495, 633, 634, 660, 674, 496, 665, 632, 664, + 675, 632, 53, 169, 228, 415, 632, 665, 678, 632, + 495, 711, 342, 700, 494, 496, 499, 499, 501, 504, + 665, 632, 631, 631, 602, 632, 632, 632, 632, 632, + 5, 720, 721, 412, 40, 400, 690, 716, 632, 632, + 495, 522, 679, 130, 157, 270, 275, 280, 421, 432, + 632, 275, 495, 632, 414, 48, 174, 190, 195, 232, + 379, 632, 632, 632, 632, 632, 632, 632, 632, 632, + 632, 27, 34, 384, 657, 178, 160, 640, 355, 495, + 653, 694, 175, 236, 403, 407, 409, 434, 530, 702, + 169, 579, 667, 488, 579, 495, 710, 496, 702, 723, + 702, 834, 632, 496, 495, 37, 124, 540, 540, 499, + 438, 540, 355, 356, 486, 487, 555, 557, 634, 377, + 222, 286, 307, 307, 499, 490, 4, 556, 709, 556, + 355, 356, 557, 701, 702, 274, 381, 576, 571, 543, + 496, 438, 512, 36, 115, 298, 495, 521, 814, 495, + 711, 819, 828, 829, 831, 711, 340, 746, 495, 188, + 780, 705, 222, 270, 222, 438, 495, 773, 602, 705, + 711, 188, 705, 188, 711, 23, 135, 374, 720, 742, + 745, 763, 778, 705, 720, 772, 792, 705, 743, 705, + 340, 374, 746, 851, 853, 716, 705, 853, 716, 705, + 853, 340, 374, 746, 705, 705, 705, 705, 340, 374, + 746, 705, 705, 536, 536, 536, 446, 668, 189, 345, + 535, 632, 632, 632, 687, 323, 882, 496, 499, 283, + 169, 414, 877, 450, 515, 702, 702, 711, 290, 800, + 706, 495, 495, 150, 150, 149, 521, 232, 711, 770, + 780, 784, 787, 797, 799, 457, 459, 775, 457, 872, + 496, 667, 36, 270, 285, 665, 496, 496, 808, 496, + 493, 478, 478, 496, 496, 496, 499, 602, 709, 494, + 709, 496, 496, 624, 626, 627, 628, 627, 628, 628, + 808, 808, 285, 808, 403, 270, 36, 488, 495, 845, + 853, 884, 496, 499, 36, 881, 710, 881, 270, 275, + 326, 881, 881, 864, 602, 496, 494, 632, 137, 682, + 683, 36, 496, 632, 496, 496, 496, 169, 496, 496, + 499, 496, 497, 308, 673, 496, 633, 633, 632, 11, + 16, 17, 18, 195, 217, 287, 482, 483, 484, 486, + 487, 488, 489, 490, 491, 660, 633, 496, 496, 164, + 169, 676, 677, 499, 496, 36, 678, 665, 678, 678, + 169, 496, 36, 703, 704, 495, 632, 697, 689, 632, + 654, 632, 496, 496, 478, 633, 633, 143, 665, 169, + 130, 157, 275, 280, 421, 432, 495, 143, 663, 632, + 400, 690, 632, 679, 632, 414, 495, 522, 495, 495, + 153, 641, 407, 409, 407, 409, 702, 403, 531, 531, + 531, 227, 356, 495, 522, 580, 581, 582, 583, 590, + 591, 635, 637, 638, 711, 454, 596, 536, 696, 596, + 709, 631, 718, 520, 480, 541, 541, 539, 287, 658, + 661, 541, 4, 709, 557, 286, 436, 554, 499, 241, + 581, 454, 511, 711, 444, 402, 437, 823, 711, 818, + 827, 285, 820, 824, 831, 689, 499, 579, 484, 414, + 632, 270, 796, 495, 150, 495, 773, 198, 793, 794, + 756, 289, 766, 756, 23, 135, 344, 346, 374, 739, + 740, 741, 747, 748, 150, 808, 150, 808, 763, 778, + 763, 496, 499, 710, 759, 484, 497, 496, 499, 414, + 360, 86, 414, 803, 360, 414, 414, 414, 360, 535, + 535, 535, 668, 277, 277, 496, 494, 391, 392, 710, + 891, 788, 882, 702, 36, 495, 789, 750, 342, 403, + 710, 859, 860, 793, 702, 515, 702, 705, 457, 514, + 702, 496, 499, 283, 768, 283, 285, 767, 768, 36, + 496, 403, 632, 150, 702, 496, 603, 709, 622, 622, + 603, 711, 494, 494, 716, 150, 845, 879, 890, 885, + 710, 710, 275, 793, 488, 793, 710, 710, 411, 632, + 141, 602, 496, 632, 632, 663, 632, 676, 602, 633, + 633, 633, 633, 130, 270, 280, 633, 633, 633, 633, + 633, 633, 633, 633, 633, 633, 632, 632, 677, 676, + 602, 496, 496, 496, 665, 602, 499, 496, 632, 697, + 698, 699, 36, 496, 631, 632, 33, 33, 632, 496, + 632, 169, 495, 669, 632, 496, 143, 633, 633, 143, + 143, 632, 632, 537, 454, 295, 645, 531, 531, 531, + 531, 702, 702, 702, 522, 591, 169, 522, 582, 583, + 36, 584, 585, 711, 499, 94, 170, 204, 220, 230, + 264, 351, 587, 585, 36, 584, 586, 711, 481, 595, + 688, 632, 178, 559, 535, 700, 559, 496, 496, 161, + 226, 495, 541, 286, 702, 632, 348, 822, 443, 689, + 496, 499, 84, 822, 496, 499, 819, 511, 632, 705, + 496, 150, 794, 780, 794, 756, 783, 499, 496, 117, + 202, 268, 270, 779, 495, 790, 173, 115, 187, 270, + 768, 852, 107, 115, 173, 270, 390, 393, 768, 854, + 374, 741, 425, 705, 711, 745, 3, 44, 50, 74, + 82, 94, 101, 168, 170, 174, 190, 204, 217, 218, + 220, 230, 232, 244, 264, 269, 273, 287, 294, 296, + 351, 375, 379, 396, 405, 424, 448, 486, 487, 602, + 661, 710, 713, 757, 795, 853, 893, 899, 720, 792, + 705, 705, 705, 705, 705, 705, 705, 705, 705, 705, + 496, 496, 496, 536, 852, 891, 495, 521, 787, 872, + 800, 188, 702, 496, 499, 496, 849, 36, 495, 833, + 107, 268, 777, 775, 784, 79, 521, 521, 783, 438, + 869, 494, 602, 808, 515, 496, 499, 793, 632, 496, + 496, 677, 169, 130, 280, 495, 496, 496, 499, 496, + 711, 632, 632, 632, 669, 496, 632, 33, 33, 632, + 632, 143, 496, 496, 632, 495, 646, 711, 702, 702, + 702, 702, 585, 586, 495, 496, 711, 712, 405, 550, + 551, 495, 582, 220, 294, 588, 582, 588, 220, 587, + 588, 220, 551, 495, 711, 551, 495, 292, 54, 182, + 568, 496, 568, 710, 663, 692, 521, 298, 521, 818, + 285, 495, 816, 484, 831, 822, 756, 780, 496, 496, + 457, 786, 118, 191, 200, 117, 440, 763, 781, 67, + 73, 86, 115, 117, 173, 202, 270, 275, 318, 334, + 431, 438, 761, 762, 774, 30, 54, 801, 188, 275, + 853, 632, 801, 275, 486, 487, 856, 711, 602, 808, + 808, 244, 396, 713, 717, 484, 414, 414, 535, 883, + 438, 878, 880, 793, 514, 496, 36, 403, 270, 495, + 710, 872, 149, 521, 787, 514, 107, 147, 196, 767, + 120, 135, 317, 457, 517, 285, 711, 868, 495, 36, + 890, 633, 169, 495, 669, 697, 496, 632, 632, 632, + 496, 647, 711, 592, 593, 637, 584, 495, 4, 9, + 546, 548, 549, 711, 704, 582, 285, 438, 589, 582, + 220, 582, 597, 598, 711, 495, 597, 711, 27, 96, + 179, 354, 488, 495, 560, 561, 562, 563, 564, 565, + 566, 632, 632, 456, 642, 710, 642, 496, 499, 823, + 86, 495, 637, 711, 821, 830, 131, 632, 334, 786, + 495, 776, 756, 496, 499, 495, 716, 705, 633, 801, + 118, 191, 117, 275, 222, 702, 786, 81, 115, 36, + 150, 73, 599, 717, 490, 757, 705, 705, 496, 852, + 122, 496, 775, 521, 702, 150, 36, 705, 514, 496, + 27, 78, 87, 116, 187, 199, 390, 393, 771, 771, + 356, 356, 59, 67, 236, 702, 830, 633, 669, 496, + 304, 648, 496, 499, 36, 594, 704, 307, 490, 307, + 356, 490, 495, 495, 496, 632, 495, 582, 589, 496, + 499, 602, 597, 496, 495, 376, 495, 496, 499, 643, + 644, 711, 325, 569, 569, 443, 705, 632, 73, 825, + 825, 496, 499, 271, 436, 702, 756, 720, 782, 785, + 763, 632, 270, 762, 36, 786, 789, 705, 187, 716, + 438, 744, 490, 425, 883, 710, 872, 767, 517, 495, + 702, 521, 833, 775, 67, 288, 67, 869, 496, 496, + 54, 536, 595, 592, 495, 496, 711, 546, 704, 598, + 599, 496, 665, 495, 665, 562, 499, 36, 632, 438, + 547, 547, 521, 496, 716, 716, 826, 826, 596, 821, + 374, 789, 484, 496, 499, 496, 187, 246, 798, 495, + 758, 632, 425, 36, 495, 517, 514, 767, 288, 288, + 495, 872, 664, 327, 356, 649, 597, 496, 499, 496, + 496, 496, 561, 496, 644, 646, 358, 825, 540, 540, + 829, 798, 757, 785, 268, 769, 758, 170, 303, 380, + 285, 764, 765, 791, 851, 521, 830, 596, 48, 97, + 427, 632, 650, 651, 650, 496, 496, 9, 341, 552, + 496, 549, 826, 541, 541, 596, 765, 200, 120, 436, + 285, 791, 285, 764, 496, 517, 496, 651, 355, 163, + 313, 163, 313, 496, 495, 540, 756, 58, 268, 347, + 374, 760, 760, 872, 33, 9, 541, 22, 115, 275, + 596, 651, 496 }; #define yyerrok (yyerrstatus = 0) @@ -245539,7 +256677,7 @@ while (YYID (0)) we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT -# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +# if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ @@ -246119,7 +257257,7 @@ YYLTYPE yylloc; yyssp = yyss; yyvsp = yyvs; yylsp = yyls; -#if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL +#if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 0; @@ -246308,14 +257446,14 @@ YYLTYPE yylloc; switch (yyn) { case 2: -#line 466 "third_party/libpg_query/grammar/grammar.y" +#line 468 "third_party/libpg_query/grammar/grammar.y" { pg_yyget_extra(yyscanner)->parsetree = (yyvsp[(1) - (1)].list); ;} break; case 3: -#line 482 "third_party/libpg_query/grammar/grammar.y" +#line 484 "third_party/libpg_query/grammar/grammar.y" { if ((yyvsp[(1) - (3)].list) != NIL) { @@ -246330,7 +257468,7 @@ YYLTYPE yylloc; break; case 4: -#line 494 "third_party/libpg_query/grammar/grammar.y" +#line 496 "third_party/libpg_query/grammar/grammar.y" { if ((yyvsp[(1) - (1)].node) != NULL) (yyval.list) = list_make1(makeRawStmt((yyvsp[(1) - (1)].node), 0)); @@ -246340,7899 +257478,8712 @@ YYLTYPE yylloc; break; case 39: -#line 537 "third_party/libpg_query/grammar/grammar.y" +#line 539 "third_party/libpg_query/grammar/grammar.y" { (yyval.node) = NULL; ;} break; case 40: -#line 10 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 9 "third_party/libpg_query/grammar/statements/delete.y" { - PGAlterTableStmt *n = makeNode(PGAlterTableStmt); - n->relation = (yyvsp[(3) - (4)].range); - n->cmds = (yyvsp[(4) - (4)].list); - n->relkind = PG_OBJECT_TABLE; - n->missing_ok = false; + PGDeleteStmt *n = makeNode(PGDeleteStmt); + n->relation = (yyvsp[(4) - (7)].range); + n->usingClause = (yyvsp[(5) - (7)].list); + n->whereClause = (yyvsp[(6) - (7)].node); + n->returningList = (yyvsp[(7) - (7)].list); + n->withClause = (yyvsp[(1) - (7)].with); (yyval.node) = (PGNode *)n; ;} break; case 41: -#line 19 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 22 "third_party/libpg_query/grammar/statements/delete.y" { - PGAlterTableStmt *n = makeNode(PGAlterTableStmt); - n->relation = (yyvsp[(5) - (6)].range); - n->cmds = (yyvsp[(6) - (6)].list); - n->relkind = PG_OBJECT_TABLE; - n->missing_ok = true; - (yyval.node) = (PGNode *)n; + (yyval.range) = (yyvsp[(1) - (1)].range); ;} break; case 42: -#line 28 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 26 "third_party/libpg_query/grammar/statements/delete.y" { - PGAlterTableStmt *n = makeNode(PGAlterTableStmt); - n->relation = (yyvsp[(3) - (4)].range); - n->cmds = (yyvsp[(4) - (4)].list); - n->relkind = PG_OBJECT_INDEX; - n->missing_ok = false; - (yyval.node) = (PGNode *)n; + PGAlias *alias = makeNode(PGAlias); + alias->aliasname = (yyvsp[(2) - (2)].str); + (yyvsp[(1) - (2)].range)->alias = alias; + (yyval.range) = (yyvsp[(1) - (2)].range); ;} break; case 43: -#line 37 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 33 "third_party/libpg_query/grammar/statements/delete.y" { - PGAlterTableStmt *n = makeNode(PGAlterTableStmt); - n->relation = (yyvsp[(5) - (6)].range); - n->cmds = (yyvsp[(6) - (6)].list); - n->relkind = PG_OBJECT_INDEX; - n->missing_ok = true; - (yyval.node) = (PGNode *)n; + PGAlias *alias = makeNode(PGAlias); + alias->aliasname = (yyvsp[(3) - (3)].str); + (yyvsp[(1) - (3)].range)->alias = alias; + (yyval.range) = (yyvsp[(1) - (3)].range); ;} break; case 44: -#line 46 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableStmt *n = makeNode(PGAlterTableStmt); - n->relation = (yyvsp[(3) - (4)].range); - n->cmds = (yyvsp[(4) - (4)].list); - n->relkind = PG_OBJECT_SEQUENCE; - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} +#line 43 "third_party/libpg_query/grammar/statements/delete.y" + { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; case 45: -#line 55 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableStmt *n = makeNode(PGAlterTableStmt); - n->relation = (yyvsp[(5) - (6)].range); - n->cmds = (yyvsp[(6) - (6)].list); - n->relkind = PG_OBJECT_SEQUENCE; - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} +#line 44 "third_party/libpg_query/grammar/statements/delete.y" + { (yyval.node) = NULL; ;} break; case 46: -#line 64 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableStmt *n = makeNode(PGAlterTableStmt); - n->relation = (yyvsp[(3) - (4)].range); - n->cmds = (yyvsp[(4) - (4)].list); - n->relkind = PG_OBJECT_VIEW; - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} +#line 50 "third_party/libpg_query/grammar/statements/delete.y" + { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; case 47: -#line 73 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableStmt *n = makeNode(PGAlterTableStmt); - n->relation = (yyvsp[(5) - (6)].range); - n->cmds = (yyvsp[(6) - (6)].list); - n->relkind = PG_OBJECT_VIEW; - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} +#line 51 "third_party/libpg_query/grammar/statements/delete.y" + { (yyval.list) = NIL; ;} break; case 48: -#line 86 "third_party/libpg_query/grammar/statements/alter_table.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} +#line 12 "third_party/libpg_query/grammar/statements/create_as.y" + { + PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); + ctas->query = (yyvsp[(6) - (7)].node); + ctas->into = (yyvsp[(4) - (7)].into); + ctas->relkind = PG_OBJECT_TABLE; + ctas->is_select_into = false; + ctas->onconflict = PG_ERROR_ON_CONFLICT; + /* cram additional flags into the PGIntoClause */ + (yyvsp[(4) - (7)].into)->rel->relpersistence = (yyvsp[(2) - (7)].ival); + (yyvsp[(4) - (7)].into)->skipData = !((yyvsp[(7) - (7)].boolean)); + (yyval.node) = (PGNode *) ctas; + ;} break; case 49: -#line 88 "third_party/libpg_query/grammar/statements/alter_table.y" - { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].defelt)); ;} +#line 25 "third_party/libpg_query/grammar/statements/create_as.y" + { + PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); + ctas->query = (yyvsp[(9) - (10)].node); + ctas->into = (yyvsp[(7) - (10)].into); + ctas->relkind = PG_OBJECT_TABLE; + ctas->is_select_into = false; + ctas->onconflict = PG_IGNORE_ON_CONFLICT; + /* cram additional flags into the PGIntoClause */ + (yyvsp[(7) - (10)].into)->rel->relpersistence = (yyvsp[(2) - (10)].ival); + (yyvsp[(7) - (10)].into)->skipData = !((yyvsp[(10) - (10)].boolean)); + (yyval.node) = (PGNode *) ctas; + ;} break; case 50: -#line 93 "third_party/libpg_query/grammar/statements/alter_table.y" - { (yyval.node) = (yyvsp[(3) - (3)].node); ;} +#line 38 "third_party/libpg_query/grammar/statements/create_as.y" + { + PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); + ctas->query = (yyvsp[(8) - (9)].node); + ctas->into = (yyvsp[(6) - (9)].into); + ctas->relkind = PG_OBJECT_TABLE; + ctas->is_select_into = false; + ctas->onconflict = PG_REPLACE_ON_CONFLICT; + /* cram additional flags into the PGIntoClause */ + (yyvsp[(6) - (9)].into)->rel->relpersistence = (yyvsp[(4) - (9)].ival); + (yyvsp[(6) - (9)].into)->skipData = !((yyvsp[(9) - (9)].boolean)); + (yyval.node) = (PGNode *) ctas; + ;} break; case 51: -#line 94 "third_party/libpg_query/grammar/statements/alter_table.y" - { (yyval.node) = NULL; ;} +#line 54 "third_party/libpg_query/grammar/statements/create_as.y" + { (yyval.boolean) = true; ;} break; case 52: -#line 100 "third_party/libpg_query/grammar/statements/alter_table.y" - { - (yyval.defelt) = makeDefElem("restart", NULL, (yylsp[(1) - (1)])); - ;} +#line 55 "third_party/libpg_query/grammar/statements/create_as.y" + { (yyval.boolean) = false; ;} break; case 53: -#line 104 "third_party/libpg_query/grammar/statements/alter_table.y" - { - (yyval.defelt) = makeDefElem("restart", (PGNode *)(yyvsp[(3) - (3)].value), (yylsp[(1) - (3)])); - ;} +#line 56 "third_party/libpg_query/grammar/statements/create_as.y" + { (yyval.boolean) = true; ;} break; case 54: -#line 108 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 62 "third_party/libpg_query/grammar/statements/create_as.y" { - if (strcmp((yyvsp[(2) - (2)].defelt)->defname, "as") == 0 || - strcmp((yyvsp[(2) - (2)].defelt)->defname, "restart") == 0 || - strcmp((yyvsp[(2) - (2)].defelt)->defname, "owned_by") == 0) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("sequence option \"%s\" not supported here", (yyvsp[(2) - (2)].defelt)->defname), - parser_errposition((yylsp[(2) - (2)])))); - (yyval.defelt) = (yyvsp[(2) - (2)].defelt); + (yyval.into) = makeNode(PGIntoClause); + (yyval.into)->rel = (yyvsp[(1) - (4)].range); + (yyval.into)->colNames = (yyvsp[(2) - (4)].list); + (yyval.into)->options = (yyvsp[(3) - (4)].list); + (yyval.into)->onCommit = (yyvsp[(4) - (4)].oncommit); + (yyval.into)->viewQuery = NULL; + (yyval.into)->skipData = false; /* might get changed later */ ;} break; case 55: -#line 119 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 10 "third_party/libpg_query/grammar/statements/view.y" { - (yyval.defelt) = makeDefElem("generated", (PGNode *) makeInteger((yyvsp[(3) - (3)].ival)), (yylsp[(1) - (3)])); + PGViewStmt *n = makeNode(PGViewStmt); + n->view = (yyvsp[(4) - (9)].range); + n->view->relpersistence = (yyvsp[(2) - (9)].ival); + n->aliases = (yyvsp[(5) - (9)].list); + n->query = (yyvsp[(8) - (9)].node); + n->onconflict = PG_ERROR_ON_CONFLICT; + n->options = (yyvsp[(6) - (9)].list); + n->withCheckOption = (yyvsp[(9) - (9)].viewcheckoption); + (yyval.node) = (PGNode *) n; ;} break; case 56: -#line 127 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 23 "third_party/libpg_query/grammar/statements/view.y" { - (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); + PGViewStmt *n = makeNode(PGViewStmt); + n->view = (yyvsp[(6) - (11)].range); + n->view->relpersistence = (yyvsp[(4) - (11)].ival); + n->aliases = (yyvsp[(7) - (11)].list); + n->query = (yyvsp[(10) - (11)].node); + n->onconflict = PG_REPLACE_ON_CONFLICT; + n->options = (yyvsp[(8) - (11)].list); + n->withCheckOption = (yyvsp[(11) - (11)].viewcheckoption); + (yyval.node) = (PGNode *) n; ;} break; case 57: -#line 131 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 36 "third_party/libpg_query/grammar/statements/view.y" { - (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); + PGViewStmt *n = makeNode(PGViewStmt); + n->view = (yyvsp[(5) - (12)].range); + n->view->relpersistence = (yyvsp[(2) - (12)].ival); + n->aliases = (yyvsp[(7) - (12)].list); + n->query = makeRecursiveViewSelect(n->view->relname, n->aliases, (yyvsp[(11) - (12)].node)); + n->onconflict = PG_ERROR_ON_CONFLICT; + n->options = (yyvsp[(9) - (12)].list); + n->withCheckOption = (yyvsp[(12) - (12)].viewcheckoption); + if (n->withCheckOption != PG_NO_CHECK_OPTION) + ereport(ERROR, + (errcode(PG_ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("WITH CHECK OPTION not supported on recursive views"), + parser_errposition((yylsp[(12) - (12)])))); + (yyval.node) = (PGNode *) n; ;} break; case 58: -#line 140 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 54 "third_party/libpg_query/grammar/statements/view.y" { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_AddColumn; - n->def = (yyvsp[(2) - (2)].node); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; + PGViewStmt *n = makeNode(PGViewStmt); + n->view = (yyvsp[(7) - (14)].range); + n->view->relpersistence = (yyvsp[(4) - (14)].ival); + n->aliases = (yyvsp[(9) - (14)].list); + n->query = makeRecursiveViewSelect(n->view->relname, n->aliases, (yyvsp[(13) - (14)].node)); + n->onconflict = PG_REPLACE_ON_CONFLICT; + n->options = (yyvsp[(11) - (14)].list); + n->withCheckOption = (yyvsp[(14) - (14)].viewcheckoption); + if (n->withCheckOption != PG_NO_CHECK_OPTION) + ereport(ERROR, + (errcode(PG_ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("WITH CHECK OPTION not supported on recursive views"), + parser_errposition((yylsp[(14) - (14)])))); + (yyval.node) = (PGNode *) n; ;} break; case 59: -#line 149 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_AddColumn; - n->def = (yyvsp[(5) - (5)].node); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} +#line 74 "third_party/libpg_query/grammar/statements/view.y" + { (yyval.viewcheckoption) = CASCADED_CHECK_OPTION; ;} break; case 60: -#line 158 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_AddColumn; - n->def = (yyvsp[(3) - (3)].node); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} +#line 75 "third_party/libpg_query/grammar/statements/view.y" + { (yyval.viewcheckoption) = CASCADED_CHECK_OPTION; ;} break; case 61: -#line 167 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_AddColumn; - n->def = (yyvsp[(6) - (6)].node); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} +#line 76 "third_party/libpg_query/grammar/statements/view.y" + { (yyval.viewcheckoption) = PG_LOCAL_CHECK_OPTION; ;} break; case 62: -#line 176 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_ColumnDefault; - n->name = (yyvsp[(3) - (4)].str); - n->def = (yyvsp[(4) - (4)].node); - (yyval.node) = (PGNode *)n; - ;} +#line 77 "third_party/libpg_query/grammar/statements/view.y" + { (yyval.viewcheckoption) = PG_NO_CHECK_OPTION; ;} break; case 63: -#line 185 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 8 "third_party/libpg_query/grammar/statements/prepare.y" { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_DropNotNull; - n->name = (yyvsp[(3) - (6)].str); - (yyval.node) = (PGNode *)n; + PGPrepareStmt *n = makeNode(PGPrepareStmt); + n->name = (yyvsp[(2) - (5)].str); + n->argtypes = (yyvsp[(3) - (5)].list); + n->query = (yyvsp[(5) - (5)].node); + (yyval.node) = (PGNode *) n; ;} break; case 64: -#line 193 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_SetNotNull; - n->name = (yyvsp[(3) - (6)].str); - (yyval.node) = (PGNode *)n; - ;} +#line 18 "third_party/libpg_query/grammar/statements/prepare.y" + { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; case 65: -#line 201 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_SetStatistics; - n->name = (yyvsp[(3) - (6)].str); - n->def = (PGNode *) makeInteger((yyvsp[(6) - (6)].ival)); - (yyval.node) = (PGNode *)n; - ;} - break; - - case 66: -#line 210 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_SetOptions; - n->name = (yyvsp[(3) - (5)].str); - n->def = (PGNode *) (yyvsp[(5) - (5)].list); - (yyval.node) = (PGNode *)n; - ;} - break; - - case 67: -#line 219 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_ResetOptions; - n->name = (yyvsp[(3) - (5)].str); - n->def = (PGNode *) (yyvsp[(5) - (5)].list); - (yyval.node) = (PGNode *)n; - ;} - break; - - case 68: -#line 228 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_SetStorage; - n->name = (yyvsp[(3) - (6)].str); - n->def = (PGNode *) makeString((yyvsp[(6) - (6)].str)); - (yyval.node) = (PGNode *)n; - ;} - break; - - case 69: -#line 237 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - PGConstraint *c = makeNode(PGConstraint); - - c->contype = PG_CONSTR_IDENTITY; - c->generated_when = (yyvsp[(6) - (9)].ival); - c->options = (yyvsp[(9) - (9)].list); - c->location = (yylsp[(5) - (9)]); - - n->subtype = PG_AT_AddIdentity; - n->name = (yyvsp[(3) - (9)].str); - n->def = (PGNode *) c; - - (yyval.node) = (PGNode *)n; - ;} - break; - - case 70: -#line 254 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_SetIdentity; - n->name = (yyvsp[(3) - (4)].str); - n->def = (PGNode *) (yyvsp[(4) - (4)].list); - (yyval.node) = (PGNode *)n; - ;} - break; - - case 71: -#line 263 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = AT_DropIdentity; - n->name = (yyvsp[(3) - (5)].str); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} +#line 19 "third_party/libpg_query/grammar/statements/prepare.y" + { (yyval.list) = NIL; ;} break; case 72: -#line 272 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = AT_DropIdentity; - n->name = (yyvsp[(3) - (7)].str); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} +#line 52 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; case 73: -#line 281 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_DropColumn; - n->name = (yyvsp[(5) - (6)].str); - n->behavior = (yyvsp[(6) - (6)].dbehavior); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} +#line 53 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; case 74: -#line 291 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_DropColumn; - n->name = (yyvsp[(3) - (4)].str); - n->behavior = (yyvsp[(4) - (4)].dbehavior); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} +#line 68 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; case 75: -#line 304 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 70 "third_party/libpg_query/grammar/statements/select.y" { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - PGColumnDef *def = makeNode(PGColumnDef); - n->subtype = PG_AT_AlterColumnType; - n->name = (yyvsp[(3) - (8)].str); - n->def = (PGNode *) def; - /* We only use these fields of the PGColumnDef node */ - def->typeName = (yyvsp[(6) - (8)].typnam); - def->collClause = (PGCollateClause *) (yyvsp[(7) - (8)].node); - def->raw_default = (yyvsp[(8) - (8)].node); - def->location = (yylsp[(3) - (8)]); - (yyval.node) = (PGNode *)n; + insertSelectOptions((PGSelectStmt *) (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].list), NIL, + NULL, NULL, NULL, + yyscanner); + (yyval.node) = (yyvsp[(1) - (2)].node); ;} break; case 76: -#line 319 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 77 "third_party/libpg_query/grammar/statements/select.y" { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_AlterColumnGenericOptions; - n->name = (yyvsp[(3) - (4)].str); - n->def = (PGNode *) (yyvsp[(4) - (4)].list); - (yyval.node) = (PGNode *)n; + insertSelectOptions((PGSelectStmt *) (yyvsp[(1) - (4)].node), (yyvsp[(2) - (4)].list), (yyvsp[(3) - (4)].list), + (PGNode*) list_nth((yyvsp[(4) - (4)].list), 0), (PGNode*) list_nth((yyvsp[(4) - (4)].list), 1), + NULL, + yyscanner); + (yyval.node) = (yyvsp[(1) - (4)].node); ;} break; case 77: -#line 328 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 85 "third_party/libpg_query/grammar/statements/select.y" { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_AddConstraint; - n->def = (yyvsp[(2) - (2)].node); - (yyval.node) = (PGNode *)n; + insertSelectOptions((PGSelectStmt *) (yyvsp[(1) - (4)].node), (yyvsp[(2) - (4)].list), (yyvsp[(4) - (4)].list), + (PGNode*) list_nth((yyvsp[(3) - (4)].list), 0), (PGNode*) list_nth((yyvsp[(3) - (4)].list), 1), + NULL, + yyscanner); + (yyval.node) = (yyvsp[(1) - (4)].node); ;} break; case 78: -#line 336 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 93 "third_party/libpg_query/grammar/statements/select.y" { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - PGConstraint *c = makeNode(PGConstraint); - n->subtype = PG_AT_AlterConstraint; - n->def = (PGNode *) c; - c->contype = PG_CONSTR_FOREIGN; /* others not supported, yet */ - c->conname = (yyvsp[(3) - (4)].str); - processCASbits((yyvsp[(4) - (4)].ival), (yylsp[(4) - (4)]), "ALTER CONSTRAINT statement", - &c->deferrable, - &c->initdeferred, - NULL, NULL, yyscanner); - (yyval.node) = (PGNode *)n; + insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (2)].node), NULL, NIL, + NULL, NULL, + (yyvsp[(1) - (2)].with), + yyscanner); + (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; case 79: -#line 351 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 101 "third_party/libpg_query/grammar/statements/select.y" { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_ValidateConstraint; - n->name = (yyvsp[(3) - (3)].str); - (yyval.node) = (PGNode *)n; + insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (3)].node), (yyvsp[(3) - (3)].list), NIL, + NULL, NULL, + (yyvsp[(1) - (3)].with), + yyscanner); + (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; case 80: -#line 359 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 109 "third_party/libpg_query/grammar/statements/select.y" { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_DropConstraint; - n->name = (yyvsp[(5) - (6)].str); - n->behavior = (yyvsp[(6) - (6)].dbehavior); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; + insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (5)].node), (yyvsp[(3) - (5)].list), (yyvsp[(4) - (5)].list), + (PGNode*) list_nth((yyvsp[(5) - (5)].list), 0), (PGNode*) list_nth((yyvsp[(5) - (5)].list), 1), + (yyvsp[(1) - (5)].with), + yyscanner); + (yyval.node) = (yyvsp[(2) - (5)].node); ;} break; case 81: -#line 369 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 117 "third_party/libpg_query/grammar/statements/select.y" { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_DropConstraint; - n->name = (yyvsp[(3) - (4)].str); - n->behavior = (yyvsp[(4) - (4)].dbehavior); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; + insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (5)].node), (yyvsp[(3) - (5)].list), (yyvsp[(5) - (5)].list), + (PGNode*) list_nth((yyvsp[(4) - (5)].list), 0), (PGNode*) list_nth((yyvsp[(4) - (5)].list), 1), + (yyvsp[(1) - (5)].with), + yyscanner); + (yyval.node) = (yyvsp[(2) - (5)].node); ;} break; case 82: -#line 379 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_SetLogged; - (yyval.node) = (PGNode *)n; - ;} +#line 127 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; case 83: -#line 386 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_SetUnLogged; - (yyval.node) = (PGNode *)n; - ;} +#line 128 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; case 84: -#line 393 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 158 "third_party/libpg_query/grammar/statements/select.y" { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_SetRelOptions; - n->def = (PGNode *)(yyvsp[(2) - (2)].list); + PGSelectStmt *n = makeNode(PGSelectStmt); + n->targetList = (yyvsp[(3) - (11)].list); + n->intoClause = (yyvsp[(4) - (11)].into); + n->fromClause = (yyvsp[(5) - (11)].list); + n->whereClause = (yyvsp[(6) - (11)].node); + n->groupClause = (yyvsp[(7) - (11)].list); + n->havingClause = (yyvsp[(8) - (11)].node); + n->windowClause = (yyvsp[(9) - (11)].list); + n->qualifyClause = (yyvsp[(10) - (11)].node); + n->sampleOptions = (yyvsp[(11) - (11)].node); (yyval.node) = (PGNode *)n; ;} break; case 85: -#line 401 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 174 "third_party/libpg_query/grammar/statements/select.y" { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_ResetRelOptions; - n->def = (PGNode *)(yyvsp[(2) - (2)].list); + PGSelectStmt *n = makeNode(PGSelectStmt); + n->distinctClause = (yyvsp[(2) - (11)].list); + n->targetList = (yyvsp[(3) - (11)].list); + n->intoClause = (yyvsp[(4) - (11)].into); + n->fromClause = (yyvsp[(5) - (11)].list); + n->whereClause = (yyvsp[(6) - (11)].node); + n->groupClause = (yyvsp[(7) - (11)].list); + n->havingClause = (yyvsp[(8) - (11)].node); + n->windowClause = (yyvsp[(9) - (11)].list); + n->qualifyClause = (yyvsp[(10) - (11)].node); + n->sampleOptions = (yyvsp[(11) - (11)].node); (yyval.node) = (PGNode *)n; ;} break; case 86: -#line 408 "third_party/libpg_query/grammar/statements/alter_table.y" - { - PGAlterTableCmd *n = makeNode(PGAlterTableCmd); - n->subtype = PG_AT_GenericOptions; - n->def = (PGNode *)(yyvsp[(1) - (1)].list); - (yyval.node) = (PGNode *) n; - ;} +#line 188 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; case 87: -#line 418 "third_party/libpg_query/grammar/statements/alter_table.y" - { (yyval.node) = (yyvsp[(2) - (2)].node); ;} +#line 190 "third_party/libpg_query/grammar/statements/select.y" + { + /* same as SELECT * FROM relation_expr */ + PGColumnRef *cr = makeNode(PGColumnRef); + PGResTarget *rt = makeNode(PGResTarget); + PGSelectStmt *n = makeNode(PGSelectStmt); + + cr->fields = list_make1(makeNode(PGAStar)); + cr->location = -1; + + rt->name = NULL; + rt->indirection = NIL; + rt->val = (PGNode *)cr; + rt->location = -1; + + n->targetList = list_make1(rt); + n->fromClause = list_make1((yyvsp[(2) - (2)].range)); + (yyval.node) = (PGNode *)n; + ;} break; case 88: -#line 419 "third_party/libpg_query/grammar/statements/alter_table.y" - { (yyval.node) = NULL; ;} +#line 209 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeSetOp(PG_SETOP_UNION, (yyvsp[(3) - (4)].boolean), (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node)); + ;} break; case 89: -#line 425 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 213 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = (yyvsp[(1) - (1)].defelt); + (yyval.node) = makeSetOp(PG_SETOP_INTERSECT, (yyvsp[(3) - (4)].boolean), (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node)); ;} break; case 90: -#line 429 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 217 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = (yyvsp[(2) - (2)].defelt); - (yyval.defelt)->defaction = PG_DEFELEM_SET; + (yyval.node) = makeSetOp(PG_SETOP_EXCEPT, (yyvsp[(3) - (4)].boolean), (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node)); ;} break; case 91: -#line 434 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 234 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = (yyvsp[(2) - (2)].defelt); - (yyval.defelt)->defaction = PG_DEFELEM_ADD; - ;} + (yyval.with) = makeNode(PGWithClause); + (yyval.with)->ctes = (yyvsp[(2) - (2)].list); + (yyval.with)->recursive = false; + (yyval.with)->location = (yylsp[(1) - (2)]); + ;} break; case 92: -#line 439 "third_party/libpg_query/grammar/statements/alter_table.y" +#line 241 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElemExtended(NULL, (yyvsp[(2) - (2)].str), NULL, DEFELEM_DROP, (yylsp[(2) - (2)])); - ;} + (yyval.with) = makeNode(PGWithClause); + (yyval.with)->ctes = (yyvsp[(2) - (2)].list); + (yyval.with)->recursive = false; + (yyval.with)->location = (yylsp[(1) - (2)]); + ;} break; case 93: -#line 446 "third_party/libpg_query/grammar/statements/alter_table.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} +#line 248 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.with) = makeNode(PGWithClause); + (yyval.with)->ctes = (yyvsp[(3) - (3)].list); + (yyval.with)->recursive = true; + (yyval.with)->location = (yylsp[(1) - (3)]); + ;} break; case 94: -#line 447 "third_party/libpg_query/grammar/statements/alter_table.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} +#line 257 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; case 95: -#line 452 "third_party/libpg_query/grammar/statements/alter_table.y" - { (yyval.list) = (yyvsp[(3) - (4)].list); ;} +#line 258 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; case 96: -#line 456 "third_party/libpg_query/grammar/statements/alter_table.y" - { (yyval.ival) = 1; ;} +#line 262 "third_party/libpg_query/grammar/statements/select.y" + { + PGCommonTableExpr *n = makeNode(PGCommonTableExpr); + n->ctename = (yyvsp[(1) - (6)].str); + n->aliascolnames = (yyvsp[(2) - (6)].list); + n->ctequery = (yyvsp[(5) - (6)].node); + n->location = (yylsp[(1) - (6)]); + (yyval.node) = (PGNode *) n; + ;} break; case 97: -#line 457 "third_party/libpg_query/grammar/statements/alter_table.y" - { (yyval.ival) = 0; ;} +#line 274 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.into) = makeNode(PGIntoClause); + (yyval.into)->rel = (yyvsp[(2) - (2)].range); + (yyval.into)->colNames = NIL; + (yyval.into)->options = NIL; + (yyval.into)->onCommit = PG_ONCOMMIT_NOOP; + (yyval.into)->viewQuery = NULL; + (yyval.into)->skipData = false; + ;} break; case 98: -#line 458 "third_party/libpg_query/grammar/statements/alter_table.y" - { (yyval.ival) = 0; ;} +#line 284 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.into) = NULL; ;} break; case 99: -#line 8 "third_party/libpg_query/grammar/statements/deallocate.y" +#line 293 "third_party/libpg_query/grammar/statements/select.y" { - PGDeallocateStmt *n = makeNode(PGDeallocateStmt); - n->name = (yyvsp[(2) - (2)].str); - (yyval.node) = (PGNode *) n; - ;} + (yyval.range) = (yyvsp[(3) - (3)].range); + (yyval.range)->relpersistence = PG_RELPERSISTENCE_TEMP; + ;} break; case 100: -#line 14 "third_party/libpg_query/grammar/statements/deallocate.y" +#line 298 "third_party/libpg_query/grammar/statements/select.y" { - PGDeallocateStmt *n = makeNode(PGDeallocateStmt); - n->name = (yyvsp[(3) - (3)].str); - (yyval.node) = (PGNode *) n; - ;} + (yyval.range) = (yyvsp[(3) - (3)].range); + (yyval.range)->relpersistence = PG_RELPERSISTENCE_TEMP; + ;} break; case 101: -#line 20 "third_party/libpg_query/grammar/statements/deallocate.y" +#line 303 "third_party/libpg_query/grammar/statements/select.y" { - PGDeallocateStmt *n = makeNode(PGDeallocateStmt); - n->name = NULL; - (yyval.node) = (PGNode *) n; - ;} + (yyval.range) = (yyvsp[(4) - (4)].range); + (yyval.range)->relpersistence = PG_RELPERSISTENCE_TEMP; + ;} break; case 102: -#line 26 "third_party/libpg_query/grammar/statements/deallocate.y" +#line 308 "third_party/libpg_query/grammar/statements/select.y" { - PGDeallocateStmt *n = makeNode(PGDeallocateStmt); - n->name = NULL; - (yyval.node) = (PGNode *) n; - ;} + (yyval.range) = (yyvsp[(4) - (4)].range); + (yyval.range)->relpersistence = PG_RELPERSISTENCE_TEMP; + ;} break; case 103: -#line 8 "third_party/libpg_query/grammar/statements/create_enum.y" +#line 313 "third_party/libpg_query/grammar/statements/select.y" { - PGCreateEnumStmt *n = makeNode(PGCreateEnumStmt); - n->typeName = (yyvsp[(3) - (8)].list); - n->vals = (yyvsp[(7) - (8)].list); - (yyval.node) = (PGNode *)n; + ereport(PGWARNING, + (errmsg("GLOBAL is deprecated in temporary table creation"), + parser_errposition((yylsp[(1) - (4)])))); + (yyval.range) = (yyvsp[(4) - (4)].range); + (yyval.range)->relpersistence = PG_RELPERSISTENCE_TEMP; ;} break; case 104: -#line 17 "third_party/libpg_query/grammar/statements/create_enum.y" - { (yyval.list) = (yyvsp[(1) - (1)].list); ;} +#line 321 "third_party/libpg_query/grammar/statements/select.y" + { + ereport(PGWARNING, + (errmsg("GLOBAL is deprecated in temporary table creation"), + parser_errposition((yylsp[(1) - (4)])))); + (yyval.range) = (yyvsp[(4) - (4)].range); + (yyval.range)->relpersistence = PG_RELPERSISTENCE_TEMP; + ;} break; - case 105: -#line 18 "third_party/libpg_query/grammar/statements/create_enum.y" - { (yyval.list) = NIL; ;} + case 105: +#line 329 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.range) = (yyvsp[(3) - (3)].range); + (yyval.range)->relpersistence = PG_RELPERSISTENCE_UNLOGGED; + ;} break; case 106: -#line 22 "third_party/libpg_query/grammar/statements/create_enum.y" - { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} +#line 334 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.range) = (yyvsp[(2) - (2)].range); + (yyval.range)->relpersistence = RELPERSISTENCE_PERMANENT; + ;} break; case 107: -#line 24 "third_party/libpg_query/grammar/statements/create_enum.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeString((yyvsp[(3) - (3)].str))); ;} +#line 339 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.range) = (yyvsp[(1) - (1)].range); + (yyval.range)->relpersistence = RELPERSISTENCE_PERMANENT; + ;} break; case 108: -#line 7 "third_party/libpg_query/grammar/statements/rename.y" - { - PGRenameStmt *n = makeNode(PGRenameStmt); - n->renameType = PG_OBJECT_SCHEMA; - n->subname = (yyvsp[(3) - (6)].str); - n->newname = (yyvsp[(6) - (6)].str); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} +#line 345 "third_party/libpg_query/grammar/statements/select.y" + {;} break; case 109: -#line 16 "third_party/libpg_query/grammar/statements/rename.y" - { - PGRenameStmt *n = makeNode(PGRenameStmt); - n->renameType = PG_OBJECT_TABLE; - n->relation = (yyvsp[(3) - (6)].range); - n->subname = NULL; - n->newname = (yyvsp[(6) - (6)].str); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} +#line 346 "third_party/libpg_query/grammar/statements/select.y" + {;} break; case 110: -#line 26 "third_party/libpg_query/grammar/statements/rename.y" - { - PGRenameStmt *n = makeNode(PGRenameStmt); - n->renameType = PG_OBJECT_TABLE; - n->relation = (yyvsp[(5) - (8)].range); - n->subname = NULL; - n->newname = (yyvsp[(8) - (8)].str); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} +#line 350 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = true; ;} break; case 111: -#line 36 "third_party/libpg_query/grammar/statements/rename.y" - { - PGRenameStmt *n = makeNode(PGRenameStmt); - n->renameType = PG_OBJECT_SEQUENCE; - n->relation = (yyvsp[(3) - (6)].range); - n->subname = NULL; - n->newname = (yyvsp[(6) - (6)].str); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} +#line 351 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = false; ;} break; case 112: -#line 46 "third_party/libpg_query/grammar/statements/rename.y" - { - PGRenameStmt *n = makeNode(PGRenameStmt); - n->renameType = PG_OBJECT_SEQUENCE; - n->relation = (yyvsp[(5) - (8)].range); - n->subname = NULL; - n->newname = (yyvsp[(8) - (8)].str); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} +#line 352 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = false; ;} break; case 113: -#line 56 "third_party/libpg_query/grammar/statements/rename.y" - { - PGRenameStmt *n = makeNode(PGRenameStmt); - n->renameType = PG_OBJECT_VIEW; - n->relation = (yyvsp[(3) - (6)].range); - n->subname = NULL; - n->newname = (yyvsp[(6) - (6)].str); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} +#line 359 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(NIL); ;} break; case 114: -#line 66 "third_party/libpg_query/grammar/statements/rename.y" - { - PGRenameStmt *n = makeNode(PGRenameStmt); - n->renameType = PG_OBJECT_VIEW; - n->relation = (yyvsp[(5) - (8)].range); - n->subname = NULL; - n->newname = (yyvsp[(8) - (8)].str); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} +#line 360 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(4) - (5)].list); ;} break; case 115: -#line 76 "third_party/libpg_query/grammar/statements/rename.y" - { - PGRenameStmt *n = makeNode(PGRenameStmt); - n->renameType = PG_OBJECT_INDEX; - n->relation = (yyvsp[(3) - (6)].range); - n->subname = NULL; - n->newname = (yyvsp[(6) - (6)].str); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} +#line 364 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL;;} break; case 116: -#line 86 "third_party/libpg_query/grammar/statements/rename.y" - { - PGRenameStmt *n = makeNode(PGRenameStmt); - n->renameType = PG_OBJECT_INDEX; - n->relation = (yyvsp[(5) - (8)].range); - n->subname = NULL; - n->newname = (yyvsp[(8) - (8)].str); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} +#line 365 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} break; case 117: -#line 96 "third_party/libpg_query/grammar/statements/rename.y" - { - PGRenameStmt *n = makeNode(PGRenameStmt); - n->renameType = PG_OBJECT_COLUMN; - n->relationType = PG_OBJECT_TABLE; - n->relation = (yyvsp[(3) - (8)].range); - n->subname = (yyvsp[(6) - (8)].str); - n->newname = (yyvsp[(8) - (8)].str); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} +#line 369 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = true;;} break; case 118: -#line 107 "third_party/libpg_query/grammar/statements/rename.y" - { - PGRenameStmt *n = makeNode(PGRenameStmt); - n->renameType = PG_OBJECT_COLUMN; - n->relationType = PG_OBJECT_TABLE; - n->relation = (yyvsp[(5) - (10)].range); - n->subname = (yyvsp[(8) - (10)].str); - n->newname = (yyvsp[(10) - (10)].str); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} +#line 370 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = false;;} break; case 119: -#line 118 "third_party/libpg_query/grammar/statements/rename.y" - { - PGRenameStmt *n = makeNode(PGRenameStmt); - n->renameType = PG_OBJECT_TABCONSTRAINT; - n->relation = (yyvsp[(3) - (8)].range); - n->subname = (yyvsp[(6) - (8)].str); - n->newname = (yyvsp[(8) - (8)].str); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} +#line 371 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = false; ;} break; case 120: -#line 128 "third_party/libpg_query/grammar/statements/rename.y" - { - PGRenameStmt *n = makeNode(PGRenameStmt); - n->renameType = PG_OBJECT_TABCONSTRAINT; - n->relation = (yyvsp[(5) - (10)].range); - n->subname = (yyvsp[(8) - (10)].str); - n->newname = (yyvsp[(10) - (10)].str); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} +#line 375 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (1)].list);;} break; case 121: -#line 140 "third_party/libpg_query/grammar/statements/rename.y" - { (yyval.ival) = COLUMN; ;} +#line 376 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} break; case 122: -#line 141 "third_party/libpg_query/grammar/statements/rename.y" - { (yyval.ival) = 0; ;} +#line 380 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(3) - (3)].list); ;} break; case 123: -#line 10 "third_party/libpg_query/grammar/statements/insert.y" +#line 382 "third_party/libpg_query/grammar/statements/select.y" { - (yyvsp[(5) - (7)].istmt)->relation = (yyvsp[(4) - (7)].range); - (yyvsp[(5) - (7)].istmt)->onConflictClause = (yyvsp[(6) - (7)].onconflict); - (yyvsp[(5) - (7)].istmt)->returningList = (yyvsp[(7) - (7)].list); - (yyvsp[(5) - (7)].istmt)->withClause = (yyvsp[(1) - (7)].with); - (yyval.node) = (PGNode *) (yyvsp[(5) - (7)].istmt); + PGSortBy *sort = makeNode(PGSortBy); + sort->node = (PGNode *) makeNode(PGAStar); + sort->sortby_dir = (yyvsp[(4) - (5)].sortorder); + sort->sortby_nulls = (yyvsp[(5) - (5)].nullorder); + sort->useOp = NIL; + sort->location = -1; /* no operator */ + (yyval.list) = list_make1(sort); ;} break; case 124: -#line 22 "third_party/libpg_query/grammar/statements/insert.y" +#line 392 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.istmt) = makeNode(PGInsertStmt); - (yyval.istmt)->cols = NIL; - (yyval.istmt)->selectStmt = (yyvsp[(1) - (1)].node); + PGSortBy *sort = makeNode(PGSortBy); + sort->node = (PGNode *) makeNode(PGAStar); + sort->sortby_dir = (yyvsp[(4) - (5)].sortorder); + sort->sortby_nulls = (yyvsp[(5) - (5)].nullorder); + sort->useOp = NIL; + sort->location = -1; /* no operator */ + (yyval.list) = list_make1(sort); ;} break; case 125: -#line 28 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyval.istmt) = makeNode(PGInsertStmt); - (yyval.istmt)->cols = NIL; - (yyval.istmt)->override = (yyvsp[(2) - (4)].override); - (yyval.istmt)->selectStmt = (yyvsp[(4) - (4)].node); - ;} +#line 404 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].sortby)); ;} break; case 126: -#line 35 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyval.istmt) = makeNode(PGInsertStmt); - (yyval.istmt)->cols = (yyvsp[(2) - (4)].list); - (yyval.istmt)->selectStmt = (yyvsp[(4) - (4)].node); - ;} +#line 405 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].sortby)); ;} break; case 127: -#line 41 "third_party/libpg_query/grammar/statements/insert.y" +#line 409 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.istmt) = makeNode(PGInsertStmt); - (yyval.istmt)->cols = (yyvsp[(2) - (7)].list); - (yyval.istmt)->override = (yyvsp[(5) - (7)].override); - (yyval.istmt)->selectStmt = (yyvsp[(7) - (7)].node); + (yyval.sortby) = makeNode(PGSortBy); + (yyval.sortby)->node = (yyvsp[(1) - (4)].node); + (yyval.sortby)->sortby_dir = SORTBY_USING; + (yyval.sortby)->sortby_nulls = (yyvsp[(4) - (4)].nullorder); + (yyval.sortby)->useOp = (yyvsp[(3) - (4)].list); + (yyval.sortby)->location = (yylsp[(3) - (4)]); ;} break; case 128: -#line 48 "third_party/libpg_query/grammar/statements/insert.y" +#line 418 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.istmt) = makeNode(PGInsertStmt); - (yyval.istmt)->cols = NIL; - (yyval.istmt)->selectStmt = NULL; + (yyval.sortby) = makeNode(PGSortBy); + (yyval.sortby)->node = (yyvsp[(1) - (3)].node); + (yyval.sortby)->sortby_dir = (yyvsp[(2) - (3)].sortorder); + (yyval.sortby)->sortby_nulls = (yyvsp[(3) - (3)].nullorder); + (yyval.sortby)->useOp = NIL; + (yyval.sortby)->location = -1; /* no operator */ ;} break; case 129: -#line 58 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyval.range) = (yyvsp[(1) - (1)].range); - ;} +#line 428 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.sortorder) = PG_SORTBY_ASC; ;} break; case 130: -#line 62 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyvsp[(1) - (3)].range)->alias = makeAlias((yyvsp[(3) - (3)].str), NIL); - (yyval.range) = (yyvsp[(1) - (3)].range); - ;} +#line 429 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.sortorder) = PG_SORTBY_DESC; ;} break; case 131: -#line 71 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyval.infer) = makeNode(PGInferClause); - (yyval.infer)->indexElems = (yyvsp[(2) - (4)].list); - (yyval.infer)->whereClause = (yyvsp[(4) - (4)].node); - (yyval.infer)->conname = NULL; - (yyval.infer)->location = (yylsp[(1) - (4)]); - ;} +#line 430 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.sortorder) = PG_SORTBY_DEFAULT; ;} break; case 132: -#line 80 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyval.infer) = makeNode(PGInferClause); - (yyval.infer)->indexElems = NIL; - (yyval.infer)->whereClause = NULL; - (yyval.infer)->conname = (yyvsp[(3) - (3)].str); - (yyval.infer)->location = (yylsp[(1) - (3)]); - ;} +#line 433 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.nullorder) = PG_SORTBY_NULLS_FIRST; ;} break; case 133: -#line 88 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyval.infer) = NULL; - ;} +#line 434 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.nullorder) = PG_SORTBY_NULLS_LAST; ;} break; case 134: -#line 95 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.with) = (yyvsp[(1) - (1)].with); ;} +#line 435 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.nullorder) = PG_SORTBY_NULLS_DEFAULT; ;} break; case 135: -#line 96 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.with) = NULL; ;} +#line 439 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make2((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].node)); ;} break; case 136: -#line 102 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyval.target) = makeNode(PGResTarget); - (yyval.target)->name = (yyvsp[(1) - (2)].str); - (yyval.target)->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); - (yyval.target)->val = NULL; - (yyval.target)->location = (yylsp[(1) - (2)]); - ;} +#line 440 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make2((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node)); ;} break; case 137: -#line 114 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyvsp[(1) - (3)].target)->val = (PGNode *) (yyvsp[(3) - (3)].node); - (yyval.list) = list_make1((yyvsp[(1) - (3)].target)); - ;} +#line 441 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make2(NULL, (yyvsp[(1) - (1)].node)); ;} break; case 138: -#line 119 "third_party/libpg_query/grammar/statements/insert.y" - { - int ncolumns = list_length((yyvsp[(2) - (5)].list)); - int i = 1; - PGListCell *col_cell; - - /* Create a PGMultiAssignRef source for each target */ - foreach(col_cell, (yyvsp[(2) - (5)].list)) - { - PGResTarget *res_col = (PGResTarget *) lfirst(col_cell); - PGMultiAssignRef *r = makeNode(PGMultiAssignRef); - - r->source = (PGNode *) (yyvsp[(5) - (5)].node); - r->colno = i; - r->ncolumns = ncolumns; - res_col->val = (PGNode *) r; - i++; - } - - (yyval.list) = (yyvsp[(2) - (5)].list); - ;} +#line 442 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make2((yyvsp[(1) - (1)].node), NULL); ;} break; case 139: -#line 144 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyval.onconflict) = makeNode(PGOnConflictClause); - (yyval.onconflict)->action = PG_ONCONFLICT_UPDATE; - (yyval.onconflict)->infer = (yyvsp[(3) - (8)].infer); - (yyval.onconflict)->targetList = (yyvsp[(7) - (8)].list); - (yyval.onconflict)->whereClause = (yyvsp[(8) - (8)].node); - (yyval.onconflict)->location = (yylsp[(1) - (8)]); - ;} +#line 446 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; case 140: -#line 154 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyval.onconflict) = makeNode(PGOnConflictClause); - (yyval.onconflict)->action = PG_ONCONFLICT_NOTHING; - (yyval.onconflict)->infer = (yyvsp[(3) - (5)].infer); - (yyval.onconflict)->targetList = NIL; - (yyval.onconflict)->whereClause = NULL; - (yyval.onconflict)->location = (yylsp[(1) - (5)]); - ;} +#line 447 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make2(NULL,NULL); ;} break; case 141: -#line 163 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyval.onconflict) = NULL; - ;} +#line 452 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; case 142: -#line 170 "third_party/libpg_query/grammar/statements/insert.y" +#line 454 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.ielem) = makeNode(PGIndexElem); - (yyval.ielem)->name = (yyvsp[(1) - (5)].str); - (yyval.ielem)->expr = NULL; - (yyval.ielem)->indexcolname = NULL; - (yyval.ielem)->collation = (yyvsp[(2) - (5)].list); - (yyval.ielem)->opclass = (yyvsp[(3) - (5)].list); - (yyval.ielem)->ordering = (yyvsp[(4) - (5)].sortorder); - (yyval.ielem)->nulls_ordering = (yyvsp[(5) - (5)].nullorder); + /* Disabled because it was too confusing, bjm 2002-02-18 */ + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("LIMIT #,# syntax is not supported"), + errhint("Use separate LIMIT and OFFSET clauses."), + parser_errposition((yylsp[(1) - (4)])))); ;} break; case 143: -#line 181 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyval.ielem) = makeNode(PGIndexElem); - (yyval.ielem)->name = NULL; - (yyval.ielem)->expr = (yyvsp[(1) - (5)].node); - (yyval.ielem)->indexcolname = NULL; - (yyval.ielem)->collation = (yyvsp[(2) - (5)].list); - (yyval.ielem)->opclass = (yyvsp[(3) - (5)].list); - (yyval.ielem)->ordering = (yyvsp[(4) - (5)].sortorder); - (yyval.ielem)->nulls_ordering = (yyvsp[(5) - (5)].nullorder); - ;} +#line 470 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(3) - (5)].node); ;} break; case 144: -#line 192 "third_party/libpg_query/grammar/statements/insert.y" - { - (yyval.ielem) = makeNode(PGIndexElem); - (yyval.ielem)->name = NULL; - (yyval.ielem)->expr = (yyvsp[(2) - (7)].node); - (yyval.ielem)->indexcolname = NULL; - (yyval.ielem)->collation = (yyvsp[(4) - (7)].list); - (yyval.ielem)->opclass = (yyvsp[(5) - (7)].list); - (yyval.ielem)->ordering = (yyvsp[(6) - (7)].sortorder); - (yyval.ielem)->nulls_ordering = (yyvsp[(7) - (7)].nullorder); - ;} +#line 472 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeIntConst(1, -1); ;} break; case 145: -#line 206 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = (yyvsp[(2) - (2)].list); ;} +#line 477 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; case 146: -#line 207 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = NIL; ;} +#line 480 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(2) - (3)].node); ;} break; case 147: -#line 213 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.override) = PG_OVERRIDING_USER_VALUE; ;} +#line 488 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeSampleSize(makeFloat((yyvsp[(1) - (2)].str)), true); + ;} break; case 148: -#line 214 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.override) = OVERRIDING_SYSTEM_VALUE; ;} +#line 492 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeSampleSize(makeInteger((yyvsp[(1) - (2)].ival)), true); + ;} break; case 149: -#line 219 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].target)); ;} +#line 496 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeSampleSize(makeFloat((yyvsp[(1) - (2)].str)), true); + ;} break; case 150: -#line 220 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list),(yyvsp[(3) - (3)].target)); ;} +#line 500 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeSampleSize(makeInteger((yyvsp[(1) - (2)].ival)), true); + ;} break; case 151: -#line 226 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = (yyvsp[(2) - (2)].list); ;} +#line 504 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeSampleSize(makeInteger((yyvsp[(1) - (1)].ival)), false); + ;} break; case 152: -#line 227 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = NIL; ;} +#line 508 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeSampleSize(makeInteger((yyvsp[(1) - (2)].ival)), false); + ;} break; case 153: -#line 231 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = (yyvsp[(1) - (1)].list); ;} +#line 515 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = (yyvsp[(3) - (3)].node); + ;} break; case 154: -#line 232 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = NIL; ;} +#line 519 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} break; case 155: -#line 238 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].target)); ;} +#line 526 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; case 156: -#line 240 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].target)); ;} +#line 527 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = NULL; ;} break; case 157: -#line 245 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = (yyvsp[(1) - (1)].list); ;} +#line 532 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeSampleOptions((yyvsp[(3) - (5)].node), (yyvsp[(1) - (5)].str), (yyvsp[(5) - (5)].ival), (yylsp[(1) - (5)])); + ;} break; case 158: -#line 246 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = list_concat((yyvsp[(1) - (3)].list),(yyvsp[(3) - (3)].list)); ;} +#line 536 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeSampleOptions((yyvsp[(1) - (1)].node), NULL, -1, (yylsp[(1) - (1)])); + ;} break; case 159: -#line 250 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].ielem)); ;} +#line 540 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeSampleOptions((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].str), -1, (yylsp[(1) - (4)])); + ;} break; case 160: -#line 251 "third_party/libpg_query/grammar/statements/insert.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].ielem)); ;} +#line 544 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeSampleOptions((yyvsp[(1) - (6)].node), (yyvsp[(3) - (6)].str), (yyvsp[(5) - (6)].ival), (yylsp[(1) - (6)])); + ;} break; case 161: -#line 257 "third_party/libpg_query/grammar/statements/insert.y" +#line 551 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.target) = makeNode(PGResTarget); - (yyval.target)->name = (yyvsp[(1) - (2)].str); - (yyval.target)->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); - (yyval.target)->val = NULL; /* upper production sets this */ - (yyval.target)->location = (yylsp[(1) - (2)]); + (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; case 162: -#line 8 "third_party/libpg_query/grammar/statements/pragma.y" +#line 557 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + break; + + case 163: +#line 558 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} + break; + + case 164: +#line 563 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.ival) = (yyvsp[(3) - (4)].ival); ;} + break; + + case 165: +#line 564 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.ival) = -1; ;} + break; + + case 166: +#line 568 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + break; + + case 167: +#line 570 "third_party/libpg_query/grammar/statements/select.y" { - PGPragmaStmt *n = makeNode(PGPragmaStmt); - n->kind = PG_PRAGMA_TYPE_NOTHING; - n->name = (yyvsp[(2) - (2)].str); - (yyval.node) = (PGNode *)n; + /* LIMIT ALL is represented as a NULL constant */ + (yyval.node) = makeNullAConst((yylsp[(1) - (1)])); ;} break; - case 163: -#line 15 "third_party/libpg_query/grammar/statements/pragma.y" + case 168: +#line 575 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeLimitPercent((yyvsp[(1) - (2)].node)); ;} + break; + + case 169: +#line 577 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeLimitPercent(makeFloatConst((yyvsp[(1) - (2)].str),(yylsp[(1) - (2)]))); ;} + break; + + case 170: +#line 579 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeLimitPercent(makeIntConst((yyvsp[(1) - (2)].ival),(yylsp[(1) - (2)]))); ;} + break; + + case 171: +#line 583 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + break; + + case 172: +#line 603 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + break; + + case 173: +#line 605 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + break; + + case 174: +#line 607 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = doNegate((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + break; + + case 175: +#line 611 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeIntConst((yyvsp[(1) - (1)].ival),(yylsp[(1) - (1)])); ;} + break; + + case 176: +#line 612 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeFloatConst((yyvsp[(1) - (1)].str),(yylsp[(1) - (1)])); ;} + break; + + case 177: +#line 616 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.ival) = 0; ;} + break; + + case 178: +#line 617 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.ival) = 0; ;} + break; + + case 179: +#line 620 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.ival) = 0; ;} + break; + + case 180: +#line 621 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.ival) = 0; ;} + break; + + case 181: +#line 646 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(3) - (3)].list); ;} + break; + + case 182: +#line 648 "third_party/libpg_query/grammar/statements/select.y" { - PGPragmaStmt *n = makeNode(PGPragmaStmt); - n->kind = PG_PRAGMA_TYPE_ASSIGNMENT; - n->name = (yyvsp[(2) - (4)].str); - n->args = (yyvsp[(4) - (4)].list); - (yyval.node) = (PGNode *)n; + PGNode *node = (PGNode *) makeGroupingSet(GROUPING_SET_ALL, NIL, (yylsp[(3) - (3)])); + (yyval.list) = list_make1(node); ;} break; - case 164: -#line 23 "third_party/libpg_query/grammar/statements/pragma.y" + case 183: +#line 653 "third_party/libpg_query/grammar/statements/select.y" { - PGPragmaStmt *n = makeNode(PGPragmaStmt); - n->kind = PG_PRAGMA_TYPE_CALL; - n->name = (yyvsp[(2) - (5)].str); - n->args = (yyvsp[(4) - (5)].list); - (yyval.node) = (PGNode *)n; + PGNode *node = (PGNode *) makeGroupingSet(GROUPING_SET_ALL, NIL, (yylsp[(3) - (3)])); + (yyval.list) = list_make1(node); ;} break; - case 165: -#line 10 "third_party/libpg_query/grammar/statements/create_sequence.y" + case 184: +#line 657 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} + break; + + case 185: +#line 661 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} + break; + + case 186: +#line 662 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list),(yyvsp[(3) - (3)].node)); ;} + break; + + case 187: +#line 666 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} + break; + + case 188: +#line 667 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (2)].list); ;} + break; + + case 189: +#line 671 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + break; + + case 190: +#line 672 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + break; + + case 191: +#line 673 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + break; + + case 192: +#line 674 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + break; + + case 193: +#line 675 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + break; + + case 194: +#line 680 "third_party/libpg_query/grammar/statements/select.y" { - PGCreateSeqStmt *n = makeNode(PGCreateSeqStmt); - (yyvsp[(4) - (5)].range)->relpersistence = (yyvsp[(2) - (5)].ival); - n->sequence = (yyvsp[(4) - (5)].range); - n->options = (yyvsp[(5) - (5)].list); - n->ownerId = InvalidOid; - n->onconflict = PG_ERROR_ON_CONFLICT; - (yyval.node) = (PGNode *)n; + (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_EMPTY, NIL, (yylsp[(1) - (2)])); ;} break; - case 166: -#line 20 "third_party/libpg_query/grammar/statements/create_sequence.y" + case 195: +#line 693 "third_party/libpg_query/grammar/statements/select.y" { - PGCreateSeqStmt *n = makeNode(PGCreateSeqStmt); - (yyvsp[(7) - (8)].range)->relpersistence = (yyvsp[(2) - (8)].ival); - n->sequence = (yyvsp[(7) - (8)].range); - n->options = (yyvsp[(8) - (8)].list); - n->ownerId = InvalidOid; - n->onconflict = PG_IGNORE_ON_CONFLICT; - (yyval.node) = (PGNode *)n; + (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_ROLLUP, (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 167: -#line 32 "third_party/libpg_query/grammar/statements/create_sequence.y" + case 196: +#line 700 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_CUBE, (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); + ;} + break; + + case 197: +#line 707 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_SETS, (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); + ;} + break; + + case 198: +#line 713 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} + break; + + case 199: +#line 714 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} + break; + + case 200: +#line 718 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(2) - (2)].node); ;} + break; + + case 201: +#line 719 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} + break; + + case 202: +#line 723 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(2) - (2)].node); ;} + break; + + case 203: +#line 724 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} + break; + + case 204: +#line 728 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 168: -#line 33 "third_party/libpg_query/grammar/statements/create_sequence.y" + case 205: +#line 729 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 169: -#line 8 "third_party/libpg_query/grammar/statements/execute.y" + case 206: +#line 733 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} + break; + + case 207: +#line 734 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} + break; + + case 208: +#line 738 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} + break; + + case 209: +#line 739 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} + break; + + case 210: +#line 744 "third_party/libpg_query/grammar/statements/select.y" { - PGExecuteStmt *n = makeNode(PGExecuteStmt); - n->name = (yyvsp[(2) - (3)].str); - n->params = (yyvsp[(3) - (3)].list); + PGLockingClause *n = makeNode(PGLockingClause); + n->lockedRels = (yyvsp[(2) - (3)].list); + n->strength = (yyvsp[(1) - (3)].lockstrength); + n->waitPolicy = (yyvsp[(3) - (3)].lockwaitpolicy); (yyval.node) = (PGNode *) n; ;} break; - case 170: -#line 16 "third_party/libpg_query/grammar/statements/execute.y" + case 211: +#line 754 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.lockstrength) = LCS_FORUPDATE; ;} + break; + + case 212: +#line 755 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.lockstrength) = PG_LCS_FORNOKEYUPDATE; ;} + break; + + case 213: +#line 756 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.lockstrength) = PG_LCS_FORSHARE; ;} + break; + + case 214: +#line 757 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.lockstrength) = PG_LCS_FORKEYSHARE; ;} + break; + + case 215: +#line 761 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(2) - (2)].list); ;} + break; + + case 216: +#line 762 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} + break; + + case 217: +#line 767 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.lockwaitpolicy) = LockWaitError; ;} + break; + + case 218: +#line 768 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.lockwaitpolicy) = PGLockWaitSkip; ;} + break; + + case 219: +#line 769 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.lockwaitpolicy) = PGLockWaitBlock; ;} + break; + + case 220: +#line 779 "third_party/libpg_query/grammar/statements/select.y" { - PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); - PGExecuteStmt *n = makeNode(PGExecuteStmt); - n->name = (yyvsp[(7) - (9)].str); - n->params = (yyvsp[(8) - (9)].list); - ctas->query = (PGNode *) n; - ctas->into = (yyvsp[(4) - (9)].into); - ctas->relkind = PG_OBJECT_TABLE; - ctas->is_select_into = false; - ctas->onconflict = PG_ERROR_ON_CONFLICT; - /* cram additional flags into the PGIntoClause */ - (yyvsp[(4) - (9)].into)->rel->relpersistence = (yyvsp[(2) - (9)].ival); - (yyvsp[(4) - (9)].into)->skipData = !((yyvsp[(9) - (9)].boolean)); - (yyval.node) = (PGNode *) ctas; + PGSelectStmt *n = makeNode(PGSelectStmt); + n->valuesLists = list_make1((yyvsp[(3) - (4)].list)); + (yyval.node) = (PGNode *) n; ;} break; - case 171: -#line 33 "third_party/libpg_query/grammar/statements/execute.y" + case 221: +#line 785 "third_party/libpg_query/grammar/statements/select.y" { - PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); - PGExecuteStmt *n = makeNode(PGExecuteStmt); - n->name = (yyvsp[(10) - (12)].str); - n->params = (yyvsp[(11) - (12)].list); - ctas->query = (PGNode *) n; - ctas->into = (yyvsp[(7) - (12)].into); - ctas->relkind = PG_OBJECT_TABLE; - ctas->is_select_into = false; - ctas->onconflict = PG_IGNORE_ON_CONFLICT; - /* cram additional flags into the PGIntoClause */ - (yyvsp[(7) - (12)].into)->rel->relpersistence = (yyvsp[(2) - (12)].ival); - (yyvsp[(7) - (12)].into)->skipData = !((yyvsp[(12) - (12)].boolean)); - (yyval.node) = (PGNode *) ctas; + PGSelectStmt *n = (PGSelectStmt *) (yyvsp[(1) - (5)].node); + n->valuesLists = lappend(n->valuesLists, (yyvsp[(4) - (5)].list)); + (yyval.node) = (PGNode *) n; ;} break; - case 172: -#line 51 "third_party/libpg_query/grammar/statements/execute.y" - { (yyval.list) = (yyvsp[(2) - (3)].list); ;} + case 222: +#line 793 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 173: -#line 52 "third_party/libpg_query/grammar/statements/execute.y" + case 223: +#line 794 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (2)].node); ;} + break; + + case 224: +#line 807 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(2) - (2)].list); ;} + break; + + case 225: +#line 808 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = NIL; ;} break; - case 174: -#line 10 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 226: +#line 812 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} + break; + + case 227: +#line 813 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} + break; + + case 228: +#line 817 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} + break; + + case 229: +#line 818 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (2)].list); ;} + break; + + case 230: +#line 825 "third_party/libpg_query/grammar/statements/select.y" { - PGAlterSeqStmt *n = makeNode(PGAlterSeqStmt); - n->sequence = (yyvsp[(3) - (4)].range); - n->options = (yyvsp[(4) - (4)].list); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; + (yyvsp[(1) - (3)].range)->alias = (yyvsp[(2) - (3)].alias); + (yyvsp[(1) - (3)].range)->sample = (yyvsp[(3) - (3)].node); + (yyval.node) = (PGNode *) (yyvsp[(1) - (3)].range); ;} break; - case 175: -#line 18 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 231: +#line 831 "third_party/libpg_query/grammar/statements/select.y" { - PGAlterSeqStmt *n = makeNode(PGAlterSeqStmt); - n->sequence = (yyvsp[(5) - (6)].range); - n->options = (yyvsp[(6) - (6)].list); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; + PGRangeFunction *n = (PGRangeFunction *) (yyvsp[(1) - (3)].node); + n->alias = (PGAlias*) linitial((yyvsp[(2) - (3)].list)); + n->coldeflist = (PGList*) lsecond((yyvsp[(2) - (3)].list)); + n->sample = (yyvsp[(3) - (3)].node); + (yyval.node) = (PGNode *) n; ;} break; - case 176: -#line 29 "third_party/libpg_query/grammar/statements/alter_sequence.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} + case 232: +#line 839 "third_party/libpg_query/grammar/statements/select.y" + { + PGRangeFunction *n = (PGRangeFunction *) (yyvsp[(2) - (3)].node); + n->lateral = true; + n->alias = (PGAlias*) linitial((yyvsp[(3) - (3)].list)); + n->coldeflist = (PGList*) lsecond((yyvsp[(3) - (3)].list)); + (yyval.node) = (PGNode *) n; + ;} break; - case 177: -#line 30 "third_party/libpg_query/grammar/statements/alter_sequence.y" - { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].defelt)); ;} + case 233: +#line 847 "third_party/libpg_query/grammar/statements/select.y" + { + PGRangeSubselect *n = makeNode(PGRangeSubselect); + n->lateral = false; + n->subquery = (yyvsp[(1) - (3)].node); + n->alias = (yyvsp[(2) - (3)].alias); + n->sample = (yyvsp[(3) - (3)].node); + (yyval.node) = (PGNode *) n; + ;} break; - case 178: -#line 34 "third_party/libpg_query/grammar/statements/alter_sequence.y" - {;} + case 234: +#line 856 "third_party/libpg_query/grammar/statements/select.y" + { + PGRangeSubselect *n = makeNode(PGRangeSubselect); + n->lateral = true; + n->subquery = (yyvsp[(2) - (3)].node); + n->alias = (yyvsp[(3) - (3)].alias); + n->sample = NULL; + (yyval.node) = (PGNode *) n; + ;} break; - case 179: -#line 35 "third_party/libpg_query/grammar/statements/alter_sequence.y" - {;} + case 235: +#line 865 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = (PGNode *) (yyvsp[(1) - (1)].jexpr); + ;} break; - case 180: -#line 36 "third_party/libpg_query/grammar/statements/alter_sequence.y" - {;} + case 236: +#line 869 "third_party/libpg_query/grammar/statements/select.y" + { + (yyvsp[(2) - (4)].jexpr)->alias = (yyvsp[(4) - (4)].alias); + (yyval.node) = (PGNode *) (yyvsp[(2) - (4)].jexpr); + ;} break; - case 181: -#line 41 "third_party/libpg_query/grammar/statements/alter_sequence.y" - { (yyval.value) = makeFloat((yyvsp[(1) - (1)].str)); ;} + case 237: +#line 895 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.jexpr) = (yyvsp[(2) - (3)].jexpr); + ;} break; - case 182: -#line 42 "third_party/libpg_query/grammar/statements/alter_sequence.y" - { (yyval.value) = makeFloat((yyvsp[(2) - (2)].str)); ;} + case 238: +#line 899 "third_party/libpg_query/grammar/statements/select.y" + { + /* CROSS JOIN is same as unqualified inner join */ + PGJoinExpr *n = makeNode(PGJoinExpr); + n->jointype = PG_JOIN_INNER; + n->isNatural = false; + n->larg = (yyvsp[(1) - (4)].node); + n->rarg = (yyvsp[(4) - (4)].node); + n->usingClause = NIL; + n->quals = NULL; + n->location = (yylsp[(2) - (4)]); + (yyval.jexpr) = n; + ;} + break; + + case 239: +#line 912 "third_party/libpg_query/grammar/statements/select.y" + { + PGJoinExpr *n = makeNode(PGJoinExpr); + n->jointype = (yyvsp[(2) - (5)].jtype); + n->isNatural = false; + n->larg = (yyvsp[(1) - (5)].node); + n->rarg = (yyvsp[(4) - (5)].node); + if ((yyvsp[(5) - (5)].node) != NULL && IsA((yyvsp[(5) - (5)].node), PGList)) + n->usingClause = (PGList *) (yyvsp[(5) - (5)].node); /* USING clause */ + else + n->quals = (yyvsp[(5) - (5)].node); /* ON clause */ + n->location = (yylsp[(2) - (5)]); + (yyval.jexpr) = n; + ;} + break; + + case 240: +#line 926 "third_party/libpg_query/grammar/statements/select.y" + { + /* letting join_type reduce to empty doesn't work */ + PGJoinExpr *n = makeNode(PGJoinExpr); + n->jointype = PG_JOIN_INNER; + n->isNatural = false; + n->larg = (yyvsp[(1) - (4)].node); + n->rarg = (yyvsp[(3) - (4)].node); + if ((yyvsp[(4) - (4)].node) != NULL && IsA((yyvsp[(4) - (4)].node), PGList)) + n->usingClause = (PGList *) (yyvsp[(4) - (4)].node); /* USING clause */ + else + n->quals = (yyvsp[(4) - (4)].node); /* ON clause */ + n->location = (yylsp[(2) - (4)]); + (yyval.jexpr) = n; + ;} + break; + + case 241: +#line 941 "third_party/libpg_query/grammar/statements/select.y" + { + PGJoinExpr *n = makeNode(PGJoinExpr); + n->jointype = (yyvsp[(3) - (5)].jtype); + n->isNatural = true; + n->larg = (yyvsp[(1) - (5)].node); + n->rarg = (yyvsp[(5) - (5)].node); + n->usingClause = NIL; /* figure out which columns later... */ + n->quals = NULL; /* fill later */ + n->location = (yylsp[(2) - (5)]); + (yyval.jexpr) = n; + ;} break; - case 183: -#line 44 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 242: +#line 953 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.value) = makeFloat((yyvsp[(2) - (2)].str)); - doNegateFloat((yyval.value)); + /* letting join_type reduce to empty doesn't work */ + PGJoinExpr *n = makeNode(PGJoinExpr); + n->jointype = PG_JOIN_INNER; + n->isNatural = true; + n->larg = (yyvsp[(1) - (4)].node); + n->rarg = (yyvsp[(4) - (4)].node); + n->usingClause = NIL; /* figure out which columns later... */ + n->quals = NULL; /* fill later */ + n->location = (yylsp[(2) - (4)]); + (yyval.jexpr) = n; ;} break; - case 184: -#line 48 "third_party/libpg_query/grammar/statements/alter_sequence.y" - { (yyval.value) = makeInteger((yyvsp[(1) - (1)].ival)); ;} + case 243: +#line 969 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.alias) = makeNode(PGAlias); + (yyval.alias)->aliasname = (yyvsp[(2) - (5)].str); + (yyval.alias)->colnames = (yyvsp[(4) - (5)].list); + ;} break; - case 185: -#line 53 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 244: +#line 975 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("as", (PGNode *)(yyvsp[(2) - (2)].typnam), (yylsp[(1) - (2)])); + (yyval.alias) = makeNode(PGAlias); + (yyval.alias)->aliasname = (yyvsp[(2) - (2)].str); ;} break; - case 186: -#line 57 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 245: +#line 980 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("cache", (PGNode *)(yyvsp[(2) - (2)].value), (yylsp[(1) - (2)])); + (yyval.alias) = makeNode(PGAlias); + (yyval.alias)->aliasname = (yyvsp[(1) - (4)].str); + (yyval.alias)->colnames = (yyvsp[(3) - (4)].list); ;} break; - case 187: -#line 61 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 246: +#line 986 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("cycle", (PGNode *)makeInteger(true), (yylsp[(1) - (1)])); + (yyval.alias) = makeNode(PGAlias); + (yyval.alias)->aliasname = (yyvsp[(1) - (1)].str); ;} break; - case 188: -#line 65 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 247: +#line 992 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.alias) = (yyvsp[(1) - (1)].alias); ;} + break; + + case 248: +#line 993 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.alias) = NULL; ;} + break; + + case 249: +#line 1002 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("cycle", (PGNode *)makeInteger(false), (yylsp[(1) - (2)])); + (yyval.list) = list_make2((yyvsp[(1) - (1)].alias), NIL); ;} break; - case 189: -#line 69 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 250: +#line 1006 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("increment", (PGNode *)(yyvsp[(3) - (3)].value), (yylsp[(1) - (3)])); + (yyval.list) = list_make2(NULL, (yyvsp[(3) - (4)].list)); ;} break; - case 190: -#line 73 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 251: +#line 1010 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("maxvalue", (PGNode *)(yyvsp[(2) - (2)].value), (yylsp[(1) - (2)])); + PGAlias *a = makeNode(PGAlias); + a->aliasname = (yyvsp[(2) - (5)].str); + (yyval.list) = list_make2(a, (yyvsp[(4) - (5)].list)); ;} break; - case 191: -#line 77 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 252: +#line 1016 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("minvalue", (PGNode *)(yyvsp[(2) - (2)].value), (yylsp[(1) - (2)])); + PGAlias *a = makeNode(PGAlias); + a->aliasname = (yyvsp[(1) - (4)].str); + (yyval.list) = list_make2(a, (yyvsp[(3) - (4)].list)); ;} break; - case 192: -#line 81 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 253: +#line 1022 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("maxvalue", NULL, (yylsp[(1) - (2)])); + (yyval.list) = list_make2(NULL, NIL); ;} break; - case 193: -#line 85 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 254: +#line 1027 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.jtype) = PG_JOIN_FULL; ;} + break; + + case 255: +#line 1028 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.jtype) = PG_JOIN_LEFT; ;} + break; + + case 256: +#line 1029 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.jtype) = PG_JOIN_RIGHT; ;} + break; + + case 257: +#line 1030 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.jtype) = PG_JOIN_INNER; ;} + break; + + case 258: +#line 1034 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} + break; + + case 259: +#line 1035 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} + break; + + case 260: +#line 1047 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) (yyvsp[(3) - (4)].list); ;} + break; + + case 261: +#line 1048 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(2) - (2)].node); ;} + break; + + case 262: +#line 1054 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("minvalue", NULL, (yylsp[(1) - (2)])); + /* inheritance query, implicitly */ + (yyval.range) = (yyvsp[(1) - (1)].range); + (yyval.range)->inh = true; + (yyval.range)->alias = NULL; ;} break; - case 194: -#line 89 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 263: +#line 1061 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("owned_by", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); + /* inheritance query, explicitly */ + (yyval.range) = (yyvsp[(1) - (2)].range); + (yyval.range)->inh = true; + (yyval.range)->alias = NULL; ;} break; - case 195: -#line 93 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 264: +#line 1068 "third_party/libpg_query/grammar/statements/select.y" { - /* not documented, only used by pg_dump */ - (yyval.defelt) = makeDefElem("sequence_name", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); + /* no inheritance */ + (yyval.range) = (yyvsp[(2) - (2)].range); + (yyval.range)->inh = false; + (yyval.range)->alias = NULL; ;} break; - case 196: -#line 98 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 265: +#line 1075 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("start", (PGNode *)(yyvsp[(3) - (3)].value), (yylsp[(1) - (3)])); + /* no inheritance, SQL99-style syntax */ + (yyval.range) = (yyvsp[(3) - (4)].range); + (yyval.range)->inh = false; + (yyval.range)->alias = NULL; ;} break; - case 197: -#line 102 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 266: +#line 1107 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("restart", NULL, (yylsp[(1) - (1)])); + PGRangeFunction *n = makeNode(PGRangeFunction); + n->lateral = false; + n->ordinality = (yyvsp[(2) - (2)].boolean); + n->is_rowsfrom = false; + n->functions = list_make1(list_make2((yyvsp[(1) - (2)].node), NIL)); + n->sample = NULL; + /* alias and coldeflist are set by table_ref production */ + (yyval.node) = (PGNode *) n; ;} break; - case 198: -#line 106 "third_party/libpg_query/grammar/statements/alter_sequence.y" + case 267: +#line 1118 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("restart", (PGNode *)(yyvsp[(3) - (3)].value), (yylsp[(1) - (3)])); + PGRangeFunction *n = makeNode(PGRangeFunction); + n->lateral = false; + n->ordinality = (yyvsp[(6) - (6)].boolean); + n->is_rowsfrom = true; + n->functions = (yyvsp[(4) - (6)].list); + n->sample = NULL; + /* alias and coldeflist are set by table_ref production */ + (yyval.node) = (PGNode *) n; ;} break; - case 199: -#line 112 "third_party/libpg_query/grammar/statements/alter_sequence.y" - {;} + case 268: +#line 1131 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make2((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].list)); ;} break; - case 200: -#line 113 "third_party/libpg_query/grammar/statements/alter_sequence.y" - {;} + case 269: +#line 1135 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 201: -#line 117 "third_party/libpg_query/grammar/statements/alter_sequence.y" - { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} + case 270: +#line 1136 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 202: -#line 118 "third_party/libpg_query/grammar/statements/alter_sequence.y" - { (yyval.ival) = + (yyvsp[(2) - (2)].ival); ;} + case 271: +#line 1139 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 203: -#line 119 "third_party/libpg_query/grammar/statements/alter_sequence.y" - { (yyval.ival) = - (yyvsp[(2) - (2)].ival); ;} + case 272: +#line 1140 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} break; - case 204: -#line 3 "third_party/libpg_query/grammar/statements/transaction.y" - { - PGTransactionStmt *n = makeNode(PGTransactionStmt); - n->kind = PG_TRANS_STMT_ROLLBACK; - n->options = NIL; - (yyval.node) = (PGNode *)n; - ;} + case 273: +#line 1143 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = true; ;} break; - case 205: -#line 10 "third_party/libpg_query/grammar/statements/transaction.y" - { - PGTransactionStmt *n = makeNode(PGTransactionStmt); - n->kind = PG_TRANS_STMT_BEGIN; - (yyval.node) = (PGNode *)n; - ;} + case 274: +#line 1144 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = false; ;} break; - case 206: -#line 16 "third_party/libpg_query/grammar/statements/transaction.y" + case 275: +#line 1149 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(2) - (2)].node); ;} + break; + + case 276: +#line 1150 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} + break; + + case 277: +#line 1156 "third_party/libpg_query/grammar/statements/select.y" { - PGTransactionStmt *n = makeNode(PGTransactionStmt); - n->kind = PG_TRANS_STMT_START; - (yyval.node) = (PGNode *)n; + (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 207: -#line 22 "third_party/libpg_query/grammar/statements/transaction.y" + case 278: +#line 1160 "third_party/libpg_query/grammar/statements/select.y" { - PGTransactionStmt *n = makeNode(PGTransactionStmt); - n->kind = PG_TRANS_STMT_COMMIT; - n->options = NIL; - (yyval.node) = (PGNode *)n; + (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 208: -#line 29 "third_party/libpg_query/grammar/statements/transaction.y" + case 279: +#line 1166 "third_party/libpg_query/grammar/statements/select.y" { - PGTransactionStmt *n = makeNode(PGTransactionStmt); - n->kind = PG_TRANS_STMT_COMMIT; - n->options = NIL; + PGColumnDef *n = makeNode(PGColumnDef); + n->colname = (yyvsp[(1) - (3)].str); + n->typeName = (yyvsp[(2) - (3)].typnam); + n->inhcount = 0; + n->is_local = true; + n->is_not_null = false; + n->is_from_type = false; + n->storage = 0; + n->raw_default = NULL; + n->cooked_default = NULL; + n->collClause = (PGCollateClause *) (yyvsp[(3) - (3)].node); + n->collOid = InvalidOid; + n->constraints = NIL; + n->location = (yylsp[(1) - (3)]); (yyval.node) = (PGNode *)n; ;} break; - case 209: -#line 36 "third_party/libpg_query/grammar/statements/transaction.y" + case 280: +#line 1187 "third_party/libpg_query/grammar/statements/select.y" { - PGTransactionStmt *n = makeNode(PGTransactionStmt); - n->kind = PG_TRANS_STMT_ROLLBACK; - n->options = NIL; - (yyval.node) = (PGNode *)n; + PGCollateClause *n = makeNode(PGCollateClause); + n->arg = NULL; + n->collname = (yyvsp[(2) - (2)].list); + n->location = (yylsp[(1) - (2)]); + (yyval.node) = (PGNode *) n; ;} break; - case 210: -#line 45 "third_party/libpg_query/grammar/statements/transaction.y" - {;} + case 281: +#line 1194 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} break; - case 211: -#line 46 "third_party/libpg_query/grammar/statements/transaction.y" - {;} + case 282: +#line 1207 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = list_make1(list_make2(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].typnam))); + ;} break; - case 212: -#line 47 "third_party/libpg_query/grammar/statements/transaction.y" - {;} + case 283: +#line 1210 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = lappend((yyvsp[(1) - (4)].list), list_make2(makeString((yyvsp[(3) - (4)].str)), (yyvsp[(4) - (4)].typnam))); + ;} break; - case 213: -#line 9 "third_party/libpg_query/grammar/statements/create.y" + case 286: +#line 1217 "third_party/libpg_query/grammar/statements/select.y" { - PGCreateStmt *n = makeNode(PGCreateStmt); - (yyvsp[(4) - (9)].range)->relpersistence = (yyvsp[(2) - (9)].ival); - n->relation = (yyvsp[(4) - (9)].range); - n->tableElts = (yyvsp[(6) - (9)].list); - n->ofTypename = NULL; - n->constraints = NIL; - n->options = (yyvsp[(8) - (9)].list); - n->oncommit = (yyvsp[(9) - (9)].oncommit); - n->onconflict = PG_ERROR_ON_CONFLICT; - (yyval.node) = (PGNode *)n; + (yyval.typnam) = (yyvsp[(1) - (2)].typnam); + (yyval.typnam)->arrayBounds = (yyvsp[(2) - (2)].list); ;} break; - case 214: -#line 24 "third_party/libpg_query/grammar/statements/create.y" + case 287: +#line 1222 "third_party/libpg_query/grammar/statements/select.y" { - PGCreateStmt *n = makeNode(PGCreateStmt); - (yyvsp[(7) - (12)].range)->relpersistence = (yyvsp[(2) - (12)].ival); - n->relation = (yyvsp[(7) - (12)].range); - n->tableElts = (yyvsp[(9) - (12)].list); - n->ofTypename = NULL; - n->constraints = NIL; - n->options = (yyvsp[(11) - (12)].list); - n->oncommit = (yyvsp[(12) - (12)].oncommit); - n->onconflict = PG_IGNORE_ON_CONFLICT; - (yyval.node) = (PGNode *)n; + (yyval.typnam) = (yyvsp[(2) - (3)].typnam); + (yyval.typnam)->arrayBounds = (yyvsp[(3) - (3)].list); + (yyval.typnam)->setof = true; ;} break; - case 215: -#line 39 "third_party/libpg_query/grammar/statements/create.y" + case 288: +#line 1229 "third_party/libpg_query/grammar/statements/select.y" { - PGCreateStmt *n = makeNode(PGCreateStmt); - (yyvsp[(6) - (11)].range)->relpersistence = (yyvsp[(4) - (11)].ival); - n->relation = (yyvsp[(6) - (11)].range); - n->tableElts = (yyvsp[(8) - (11)].list); - n->ofTypename = NULL; - n->constraints = NIL; - n->options = (yyvsp[(10) - (11)].list); - n->oncommit = (yyvsp[(11) - (11)].oncommit); - n->onconflict = PG_REPLACE_ON_CONFLICT; - (yyval.node) = (PGNode *)n; + (yyval.typnam) = (yyvsp[(1) - (5)].typnam); + (yyval.typnam)->arrayBounds = list_make1(makeInteger((yyvsp[(4) - (5)].ival))); ;} break; - case 216: -#line 56 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = 0; ;} + case 289: +#line 1234 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = (yyvsp[(2) - (6)].typnam); + (yyval.typnam)->arrayBounds = list_make1(makeInteger((yyvsp[(5) - (6)].ival))); + (yyval.typnam)->setof = true; + ;} break; - case 217: -#line 58 "third_party/libpg_query/grammar/statements/create.y" + case 290: +#line 1240 "third_party/libpg_query/grammar/statements/select.y" { - /* - * We must complain about conflicting options. - * We could, but choose not to, complain about redundant - * options (ie, where $2's bit is already set in $1). - */ - int newspec = (yyvsp[(1) - (2)].ival) | (yyvsp[(2) - (2)].ival); + (yyval.typnam) = (yyvsp[(1) - (2)].typnam); + (yyval.typnam)->arrayBounds = list_make1(makeInteger(-1)); + ;} + break; - /* special message for this case */ - if ((newspec & (CAS_NOT_DEFERRABLE | CAS_INITIALLY_DEFERRED)) == (CAS_NOT_DEFERRABLE | CAS_INITIALLY_DEFERRED)) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("constraint declared INITIALLY DEFERRED must be DEFERRABLE"), - parser_errposition((yylsp[(2) - (2)])))); - /* generic message for other conflicts */ - if ((newspec & (CAS_NOT_DEFERRABLE | CAS_DEFERRABLE)) == (CAS_NOT_DEFERRABLE | CAS_DEFERRABLE) || - (newspec & (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED)) == (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED)) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("conflicting constraint properties"), - parser_errposition((yylsp[(2) - (2)])))); - (yyval.ival) = newspec; + case 291: +#line 1245 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = (yyvsp[(2) - (3)].typnam); + (yyval.typnam)->arrayBounds = list_make1(makeInteger(-1)); + (yyval.typnam)->setof = true; ;} break; - case 218: -#line 84 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.node) = (PGNode *)(yyvsp[(1) - (1)].typnam); ;} + case 292: +#line 1250 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = SystemTypeName("struct"); + (yyval.typnam)->arrayBounds = (yyvsp[(5) - (5)].list); + (yyval.typnam)->typmods = (yyvsp[(3) - (5)].list); + (yyval.typnam)->location = (yylsp[(1) - (5)]); + ;} break; - case 219: -#line 85 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.node) = (PGNode *)makeString(pstrdup((yyvsp[(1) - (1)].keyword))); ;} + case 293: +#line 1256 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = SystemTypeName("map"); + (yyval.typnam)->arrayBounds = (yyvsp[(5) - (5)].list); + (yyval.typnam)->typmods = (yyvsp[(3) - (5)].list); + (yyval.typnam)->location = (yylsp[(1) - (5)]); + ;} break; - case 220: -#line 86 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.node) = (PGNode *)(yyvsp[(1) - (1)].list); ;} + case 294: +#line 1266 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeInteger(-1)); ;} break; - case 221: -#line 87 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.node) = (PGNode *)(yyvsp[(1) - (1)].value); ;} + case 295: +#line 1268 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (4)].list), makeInteger((yyvsp[(3) - (4)].ival))); ;} break; - case 222: -#line 88 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.node) = (PGNode *)makeString((yyvsp[(1) - (1)].str)); ;} + case 296: +#line 1270 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} break; - case 223: -#line 89 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.node) = (PGNode *)makeString(pstrdup((yyvsp[(1) - (1)].keyword))); ;} + case 297: +#line 1274 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 224: -#line 93 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = (yyvsp[(2) - (3)].list); ;} + case 298: +#line 1275 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 225: -#line 94 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = NIL; ;} + case 299: +#line 1276 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 226: -#line 99 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); ;} + case 300: +#line 1277 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 227: -#line 104 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_FKCONSTR_ACTION_NOACTION; ;} + case 301: +#line 1278 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 228: -#line 105 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_FKCONSTR_ACTION_RESTRICT; ;} + case 302: +#line 1280 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = (yyvsp[(1) - (2)].typnam); + (yyval.typnam)->typmods = (yyvsp[(2) - (2)].list); + ;} break; - case 229: -#line 106 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_FKCONSTR_ACTION_CASCADE; ;} + case 303: +#line 1285 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = (yyvsp[(1) - (4)].typnam); + (yyval.typnam)->typmods = list_make2(makeIntConst(INTERVAL_FULL_RANGE, -1), + makeIntConst((yyvsp[(3) - (4)].ival), (yylsp[(3) - (4)]))); + ;} break; - case 230: -#line 107 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_FKCONSTR_ACTION_SETNULL; ;} + case 304: +#line 1304 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 231: -#line 108 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_FKCONSTR_ACTION_SETDEFAULT; ;} + case 305: +#line 1305 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 232: -#line 114 "third_party/libpg_query/grammar/statements/create.y" + case 306: +#line 1306 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + break; + + case 307: +#line 1307 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + break; + + case 308: +#line 1319 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = castNode(PGConstraint, (yyvsp[(3) - (3)].node)); - n->conname = (yyvsp[(2) - (3)].str); - n->location = (yylsp[(1) - (3)]); - (yyval.node) = (PGNode *) n; + (yyval.typnam) = makeTypeName((yyvsp[(1) - (2)].str)); + (yyval.typnam)->typmods = (yyvsp[(2) - (2)].list); + (yyval.typnam)->location = (yylsp[(1) - (2)]); ;} break; - case 233: -#line 120 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 309: +#line 1332 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 234: -#line 121 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 310: +#line 1333 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} break; - case 235: -#line 123 "third_party/libpg_query/grammar/statements/create.y" + case 311: +#line 1340 "third_party/libpg_query/grammar/statements/select.y" { - /* - * Note: the PGCollateClause is momentarily included in - * the list built by ColQualList, but we split it out - * again in SplitColQualList. - */ - PGCollateClause *n = makeNode(PGCollateClause); - n->arg = NULL; - n->collname = (yyvsp[(2) - (2)].list); - n->location = (yylsp[(1) - (2)]); - (yyval.node) = (PGNode *) n; + (yyval.typnam) = SystemTypeName("int4"); + (yyval.typnam)->location = (yylsp[(1) - (1)]); ;} break; - case 236: -#line 140 "third_party/libpg_query/grammar/statements/create.y" + case 312: +#line 1345 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_NOTNULL; - n->location = (yylsp[(1) - (2)]); - (yyval.node) = (PGNode *)n; + (yyval.typnam) = SystemTypeName("int4"); + (yyval.typnam)->location = (yylsp[(1) - (1)]); ;} break; - case 237: -#line 147 "third_party/libpg_query/grammar/statements/create.y" + case 313: +#line 1350 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_NULL; - n->location = (yylsp[(1) - (1)]); - (yyval.node) = (PGNode *)n; + (yyval.typnam) = SystemTypeName("int2"); + (yyval.typnam)->location = (yylsp[(1) - (1)]); ;} break; - case 238: -#line 154 "third_party/libpg_query/grammar/statements/create.y" + case 314: +#line 1355 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_UNIQUE; - n->location = (yylsp[(1) - (2)]); - n->keys = NULL; - n->options = (yyvsp[(2) - (2)].list); - n->indexname = NULL; - (yyval.node) = (PGNode *)n; + (yyval.typnam) = SystemTypeName("int8"); + (yyval.typnam)->location = (yylsp[(1) - (1)]); ;} break; - case 239: -#line 164 "third_party/libpg_query/grammar/statements/create.y" + case 315: +#line 1360 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_PRIMARY; - n->location = (yylsp[(1) - (3)]); - n->keys = NULL; - n->options = (yyvsp[(3) - (3)].list); - n->indexname = NULL; - (yyval.node) = (PGNode *)n; + (yyval.typnam) = SystemTypeName("float4"); + (yyval.typnam)->location = (yylsp[(1) - (1)]); ;} break; - case 240: -#line 174 "third_party/libpg_query/grammar/statements/create.y" + case 316: +#line 1365 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_CHECK; - n->location = (yylsp[(1) - (5)]); - n->is_no_inherit = (yyvsp[(5) - (5)].boolean); - n->raw_expr = (yyvsp[(3) - (5)].node); - n->cooked_expr = NULL; - n->skip_validation = false; - n->initially_valid = true; - (yyval.node) = (PGNode *)n; + (yyval.typnam) = (yyvsp[(2) - (2)].typnam); + (yyval.typnam)->location = (yylsp[(1) - (2)]); ;} break; - case 241: -#line 186 "third_party/libpg_query/grammar/statements/create.y" + case 317: +#line 1370 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_COMPRESSION; - n->location = (yylsp[(1) - (3)]); - n->compression_name = (yyvsp[(3) - (3)].str); - (yyval.node) = (PGNode *)n; + (yyval.typnam) = SystemTypeName("float8"); + (yyval.typnam)->location = (yylsp[(1) - (2)]); ;} break; - case 242: -#line 194 "third_party/libpg_query/grammar/statements/create.y" + case 318: +#line 1375 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_DEFAULT; - n->location = (yylsp[(1) - (2)]); - n->raw_expr = (yyvsp[(2) - (2)].node); - n->cooked_expr = NULL; - (yyval.node) = (PGNode *)n; + (yyval.typnam) = SystemTypeName("numeric"); + (yyval.typnam)->typmods = (yyvsp[(2) - (2)].list); + (yyval.typnam)->location = (yylsp[(1) - (2)]); ;} break; - case 243: -#line 203 "third_party/libpg_query/grammar/statements/create.y" + case 319: +#line 1381 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_IDENTITY; - n->generated_when = (yyvsp[(2) - (5)].ival); - n->options = (yyvsp[(5) - (5)].list); - n->location = (yylsp[(1) - (5)]); - (yyval.node) = (PGNode *)n; + (yyval.typnam) = SystemTypeName("numeric"); + (yyval.typnam)->typmods = (yyvsp[(2) - (2)].list); + (yyval.typnam)->location = (yylsp[(1) - (2)]); ;} break; - case 244: -#line 212 "third_party/libpg_query/grammar/statements/create.y" + case 320: +#line 1387 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_FOREIGN; - n->location = (yylsp[(1) - (5)]); - n->pktable = (yyvsp[(2) - (5)].range); - n->fk_attrs = NIL; - n->pk_attrs = (yyvsp[(3) - (5)].list); - n->fk_matchtype = (yyvsp[(4) - (5)].ival); - n->fk_upd_action = (char) ((yyvsp[(5) - (5)].ival) >> 8); - n->fk_del_action = (char) ((yyvsp[(5) - (5)].ival) & 0xFF); - n->skip_validation = false; - n->initially_valid = true; - (yyval.node) = (PGNode *)n; + (yyval.typnam) = SystemTypeName("numeric"); + (yyval.typnam)->typmods = (yyvsp[(2) - (2)].list); + (yyval.typnam)->location = (yylsp[(1) - (2)]); ;} break; - case 245: -#line 231 "third_party/libpg_query/grammar/statements/create.y" + case 321: +#line 1393 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); + (yyval.typnam) = SystemTypeName("bool"); + (yyval.typnam)->location = (yylsp[(1) - (1)]); ;} break; - case 246: -#line 237 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = (yyvsp[(3) - (3)].ival); ;} - break; - - case 247: -#line 243 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = ((yyvsp[(1) - (1)].ival) << 8) | (PG_FKCONSTR_ACTION_NOACTION & 0xFF); ;} - break; - - case 248: -#line 245 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = (PG_FKCONSTR_ACTION_NOACTION << 8) | ((yyvsp[(1) - (1)].ival) & 0xFF); ;} - break; - - case 249: -#line 247 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = ((yyvsp[(1) - (2)].ival) << 8) | ((yyvsp[(2) - (2)].ival) & 0xFF); ;} - break; - - case 250: -#line 249 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = ((yyvsp[(2) - (2)].ival) << 8) | ((yyvsp[(1) - (2)].ival) & 0xFF); ;} + case 322: +#line 1400 "third_party/libpg_query/grammar/statements/select.y" + { + /* + * Check FLOAT() precision limits assuming IEEE floating + * types - thomas 1997-09-18 + */ + if ((yyvsp[(2) - (3)].ival) < 1) + ereport(ERROR, + (errcode(PG_ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("precision for type float must be at least 1 bit"), + parser_errposition((yylsp[(2) - (3)])))); + else if ((yyvsp[(2) - (3)].ival) <= 24) + (yyval.typnam) = SystemTypeName("float4"); + else if ((yyvsp[(2) - (3)].ival) <= 53) + (yyval.typnam) = SystemTypeName("float8"); + else + ereport(ERROR, + (errcode(PG_ERRCODE_INVALID_PARAMETER_VALUE), + errmsg("precision for type float must be less than 54 bits"), + parser_errposition((yylsp[(2) - (3)])))); + ;} break; - case 251: -#line 251 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = (PG_FKCONSTR_ACTION_NOACTION << 8) | (PG_FKCONSTR_ACTION_NOACTION & 0xFF); ;} + case 323: +#line 1421 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = SystemTypeName("float4"); + ;} break; - case 252: -#line 256 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = (yyvsp[(3) - (4)].list); ;} + case 324: +#line 1431 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = (yyvsp[(1) - (1)].typnam); + ;} break; - case 253: -#line 257 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = NIL; ;} + case 325: +#line 1435 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = (yyvsp[(1) - (1)].typnam); + ;} break; - case 254: -#line 261 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.oncommit) = ONCOMMIT_DROP; ;} + case 326: +#line 1443 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = (yyvsp[(1) - (1)].typnam); + ;} break; - case 255: -#line 262 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.oncommit) = PG_ONCOMMIT_DELETE_ROWS; ;} + case 327: +#line 1447 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = (yyvsp[(1) - (1)].typnam); + (yyval.typnam)->typmods = NIL; + ;} break; - case 256: -#line 263 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.oncommit) = PG_ONCOMMIT_PRESERVE_ROWS; ;} - break; + case 328: +#line 1455 "third_party/libpg_query/grammar/statements/select.y" + { + const char *typname; - case 257: -#line 264 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.oncommit) = PG_ONCOMMIT_NOOP; ;} + typname = (yyvsp[(2) - (5)].boolean) ? "varbit" : "bit"; + (yyval.typnam) = SystemTypeName(typname); + (yyval.typnam)->typmods = (yyvsp[(4) - (5)].list); + (yyval.typnam)->location = (yylsp[(1) - (5)]); + ;} break; - case 258: -#line 269 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = (yyvsp[(2) - (3)].list); ;} + case 329: +#line 1467 "third_party/libpg_query/grammar/statements/select.y" + { + /* bit defaults to bit(1), varbit to no limit */ + if ((yyvsp[(2) - (2)].boolean)) + { + (yyval.typnam) = SystemTypeName("varbit"); + } + else + { + (yyval.typnam) = SystemTypeName("bit"); + (yyval.typnam)->typmods = list_make1(makeIntConst(1, -1)); + } + (yyval.typnam)->location = (yylsp[(1) - (2)]); + ;} break; - case 259: -#line 273 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.boolean) = true; ;} + case 330: +#line 1488 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = (yyvsp[(1) - (1)].typnam); + ;} break; - case 260: -#line 274 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.boolean) = false; ;} + case 331: +#line 1492 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = (yyvsp[(1) - (1)].typnam); + ;} break; - case 261: -#line 280 "third_party/libpg_query/grammar/statements/create.y" + case 332: +#line 1498 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = castNode(PGConstraint, (yyvsp[(3) - (3)].node)); - n->conname = (yyvsp[(2) - (3)].str); - n->location = (yylsp[(1) - (3)]); - (yyval.node) = (PGNode *) n; + (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} break; - case 262: -#line 286 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 333: +#line 1502 "third_party/libpg_query/grammar/statements/select.y" + { + /* Length was not specified so allow to be unrestricted. + * This handles problems with fixed-length (bpchar) strings + * which in column definitions must default to a length + * of one, but should not be constrained if the length + * was not specified. + */ + (yyval.typnam) = (yyvsp[(1) - (1)].typnam); + (yyval.typnam)->typmods = NIL; + ;} break; - case 263: -#line 291 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_CREATE_TABLE_LIKE_COMMENTS; ;} + case 334: +#line 1515 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = SystemTypeName((yyvsp[(1) - (4)].conststr)); + (yyval.typnam)->typmods = list_make1(makeIntConst((yyvsp[(3) - (4)].ival), (yylsp[(3) - (4)]))); + (yyval.typnam)->location = (yylsp[(1) - (4)]); + ;} break; - case 264: -#line 292 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_CREATE_TABLE_LIKE_CONSTRAINTS; ;} + case 335: +#line 1523 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.typnam) = SystemTypeName((yyvsp[(1) - (1)].conststr)); + /* char defaults to char(1), varchar to no limit */ + if (strcmp((yyvsp[(1) - (1)].conststr), "bpchar") == 0) + (yyval.typnam)->typmods = list_make1(makeIntConst(1, -1)); + (yyval.typnam)->location = (yylsp[(1) - (1)]); + ;} break; - case 265: -#line 293 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_CREATE_TABLE_LIKE_DEFAULTS; ;} + case 336: +#line 1533 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = (yyvsp[(2) - (2)].boolean) ? "varchar": "bpchar"; ;} break; - case 266: -#line 294 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_CREATE_TABLE_LIKE_IDENTITY; ;} + case 337: +#line 1535 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = (yyvsp[(2) - (2)].boolean) ? "varchar": "bpchar"; ;} break; - case 267: -#line 295 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_CREATE_TABLE_LIKE_INDEXES; ;} + case 338: +#line 1537 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = "varchar"; ;} break; - case 268: -#line 296 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_CREATE_TABLE_LIKE_STATISTICS; ;} + case 339: +#line 1539 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = (yyvsp[(3) - (3)].boolean) ? "varchar": "bpchar"; ;} break; - case 269: -#line 297 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_CREATE_TABLE_LIKE_STORAGE; ;} + case 340: +#line 1541 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = (yyvsp[(3) - (3)].boolean) ? "varchar": "bpchar"; ;} break; - case 270: -#line 298 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_CREATE_TABLE_LIKE_ALL; ;} + case 341: +#line 1543 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = (yyvsp[(2) - (2)].boolean) ? "varchar": "bpchar"; ;} break; - case 271: -#line 304 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} + case 342: +#line 1547 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = true; ;} break; - case 272: -#line 305 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} + case 343: +#line 1548 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = false; ;} break; - case 273: -#line 309 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.str) = (yyvsp[(3) - (3)].str); ;} + case 344: +#line 1556 "third_party/libpg_query/grammar/statements/select.y" + { + if ((yyvsp[(5) - (5)].boolean)) + (yyval.typnam) = SystemTypeName("timestamptz"); + else + (yyval.typnam) = SystemTypeName("timestamp"); + (yyval.typnam)->typmods = list_make1(makeIntConst((yyvsp[(3) - (5)].ival), (yylsp[(3) - (5)]))); + (yyval.typnam)->location = (yylsp[(1) - (5)]); + ;} break; - case 274: -#line 315 "third_party/libpg_query/grammar/statements/create.y" + case 345: +#line 1565 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_ATTR_DEFERRABLE; - n->location = (yylsp[(1) - (1)]); - (yyval.node) = (PGNode *)n; + if ((yyvsp[(2) - (2)].boolean)) + (yyval.typnam) = SystemTypeName("timestamptz"); + else + (yyval.typnam) = SystemTypeName("timestamp"); + (yyval.typnam)->location = (yylsp[(1) - (2)]); ;} break; - case 275: -#line 322 "third_party/libpg_query/grammar/statements/create.y" + case 346: +#line 1573 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_ATTR_NOT_DEFERRABLE; - n->location = (yylsp[(1) - (2)]); - (yyval.node) = (PGNode *)n; + if ((yyvsp[(5) - (5)].boolean)) + (yyval.typnam) = SystemTypeName("timetz"); + else + (yyval.typnam) = SystemTypeName("time"); + (yyval.typnam)->typmods = list_make1(makeIntConst((yyvsp[(3) - (5)].ival), (yylsp[(3) - (5)]))); + (yyval.typnam)->location = (yylsp[(1) - (5)]); ;} break; - case 276: -#line 329 "third_party/libpg_query/grammar/statements/create.y" + case 347: +#line 1582 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_ATTR_DEFERRED; - n->location = (yylsp[(1) - (2)]); - (yyval.node) = (PGNode *)n; + if ((yyvsp[(2) - (2)].boolean)) + (yyval.typnam) = SystemTypeName("timetz"); + else + (yyval.typnam) = SystemTypeName("time"); + (yyval.typnam)->location = (yylsp[(1) - (2)]); ;} break; - case 277: -#line 336 "third_party/libpg_query/grammar/statements/create.y" + case 348: +#line 1593 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_ATTR_IMMEDIATE; - n->location = (yylsp[(1) - (2)]); - (yyval.node) = (PGNode *)n; + (yyval.typnam) = SystemTypeName("interval"); + (yyval.typnam)->location = (yylsp[(1) - (1)]); ;} break; - case 278: -#line 347 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = (yyvsp[(2) - (2)].list); ;} + case 349: +#line 1600 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = true; ;} break; - case 279: -#line 348 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = list_make1(makeDefElem("oids", (PGNode *) makeInteger(true), (yylsp[(1) - (2)]))); ;} + case 350: +#line 1601 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = false; ;} break; - case 280: -#line 349 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = list_make1(makeDefElem("oids", (PGNode *) makeInteger(false), (yylsp[(1) - (2)]))); ;} + case 351: +#line 1602 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = false; ;} break; - case 281: -#line 350 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = NIL; ;} + case 368: +#line 1631 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(YEAR), (yylsp[(1) - (1)]))); ;} break; - case 282: -#line 354 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = (yyvsp[(2) - (3)].list); ;} + case 369: +#line 1633 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MONTH), (yylsp[(1) - (1)]))); ;} break; - case 283: -#line 359 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} + case 370: +#line 1635 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY), (yylsp[(1) - (1)]))); ;} break; - case 284: -#line 360 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = (yyvsp[(1) - (3)].ival) & ~(yyvsp[(3) - (3)].ival); ;} + case 371: +#line 1637 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(HOUR), (yylsp[(1) - (1)]))); ;} break; - case 285: -#line 361 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = 0; ;} + case 372: +#line 1639 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MINUTE), (yylsp[(1) - (1)]))); ;} break; - case 286: -#line 366 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 373: +#line 1641 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(SECOND), (yylsp[(1) - (1)]))); ;} break; - case 287: -#line 371 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = CAS_NOT_DEFERRABLE; ;} + case 374: +#line 1643 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MILLISECOND), (yylsp[(1) - (1)]))); ;} break; - case 288: -#line 372 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = CAS_DEFERRABLE; ;} + case 375: +#line 1645 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MICROSECOND), (yylsp[(1) - (1)]))); ;} break; - case 289: -#line 373 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = CAS_INITIALLY_IMMEDIATE; ;} + case 376: +#line 1647 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(YEAR) | + INTERVAL_MASK(MONTH), (yylsp[(1) - (3)]))); + ;} break; - case 290: -#line 374 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = CAS_INITIALLY_DEFERRED; ;} + case 377: +#line 1652 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY) | + INTERVAL_MASK(HOUR), (yylsp[(1) - (3)]))); + ;} break; - case 291: -#line 375 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = CAS_NOT_VALID; ;} + case 378: +#line 1657 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY) | + INTERVAL_MASK(HOUR) | + INTERVAL_MASK(MINUTE), (yylsp[(1) - (3)]))); + ;} break; - case 292: -#line 376 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = CAS_NO_INHERIT; ;} + case 379: +#line 1663 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY) | + INTERVAL_MASK(HOUR) | + INTERVAL_MASK(MINUTE) | + INTERVAL_MASK(SECOND), (yylsp[(1) - (3)]))); + ;} break; - case 293: -#line 382 "third_party/libpg_query/grammar/statements/create.y" + case 380: +#line 1670 "third_party/libpg_query/grammar/statements/select.y" { - PGColumnDef *n = makeNode(PGColumnDef); - n->colname = (yyvsp[(1) - (4)].str); - n->typeName = (yyvsp[(2) - (4)].typnam); - n->inhcount = 0; - n->is_local = true; - n->is_not_null = false; - n->is_from_type = false; - n->storage = 0; - n->raw_default = NULL; - n->cooked_default = NULL; - n->collOid = InvalidOid; - n->fdwoptions = (yyvsp[(3) - (4)].list); - SplitColQualList((yyvsp[(4) - (4)].list), &n->constraints, &n->collClause, - yyscanner); - n->location = (yylsp[(1) - (4)]); - (yyval.node) = (PGNode *)n; + (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(HOUR) | + INTERVAL_MASK(MINUTE), (yylsp[(1) - (3)]))); + ;} + break; + + case 381: +#line 1675 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(HOUR) | + INTERVAL_MASK(MINUTE) | + INTERVAL_MASK(SECOND), (yylsp[(1) - (3)]))); + ;} + break; + + case 382: +#line 1681 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MINUTE) | + INTERVAL_MASK(SECOND), (yylsp[(1) - (3)]))); ;} break; - case 294: -#line 405 "third_party/libpg_query/grammar/statements/create.y" + case 383: +#line 1686 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} + break; + + case 384: +#line 1717 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + break; + + case 385: +#line 1720 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeTypeCast((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].typnam), 0, (yylsp[(2) - (3)])); ;} + break; + + case 386: +#line 1722 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); + PGCollateClause *n = makeNode(PGCollateClause); + n->arg = (yyvsp[(1) - (3)].node); + n->collname = (yyvsp[(3) - (3)].list); + n->location = (yylsp[(2) - (3)]); + (yyval.node) = (PGNode *) n; ;} break; - case 295: -#line 409 "third_party/libpg_query/grammar/statements/create.y" + case 387: +#line 1730 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); + (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("timezone"), + list_make2((yyvsp[(5) - (5)].node), (yyvsp[(1) - (5)].node)), + (yylsp[(2) - (5)])); ;} break; - case 296: -#line 415 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} + case 388: +#line 1745 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 297: -#line 416 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} + case 389: +#line 1747 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = doNegate((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 298: -#line 420 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 390: +#line 1749 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 299: -#line 424 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 391: +#line 1751 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "-", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 300: -#line 425 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 392: +#line 1753 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "*", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 301: -#line 426 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 393: +#line 1755 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "/", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 302: -#line 431 "third_party/libpg_query/grammar/statements/create.y" - { - (yyval.defelt) = makeDefElem((yyvsp[(1) - (3)].str), (PGNode *) (yyvsp[(3) - (3)].node), (yylsp[(1) - (3)])); - ;} + case 394: +#line 1757 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "%", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 303: -#line 435 "third_party/libpg_query/grammar/statements/create.y" - { - (yyval.defelt) = makeDefElem((yyvsp[(1) - (1)].str), NULL, (yylsp[(1) - (1)])); - ;} + case 395: +#line 1759 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "^", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 304: -#line 442 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = (yyvsp[(2) - (2)].list); ;} + case 396: +#line 1761 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 305: -#line 443 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = NIL; ;} + case 397: +#line 1763 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 306: -#line 448 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = (yyvsp[(1) - (1)].list); ;} + case 398: +#line 1765 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 307: -#line 449 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = NIL; ;} + case 399: +#line 1767 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 308: -#line 454 "third_party/libpg_query/grammar/statements/create.y" - { - (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); - ;} + case 400: +#line 1769 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 309: -#line 461 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = (yyvsp[(2) - (3)].list); ;} + case 401: +#line 1771 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<>", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 310: -#line 462 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = NIL; ;} + case 402: +#line 1774 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (3)].list), (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 311: -#line 467 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} + case 403: +#line 1776 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(1) - (2)].list), NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 312: -#line 468 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = NIL; ;} + case 404: +#line 1778 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (2)].list), (yyvsp[(1) - (2)].node), NULL, (yylsp[(2) - (2)])); ;} break; - case 313: -#line 472 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = (yyvsp[(3) - (3)].ival); ;} + case 405: +#line 1781 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeAndExpr((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 314: -#line 478 "third_party/libpg_query/grammar/statements/create.y" + case 406: +#line 1783 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeOrExpr((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + break; + + case 407: +#line 1785 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeNotExpr((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + break; + + case 408: +#line 1787 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeNotExpr((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + break; + + case 409: +#line 1790 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem((yyvsp[(1) - (3)].str), (PGNode *) (yyvsp[(3) - (3)].node), (yylsp[(1) - (3)])); + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_GLOB, "~~~", + (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 315: -#line 482 "third_party/libpg_query/grammar/statements/create.y" + case 410: +#line 1795 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem((yyvsp[(1) - (1)].str), NULL, (yylsp[(1) - (1)])); + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_LIKE, "~~", + (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 316: -#line 486 "third_party/libpg_query/grammar/statements/create.y" + case 411: +#line 1800 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElemExtended((yyvsp[(1) - (5)].str), (yyvsp[(3) - (5)].str), (PGNode *) (yyvsp[(5) - (5)].node), - PG_DEFELEM_UNSPEC, (yylsp[(1) - (5)])); + PGFuncCall *n = makeFuncCall(SystemFuncName("like_escape"), + list_make3((yyvsp[(1) - (5)].node), (yyvsp[(3) - (5)].node), (yyvsp[(5) - (5)].node)), + (yylsp[(2) - (5)])); + (yyval.node) = (PGNode *) n; ;} break; - case 317: -#line 491 "third_party/libpg_query/grammar/statements/create.y" + case 412: +#line 1807 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElemExtended((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str), NULL, PG_DEFELEM_UNSPEC, (yylsp[(1) - (3)])); + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_LIKE, "!~~", + (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node), (yylsp[(2) - (4)])); ;} break; - case 318: -#line 498 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} + case 413: +#line 1812 "third_party/libpg_query/grammar/statements/select.y" + { + PGFuncCall *n = makeFuncCall(SystemFuncName("not_like_escape"), + list_make3((yyvsp[(1) - (6)].node), (yyvsp[(4) - (6)].node), (yyvsp[(6) - (6)].node)), + (yylsp[(2) - (6)])); + (yyval.node) = (PGNode *) n; + ;} break; - case 319: -#line 499 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} + case 414: +#line 1819 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_ILIKE, "~~*", + (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); + ;} break; - case 320: -#line 503 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + case 415: +#line 1824 "third_party/libpg_query/grammar/statements/select.y" + { + PGFuncCall *n = makeFuncCall(SystemFuncName("ilike_escape"), + list_make3((yyvsp[(1) - (5)].node), (yyvsp[(3) - (5)].node), (yyvsp[(5) - (5)].node)), + (yylsp[(2) - (5)])); + (yyval.node) = (PGNode *) n; + ;} break; - case 321: -#line 505 "third_party/libpg_query/grammar/statements/create.y" + case 416: +#line 1831 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.typnam) = makeTypeNameFromNameList(lcons(makeString((yyvsp[(1) - (4)].str)), (yyvsp[(2) - (4)].list))); - (yyval.typnam)->pct_type = true; - (yyval.typnam)->location = (yylsp[(1) - (4)]); + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_ILIKE, "!~~*", + (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node), (yylsp[(2) - (4)])); ;} break; - case 322: -#line 511 "third_party/libpg_query/grammar/statements/create.y" + case 417: +#line 1836 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.typnam) = makeTypeNameFromNameList(lcons(makeString((yyvsp[(2) - (5)].str)), (yyvsp[(3) - (5)].list))); - (yyval.typnam)->pct_type = true; - (yyval.typnam)->setof = true; - (yyval.typnam)->location = (yylsp[(2) - (5)]); + PGFuncCall *n = makeFuncCall(SystemFuncName("not_ilike_escape"), + list_make3((yyvsp[(1) - (6)].node), (yyvsp[(4) - (6)].node), (yyvsp[(6) - (6)].node)), + (yylsp[(2) - (6)])); + (yyval.node) = (PGNode *) n; ;} break; - case 323: -#line 522 "third_party/libpg_query/grammar/statements/create.y" + case 418: +#line 1844 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_CHECK; - n->location = (yylsp[(1) - (5)]); - n->raw_expr = (yyvsp[(3) - (5)].node); - n->cooked_expr = NULL; - processCASbits((yyvsp[(5) - (5)].ival), (yylsp[(5) - (5)]), "CHECK", - NULL, NULL, &n->skip_validation, - &n->is_no_inherit, yyscanner); - n->initially_valid = !n->skip_validation; - (yyval.node) = (PGNode *)n; + PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), + list_make2((yyvsp[(4) - (4)].node), makeNullAConst(-1)), + (yylsp[(2) - (4)])); + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_SIMILAR, "~", + (yyvsp[(1) - (4)].node), (PGNode *) n, (yylsp[(2) - (4)])); ;} break; - case 324: -#line 536 "third_party/libpg_query/grammar/statements/create.y" + case 419: +#line 1852 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_UNIQUE; - n->location = (yylsp[(1) - (6)]); - n->keys = (yyvsp[(3) - (6)].list); - n->options = (yyvsp[(5) - (6)].list); - n->indexname = NULL; - processCASbits((yyvsp[(6) - (6)].ival), (yylsp[(6) - (6)]), "UNIQUE", - &n->deferrable, &n->initdeferred, NULL, - NULL, yyscanner); - (yyval.node) = (PGNode *)n; + PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), + list_make2((yyvsp[(4) - (6)].node), (yyvsp[(6) - (6)].node)), + (yylsp[(2) - (6)])); + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_SIMILAR, "~", + (yyvsp[(1) - (6)].node), (PGNode *) n, (yylsp[(2) - (6)])); ;} break; - case 325: -#line 549 "third_party/libpg_query/grammar/statements/create.y" + case 420: +#line 1860 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_UNIQUE; - n->location = (yylsp[(1) - (3)]); - n->keys = NIL; - n->options = NIL; - n->indexname = (yyvsp[(2) - (3)].str); - n->indexspace = NULL; - processCASbits((yyvsp[(3) - (3)].ival), (yylsp[(3) - (3)]), "UNIQUE", - &n->deferrable, &n->initdeferred, NULL, - NULL, yyscanner); - (yyval.node) = (PGNode *)n; + PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), + list_make2((yyvsp[(5) - (5)].node), makeNullAConst(-1)), + (yylsp[(2) - (5)])); + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_SIMILAR, "!~", + (yyvsp[(1) - (5)].node), (PGNode *) n, (yylsp[(2) - (5)])); ;} break; - case 326: -#line 564 "third_party/libpg_query/grammar/statements/create.y" + case 421: +#line 1868 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_PRIMARY; - n->location = (yylsp[(1) - (7)]); - n->keys = (yyvsp[(4) - (7)].list); - n->options = (yyvsp[(6) - (7)].list); - n->indexname = NULL; - processCASbits((yyvsp[(7) - (7)].ival), (yylsp[(7) - (7)]), "PRIMARY KEY", - &n->deferrable, &n->initdeferred, NULL, - NULL, yyscanner); + PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), + list_make2((yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)), + (yylsp[(2) - (7)])); + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_SIMILAR, "!~", + (yyvsp[(1) - (7)].node), (PGNode *) n, (yylsp[(2) - (7)])); + ;} + break; + + case 422: +#line 1886 "third_party/libpg_query/grammar/statements/select.y" + { + PGNullTest *n = makeNode(PGNullTest); + n->arg = (PGExpr *) (yyvsp[(1) - (3)].node); + n->nulltesttype = PG_IS_NULL; + n->location = (yylsp[(2) - (3)]); (yyval.node) = (PGNode *)n; ;} break; - case 327: -#line 577 "third_party/libpg_query/grammar/statements/create.y" + case 423: +#line 1894 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_PRIMARY; - n->location = (yylsp[(1) - (4)]); - n->keys = NIL; - n->options = NIL; - n->indexname = (yyvsp[(3) - (4)].str); - n->indexspace = NULL; - processCASbits((yyvsp[(4) - (4)].ival), (yylsp[(4) - (4)]), "PRIMARY KEY", - &n->deferrable, &n->initdeferred, NULL, - NULL, yyscanner); + PGNullTest *n = makeNode(PGNullTest); + n->arg = (PGExpr *) (yyvsp[(1) - (2)].node); + n->nulltesttype = PG_IS_NULL; + n->location = (yylsp[(2) - (2)]); (yyval.node) = (PGNode *)n; ;} break; - case 328: -#line 592 "third_party/libpg_query/grammar/statements/create.y" + case 424: +#line 1902 "third_party/libpg_query/grammar/statements/select.y" { - PGConstraint *n = makeNode(PGConstraint); - n->contype = PG_CONSTR_FOREIGN; - n->location = (yylsp[(1) - (11)]); - n->pktable = (yyvsp[(7) - (11)].range); - n->fk_attrs = (yyvsp[(4) - (11)].list); - n->pk_attrs = (yyvsp[(8) - (11)].list); - n->fk_matchtype = (yyvsp[(9) - (11)].ival); - n->fk_upd_action = (char) ((yyvsp[(10) - (11)].ival) >> 8); - n->fk_del_action = (char) ((yyvsp[(10) - (11)].ival) & 0xFF); - processCASbits((yyvsp[(11) - (11)].ival), (yylsp[(11) - (11)]), "FOREIGN KEY", - &n->deferrable, &n->initdeferred, - &n->skip_validation, NULL, - yyscanner); - n->initially_valid = !n->skip_validation; + PGNullTest *n = makeNode(PGNullTest); + n->arg = (PGExpr *) (yyvsp[(1) - (4)].node); + n->nulltesttype = IS_NOT_NULL; + n->location = (yylsp[(2) - (4)]); (yyval.node) = (PGNode *)n; ;} break; - case 329: -#line 614 "third_party/libpg_query/grammar/statements/create.y" + case 425: +#line 1910 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); + PGNullTest *n = makeNode(PGNullTest); + n->arg = (PGExpr *) (yyvsp[(1) - (3)].node); + n->nulltesttype = IS_NOT_NULL; + n->location = (yylsp[(2) - (3)]); + (yyval.node) = (PGNode *)n; ;} break; - case 330: -#line 618 "third_party/libpg_query/grammar/statements/create.y" + case 426: +#line 1918 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); + PGNullTest *n = makeNode(PGNullTest); + n->arg = (PGExpr *) (yyvsp[(1) - (2)].node); + n->nulltesttype = IS_NOT_NULL; + n->location = (yylsp[(2) - (2)]); + (yyval.node) = (PGNode *)n; ;} break; - case 331: -#line 625 "third_party/libpg_query/grammar/statements/create.y" + case 427: +#line 1925 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.ival) = PG_FKCONSTR_MATCH_FULL; + PGFuncCall *n = makeFuncCall(SystemFuncName("row"), (yyvsp[(1) - (1)].list), (yylsp[(1) - (1)])); + (yyval.node) = (PGNode *) n; ;} break; - case 332: -#line 629 "third_party/libpg_query/grammar/statements/create.y" + case 428: +#line 1929 "third_party/libpg_query/grammar/statements/select.y" { - ereport(ERROR, - (errcode(PG_ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("MATCH PARTIAL not yet implemented"), - parser_errposition((yylsp[(1) - (2)])))); - (yyval.ival) = PG_FKCONSTR_MATCH_PARTIAL; + PGFuncCall *n = makeFuncCall(SystemFuncName("struct_pack"), (yyvsp[(2) - (3)].list), (yylsp[(2) - (3)])); + (yyval.node) = (PGNode *) n; ;} break; - case 333: -#line 637 "third_party/libpg_query/grammar/statements/create.y" + case 429: +#line 1933 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.ival) = PG_FKCONSTR_MATCH_SIMPLE; + PGFuncCall *n = makeFuncCall(SystemFuncName("list_value"), (yyvsp[(2) - (3)].list), (yylsp[(2) - (3)])); + (yyval.node) = (PGNode *) n; ;} break; - case 334: -#line 641 "third_party/libpg_query/grammar/statements/create.y" + case 430: +#line 1938 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.ival) = PG_FKCONSTR_MATCH_SIMPLE; + PGLambdaFunction *n = makeNode(PGLambdaFunction); + n->lhs = (yyvsp[(1) - (3)].node); + n->rhs = (yyvsp[(3) - (3)].node); + n->location = (yylsp[(2) - (3)]); + (yyval.node) = (PGNode *) n; ;} break; - case 335: -#line 649 "third_party/libpg_query/grammar/statements/create.y" + case 431: +#line 1946 "third_party/libpg_query/grammar/statements/select.y" { - PGTableLikeClause *n = makeNode(PGTableLikeClause); - n->relation = (yyvsp[(2) - (3)].range); - n->options = (yyvsp[(3) - (3)].ival); - (yyval.node) = (PGNode *)n; + if (list_length((yyvsp[(1) - (3)].list)) != 2) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("wrong number of parameters on left side of OVERLAPS expression"), + parser_errposition((yylsp[(1) - (3)])))); + if (list_length((yyvsp[(3) - (3)].list)) != 2) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("wrong number of parameters on right side of OVERLAPS expression"), + parser_errposition((yylsp[(3) - (3)])))); + (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("overlaps"), + list_concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)), + (yylsp[(2) - (3)])); ;} break; - case 336: -#line 658 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} - break; - - case 337: -#line 659 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} - break; - - case 338: -#line 660 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} + case 432: +#line 1962 "third_party/libpg_query/grammar/statements/select.y" + { + PGBooleanTest *b = makeNode(PGBooleanTest); + b->arg = (PGExpr *) (yyvsp[(1) - (3)].node); + b->booltesttype = PG_IS_TRUE; + b->location = (yylsp[(2) - (3)]); + (yyval.node) = (PGNode *)b; + ;} break; - case 339: -#line 661 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} + case 433: +#line 1970 "third_party/libpg_query/grammar/statements/select.y" + { + PGBooleanTest *b = makeNode(PGBooleanTest); + b->arg = (PGExpr *) (yyvsp[(1) - (4)].node); + b->booltesttype = IS_NOT_TRUE; + b->location = (yylsp[(2) - (4)]); + (yyval.node) = (PGNode *)b; + ;} break; - case 340: -#line 663 "third_party/libpg_query/grammar/statements/create.y" + case 434: +#line 1978 "third_party/libpg_query/grammar/statements/select.y" { - ereport(PGWARNING, - (errmsg("GLOBAL is deprecated in temporary table creation"), - parser_errposition((yylsp[(1) - (2)])))); - (yyval.ival) = PG_RELPERSISTENCE_TEMP; + PGBooleanTest *b = makeNode(PGBooleanTest); + b->arg = (PGExpr *) (yyvsp[(1) - (3)].node); + b->booltesttype = IS_FALSE; + b->location = (yylsp[(2) - (3)]); + (yyval.node) = (PGNode *)b; ;} break; - case 341: -#line 670 "third_party/libpg_query/grammar/statements/create.y" + case 435: +#line 1986 "third_party/libpg_query/grammar/statements/select.y" { - ereport(PGWARNING, - (errmsg("GLOBAL is deprecated in temporary table creation"), - parser_errposition((yylsp[(1) - (2)])))); - (yyval.ival) = PG_RELPERSISTENCE_TEMP; + PGBooleanTest *b = makeNode(PGBooleanTest); + b->arg = (PGExpr *) (yyvsp[(1) - (4)].node); + b->booltesttype = IS_NOT_FALSE; + b->location = (yylsp[(2) - (4)]); + (yyval.node) = (PGNode *)b; ;} break; - case 342: -#line 676 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_RELPERSISTENCE_UNLOGGED; ;} + case 436: +#line 1994 "third_party/libpg_query/grammar/statements/select.y" + { + PGBooleanTest *b = makeNode(PGBooleanTest); + b->arg = (PGExpr *) (yyvsp[(1) - (3)].node); + b->booltesttype = IS_UNKNOWN; + b->location = (yylsp[(2) - (3)]); + (yyval.node) = (PGNode *)b; + ;} break; - case 343: -#line 677 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = RELPERSISTENCE_PERMANENT; ;} + case 437: +#line 2002 "third_party/libpg_query/grammar/statements/select.y" + { + PGBooleanTest *b = makeNode(PGBooleanTest); + b->arg = (PGExpr *) (yyvsp[(1) - (4)].node); + b->booltesttype = IS_NOT_UNKNOWN; + b->location = (yylsp[(2) - (4)]); + (yyval.node) = (PGNode *)b; + ;} break; - case 344: -#line 682 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = PG_ATTRIBUTE_IDENTITY_ALWAYS; ;} + case 438: +#line 2010 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_DISTINCT, "=", (yyvsp[(1) - (5)].node), (yyvsp[(5) - (5)].node), (yylsp[(2) - (5)])); + ;} break; - case 345: -#line 683 "third_party/libpg_query/grammar/statements/create.y" - { (yyval.ival) = ATTRIBUTE_IDENTITY_BY_DEFAULT; ;} + case 439: +#line 2014 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_DISTINCT, "=", (yyvsp[(1) - (6)].node), (yyvsp[(6) - (6)].node), (yylsp[(2) - (6)])); + ;} break; - case 346: -#line 10 "third_party/libpg_query/grammar/statements/drop.y" + case 440: +#line 2018 "third_party/libpg_query/grammar/statements/select.y" { - PGDropStmt *n = makeNode(PGDropStmt); - n->removeType = (yyvsp[(2) - (6)].objtype); - n->missing_ok = true; - n->objects = (yyvsp[(5) - (6)].list); - n->behavior = (yyvsp[(6) - (6)].dbehavior); - n->concurrent = false; - (yyval.node) = (PGNode *)n; + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "=", (yyvsp[(1) - (6)].node), (PGNode *) (yyvsp[(5) - (6)].list), (yylsp[(2) - (6)])); ;} break; - case 347: -#line 20 "third_party/libpg_query/grammar/statements/drop.y" + case 441: +#line 2022 "third_party/libpg_query/grammar/statements/select.y" { - PGDropStmt *n = makeNode(PGDropStmt); - n->removeType = (yyvsp[(2) - (4)].objtype); - n->missing_ok = false; - n->objects = (yyvsp[(3) - (4)].list); - n->behavior = (yyvsp[(4) - (4)].dbehavior); - n->concurrent = false; - (yyval.node) = (PGNode *)n; + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "<>", (yyvsp[(1) - (7)].node), (PGNode *) (yyvsp[(6) - (7)].list), (yylsp[(2) - (7)])); ;} break; - case 348: -#line 30 "third_party/libpg_query/grammar/statements/drop.y" + case 442: +#line 2026 "third_party/libpg_query/grammar/statements/select.y" { - PGDropStmt *n = makeNode(PGDropStmt); - n->removeType = (yyvsp[(2) - (6)].objtype); - n->missing_ok = true; - n->objects = (yyvsp[(5) - (6)].list); - n->behavior = (yyvsp[(6) - (6)].dbehavior); - n->concurrent = false; - (yyval.node) = (PGNode *)n; + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_BETWEEN, + "BETWEEN", + (yyvsp[(1) - (6)].node), + (PGNode *) list_make2((yyvsp[(4) - (6)].node), (yyvsp[(6) - (6)].node)), + (yylsp[(2) - (6)])); ;} break; - case 349: -#line 40 "third_party/libpg_query/grammar/statements/drop.y" + case 443: +#line 2034 "third_party/libpg_query/grammar/statements/select.y" { - PGDropStmt *n = makeNode(PGDropStmt); - n->removeType = (yyvsp[(2) - (4)].objtype); - n->missing_ok = false; - n->objects = (yyvsp[(3) - (4)].list); - n->behavior = (yyvsp[(4) - (4)].dbehavior); - n->concurrent = false; - (yyval.node) = (PGNode *)n; + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_BETWEEN, + "NOT BETWEEN", + (yyvsp[(1) - (7)].node), + (PGNode *) list_make2((yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)), + (yylsp[(2) - (7)])); ;} break; - case 350: -#line 50 "third_party/libpg_query/grammar/statements/drop.y" + case 444: +#line 2042 "third_party/libpg_query/grammar/statements/select.y" { - PGDropStmt *n = makeNode(PGDropStmt); - n->removeType = (yyvsp[(2) - (6)].objtype); - n->objects = list_make1(lappend((yyvsp[(5) - (6)].list), makeString((yyvsp[(3) - (6)].str)))); - n->behavior = (yyvsp[(6) - (6)].dbehavior); - n->missing_ok = false; - n->concurrent = false; - (yyval.node) = (PGNode *) n; + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_BETWEEN_SYM, + "BETWEEN SYMMETRIC", + (yyvsp[(1) - (6)].node), + (PGNode *) list_make2((yyvsp[(4) - (6)].node), (yyvsp[(6) - (6)].node)), + (yylsp[(2) - (6)])); ;} break; - case 351: -#line 60 "third_party/libpg_query/grammar/statements/drop.y" + case 445: +#line 2050 "third_party/libpg_query/grammar/statements/select.y" { - PGDropStmt *n = makeNode(PGDropStmt); - n->removeType = (yyvsp[(2) - (8)].objtype); - n->objects = list_make1(lappend((yyvsp[(7) - (8)].list), makeString((yyvsp[(5) - (8)].str)))); - n->behavior = (yyvsp[(8) - (8)].dbehavior); - n->missing_ok = true; - n->concurrent = false; - (yyval.node) = (PGNode *) n; + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_BETWEEN_SYM, + "NOT BETWEEN SYMMETRIC", + (yyvsp[(1) - (7)].node), + (PGNode *) list_make2((yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)), + (yylsp[(2) - (7)])); ;} break; - case 352: -#line 70 "third_party/libpg_query/grammar/statements/drop.y" + case 446: +#line 2058 "third_party/libpg_query/grammar/statements/select.y" { - PGDropStmt *n = makeNode(PGDropStmt); - n->removeType = PG_OBJECT_TYPE; - n->missing_ok = false; - n->objects = (yyvsp[(3) - (4)].list); - n->behavior = (yyvsp[(4) - (4)].dbehavior); - n->concurrent = false; - (yyval.node) = (PGNode *) n; + /* in_expr returns a PGSubLink or a list of a_exprs */ + if (IsA((yyvsp[(3) - (3)].node), PGSubLink)) + { + /* generate foo = ANY (subquery) */ + PGSubLink *n = (PGSubLink *) (yyvsp[(3) - (3)].node); + n->subLinkType = PG_ANY_SUBLINK; + n->subLinkId = 0; + n->testexpr = (yyvsp[(1) - (3)].node); + n->operName = NIL; /* show it's IN not = ANY */ + n->location = (yylsp[(2) - (3)]); + (yyval.node) = (PGNode *)n; + } + else + { + /* generate scalar IN expression */ + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_IN, "=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); + } ;} break; - case 353: -#line 80 "third_party/libpg_query/grammar/statements/drop.y" + case 447: +#line 2078 "third_party/libpg_query/grammar/statements/select.y" { - PGDropStmt *n = makeNode(PGDropStmt); - n->removeType = PG_OBJECT_TYPE; - n->missing_ok = true; - n->objects = (yyvsp[(5) - (6)].list); - n->behavior = (yyvsp[(6) - (6)].dbehavior); - n->concurrent = false; - (yyval.node) = (PGNode *) n; + /* in_expr returns a PGSubLink or a list of a_exprs */ + if (IsA((yyvsp[(4) - (4)].node), PGSubLink)) + { + /* generate NOT (foo = ANY (subquery)) */ + /* Make an = ANY node */ + PGSubLink *n = (PGSubLink *) (yyvsp[(4) - (4)].node); + n->subLinkType = PG_ANY_SUBLINK; + n->subLinkId = 0; + n->testexpr = (yyvsp[(1) - (4)].node); + n->operName = NIL; /* show it's IN not = ANY */ + n->location = (yylsp[(2) - (4)]); + /* Stick a NOT on top; must have same parse location */ + (yyval.node) = makeNotExpr((PGNode *) n, (yylsp[(2) - (4)])); + } + else + { + /* generate scalar NOT IN expression */ + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_IN, "<>", (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node), (yylsp[(2) - (4)])); + } ;} break; - case 354: -#line 93 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_TABLE; ;} + case 448: +#line 2100 "third_party/libpg_query/grammar/statements/select.y" + { + PGSubLink *n = makeNode(PGSubLink); + n->subLinkType = (yyvsp[(3) - (4)].subquerytype); + n->subLinkId = 0; + n->testexpr = (yyvsp[(1) - (4)].node); + n->operName = (yyvsp[(2) - (4)].list); + n->subselect = (yyvsp[(4) - (4)].node); + n->location = (yylsp[(2) - (4)]); + (yyval.node) = (PGNode *)n; + ;} break; - case 355: -#line 94 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_SEQUENCE; ;} + case 449: +#line 2111 "third_party/libpg_query/grammar/statements/select.y" + { + if ((yyvsp[(3) - (6)].subquerytype) == PG_ANY_SUBLINK) + (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP_ANY, (yyvsp[(2) - (6)].list), (yyvsp[(1) - (6)].node), (yyvsp[(5) - (6)].node), (yylsp[(2) - (6)])); + else + (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP_ALL, (yyvsp[(2) - (6)].list), (yyvsp[(1) - (6)].node), (yyvsp[(5) - (6)].node), (yylsp[(2) - (6)])); + ;} break; - case 356: -#line 95 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_FUNCTION; ;} + case 450: +#line 2118 "third_party/libpg_query/grammar/statements/select.y" + { + /* + * The SQL spec only allows DEFAULT in "contextually typed + * expressions", but for us, it's easier to allow it in + * any a_expr and then throw error during parse analysis + * if it's in an inappropriate context. This way also + * lets us say something smarter than "syntax error". + */ + PGSetToDefault *n = makeNode(PGSetToDefault); + /* parse analysis will fill in the rest */ + n->location = (yylsp[(1) - (1)]); + (yyval.node) = (PGNode *)n; + ;} break; - case 357: -#line 96 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_FUNCTION; ;} + case 451: +#line 2131 "third_party/libpg_query/grammar/statements/select.y" + { + PGList *func_name = list_make1(makeString("construct_array")); + PGFuncCall *n = makeFuncCall(func_name, (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); + (yyval.node) = (PGNode *) n; + ;} break; - case 358: -#line 97 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_VIEW; ;} + case 452: +#line 2148 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 359: -#line 98 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_MATVIEW; ;} + case 453: +#line 2150 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeTypeCast((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].typnam), 0, (yylsp[(2) - (3)])); ;} break; - case 360: -#line 99 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_INDEX; ;} + case 454: +#line 2152 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 361: -#line 100 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_FOREIGN_TABLE; ;} + case 455: +#line 2154 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = doNegate((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 362: -#line 101 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_COLLATION; ;} + case 456: +#line 2156 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 363: -#line 102 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_CONVERSION; ;} + case 457: +#line 2158 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "-", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 364: -#line 103 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_STATISTIC_EXT; ;} + case 458: +#line 2160 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "*", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 365: -#line 104 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_TSPARSER; ;} + case 459: +#line 2162 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "/", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 366: -#line 105 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_TSDICTIONARY; ;} + case 460: +#line 2164 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "%", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 367: -#line 106 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_TSTEMPLATE; ;} + case 461: +#line 2166 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "^", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 368: -#line 107 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_TSCONFIGURATION; ;} + case 462: +#line 2168 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 369: -#line 112 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_ACCESS_METHOD; ;} + case 463: +#line 2170 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 370: -#line 113 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_EVENT_TRIGGER; ;} + case 464: +#line 2172 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 371: -#line 114 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_EXTENSION; ;} + case 465: +#line 2174 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 372: -#line 115 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_FDW; ;} + case 466: +#line 2176 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 373: -#line 116 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_PUBLICATION; ;} + case 467: +#line 2178 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<>", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 374: -#line 117 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_SCHEMA; ;} + case 468: +#line 2180 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (3)].list), (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} break; - case 375: -#line 118 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_FOREIGN_SERVER; ;} + case 469: +#line 2182 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(1) - (2)].list), NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 376: -#line 123 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} + case 470: +#line 2184 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (2)].list), (yyvsp[(1) - (2)].node), NULL, (yylsp[(2) - (2)])); ;} break; - case 377: -#line 124 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} + case 471: +#line 2186 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_DISTINCT, "=", (yyvsp[(1) - (5)].node), (yyvsp[(5) - (5)].node), (yylsp[(2) - (5)])); + ;} break; - case 378: -#line 129 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.dbehavior) = PG_DROP_CASCADE; ;} + case 472: +#line 2190 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_DISTINCT, "=", (yyvsp[(1) - (6)].node), (yyvsp[(6) - (6)].node), (yylsp[(2) - (6)])); + ;} break; - case 379: -#line 130 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.dbehavior) = PG_DROP_RESTRICT; ;} + case 473: +#line 2194 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "=", (yyvsp[(1) - (6)].node), (PGNode *) (yyvsp[(5) - (6)].list), (yylsp[(2) - (6)])); + ;} break; - case 380: -#line 131 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.dbehavior) = PG_DROP_RESTRICT; /* default */ ;} + case 474: +#line 2198 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "<>", (yyvsp[(1) - (7)].node), (PGNode *) (yyvsp[(6) - (7)].list), (yylsp[(2) - (7)])); + ;} break; - case 381: -#line 136 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_POLICY; ;} + case 475: +#line 2211 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 382: -#line 137 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_RULE; ;} + case 476: +#line 2212 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 383: -#line 138 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.objtype) = PG_OBJECT_TRIGGER; ;} + case 477: +#line 2214 "third_party/libpg_query/grammar/statements/select.y" + { + PGPositionalReference *n = makeNode(PGPositionalReference); + n->position = (yyvsp[(2) - (2)].ival); + n->location = (yylsp[(1) - (2)]); + (yyval.node) = (PGNode *) n; + ;} break; - case 384: -#line 141 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].typnam)); ;} + case 478: +#line 2221 "third_party/libpg_query/grammar/statements/select.y" + { + if ((yyvsp[(2) - (2)].list)) + { + PGAIndirection *n = makeNode(PGAIndirection); + n->arg = makeParamRef(0, (yylsp[(1) - (2)])); + n->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); + (yyval.node) = (PGNode *) n; + } + else + (yyval.node) = makeParamRef(0, (yylsp[(1) - (2)])); + ;} break; - case 385: -#line 142 "third_party/libpg_query/grammar/statements/drop.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].typnam)); ;} + case 479: +#line 2233 "third_party/libpg_query/grammar/statements/select.y" + { + PGParamRef *p = makeNode(PGParamRef); + p->number = (yyvsp[(1) - (2)].ival); + p->location = (yylsp[(1) - (2)]); + if ((yyvsp[(2) - (2)].list)) + { + PGAIndirection *n = makeNode(PGAIndirection); + n->arg = (PGNode *) p; + n->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); + (yyval.node) = (PGNode *) n; + } + else + (yyval.node) = (PGNode *) p; + ;} break; - case 386: -#line 8 "third_party/libpg_query/grammar/statements/create_function.y" + case 480: +#line 2248 "third_party/libpg_query/grammar/statements/select.y" { - PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); - n->name = (yyvsp[(3) - (6)].range); - n->params = (yyvsp[(4) - (6)].list); - n->function = (yyvsp[(6) - (6)].node); - (yyval.node) = (PGNode *)n; + if ((yyvsp[(4) - (4)].list)) + { + PGAIndirection *n = makeNode(PGAIndirection); + n->arg = (yyvsp[(2) - (4)].node); + n->indirection = check_indirection((yyvsp[(4) - (4)].list), yyscanner); + (yyval.node) = (PGNode *)n; + } + else + (yyval.node) = (yyvsp[(2) - (4)].node); ;} break; - case 389: -#line 24 "third_party/libpg_query/grammar/statements/create_function.y" - { - (yyval.list) = NIL; - ;} + case 481: +#line 2260 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 390: -#line 28 "third_party/libpg_query/grammar/statements/create_function.y" + case 482: +#line 2262 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.list) = (yyvsp[(2) - (3)].list); - ;} + if ((yyvsp[(2) - (2)].list)) { + PGAIndirection *n = makeNode(PGAIndirection); + n->arg = (yyvsp[(1) - (2)].node); + n->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); + (yyval.node) = (PGNode *)n; + } + else { + (yyval.node) = (yyvsp[(1) - (2)].node); + } + ;} break; - case 391: -#line 12 "third_party/libpg_query/grammar/statements/update.y" + case 483: +#line 2274 "third_party/libpg_query/grammar/statements/select.y" { - PGUpdateStmt *n = makeNode(PGUpdateStmt); - n->relation = (yyvsp[(3) - (8)].range); - n->targetList = (yyvsp[(5) - (8)].list); - n->fromClause = (yyvsp[(6) - (8)].list); - n->whereClause = (yyvsp[(7) - (8)].node); - n->returningList = (yyvsp[(8) - (8)].list); - n->withClause = (yyvsp[(1) - (8)].with); + PGSubLink *n = makeNode(PGSubLink); + n->subLinkType = PG_EXPR_SUBLINK; + n->subLinkId = 0; + n->testexpr = NULL; + n->operName = NIL; + n->subselect = (yyvsp[(1) - (1)].node); + n->location = (yylsp[(1) - (1)]); (yyval.node) = (PGNode *)n; ;} break; - case 392: -#line 3 "third_party/libpg_query/grammar/statements/copy.y" + case 484: +#line 2285 "third_party/libpg_query/grammar/statements/select.y" { - PGCopyStmt *n = makeNode(PGCopyStmt); - n->relation = (yyvsp[(3) - (11)].range); - n->query = NULL; - n->attlist = (yyvsp[(4) - (11)].list); - n->is_from = (yyvsp[(6) - (11)].boolean); - n->is_program = (yyvsp[(7) - (11)].boolean); - n->filename = (yyvsp[(8) - (11)].str); - - if (n->is_program && n->filename == NULL) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("STDIN/STDOUT not allowed with PROGRAM"), - parser_errposition((yylsp[(8) - (11)])))); - - n->options = NIL; - /* Concatenate user-supplied flags */ - if ((yyvsp[(2) - (11)].defelt)) - n->options = lappend(n->options, (yyvsp[(2) - (11)].defelt)); - if ((yyvsp[(5) - (11)].defelt)) - n->options = lappend(n->options, (yyvsp[(5) - (11)].defelt)); - if ((yyvsp[(9) - (11)].defelt)) - n->options = lappend(n->options, (yyvsp[(9) - (11)].defelt)); - if ((yyvsp[(11) - (11)].list)) - n->options = list_concat(n->options, (yyvsp[(11) - (11)].list)); - (yyval.node) = (PGNode *)n; + /* + * Because the select_with_parens nonterminal is designed + * to "eat" as many levels of parens as possible, the + * '(' a_expr ')' opt_indirection production above will + * fail to match a sub-SELECT with indirection decoration; + * the sub-SELECT won't be regarded as an a_expr as long + * as there are parens around it. To support applying + * subscripting or field selection to a sub-SELECT result, + * we need this redundant-looking production. + */ + PGSubLink *n = makeNode(PGSubLink); + PGAIndirection *a = makeNode(PGAIndirection); + n->subLinkType = PG_EXPR_SUBLINK; + n->subLinkId = 0; + n->testexpr = NULL; + n->operName = NIL; + n->subselect = (yyvsp[(1) - (2)].node); + n->location = (yylsp[(1) - (2)]); + a->arg = (PGNode *)n; + a->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); + (yyval.node) = (PGNode *)a; ;} break; - case 393: -#line 31 "third_party/libpg_query/grammar/statements/copy.y" + case 485: +#line 2309 "third_party/libpg_query/grammar/statements/select.y" { - PGCopyStmt *n = makeNode(PGCopyStmt); - n->relation = NULL; - n->query = (yyvsp[(3) - (9)].node); - n->attlist = NIL; - n->is_from = false; - n->is_program = (yyvsp[(6) - (9)].boolean); - n->filename = (yyvsp[(7) - (9)].str); - n->options = (yyvsp[(9) - (9)].list); - - if (n->is_program && n->filename == NULL) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("STDIN/STDOUT not allowed with PROGRAM"), - parser_errposition((yylsp[(5) - (9)])))); - + PGSubLink *n = makeNode(PGSubLink); + n->subLinkType = PG_EXISTS_SUBLINK; + n->subLinkId = 0; + n->testexpr = NULL; + n->operName = NIL; + n->subselect = (yyvsp[(2) - (2)].node); + n->location = (yylsp[(1) - (2)]); (yyval.node) = (PGNode *)n; ;} break; - case 394: -#line 53 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.boolean) = true; ;} - break; - - case 395: -#line 54 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.boolean) = false; ;} + case 486: +#line 2320 "third_party/libpg_query/grammar/statements/select.y" + { + PGGroupingFunc *g = makeNode(PGGroupingFunc); + g->args = (yyvsp[(3) - (4)].list); + g->location = (yylsp[(1) - (4)]); + (yyval.node) = (PGNode *)g; + ;} break; - case 396: -#line 60 "third_party/libpg_query/grammar/statements/copy.y" + case 487: +#line 2329 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("delimiter", (PGNode *)makeString((yyvsp[(3) - (3)].str)), (yylsp[(2) - (3)])); + (yyval.node) = (PGNode *) makeFuncCall((yyvsp[(1) - (3)].list), NIL, (yylsp[(1) - (3)])); ;} break; - case 397: -#line 63 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.defelt) = NULL; ;} - break; - - case 398: -#line 69 "third_party/libpg_query/grammar/statements/copy.y" + case 488: +#line 2333 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); + PGFuncCall *n = makeFuncCall((yyvsp[(1) - (6)].list), (yyvsp[(3) - (6)].list), (yylsp[(1) - (6)])); + n->agg_order = (yyvsp[(4) - (6)].list); + n->agg_ignore_nulls = (yyvsp[(5) - (6)].boolean); + (yyval.node) = (PGNode *)n; ;} break; - case 399: -#line 73 "third_party/libpg_query/grammar/statements/copy.y" + case 489: +#line 2340 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); + PGFuncCall *n = makeFuncCall((yyvsp[(1) - (7)].list), list_make1((yyvsp[(4) - (7)].node)), (yylsp[(1) - (7)])); + n->func_variadic = true; + n->agg_order = (yyvsp[(5) - (7)].list); + n->agg_ignore_nulls = (yyvsp[(6) - (7)].boolean); + (yyval.node) = (PGNode *)n; ;} break; - case 400: -#line 80 "third_party/libpg_query/grammar/statements/copy.y" - {;} - break; - - case 401: -#line 81 "third_party/libpg_query/grammar/statements/copy.y" - {;} - break; - - case 402: -#line 85 "third_party/libpg_query/grammar/statements/copy.y" - {;} - break; - - case 403: -#line 86 "third_party/libpg_query/grammar/statements/copy.y" - {;} - break; - - case 404: -#line 91 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.boolean) = true; ;} - break; - - case 405: -#line 92 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.boolean) = false; ;} - break; - - case 406: -#line 96 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.list) = (yyvsp[(1) - (1)].list); ;} - break; - - case 407: -#line 97 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.list) = (yyvsp[(2) - (3)].list); ;} - break; - - case 408: -#line 102 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); ;} - break; - - case 409: -#line 103 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.node) = (PGNode *) (yyvsp[(1) - (1)].value); ;} - break; - - case 410: -#line 104 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.node) = (PGNode *) makeNode(PGAStar); ;} + case 490: +#line 2348 "third_party/libpg_query/grammar/statements/select.y" + { + PGFuncCall *n = makeFuncCall((yyvsp[(1) - (9)].list), lappend((yyvsp[(3) - (9)].list), (yyvsp[(6) - (9)].node)), (yylsp[(1) - (9)])); + n->func_variadic = true; + n->agg_order = (yyvsp[(7) - (9)].list); + n->agg_ignore_nulls = (yyvsp[(8) - (9)].boolean); + (yyval.node) = (PGNode *)n; + ;} break; - case 411: -#line 105 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.node) = (PGNode *) (yyvsp[(2) - (3)].list); ;} + case 491: +#line 2356 "third_party/libpg_query/grammar/statements/select.y" + { + PGFuncCall *n = makeFuncCall((yyvsp[(1) - (7)].list), (yyvsp[(4) - (7)].list), (yylsp[(1) - (7)])); + n->agg_order = (yyvsp[(5) - (7)].list); + n->agg_ignore_nulls = (yyvsp[(6) - (7)].boolean); + /* Ideally we'd mark the PGFuncCall node to indicate + * "must be an aggregate", but there's no provision + * for that in PGFuncCall at the moment. + */ + (yyval.node) = (PGNode *)n; + ;} break; - case 412: -#line 106 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.node) = NULL; ;} + case 492: +#line 2367 "third_party/libpg_query/grammar/statements/select.y" + { + PGFuncCall *n = makeFuncCall((yyvsp[(1) - (7)].list), (yyvsp[(4) - (7)].list), (yylsp[(1) - (7)])); + n->agg_order = (yyvsp[(5) - (7)].list); + n->agg_ignore_nulls = (yyvsp[(6) - (7)].boolean); + n->agg_distinct = true; + (yyval.node) = (PGNode *)n; + ;} break; - case 413: -#line 112 "third_party/libpg_query/grammar/statements/copy.y" + case 493: +#line 2375 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); + /* + * We consider AGGREGATE(*) to invoke a parameterless + * aggregate. This does the right thing for COUNT(*), + * and there are no other aggregates in SQL that accept + * '*' as parameter. + * + * The PGFuncCall node is also marked agg_star = true, + * so that later processing can detect what the argument + * really was. + */ + PGFuncCall *n = makeFuncCall((yyvsp[(1) - (4)].list), NIL, (yylsp[(1) - (4)])); + n->agg_star = true; + (yyval.node) = (PGNode *)n; ;} break; - case 414: -#line 120 "third_party/libpg_query/grammar/statements/copy.y" + case 494: +#line 2403 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("oids", (PGNode *)makeInteger(true), (yylsp[(1) - (2)])); + PGFuncCall *n = (PGFuncCall *) (yyvsp[(1) - (5)].node); + /* + * The order clause for WITHIN GROUP and the one for + * plain-aggregate ORDER BY share a field, so we have to + * check here that at most one is present. We also check + * for DISTINCT and VARIADIC here to give a better error + * location. Other consistency checks are deferred to + * parse analysis. + */ + if ((yyvsp[(2) - (5)].list) != NIL) + { + if (n->agg_order != NIL) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("cannot use multiple ORDER BY clauses with WITHIN GROUP"), + parser_errposition((yylsp[(2) - (5)])))); + if (n->agg_distinct) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("cannot use DISTINCT with WITHIN GROUP"), + parser_errposition((yylsp[(2) - (5)])))); + if (n->func_variadic) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("cannot use VARIADIC with WITHIN GROUP"), + parser_errposition((yylsp[(2) - (5)])))); + n->agg_order = (yyvsp[(2) - (5)].list); + n->agg_within_group = true; + } + n->agg_filter = (yyvsp[(3) - (5)].node); + n->export_state = (yyvsp[(4) - (5)].boolean); + n->over = (yyvsp[(5) - (5)].windef); + (yyval.node) = (PGNode *) n; ;} break; - case 415: -#line 123 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.defelt) = NULL; ;} + case 495: +#line 2439 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 416: -#line 128 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].defelt)); ;} + case 496: +#line 2449 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 417: -#line 129 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.list) = NIL; ;} + case 497: +#line 2450 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 418: -#line 135 "third_party/libpg_query/grammar/statements/copy.y" + case 498: +#line 2458 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("format", (PGNode *)makeString("binary"), (yylsp[(1) - (1)])); + (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("pg_collation_for"), + list_make1((yyvsp[(4) - (5)].node)), + (yylsp[(1) - (5)])); ;} break; - case 419: -#line 138 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.defelt) = NULL; ;} - break; - - case 420: -#line 144 "third_party/libpg_query/grammar/statements/copy.y" + case 499: +#line 2464 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("format", (PGNode *)makeString("binary"), (yylsp[(1) - (1)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_DATE, -1, (yylsp[(1) - (1)])); ;} break; - case 421: -#line 148 "third_party/libpg_query/grammar/statements/copy.y" + case 500: +#line 2468 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("oids", (PGNode *)makeInteger(true), (yylsp[(1) - (1)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_TIME, -1, (yylsp[(1) - (1)])); ;} break; - case 422: -#line 152 "third_party/libpg_query/grammar/statements/copy.y" + case 501: +#line 2472 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("freeze", (PGNode *)makeInteger(true), (yylsp[(1) - (1)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_TIME_N, (yyvsp[(3) - (4)].ival), (yylsp[(1) - (4)])); ;} break; - case 423: -#line 156 "third_party/libpg_query/grammar/statements/copy.y" + case 502: +#line 2476 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("delimiter", (PGNode *)makeString((yyvsp[(3) - (3)].str)), (yylsp[(1) - (3)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_TIMESTAMP, -1, (yylsp[(1) - (1)])); ;} break; - case 424: -#line 160 "third_party/libpg_query/grammar/statements/copy.y" + case 503: +#line 2480 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("null", (PGNode *)makeString((yyvsp[(3) - (3)].str)), (yylsp[(1) - (3)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_TIMESTAMP_N, (yyvsp[(3) - (4)].ival), (yylsp[(1) - (4)])); ;} break; - case 425: -#line 164 "third_party/libpg_query/grammar/statements/copy.y" + case 504: +#line 2484 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("format", (PGNode *)makeString("csv"), (yylsp[(1) - (1)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_LOCALTIME, -1, (yylsp[(1) - (1)])); ;} break; - case 426: -#line 168 "third_party/libpg_query/grammar/statements/copy.y" + case 505: +#line 2488 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("header", (PGNode *)makeInteger(true), (yylsp[(1) - (1)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_LOCALTIME_N, (yyvsp[(3) - (4)].ival), (yylsp[(1) - (4)])); ;} break; - case 427: -#line 172 "third_party/libpg_query/grammar/statements/copy.y" + case 506: +#line 2492 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("quote", (PGNode *)makeString((yyvsp[(3) - (3)].str)), (yylsp[(1) - (3)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_LOCALTIMESTAMP, -1, (yylsp[(1) - (1)])); ;} break; - case 428: -#line 176 "third_party/libpg_query/grammar/statements/copy.y" + case 507: +#line 2496 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("escape", (PGNode *)makeString((yyvsp[(3) - (3)].str)), (yylsp[(1) - (3)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_LOCALTIMESTAMP_N, (yyvsp[(3) - (4)].ival), (yylsp[(1) - (4)])); ;} break; - case 429: -#line 180 "third_party/libpg_query/grammar/statements/copy.y" + case 508: +#line 2500 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("force_quote", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_ROLE, -1, (yylsp[(1) - (1)])); ;} break; - case 430: -#line 184 "third_party/libpg_query/grammar/statements/copy.y" + case 509: +#line 2504 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("force_quote", (PGNode *)makeNode(PGAStar), (yylsp[(1) - (3)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_USER, -1, (yylsp[(1) - (1)])); ;} break; - case 431: -#line 188 "third_party/libpg_query/grammar/statements/copy.y" + case 510: +#line 2508 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("force_not_null", (PGNode *)(yyvsp[(4) - (4)].list), (yylsp[(1) - (4)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_SESSION_USER, -1, (yylsp[(1) - (1)])); ;} break; - case 432: -#line 192 "third_party/libpg_query/grammar/statements/copy.y" + case 511: +#line 2512 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("force_null", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_USER, -1, (yylsp[(1) - (1)])); ;} break; - case 433: -#line 196 "third_party/libpg_query/grammar/statements/copy.y" + case 512: +#line 2516 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.defelt) = makeDefElem("encoding", (PGNode *)makeString((yyvsp[(2) - (2)].str)), (yylsp[(1) - (2)])); + (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_CATALOG, -1, (yylsp[(1) - (1)])); ;} break; - case 434: -#line 203 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); ;} - break; - - case 435: -#line 209 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 513: +#line 2520 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_SCHEMA, -1, (yylsp[(1) - (1)])); + ;} break; - case 436: -#line 210 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.str) = NULL; ;} + case 514: +#line 2524 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeTypeCast((yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].typnam), 0, (yylsp[(1) - (6)])); ;} break; - case 437: -#line 211 "third_party/libpg_query/grammar/statements/copy.y" - { (yyval.str) = NULL; ;} + case 515: +#line 2526 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = makeTypeCast((yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].typnam), 1, (yylsp[(1) - (6)])); ;} break; - case 438: -#line 217 "third_party/libpg_query/grammar/statements/copy.y" + case 516: +#line 2528 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); + (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("date_part"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 439: -#line 221 "third_party/libpg_query/grammar/statements/copy.y" + case 517: +#line 2532 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); + /* overlay(A PLACING B FROM C FOR D) is converted to + * overlay(A, B, C, D) + * overlay(A PLACING B FROM C) is converted to + * overlay(A, B, C) + */ + (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("overlay"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 442: -#line 52 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(2) - (3)].node); ;} - break; - - case 443: -#line 53 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(2) - (3)].node); ;} + case 518: +#line 2541 "third_party/libpg_query/grammar/statements/select.y" + { + /* position(A in B) is converted to position(B, A) */ + (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("position"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); + ;} break; - case 444: -#line 68 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 519: +#line 2546 "third_party/libpg_query/grammar/statements/select.y" + { + /* substring(A from B for C) is converted to + * substring(A, B, C) - thomas 2000-11-28 + */ + (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("substring"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); + ;} break; - case 445: -#line 70 "third_party/libpg_query/grammar/statements/select.y" + case 520: +#line 2553 "third_party/libpg_query/grammar/statements/select.y" { - insertSelectOptions((PGSelectStmt *) (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].list), NIL, - NULL, NULL, NULL, - yyscanner); - (yyval.node) = (yyvsp[(1) - (2)].node); + /* TREAT(expr AS target) converts expr of a particular type to target, + * which is defined to be a subtype of the original expression. + * In SQL99, this is intended for use with structured UDTs, + * but let's make this a generally useful form allowing stronger + * coercions than are handled by implicit casting. + * + * Convert SystemTypeName() to SystemFuncName() even though + * at the moment they result in the same thing. + */ + (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName(((PGValue *)llast((yyvsp[(5) - (6)].typnam)->names))->val.str), + list_make1((yyvsp[(3) - (6)].node)), + (yylsp[(1) - (6)])); ;} break; - case 446: -#line 77 "third_party/libpg_query/grammar/statements/select.y" + case 521: +#line 2568 "third_party/libpg_query/grammar/statements/select.y" { - insertSelectOptions((PGSelectStmt *) (yyvsp[(1) - (4)].node), (yyvsp[(2) - (4)].list), (yyvsp[(3) - (4)].list), - (PGNode*) list_nth((yyvsp[(4) - (4)].list), 0), (PGNode*) list_nth((yyvsp[(4) - (4)].list), 1), - NULL, - yyscanner); - (yyval.node) = (yyvsp[(1) - (4)].node); + /* various trim expressions are defined in SQL + * - thomas 1997-07-19 + */ + (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("trim"), (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); ;} break; - case 447: -#line 85 "third_party/libpg_query/grammar/statements/select.y" + case 522: +#line 2575 "third_party/libpg_query/grammar/statements/select.y" { - insertSelectOptions((PGSelectStmt *) (yyvsp[(1) - (4)].node), (yyvsp[(2) - (4)].list), (yyvsp[(4) - (4)].list), - (PGNode*) list_nth((yyvsp[(3) - (4)].list), 0), (PGNode*) list_nth((yyvsp[(3) - (4)].list), 1), - NULL, - yyscanner); - (yyval.node) = (yyvsp[(1) - (4)].node); + (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("ltrim"), (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); ;} break; - case 448: -#line 93 "third_party/libpg_query/grammar/statements/select.y" + case 523: +#line 2579 "third_party/libpg_query/grammar/statements/select.y" { - insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (2)].node), NULL, NIL, - NULL, NULL, - (yyvsp[(1) - (2)].with), - yyscanner); - (yyval.node) = (yyvsp[(2) - (2)].node); + (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("rtrim"), (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); ;} break; - case 449: -#line 101 "third_party/libpg_query/grammar/statements/select.y" + case 524: +#line 2583 "third_party/libpg_query/grammar/statements/select.y" { - insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (3)].node), (yyvsp[(3) - (3)].list), NIL, - NULL, NULL, - (yyvsp[(1) - (3)].with), - yyscanner); - (yyval.node) = (yyvsp[(2) - (3)].node); + (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("trim"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 450: -#line 109 "third_party/libpg_query/grammar/statements/select.y" + case 525: +#line 2587 "third_party/libpg_query/grammar/statements/select.y" { - insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (5)].node), (yyvsp[(3) - (5)].list), (yyvsp[(4) - (5)].list), - (PGNode*) list_nth((yyvsp[(5) - (5)].list), 0), (PGNode*) list_nth((yyvsp[(5) - (5)].list), 1), - (yyvsp[(1) - (5)].with), - yyscanner); - (yyval.node) = (yyvsp[(2) - (5)].node); + (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NULLIF, "=", (yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].node), (yylsp[(1) - (6)])); ;} break; - case 451: -#line 117 "third_party/libpg_query/grammar/statements/select.y" + case 526: +#line 2591 "third_party/libpg_query/grammar/statements/select.y" { - insertSelectOptions((PGSelectStmt *) (yyvsp[(2) - (5)].node), (yyvsp[(3) - (5)].list), (yyvsp[(5) - (5)].list), - (PGNode*) list_nth((yyvsp[(4) - (5)].list), 0), (PGNode*) list_nth((yyvsp[(4) - (5)].list), 1), - (yyvsp[(1) - (5)].with), - yyscanner); - (yyval.node) = (yyvsp[(2) - (5)].node); + PGCoalesceExpr *c = makeNode(PGCoalesceExpr); + c->args = (yyvsp[(3) - (4)].list); + c->location = (yylsp[(1) - (4)]); + (yyval.node) = (PGNode *)c; ;} break; - case 452: -#line 127 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 527: +#line 2604 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(4) - (5)].list); ;} break; - case 453: -#line 128 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 528: +#line 2605 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} break; - case 454: -#line 158 "third_party/libpg_query/grammar/statements/select.y" - { - PGSelectStmt *n = makeNode(PGSelectStmt); - n->targetList = (yyvsp[(3) - (11)].list); - n->intoClause = (yyvsp[(4) - (11)].into); - n->fromClause = (yyvsp[(5) - (11)].list); - n->whereClause = (yyvsp[(6) - (11)].node); - n->groupClause = (yyvsp[(7) - (11)].list); - n->havingClause = (yyvsp[(8) - (11)].node); - n->windowClause = (yyvsp[(9) - (11)].list); - n->qualifyClause = (yyvsp[(10) - (11)].node); - n->sampleOptions = (yyvsp[(11) - (11)].node); - (yyval.node) = (PGNode *)n; - ;} + case 529: +#line 2609 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(4) - (5)].node); ;} break; - case 455: -#line 174 "third_party/libpg_query/grammar/statements/select.y" - { - PGSelectStmt *n = makeNode(PGSelectStmt); - n->distinctClause = (yyvsp[(2) - (11)].list); - n->targetList = (yyvsp[(3) - (11)].list); - n->intoClause = (yyvsp[(4) - (11)].into); - n->fromClause = (yyvsp[(5) - (11)].list); - n->whereClause = (yyvsp[(6) - (11)].node); - n->groupClause = (yyvsp[(7) - (11)].list); - n->havingClause = (yyvsp[(8) - (11)].node); - n->windowClause = (yyvsp[(9) - (11)].list); - n->qualifyClause = (yyvsp[(10) - (11)].node); - n->sampleOptions = (yyvsp[(11) - (11)].node); - (yyval.node) = (PGNode *)n; - ;} + case 530: +#line 2610 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} break; - case 456: -#line 188 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 531: +#line 2614 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = true; ;} break; - case 457: -#line 190 "third_party/libpg_query/grammar/statements/select.y" - { - /* same as SELECT * FROM relation_expr */ - PGColumnRef *cr = makeNode(PGColumnRef); - PGResTarget *rt = makeNode(PGResTarget); - PGSelectStmt *n = makeNode(PGSelectStmt); + case 532: +#line 2615 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.boolean) = false; ;} + break; - cr->fields = list_make1(makeNode(PGAStar)); - cr->location = -1; + case 533: +#line 2622 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(2) - (2)].list); ;} + break; - rt->name = NULL; - rt->indirection = NIL; - rt->val = (PGNode *)cr; - rt->location = -1; + case 534: +#line 2623 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} + break; - n->targetList = list_make1(rt); - n->fromClause = list_make1((yyvsp[(2) - (2)].range)); - (yyval.node) = (PGNode *)n; - ;} + case 535: +#line 2627 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].windef)); ;} break; - case 458: -#line 209 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = makeSetOp(PG_SETOP_UNION, (yyvsp[(3) - (4)].boolean), (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node)); - ;} + case 536: +#line 2629 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].windef)); ;} break; - case 459: -#line 213 "third_party/libpg_query/grammar/statements/select.y" + case 537: +#line 2634 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = makeSetOp(PG_SETOP_INTERSECT, (yyvsp[(3) - (4)].boolean), (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node)); + PGWindowDef *n = (yyvsp[(3) - (3)].windef); + n->name = (yyvsp[(1) - (3)].str); + (yyval.windef) = n; ;} break; - case 460: -#line 217 "third_party/libpg_query/grammar/statements/select.y" + case 538: +#line 2642 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.windef) = (yyvsp[(2) - (2)].windef); ;} + break; + + case 539: +#line 2644 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = makeSetOp(PG_SETOP_EXCEPT, (yyvsp[(3) - (4)].boolean), (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node)); + PGWindowDef *n = makeNode(PGWindowDef); + n->name = (yyvsp[(2) - (2)].str); + n->refname = NULL; + n->partitionClause = NIL; + n->orderClause = NIL; + n->frameOptions = FRAMEOPTION_DEFAULTS; + n->startOffset = NULL; + n->endOffset = NULL; + n->location = (yylsp[(2) - (2)]); + (yyval.windef) = n; ;} break; - case 461: -#line 234 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.with) = makeNode(PGWithClause); - (yyval.with)->ctes = (yyvsp[(2) - (2)].list); - (yyval.with)->recursive = false; - (yyval.with)->location = (yylsp[(1) - (2)]); - ;} + case 540: +#line 2657 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.windef) = NULL; ;} break; - case 462: -#line 241 "third_party/libpg_query/grammar/statements/select.y" + case 541: +#line 2662 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.with) = makeNode(PGWithClause); - (yyval.with)->ctes = (yyvsp[(2) - (2)].list); - (yyval.with)->recursive = false; - (yyval.with)->location = (yylsp[(1) - (2)]); - ;} + PGWindowDef *n = makeNode(PGWindowDef); + n->name = NULL; + n->refname = (yyvsp[(2) - (6)].str); + n->partitionClause = (yyvsp[(3) - (6)].list); + n->orderClause = (yyvsp[(4) - (6)].list); + /* copy relevant fields of opt_frame_clause */ + n->frameOptions = (yyvsp[(5) - (6)].windef)->frameOptions; + n->startOffset = (yyvsp[(5) - (6)].windef)->startOffset; + n->endOffset = (yyvsp[(5) - (6)].windef)->endOffset; + n->location = (yylsp[(1) - (6)]); + (yyval.windef) = n; + ;} break; - case 463: -#line 248 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.with) = makeNode(PGWithClause); - (yyval.with)->ctes = (yyvsp[(3) - (3)].list); - (yyval.with)->recursive = true; - (yyval.with)->location = (yylsp[(1) - (3)]); - ;} + case 542: +#line 2687 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 464: -#line 257 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} + case 543: +#line 2688 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = NULL; ;} break; - case 465: -#line 258 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} + case 544: +#line 2691 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(3) - (3)].list); ;} break; - case 466: -#line 262 "third_party/libpg_query/grammar/statements/select.y" - { - PGCommonTableExpr *n = makeNode(PGCommonTableExpr); - n->ctename = (yyvsp[(1) - (6)].str); - n->aliascolnames = (yyvsp[(2) - (6)].list); - n->ctequery = (yyvsp[(5) - (6)].node); - n->location = (yylsp[(1) - (6)]); - (yyval.node) = (PGNode *) n; - ;} + case 545: +#line 2692 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} break; - case 467: -#line 274 "third_party/libpg_query/grammar/statements/select.y" + case 546: +#line 2704 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.into) = makeNode(PGIntoClause); - (yyval.into)->rel = (yyvsp[(2) - (2)].range); - (yyval.into)->colNames = NIL; - (yyval.into)->options = NIL; - (yyval.into)->onCommit = PG_ONCOMMIT_NOOP; - (yyval.into)->viewQuery = NULL; - (yyval.into)->skipData = false; + PGWindowDef *n = (yyvsp[(2) - (2)].windef); + n->frameOptions |= FRAMEOPTION_NONDEFAULT | FRAMEOPTION_RANGE; + (yyval.windef) = n; ;} break; - case 468: -#line 284 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.into) = NULL; ;} + case 547: +#line 2710 "third_party/libpg_query/grammar/statements/select.y" + { + PGWindowDef *n = (yyvsp[(2) - (2)].windef); + n->frameOptions |= FRAMEOPTION_NONDEFAULT | FRAMEOPTION_ROWS; + (yyval.windef) = n; + ;} break; - case 469: -#line 293 "third_party/libpg_query/grammar/statements/select.y" + case 548: +#line 2716 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.range) = (yyvsp[(3) - (3)].range); - (yyval.range)->relpersistence = PG_RELPERSISTENCE_TEMP; + PGWindowDef *n = makeNode(PGWindowDef); + n->frameOptions = FRAMEOPTION_DEFAULTS; + n->startOffset = NULL; + n->endOffset = NULL; + (yyval.windef) = n; ;} break; - case 470: -#line 298 "third_party/libpg_query/grammar/statements/select.y" + case 549: +#line 2726 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.range) = (yyvsp[(3) - (3)].range); - (yyval.range)->relpersistence = PG_RELPERSISTENCE_TEMP; + PGWindowDef *n = (yyvsp[(1) - (1)].windef); + /* reject invalid cases */ + if (n->frameOptions & FRAMEOPTION_START_UNBOUNDED_FOLLOWING) + ereport(ERROR, + (errcode(PG_ERRCODE_WINDOWING_ERROR), + errmsg("frame start cannot be UNBOUNDED FOLLOWING"), + parser_errposition((yylsp[(1) - (1)])))); + if (n->frameOptions & FRAMEOPTION_START_VALUE_FOLLOWING) + ereport(ERROR, + (errcode(PG_ERRCODE_WINDOWING_ERROR), + errmsg("frame starting from following row cannot end with current row"), + parser_errposition((yylsp[(1) - (1)])))); + n->frameOptions |= FRAMEOPTION_END_CURRENT_ROW; + (yyval.windef) = n; ;} break; - case 471: -#line 303 "third_party/libpg_query/grammar/statements/select.y" + case 550: +#line 2743 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.range) = (yyvsp[(4) - (4)].range); - (yyval.range)->relpersistence = PG_RELPERSISTENCE_TEMP; + PGWindowDef *n1 = (yyvsp[(2) - (4)].windef); + PGWindowDef *n2 = (yyvsp[(4) - (4)].windef); + /* form merged options */ + int frameOptions = n1->frameOptions; + /* shift converts START_ options to END_ options */ + frameOptions |= n2->frameOptions << 1; + frameOptions |= FRAMEOPTION_BETWEEN; + /* reject invalid cases */ + if (frameOptions & FRAMEOPTION_START_UNBOUNDED_FOLLOWING) + ereport(ERROR, + (errcode(PG_ERRCODE_WINDOWING_ERROR), + errmsg("frame start cannot be UNBOUNDED FOLLOWING"), + parser_errposition((yylsp[(2) - (4)])))); + if (frameOptions & FRAMEOPTION_END_UNBOUNDED_PRECEDING) + ereport(ERROR, + (errcode(PG_ERRCODE_WINDOWING_ERROR), + errmsg("frame end cannot be UNBOUNDED PRECEDING"), + parser_errposition((yylsp[(4) - (4)])))); + if ((frameOptions & FRAMEOPTION_START_CURRENT_ROW) && + (frameOptions & FRAMEOPTION_END_VALUE_PRECEDING)) + ereport(ERROR, + (errcode(PG_ERRCODE_WINDOWING_ERROR), + errmsg("frame starting from current row cannot have preceding rows"), + parser_errposition((yylsp[(4) - (4)])))); + if ((frameOptions & FRAMEOPTION_START_VALUE_FOLLOWING) && + (frameOptions & (FRAMEOPTION_END_VALUE_PRECEDING | + FRAMEOPTION_END_CURRENT_ROW))) + ereport(ERROR, + (errcode(PG_ERRCODE_WINDOWING_ERROR), + errmsg("frame starting from following row cannot have preceding rows"), + parser_errposition((yylsp[(4) - (4)])))); + n1->frameOptions = frameOptions; + n1->endOffset = n2->startOffset; + (yyval.windef) = n1; ;} break; - case 472: -#line 308 "third_party/libpg_query/grammar/statements/select.y" + case 551: +#line 2788 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.range) = (yyvsp[(4) - (4)].range); - (yyval.range)->relpersistence = PG_RELPERSISTENCE_TEMP; + PGWindowDef *n = makeNode(PGWindowDef); + n->frameOptions = FRAMEOPTION_START_UNBOUNDED_PRECEDING; + n->startOffset = NULL; + n->endOffset = NULL; + (yyval.windef) = n; ;} break; - case 473: -#line 313 "third_party/libpg_query/grammar/statements/select.y" + case 552: +#line 2796 "third_party/libpg_query/grammar/statements/select.y" { - ereport(PGWARNING, - (errmsg("GLOBAL is deprecated in temporary table creation"), - parser_errposition((yylsp[(1) - (4)])))); - (yyval.range) = (yyvsp[(4) - (4)].range); - (yyval.range)->relpersistence = PG_RELPERSISTENCE_TEMP; + PGWindowDef *n = makeNode(PGWindowDef); + n->frameOptions = FRAMEOPTION_START_UNBOUNDED_FOLLOWING; + n->startOffset = NULL; + n->endOffset = NULL; + (yyval.windef) = n; ;} break; - case 474: -#line 321 "third_party/libpg_query/grammar/statements/select.y" + case 553: +#line 2804 "third_party/libpg_query/grammar/statements/select.y" { - ereport(PGWARNING, - (errmsg("GLOBAL is deprecated in temporary table creation"), - parser_errposition((yylsp[(1) - (4)])))); - (yyval.range) = (yyvsp[(4) - (4)].range); - (yyval.range)->relpersistence = PG_RELPERSISTENCE_TEMP; + PGWindowDef *n = makeNode(PGWindowDef); + n->frameOptions = FRAMEOPTION_START_CURRENT_ROW; + n->startOffset = NULL; + n->endOffset = NULL; + (yyval.windef) = n; ;} break; - case 475: -#line 329 "third_party/libpg_query/grammar/statements/select.y" + case 554: +#line 2812 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.range) = (yyvsp[(3) - (3)].range); - (yyval.range)->relpersistence = PG_RELPERSISTENCE_UNLOGGED; + PGWindowDef *n = makeNode(PGWindowDef); + n->frameOptions = FRAMEOPTION_START_VALUE_PRECEDING; + n->startOffset = (yyvsp[(1) - (2)].node); + n->endOffset = NULL; + (yyval.windef) = n; ;} break; - case 476: -#line 334 "third_party/libpg_query/grammar/statements/select.y" + case 555: +#line 2820 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.range) = (yyvsp[(2) - (2)].range); - (yyval.range)->relpersistence = RELPERSISTENCE_PERMANENT; + PGWindowDef *n = makeNode(PGWindowDef); + n->frameOptions = FRAMEOPTION_START_VALUE_FOLLOWING; + n->startOffset = (yyvsp[(1) - (2)].node); + n->endOffset = NULL; + (yyval.windef) = n; ;} break; - case 477: -#line 339 "third_party/libpg_query/grammar/statements/select.y" + case 556: +#line 2840 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(3) - (4)].list); ;} + break; + + case 557: +#line 2841 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} + break; + + case 558: +#line 2844 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (1)].list);;} + break; + + case 559: +#line 2845 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(2) - (5)].list), (yyvsp[(4) - (5)].node)); ;} + break; + + case 560: +#line 2849 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.range) = (yyvsp[(1) - (1)].range); - (yyval.range)->relpersistence = RELPERSISTENCE_PERMANENT; - ;} + PGNamedArgExpr *na = makeNode(PGNamedArgExpr); + na->name = (yyvsp[(1) - (3)].str); + na->arg = (PGExpr *) (yyvsp[(3) - (3)].node); + na->argnumber = -1; + na->location = (yylsp[(1) - (3)]); + (yyval.node) = (PGNode *) na; + ;} break; - case 478: -#line 345 "third_party/libpg_query/grammar/statements/select.y" - {;} + case 561: +#line 2859 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 479: -#line 346 "third_party/libpg_query/grammar/statements/select.y" - {;} + case 562: +#line 2860 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 480: -#line 350 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.boolean) = true; ;} + case 563: +#line 2864 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 481: -#line 351 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.boolean) = false; ;} + case 564: +#line 2865 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 482: -#line 352 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.boolean) = false; ;} + case 565: +#line 2869 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.subquerytype) = PG_ANY_SUBLINK; ;} break; - case 483: -#line 359 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(NIL); ;} + case 566: +#line 2870 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.subquerytype) = PG_ANY_SUBLINK; ;} break; - case 484: -#line 360 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(4) - (5)].list); ;} + case 567: +#line 2871 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.subquerytype) = PG_ALL_SUBLINK; ;} break; - case 485: -#line 364 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL;;} + case 568: +#line 2874 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 486: -#line 365 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 569: +#line 2875 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (char*) (yyvsp[(1) - (1)].conststr); ;} break; - case 487: -#line 369 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.boolean) = true;;} + case 570: +#line 2878 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = "+"; ;} break; - case 488: -#line 370 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.boolean) = false;;} + case 571: +#line 2879 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = "-"; ;} break; - case 489: -#line 371 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.boolean) = false; ;} + case 572: +#line 2880 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = "*"; ;} break; - case 490: -#line 375 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(1) - (1)].list);;} + case 573: +#line 2881 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = "/"; ;} break; - case 491: -#line 376 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 574: +#line 2882 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = "%"; ;} break; - case 492: -#line 380 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(3) - (3)].list); ;} + case 575: +#line 2883 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = "^"; ;} break; - case 493: -#line 382 "third_party/libpg_query/grammar/statements/select.y" - { - PGSortBy *sort = makeNode(PGSortBy); - sort->node = (PGNode *) makeNode(PGAStar); - sort->sortby_dir = (yyvsp[(4) - (5)].sortorder); - sort->sortby_nulls = (yyvsp[(5) - (5)].nullorder); - sort->useOp = NIL; - sort->location = -1; /* no operator */ - (yyval.list) = list_make1(sort); - ;} + case 576: +#line 2884 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = "<"; ;} break; - case 494: -#line 392 "third_party/libpg_query/grammar/statements/select.y" - { - PGSortBy *sort = makeNode(PGSortBy); - sort->node = (PGNode *) makeNode(PGAStar); - sort->sortby_dir = (yyvsp[(4) - (5)].sortorder); - sort->sortby_nulls = (yyvsp[(5) - (5)].nullorder); - sort->useOp = NIL; - sort->location = -1; /* no operator */ - (yyval.list) = list_make1(sort); - ;} + case 577: +#line 2885 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = ">"; ;} break; - case 495: -#line 404 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].sortby)); ;} + case 578: +#line 2886 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = "="; ;} break; - case 496: -#line 405 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].sortby)); ;} + case 579: +#line 2887 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = "<="; ;} break; - case 497: -#line 409 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.sortby) = makeNode(PGSortBy); - (yyval.sortby)->node = (yyvsp[(1) - (4)].node); - (yyval.sortby)->sortby_dir = SORTBY_USING; - (yyval.sortby)->sortby_nulls = (yyvsp[(4) - (4)].nullorder); - (yyval.sortby)->useOp = (yyvsp[(3) - (4)].list); - (yyval.sortby)->location = (yylsp[(3) - (4)]); - ;} + case 580: +#line 2888 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = ">="; ;} break; - case 498: -#line 418 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.sortby) = makeNode(PGSortBy); - (yyval.sortby)->node = (yyvsp[(1) - (3)].node); - (yyval.sortby)->sortby_dir = (yyvsp[(2) - (3)].sortorder); - (yyval.sortby)->sortby_nulls = (yyvsp[(3) - (3)].nullorder); - (yyval.sortby)->useOp = NIL; - (yyval.sortby)->location = -1; /* no operator */ - ;} + case 581: +#line 2889 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.conststr) = "<>"; ;} break; - case 499: -#line 428 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.sortorder) = PG_SORTBY_ASC; ;} + case 582: +#line 2893 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 500: -#line 429 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.sortorder) = PG_SORTBY_DESC; ;} + case 583: +#line 2895 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 501: -#line 430 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.sortorder) = PG_SORTBY_DEFAULT; ;} + case 584: +#line 2900 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 502: -#line 433 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.nullorder) = PG_SORTBY_NULLS_FIRST; ;} + case 585: +#line 2902 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 503: -#line 434 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.nullorder) = PG_SORTBY_NULLS_LAST; ;} + case 586: +#line 2907 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 504: -#line 435 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.nullorder) = PG_SORTBY_NULLS_DEFAULT; ;} + case 587: +#line 2909 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 505: -#line 439 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make2((yyvsp[(2) - (2)].node), (yyvsp[(1) - (2)].node)); ;} + case 588: +#line 2911 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString("~~")); ;} break; - case 506: -#line 440 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make2((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node)); ;} + case 589: +#line 2913 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString("!~~")); ;} break; - case 507: -#line 441 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make2(NULL, (yyvsp[(1) - (1)].node)); ;} + case 590: +#line 2915 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString("~~~")); ;} break; - case 508: -#line 442 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make2((yyvsp[(1) - (1)].node), NULL); ;} + case 591: +#line 2917 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString("!~~~")); ;} break; - case 509: -#line 446 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(1) - (1)].list); ;} + case 592: +#line 2919 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString("~~*")); ;} break; - case 510: -#line 447 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make2(NULL,NULL); ;} + case 593: +#line 2921 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString("!~~*")); ;} break; - case 511: -#line 452 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(2) - (2)].node); ;} + case 594: +#line 2935 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 512: -#line 454 "third_party/libpg_query/grammar/statements/select.y" + case 595: +#line 2937 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lcons(makeString((yyvsp[(1) - (3)].str)), (yyvsp[(3) - (3)].list)); ;} + break; + + case 596: +#line 2941 "third_party/libpg_query/grammar/statements/select.y" { - /* Disabled because it was too confusing, bjm 2002-02-18 */ - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("LIMIT #,# syntax is not supported"), - errhint("Use separate LIMIT and OFFSET clauses."), - parser_errposition((yylsp[(1) - (4)])))); + (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 513: -#line 470 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(3) - (5)].node); ;} + case 597: +#line 2945 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); + ;} break; - case 514: -#line 472 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeIntConst(1, -1); ;} + case 598: +#line 2952 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = (yyvsp[(1) - (1)].list); + ;} break; - case 515: -#line 477 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(2) - (2)].node); ;} + case 599: +#line 2957 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = (yyvsp[(1) - (2)].list); + ;} break; - case 516: -#line 480 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(2) - (3)].node); ;} + case 600: +#line 2975 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = (yyvsp[(1) - (1)].list); + ;} break; - case 517: -#line 488 "third_party/libpg_query/grammar/statements/select.y" + case 601: +#line 2979 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = makeSampleSize(makeFloat((yyvsp[(1) - (2)].str)), true); - ;} + (yyval.list) = NULL; + ;} break; - case 518: -#line 492 "third_party/libpg_query/grammar/statements/select.y" + case 602: +#line 2988 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = makeSampleSize(makeInteger((yyvsp[(1) - (2)].ival)), true); - ;} + (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); + ;} break; - case 519: -#line 496 "third_party/libpg_query/grammar/statements/select.y" + case 603: +#line 2992 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = makeSampleSize(makeFloat((yyvsp[(1) - (2)].str)), true); - ;} + (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); + ;} break; - case 520: -#line 500 "third_party/libpg_query/grammar/statements/select.y" + case 604: +#line 2998 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = makeSampleSize(makeInteger((yyvsp[(1) - (2)].ival)), true); - ;} + (yyval.node) = (yyvsp[(1) - (1)].node); + ;} break; - case 521: -#line 504 "third_party/libpg_query/grammar/statements/select.y" + case 605: +#line 3002 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = makeSampleSize(makeInteger((yyvsp[(1) - (1)].ival)), false); - ;} + PGNamedArgExpr *na = makeNode(PGNamedArgExpr); + na->name = (yyvsp[(1) - (3)].str); + na->arg = (PGExpr *) (yyvsp[(3) - (3)].node); + na->argnumber = -1; /* until determined */ + na->location = (yylsp[(1) - (3)]); + (yyval.node) = (PGNode *) na; + ;} + break; + + case 606: +#line 3011 "third_party/libpg_query/grammar/statements/select.y" + { + PGNamedArgExpr *na = makeNode(PGNamedArgExpr); + na->name = (yyvsp[(1) - (3)].str); + na->arg = (PGExpr *) (yyvsp[(3) - (3)].node); + na->argnumber = -1; /* until determined */ + na->location = (yylsp[(1) - (3)]); + (yyval.node) = (PGNode *) na; + ;} + break; + + case 607: +#line 3021 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].typnam)); ;} + break; + + case 608: +#line 3022 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].typnam)); ;} + break; + + case 609: +#line 3027 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = list_make2(makeStringConst((yyvsp[(1) - (3)].str), (yylsp[(1) - (3)])), (yyvsp[(3) - (3)].node)); + ;} + break; + + case 610: +#line 3030 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} + break; + + case 611: +#line 3037 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + break; + + case 612: +#line 3038 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (char*) "year"; ;} + break; + + case 613: +#line 3039 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (char*) "month"; ;} + break; + + case 614: +#line 3040 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (char*) "day"; ;} + break; + + case 615: +#line 3041 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (char*) "hour"; ;} + break; + + case 616: +#line 3042 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (char*) "minute"; ;} + break; + + case 617: +#line 3043 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (char*) "second"; ;} + break; + + case 618: +#line 3044 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (char*) "millisecond"; ;} + break; + + case 619: +#line 3045 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (char*) "microsecond"; ;} + break; + + case 620: +#line 3046 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 522: -#line 508 "third_party/libpg_query/grammar/statements/select.y" + case 621: +#line 3057 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = makeSampleSize(makeInteger((yyvsp[(1) - (2)].ival)), false); - ;} + (yyval.list) = list_make4((yyvsp[(1) - (4)].node), (yyvsp[(2) - (4)].node), (yyvsp[(3) - (4)].node), (yyvsp[(4) - (4)].node)); + ;} break; - case 523: -#line 515 "third_party/libpg_query/grammar/statements/select.y" + case 622: +#line 3061 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = (yyvsp[(3) - (3)].node); + (yyval.list) = list_make3((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].node), (yyvsp[(3) - (3)].node)); ;} break; - case 524: -#line 519 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} + case 623: +#line 3068 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 525: -#line 526 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 624: +#line 3074 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make2((yyvsp[(3) - (3)].node), (yyvsp[(1) - (3)].node)); ;} break; - case 526: -#line 527 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = NULL; ;} + case 625: +#line 3075 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} break; - case 527: -#line 532 "third_party/libpg_query/grammar/statements/select.y" + case 626: +#line 3092 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = makeSampleOptions((yyvsp[(3) - (5)].node), (yyvsp[(1) - (5)].str), (yyvsp[(5) - (5)].ival), (yylsp[(1) - (5)])); + (yyval.list) = list_make3((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].node), (yyvsp[(3) - (3)].node)); ;} break; - case 528: -#line 536 "third_party/libpg_query/grammar/statements/select.y" + case 627: +#line 3096 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = makeSampleOptions((yyvsp[(1) - (1)].node), NULL, -1, (yylsp[(1) - (1)])); - ;} + /* not legal per SQL99, but might as well allow it */ + (yyval.list) = list_make3((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yyvsp[(2) - (3)].node)); + ;} break; - case 529: -#line 540 "third_party/libpg_query/grammar/statements/select.y" + case 628: +#line 3101 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = makeSampleOptions((yyvsp[(1) - (4)].node), (yyvsp[(3) - (4)].str), -1, (yylsp[(1) - (4)])); - ;} + (yyval.list) = list_make2((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node)); + ;} break; - case 530: -#line 544 "third_party/libpg_query/grammar/statements/select.y" + case 629: +#line 3105 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = makeSampleOptions((yyvsp[(1) - (6)].node), (yyvsp[(3) - (6)].str), (yyvsp[(5) - (6)].ival), (yylsp[(1) - (6)])); - ;} + /* + * Since there are no cases where this syntax allows + * a textual FOR value, we forcibly cast the argument + * to int4. The possible matches in pg_proc are + * substring(text,int4) and substring(text,text), + * and we don't want the parser to choose the latter, + * which it is likely to do if the second argument + * is unknown or doesn't have an implicit cast to int4. + */ + (yyval.list) = list_make3((yyvsp[(1) - (2)].node), makeIntConst(1, -1), + makeTypeCast((yyvsp[(2) - (2)].node), + SystemTypeName("int4"), 0, -1)); + ;} break; - case 531: -#line 551 "third_party/libpg_query/grammar/statements/select.y" + case 630: +#line 3120 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = (yyvsp[(2) - (2)].node); + (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 532: -#line 557 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} - break; - - case 533: -#line 558 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} + case 631: +#line 3124 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} break; - case 534: -#line 563 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.ival) = (yyvsp[(3) - (4)].ival); ;} + case 632: +#line 3128 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 535: -#line 564 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.ival) = -1; ;} + case 633: +#line 3131 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 536: -#line 568 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 634: +#line 3134 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(3) - (3)].list), (yyvsp[(1) - (3)].node)); ;} break; - case 537: -#line 570 "third_party/libpg_query/grammar/statements/select.y" - { - /* LIMIT ALL is represented as a NULL constant */ - (yyval.node) = makeNullAConst((yylsp[(1) - (1)])); - ;} + case 635: +#line 3135 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 538: -#line 575 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeLimitPercent((yyvsp[(1) - (2)].node)); ;} + case 636: +#line 3136 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 539: -#line 577 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeLimitPercent(makeFloatConst((yyvsp[(1) - (2)].str),(yylsp[(1) - (2)]))); ;} + case 637: +#line 3140 "third_party/libpg_query/grammar/statements/select.y" + { + PGSubLink *n = makeNode(PGSubLink); + n->subselect = (yyvsp[(1) - (1)].node); + /* other fields will be filled later */ + (yyval.node) = (PGNode *)n; + ;} break; - case 540: -#line 579 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeLimitPercent(makeIntConst((yyvsp[(1) - (2)].ival),(yylsp[(1) - (2)]))); ;} + case 638: +#line 3146 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (PGNode *)(yyvsp[(2) - (3)].list); ;} break; - case 541: -#line 583 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 639: +#line 3157 "third_party/libpg_query/grammar/statements/select.y" + { + PGCaseExpr *c = makeNode(PGCaseExpr); + c->casetype = InvalidOid; /* not analyzed yet */ + c->arg = (PGExpr *) (yyvsp[(2) - (5)].node); + c->args = (yyvsp[(3) - (5)].list); + c->defresult = (PGExpr *) (yyvsp[(4) - (5)].node); + c->location = (yylsp[(1) - (5)]); + (yyval.node) = (PGNode *)c; + ;} break; - case 542: -#line 603 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 640: +#line 3170 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 543: -#line 605 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + case 641: +#line 3171 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 544: -#line 607 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = doNegate((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + case 642: +#line 3176 "third_party/libpg_query/grammar/statements/select.y" + { + PGCaseWhen *w = makeNode(PGCaseWhen); + w->expr = (PGExpr *) (yyvsp[(2) - (4)].node); + w->result = (PGExpr *) (yyvsp[(4) - (4)].node); + w->location = (yylsp[(1) - (4)]); + (yyval.node) = (PGNode *)w; + ;} break; - case 545: -#line 611 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeIntConst((yyvsp[(1) - (1)].ival),(yylsp[(1) - (1)])); ;} + case 643: +#line 3186 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 546: -#line 612 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeFloatConst((yyvsp[(1) - (1)].str),(yylsp[(1) - (1)])); ;} + case 644: +#line 3187 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} break; - case 547: -#line 616 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.ival) = 0; ;} + case 645: +#line 3190 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 548: -#line 617 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.ival) = 0; ;} + case 646: +#line 3191 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} break; - case 549: -#line 620 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.ival) = 0; ;} + case 647: +#line 3195 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeColumnRef((yyvsp[(1) - (1)].str), NIL, (yylsp[(1) - (1)]), yyscanner); + ;} break; - case 550: -#line 621 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.ival) = 0; ;} + case 648: +#line 3199 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = makeColumnRef((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].list), (yylsp[(1) - (2)]), yyscanner); + ;} break; - case 551: -#line 646 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(3) - (3)].list); ;} + case 649: +#line 3206 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.node) = (PGNode *) makeString((yyvsp[(2) - (2)].str)); + ;} break; - case 552: -#line 648 "third_party/libpg_query/grammar/statements/select.y" + case 650: +#line 3210 "third_party/libpg_query/grammar/statements/select.y" { - PGNode *node = (PGNode *) makeGroupingSet(GROUPING_SET_ALL, NIL, (yylsp[(3) - (3)])); - (yyval.list) = list_make1(node); + PGAIndices *ai = makeNode(PGAIndices); + ai->is_slice = false; + ai->lidx = NULL; + ai->uidx = (yyvsp[(2) - (3)].node); + (yyval.node) = (PGNode *) ai; ;} break; - case 553: -#line 653 "third_party/libpg_query/grammar/statements/select.y" + case 651: +#line 3218 "third_party/libpg_query/grammar/statements/select.y" { - PGNode *node = (PGNode *) makeGroupingSet(GROUPING_SET_ALL, NIL, (yylsp[(3) - (3)])); - (yyval.list) = list_make1(node); + PGAIndices *ai = makeNode(PGAIndices); + ai->is_slice = true; + ai->lidx = (yyvsp[(2) - (5)].node); + ai->uidx = (yyvsp[(4) - (5)].node); + (yyval.node) = (PGNode *) ai; ;} break; - case 554: -#line 657 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 652: +#line 3228 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 555: -#line 661 "third_party/libpg_query/grammar/statements/select.y" + case 653: +#line 3229 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.node) = NULL; ;} + break; + + case 654: +#line 3233 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 556: -#line 662 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list),(yyvsp[(3) - (3)].node)); ;} + case 655: +#line 3234 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 557: -#line 666 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 656: +#line 3238 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} break; - case 558: -#line 667 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 657: +#line 3239 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 559: -#line 668 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 660: +#line 3253 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 560: -#line 669 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 661: +#line 3254 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} break; - case 561: -#line 670 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 662: +#line 3258 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].target)); ;} break; - case 562: -#line 675 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_EMPTY, NIL, (yylsp[(1) - (2)])); - ;} + case 663: +#line 3259 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].target)); ;} break; - case 563: -#line 688 "third_party/libpg_query/grammar/statements/select.y" + case 664: +#line 3263 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} + break; + + case 665: +#line 3264 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (2)].list); ;} + break; + + case 666: +#line 3268 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_ROLLUP, (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); + (yyval.target) = makeNode(PGResTarget); + (yyval.target)->name = (yyvsp[(3) - (3)].str); + (yyval.target)->indirection = NIL; + (yyval.target)->val = (PGNode *)(yyvsp[(1) - (3)].node); + (yyval.target)->location = (yylsp[(1) - (3)]); ;} break; - case 564: -#line 695 "third_party/libpg_query/grammar/statements/select.y" + case 667: +#line 3284 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_CUBE, (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); + (yyval.target) = makeNode(PGResTarget); + (yyval.target)->name = (yyvsp[(2) - (2)].str); + (yyval.target)->indirection = NIL; + (yyval.target)->val = (PGNode *)(yyvsp[(1) - (2)].node); + (yyval.target)->location = (yylsp[(1) - (2)]); ;} break; - case 565: -#line 702 "third_party/libpg_query/grammar/statements/select.y" + case 668: +#line 3292 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = (PGNode *) makeGroupingSet(GROUPING_SET_SETS, (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); + (yyval.target) = makeNode(PGResTarget); + (yyval.target)->name = NULL; + (yyval.target)->indirection = NIL; + (yyval.target)->val = (PGNode *)(yyvsp[(1) - (1)].node); + (yyval.target)->location = (yylsp[(1) - (1)]); ;} break; - case 566: -#line 708 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} - break; + case 669: +#line 3300 "third_party/libpg_query/grammar/statements/select.y" + { + PGColumnRef *n = makeNode(PGColumnRef); + PGAStar *star = makeNode(PGAStar); + n->fields = list_make1(star); + n->location = (yylsp[(1) - (3)]); + star->except_list = (yyvsp[(2) - (3)].list); + star->replace_list = (yyvsp[(3) - (3)].list); - case 567: -#line 709 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} + (yyval.target) = makeNode(PGResTarget); + (yyval.target)->name = NULL; + (yyval.target)->indirection = NIL; + (yyval.target)->val = (PGNode *)n; + (yyval.target)->location = (yylsp[(1) - (3)]); + ;} break; - case 568: -#line 713 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(2) - (2)].node); ;} - break; + case 670: +#line 3315 "third_party/libpg_query/grammar/statements/select.y" + { + PGColumnRef *n = makeNode(PGColumnRef); + PGAStar *star = makeNode(PGAStar); + n->fields = list_make1(star); + n->location = (yylsp[(1) - (5)]); + star->relation = (yyvsp[(1) - (5)].str); + star->except_list = (yyvsp[(4) - (5)].list); + star->replace_list = (yyvsp[(5) - (5)].list); - case 569: -#line 714 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} + (yyval.target) = makeNode(PGResTarget); + (yyval.target)->name = NULL; + (yyval.target)->indirection = NIL; + (yyval.target)->val = (PGNode *)n; + (yyval.target)->location = (yylsp[(1) - (5)]); + ;} break; - case 570: -#line 718 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(2) - (2)].node); ;} + case 671: +#line 3332 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 571: -#line 719 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} + case 672: +#line 3333 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString((yyvsp[(2) - (2)].str))); ;} break; - case 572: -#line 723 "third_party/libpg_query/grammar/statements/select.y" + case 673: +#line 3336 "third_party/libpg_query/grammar/statements/select.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 573: -#line 724 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 674: +#line 3337 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NULL; ;} break; - case 574: -#line 728 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(1) - (1)].list); ;} + case 675: +#line 3340 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make2((yyvsp[(1) - (3)].node), makeString((yyvsp[(3) - (3)].str))); ;} break; - case 575: -#line 729 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 676: +#line 3344 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 576: -#line 733 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} + case 677: +#line 3345 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 577: -#line 734 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} + case 678: +#line 3349 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 578: -#line 739 "third_party/libpg_query/grammar/statements/select.y" - { - PGLockingClause *n = makeNode(PGLockingClause); - n->lockedRels = (yyvsp[(2) - (3)].list); - n->strength = (yyvsp[(1) - (3)].lockstrength); - n->waitPolicy = (yyvsp[(3) - (3)].lockwaitpolicy); - (yyval.node) = (PGNode *) n; - ;} + case 679: +#line 3350 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 579: -#line 749 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.lockstrength) = LCS_FORUPDATE; ;} + case 680: +#line 3353 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 580: -#line 750 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.lockstrength) = PG_LCS_FORNOKEYUPDATE; ;} + case 681: +#line 3354 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(2) - (2)].list)); ;} break; - case 581: -#line 751 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.lockstrength) = PG_LCS_FORSHARE; ;} + case 682: +#line 3355 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NULL; ;} break; - case 582: -#line 752 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.lockstrength) = PG_LCS_FORKEYSHARE; ;} + case 683: +#line 3365 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].range)); ;} break; - case 583: -#line 756 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(2) - (2)].list); ;} + case 684: +#line 3366 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].range)); ;} break; - case 584: -#line 757 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 685: +#line 3378 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.range) = makeRangeVar(NULL, (yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); + ;} break; - case 585: -#line 762 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.lockwaitpolicy) = LockWaitError; ;} + case 686: +#line 3382 "third_party/libpg_query/grammar/statements/select.y" + { + check_qualified_name((yyvsp[(2) - (2)].list), yyscanner); + (yyval.range) = makeRangeVar(NULL, NULL, (yylsp[(1) - (2)])); + switch (list_length((yyvsp[(2) - (2)].list))) + { + case 1: + (yyval.range)->catalogname = NULL; + (yyval.range)->schemaname = (yyvsp[(1) - (2)].str); + (yyval.range)->relname = strVal(linitial((yyvsp[(2) - (2)].list))); + break; + case 2: + (yyval.range)->catalogname = (yyvsp[(1) - (2)].str); + (yyval.range)->schemaname = strVal(linitial((yyvsp[(2) - (2)].list))); + (yyval.range)->relname = strVal(lsecond((yyvsp[(2) - (2)].list))); + break; + default: + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("improper qualified name (too many dotted names): %s", + NameListToString(lcons(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].list)))), + parser_errposition((yylsp[(1) - (2)])))); + break; + } + ;} break; - case 586: -#line 763 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.lockwaitpolicy) = PGLockWaitSkip; ;} + case 687: +#line 3409 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 587: -#line 764 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.lockwaitpolicy) = PGLockWaitBlock; ;} + case 688: +#line 3411 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeString((yyvsp[(3) - (3)].str))); ;} break; - case 588: -#line 774 "third_party/libpg_query/grammar/statements/select.y" - { - PGSelectStmt *n = makeNode(PGSelectStmt); - n->valuesLists = list_make1((yyvsp[(3) - (4)].list)); - (yyval.node) = (PGNode *) n; - ;} + case 689: +#line 3416 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 589: -#line 780 "third_party/libpg_query/grammar/statements/select.y" - { - PGSelectStmt *n = (PGSelectStmt *) (yyvsp[(1) - (5)].node); - n->valuesLists = lappend(n->valuesLists, (yyvsp[(4) - (5)].list)); - (yyval.node) = (PGNode *) n; - ;} + case 690: +#line 3417 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 590: -#line 797 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(2) - (2)].list); ;} + case 691: +#line 3420 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 591: -#line 798 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 692: +#line 3422 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 592: -#line 802 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} + case 693: +#line 3433 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 593: -#line 803 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} + case 694: +#line 3436 "third_party/libpg_query/grammar/statements/select.y" + { + (yyval.list) = check_func_name(lcons(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].list)), + yyscanner); + ;} break; - case 594: -#line 810 "third_party/libpg_query/grammar/statements/select.y" + case 695: +#line 3447 "third_party/libpg_query/grammar/statements/select.y" { - (yyvsp[(1) - (3)].range)->alias = (yyvsp[(2) - (3)].alias); - (yyvsp[(1) - (3)].range)->sample = (yyvsp[(3) - (3)].node); - (yyval.node) = (PGNode *) (yyvsp[(1) - (3)].range); + (yyval.node) = makeIntConst((yyvsp[(1) - (1)].ival), (yylsp[(1) - (1)])); ;} break; - case 595: -#line 816 "third_party/libpg_query/grammar/statements/select.y" + case 696: +#line 3451 "third_party/libpg_query/grammar/statements/select.y" { - PGRangeFunction *n = (PGRangeFunction *) (yyvsp[(1) - (3)].node); - n->alias = (PGAlias*) linitial((yyvsp[(2) - (3)].list)); - n->coldeflist = (PGList*) lsecond((yyvsp[(2) - (3)].list)); - n->sample = (yyvsp[(3) - (3)].node); - (yyval.node) = (PGNode *) n; + (yyval.node) = makeFloatConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 596: -#line 824 "third_party/libpg_query/grammar/statements/select.y" + case 697: +#line 3455 "third_party/libpg_query/grammar/statements/select.y" { - PGRangeFunction *n = (PGRangeFunction *) (yyvsp[(2) - (3)].node); - n->lateral = true; - n->alias = (PGAlias*) linitial((yyvsp[(3) - (3)].list)); - n->coldeflist = (PGList*) lsecond((yyvsp[(3) - (3)].list)); - (yyval.node) = (PGNode *) n; + if ((yyvsp[(2) - (2)].list)) + { + PGAIndirection *n = makeNode(PGAIndirection); + n->arg = makeStringConst((yyvsp[(1) - (2)].str), (yylsp[(1) - (2)])); + n->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); + (yyval.node) = (PGNode *) n; + } + else + (yyval.node) = makeStringConst((yyvsp[(1) - (2)].str), (yylsp[(1) - (2)])); ;} break; - case 597: -#line 832 "third_party/libpg_query/grammar/statements/select.y" + case 698: +#line 3467 "third_party/libpg_query/grammar/statements/select.y" { - PGRangeSubselect *n = makeNode(PGRangeSubselect); - n->lateral = false; - n->subquery = (yyvsp[(1) - (3)].node); - n->alias = (yyvsp[(2) - (3)].alias); - n->sample = (yyvsp[(3) - (3)].node); - (yyval.node) = (PGNode *) n; + (yyval.node) = makeBitStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 598: -#line 841 "third_party/libpg_query/grammar/statements/select.y" + case 699: +#line 3471 "third_party/libpg_query/grammar/statements/select.y" { - PGRangeSubselect *n = makeNode(PGRangeSubselect); - n->lateral = true; - n->subquery = (yyvsp[(2) - (3)].node); - n->alias = (yyvsp[(3) - (3)].alias); - n->sample = NULL; - (yyval.node) = (PGNode *) n; + /* This is a bit constant per SQL99: + * Without Feature F511, "BIT data type", + * a shall not be a + * or a . + */ + (yyval.node) = makeBitStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 599: -#line 850 "third_party/libpg_query/grammar/statements/select.y" + case 700: +#line 3480 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.node) = (PGNode *) (yyvsp[(1) - (1)].jexpr); + /* generic type 'literal' syntax */ + PGTypeName *t = makeTypeNameFromNameList((yyvsp[(1) - (2)].list)); + t->location = (yylsp[(1) - (2)]); + (yyval.node) = makeStringConstCast((yyvsp[(2) - (2)].str), (yylsp[(2) - (2)]), t); ;} break; - case 600: -#line 854 "third_party/libpg_query/grammar/statements/select.y" + case 701: +#line 3487 "third_party/libpg_query/grammar/statements/select.y" { - (yyvsp[(2) - (4)].jexpr)->alias = (yyvsp[(4) - (4)].alias); - (yyval.node) = (PGNode *) (yyvsp[(2) - (4)].jexpr); + /* generic syntax with a type modifier */ + PGTypeName *t = makeTypeNameFromNameList((yyvsp[(1) - (7)].list)); + PGListCell *lc; + + /* + * We must use func_arg_list and opt_sort_clause in the + * production to avoid reduce/reduce conflicts, but we + * don't actually wish to allow PGNamedArgExpr in this + * context, ORDER BY, nor IGNORE NULLS. + */ + foreach(lc, (yyvsp[(3) - (7)].list)) + { + PGNamedArgExpr *arg = (PGNamedArgExpr *) lfirst(lc); + + if (IsA(arg, PGNamedArgExpr)) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("type modifier cannot have parameter name"), + parser_errposition(arg->location))); + } + if ((yyvsp[(4) - (7)].list) != NIL) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("type modifier cannot have ORDER BY"), + parser_errposition((yylsp[(4) - (7)])))); + if ((yyvsp[(5) - (7)].boolean) != false) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("type modifier cannot have IGNORE NULLS"), + parser_errposition((yylsp[(5) - (7)])))); + + + t->typmods = (yyvsp[(3) - (7)].list); + t->location = (yylsp[(1) - (7)]); + (yyval.node) = makeStringConstCast((yyvsp[(7) - (7)].str), (yylsp[(7) - (7)]), t); ;} break; - case 601: -#line 880 "third_party/libpg_query/grammar/statements/select.y" + case 702: +#line 3525 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.jexpr) = (yyvsp[(2) - (3)].jexpr); + (yyval.node) = makeStringConstCast((yyvsp[(2) - (2)].str), (yylsp[(2) - (2)]), (yyvsp[(1) - (2)].typnam)); ;} break; - case 602: -#line 884 "third_party/libpg_query/grammar/statements/select.y" + case 703: +#line 3529 "third_party/libpg_query/grammar/statements/select.y" { - /* CROSS JOIN is same as unqualified inner join */ - PGJoinExpr *n = makeNode(PGJoinExpr); - n->jointype = PG_JOIN_INNER; - n->isNatural = false; - n->larg = (yyvsp[(1) - (4)].node); - n->rarg = (yyvsp[(4) - (4)].node); - n->usingClause = NIL; - n->quals = NULL; - n->location = (yylsp[(2) - (4)]); - (yyval.jexpr) = n; + (yyval.node) = makeIntervalNode((yyvsp[(3) - (5)].node), (yylsp[(3) - (5)]), (yyvsp[(5) - (5)].list)); ;} break; - case 603: -#line 897 "third_party/libpg_query/grammar/statements/select.y" + case 704: +#line 3533 "third_party/libpg_query/grammar/statements/select.y" { - PGJoinExpr *n = makeNode(PGJoinExpr); - n->jointype = (yyvsp[(2) - (5)].jtype); - n->isNatural = false; - n->larg = (yyvsp[(1) - (5)].node); - n->rarg = (yyvsp[(4) - (5)].node); - if ((yyvsp[(5) - (5)].node) != NULL && IsA((yyvsp[(5) - (5)].node), PGList)) - n->usingClause = (PGList *) (yyvsp[(5) - (5)].node); /* USING clause */ - else - n->quals = (yyvsp[(5) - (5)].node); /* ON clause */ - n->location = (yylsp[(2) - (5)]); - (yyval.jexpr) = n; + (yyval.node) = makeIntervalNode((yyvsp[(2) - (3)].ival), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].list)); ;} break; - case 604: -#line 911 "third_party/libpg_query/grammar/statements/select.y" + case 705: +#line 3537 "third_party/libpg_query/grammar/statements/select.y" { - /* letting join_type reduce to empty doesn't work */ - PGJoinExpr *n = makeNode(PGJoinExpr); - n->jointype = PG_JOIN_INNER; - n->isNatural = false; - n->larg = (yyvsp[(1) - (4)].node); - n->rarg = (yyvsp[(3) - (4)].node); - if ((yyvsp[(4) - (4)].node) != NULL && IsA((yyvsp[(4) - (4)].node), PGList)) - n->usingClause = (PGList *) (yyvsp[(4) - (4)].node); /* USING clause */ - else - n->quals = (yyvsp[(4) - (4)].node); /* ON clause */ - n->location = (yylsp[(2) - (4)]); - (yyval.jexpr) = n; + (yyval.node) = makeIntervalNode((yyvsp[(2) - (3)].str), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].list)); ;} break; - case 605: -#line 926 "third_party/libpg_query/grammar/statements/select.y" + case 706: +#line 3541 "third_party/libpg_query/grammar/statements/select.y" { - PGJoinExpr *n = makeNode(PGJoinExpr); - n->jointype = (yyvsp[(3) - (5)].jtype); - n->isNatural = true; - n->larg = (yyvsp[(1) - (5)].node); - n->rarg = (yyvsp[(5) - (5)].node); - n->usingClause = NIL; /* figure out which columns later... */ - n->quals = NULL; /* fill later */ - n->location = (yylsp[(2) - (5)]); - (yyval.jexpr) = n; + (yyval.node) = makeBoolAConst(true, (yylsp[(1) - (1)])); ;} break; - case 606: -#line 938 "third_party/libpg_query/grammar/statements/select.y" + case 707: +#line 3545 "third_party/libpg_query/grammar/statements/select.y" { - /* letting join_type reduce to empty doesn't work */ - PGJoinExpr *n = makeNode(PGJoinExpr); - n->jointype = PG_JOIN_INNER; - n->isNatural = true; - n->larg = (yyvsp[(1) - (4)].node); - n->rarg = (yyvsp[(4) - (4)].node); - n->usingClause = NIL; /* figure out which columns later... */ - n->quals = NULL; /* fill later */ - n->location = (yylsp[(2) - (4)]); - (yyval.jexpr) = n; + (yyval.node) = makeBoolAConst(false, (yylsp[(1) - (1)])); ;} break; - case 607: -#line 954 "third_party/libpg_query/grammar/statements/select.y" + case 708: +#line 3549 "third_party/libpg_query/grammar/statements/select.y" { - (yyval.alias) = makeNode(PGAlias); - (yyval.alias)->aliasname = (yyvsp[(2) - (5)].str); - (yyval.alias)->colnames = (yyvsp[(4) - (5)].list); + (yyval.node) = makeNullAConst((yylsp[(1) - (1)])); ;} break; - case 608: -#line 960 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.alias) = makeNode(PGAlias); - (yyval.alias)->aliasname = (yyvsp[(2) - (2)].str); - ;} + case 709: +#line 3554 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} break; - case 609: -#line 965 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.alias) = makeNode(PGAlias); - (yyval.alias)->aliasname = (yyvsp[(1) - (4)].str); - (yyval.alias)->colnames = (yyvsp[(3) - (4)].list); - ;} + case 710: +#line 3555 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 610: -#line 971 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.alias) = makeNode(PGAlias); - (yyval.alias)->aliasname = (yyvsp[(1) - (1)].str); - ;} + case 711: +#line 3571 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 611: -#line 977 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.alias) = (yyvsp[(1) - (1)].alias); ;} + case 712: +#line 3572 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 612: -#line 978 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.alias) = NULL; ;} + case 713: +#line 3573 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 613: -#line 987 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.list) = list_make2((yyvsp[(1) - (1)].alias), NIL); - ;} + case 714: +#line 3576 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 614: -#line 991 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.list) = list_make2(NULL, (yyvsp[(3) - (4)].list)); - ;} + case 715: +#line 3577 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 615: -#line 995 "third_party/libpg_query/grammar/statements/select.y" - { - PGAlias *a = makeNode(PGAlias); - a->aliasname = (yyvsp[(2) - (5)].str); - (yyval.list) = list_make2(a, (yyvsp[(4) - (5)].list)); - ;} + case 716: +#line 3583 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 616: -#line 1001 "third_party/libpg_query/grammar/statements/select.y" - { - PGAlias *a = makeNode(PGAlias); - a->aliasname = (yyvsp[(1) - (4)].str); - (yyval.list) = list_make2(a, (yyvsp[(3) - (4)].list)); - ;} + case 717: +#line 3584 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 617: -#line 1007 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.list) = list_make2(NULL, NIL); - ;} + case 718: +#line 3585 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 618: -#line 1012 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.jtype) = PG_JOIN_FULL; ;} + case 719: +#line 3588 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 619: -#line 1013 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.jtype) = PG_JOIN_LEFT; ;} + case 720: +#line 3589 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 620: -#line 1014 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.jtype) = PG_JOIN_RIGHT; ;} + case 721: +#line 3590 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 621: -#line 1015 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.jtype) = PG_JOIN_INNER; ;} + case 722: +#line 3593 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 622: -#line 1019 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} + case 723: +#line 3594 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 623: -#line 1020 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} + case 724: +#line 3595 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 624: -#line 1032 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) (yyvsp[(3) - (4)].list); ;} + case 725: +#line 3598 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 625: -#line 1033 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(2) - (2)].node); ;} + case 726: +#line 3599 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lcons(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].list)); ;} break; - case 626: -#line 1039 "third_party/libpg_query/grammar/statements/select.y" - { - /* inheritance query, implicitly */ - (yyval.range) = (yyvsp[(1) - (1)].range); - (yyval.range)->inh = true; - (yyval.range)->alias = NULL; - ;} + case 727: +#line 3603 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = list_make1(makeString((yyvsp[(2) - (2)].str))); ;} break; - case 627: -#line 1046 "third_party/libpg_query/grammar/statements/select.y" + case 728: +#line 3605 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeString((yyvsp[(3) - (3)].str))); ;} + break; + + case 729: +#line 3609 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = (yyvsp[(2) - (3)].list); ;} + break; + + case 730: +#line 3610 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.list) = NIL; ;} + break; + + case 732: +#line 3621 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + break; + + case 733: +#line 3622 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + break; + + case 734: +#line 3623 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + break; + + case 735: +#line 3624 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + break; + + case 736: +#line 3627 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + break; + + case 737: +#line 3628 "third_party/libpg_query/grammar/statements/select.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + break; + + case 738: +#line 9 "third_party/libpg_query/grammar/statements/vacuum.y" { - /* inheritance query, explicitly */ - (yyval.range) = (yyvsp[(1) - (2)].range); - (yyval.range)->inh = true; - (yyval.range)->alias = NULL; + PGVacuumStmt *n = makeNode(PGVacuumStmt); + n->options = PG_VACOPT_VACUUM; + if ((yyvsp[(2) - (4)].boolean)) + n->options |= PG_VACOPT_FULL; + if ((yyvsp[(3) - (4)].boolean)) + n->options |= PG_VACOPT_FREEZE; + if ((yyvsp[(4) - (4)].boolean)) + n->options |= PG_VACOPT_VERBOSE; + n->relation = NULL; + n->va_cols = NIL; + (yyval.node) = (PGNode *)n; ;} break; - case 628: -#line 1053 "third_party/libpg_query/grammar/statements/select.y" + case 739: +#line 23 "third_party/libpg_query/grammar/statements/vacuum.y" { - /* no inheritance */ - (yyval.range) = (yyvsp[(2) - (2)].range); - (yyval.range)->inh = false; - (yyval.range)->alias = NULL; + PGVacuumStmt *n = makeNode(PGVacuumStmt); + n->options = PG_VACOPT_VACUUM; + if ((yyvsp[(2) - (5)].boolean)) + n->options |= PG_VACOPT_FULL; + if ((yyvsp[(3) - (5)].boolean)) + n->options |= PG_VACOPT_FREEZE; + if ((yyvsp[(4) - (5)].boolean)) + n->options |= PG_VACOPT_VERBOSE; + n->relation = (yyvsp[(5) - (5)].range); + n->va_cols = NIL; + (yyval.node) = (PGNode *)n; ;} break; - case 629: -#line 1060 "third_party/libpg_query/grammar/statements/select.y" + case 740: +#line 37 "third_party/libpg_query/grammar/statements/vacuum.y" { - /* no inheritance, SQL99-style syntax */ - (yyval.range) = (yyvsp[(3) - (4)].range); - (yyval.range)->inh = false; - (yyval.range)->alias = NULL; + PGVacuumStmt *n = (PGVacuumStmt *) (yyvsp[(5) - (5)].node); + n->options |= PG_VACOPT_VACUUM; + if ((yyvsp[(2) - (5)].boolean)) + n->options |= PG_VACOPT_FULL; + if ((yyvsp[(3) - (5)].boolean)) + n->options |= PG_VACOPT_FREEZE; + if ((yyvsp[(4) - (5)].boolean)) + n->options |= PG_VACOPT_VERBOSE; + (yyval.node) = (PGNode *)n; ;} break; - case 630: -#line 1092 "third_party/libpg_query/grammar/statements/select.y" + case 741: +#line 49 "third_party/libpg_query/grammar/statements/vacuum.y" { - PGRangeFunction *n = makeNode(PGRangeFunction); - n->lateral = false; - n->ordinality = (yyvsp[(2) - (2)].boolean); - n->is_rowsfrom = false; - n->functions = list_make1(list_make2((yyvsp[(1) - (2)].node), NIL)); - n->sample = NULL; - /* alias and coldeflist are set by table_ref production */ + PGVacuumStmt *n = makeNode(PGVacuumStmt); + n->options = PG_VACOPT_VACUUM | (yyvsp[(3) - (4)].ival); + n->relation = NULL; + n->va_cols = NIL; (yyval.node) = (PGNode *) n; ;} break; - case 631: -#line 1103 "third_party/libpg_query/grammar/statements/select.y" + case 742: +#line 57 "third_party/libpg_query/grammar/statements/vacuum.y" { - PGRangeFunction *n = makeNode(PGRangeFunction); - n->lateral = false; - n->ordinality = (yyvsp[(6) - (6)].boolean); - n->is_rowsfrom = true; - n->functions = (yyvsp[(4) - (6)].list); - n->sample = NULL; - /* alias and coldeflist are set by table_ref production */ + PGVacuumStmt *n = makeNode(PGVacuumStmt); + n->options = PG_VACOPT_VACUUM | (yyvsp[(3) - (6)].ival); + n->relation = (yyvsp[(5) - (6)].range); + n->va_cols = (yyvsp[(6) - (6)].list); + if (n->va_cols != NIL) /* implies analyze */ + n->options |= PG_VACOPT_ANALYZE; (yyval.node) = (PGNode *) n; ;} break; - case 632: -#line 1116 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make2((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].list)); ;} + case 743: +#line 70 "third_party/libpg_query/grammar/statements/vacuum.y" + { (yyval.ival) = PG_VACOPT_ANALYZE; ;} break; - case 633: -#line 1120 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} + case 744: +#line 71 "third_party/libpg_query/grammar/statements/vacuum.y" + { (yyval.ival) = PG_VACOPT_VERBOSE; ;} break; - case 634: -#line 1121 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} + case 745: +#line 72 "third_party/libpg_query/grammar/statements/vacuum.y" + { (yyval.ival) = PG_VACOPT_FREEZE; ;} break; - case 635: -#line 1124 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(3) - (4)].list); ;} + case 746: +#line 73 "third_party/libpg_query/grammar/statements/vacuum.y" + { (yyval.ival) = PG_VACOPT_FULL; ;} break; - case 636: -#line 1125 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 747: +#line 75 "third_party/libpg_query/grammar/statements/vacuum.y" + { + if (strcmp((yyvsp[(1) - (1)].str), "disable_page_skipping") == 0) + (yyval.ival) = PG_VACOPT_DISABLE_PAGE_SKIPPING; + else + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("unrecognized VACUUM option \"%s\"", (yyvsp[(1) - (1)].str)), + parser_errposition((yylsp[(1) - (1)])))); + ;} break; - case 637: -#line 1128 "third_party/libpg_query/grammar/statements/select.y" + case 748: +#line 87 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.boolean) = true; ;} break; - case 638: -#line 1129 "third_party/libpg_query/grammar/statements/select.y" + case 749: +#line 88 "third_party/libpg_query/grammar/statements/vacuum.y" { (yyval.boolean) = false; ;} break; - case 639: -#line 1134 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(2) - (2)].node); ;} + case 750: +#line 93 "third_party/libpg_query/grammar/statements/vacuum.y" + { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} break; - case 640: -#line 1135 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} + case 751: +#line 94 "third_party/libpg_query/grammar/statements/vacuum.y" + { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} break; - case 641: -#line 1141 "third_party/libpg_query/grammar/statements/select.y" + case 752: +#line 98 "third_party/libpg_query/grammar/statements/vacuum.y" + { (yyval.boolean) = true; ;} + break; + + case 753: +#line 99 "third_party/libpg_query/grammar/statements/vacuum.y" + { (yyval.boolean) = false; ;} + break; + + case 754: +#line 3 "third_party/libpg_query/grammar/statements/transaction.y" + { + PGTransactionStmt *n = makeNode(PGTransactionStmt); + n->kind = PG_TRANS_STMT_ROLLBACK; + n->options = NIL; + (yyval.node) = (PGNode *)n; + ;} + break; + + case 755: +#line 10 "third_party/libpg_query/grammar/statements/transaction.y" + { + PGTransactionStmt *n = makeNode(PGTransactionStmt); + n->kind = PG_TRANS_STMT_BEGIN; + (yyval.node) = (PGNode *)n; + ;} + break; + + case 756: +#line 16 "third_party/libpg_query/grammar/statements/transaction.y" + { + PGTransactionStmt *n = makeNode(PGTransactionStmt); + n->kind = PG_TRANS_STMT_START; + (yyval.node) = (PGNode *)n; + ;} + break; + + case 757: +#line 22 "third_party/libpg_query/grammar/statements/transaction.y" + { + PGTransactionStmt *n = makeNode(PGTransactionStmt); + n->kind = PG_TRANS_STMT_COMMIT; + n->options = NIL; + (yyval.node) = (PGNode *)n; + ;} + break; + + case 758: +#line 29 "third_party/libpg_query/grammar/statements/transaction.y" + { + PGTransactionStmt *n = makeNode(PGTransactionStmt); + n->kind = PG_TRANS_STMT_COMMIT; + n->options = NIL; + (yyval.node) = (PGNode *)n; + ;} + break; + + case 759: +#line 36 "third_party/libpg_query/grammar/statements/transaction.y" + { + PGTransactionStmt *n = makeNode(PGTransactionStmt); + n->kind = PG_TRANS_STMT_ROLLBACK; + n->options = NIL; + (yyval.node) = (PGNode *)n; + ;} + break; + + case 760: +#line 45 "third_party/libpg_query/grammar/statements/transaction.y" + {;} + break; + + case 761: +#line 46 "third_party/libpg_query/grammar/statements/transaction.y" + {;} + break; + + case 762: +#line 47 "third_party/libpg_query/grammar/statements/transaction.y" + {;} + break; + + case 763: +#line 2 "third_party/libpg_query/grammar/statements/variable_reset.y" + { (yyval.node) = (PGNode *) (yyvsp[(2) - (2)].vsetstmt); ;} + break; + + case 764: +#line 8 "third_party/libpg_query/grammar/statements/variable_reset.y" { - (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); + PGVariableSetStmt *n = makeNode(PGVariableSetStmt); + n->kind = VAR_RESET; + n->name = (yyvsp[(1) - (1)].str); + (yyval.vsetstmt) = n; ;} break; - case 642: -#line 1145 "third_party/libpg_query/grammar/statements/select.y" + case 765: +#line 15 "third_party/libpg_query/grammar/statements/variable_reset.y" { - (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); + PGVariableSetStmt *n = makeNode(PGVariableSetStmt); + n->kind = VAR_RESET_ALL; + (yyval.vsetstmt) = n; ;} break; - case 643: -#line 1151 "third_party/libpg_query/grammar/statements/select.y" + case 766: +#line 24 "third_party/libpg_query/grammar/statements/variable_reset.y" + { (yyval.vsetstmt) = (yyvsp[(1) - (1)].vsetstmt); ;} + break; + + case 767: +#line 26 "third_party/libpg_query/grammar/statements/variable_reset.y" { - PGColumnDef *n = makeNode(PGColumnDef); - n->colname = (yyvsp[(1) - (3)].str); - n->typeName = (yyvsp[(2) - (3)].typnam); - n->inhcount = 0; - n->is_local = true; - n->is_not_null = false; - n->is_from_type = false; - n->storage = 0; - n->raw_default = NULL; - n->cooked_default = NULL; - n->collClause = (PGCollateClause *) (yyvsp[(3) - (3)].node); - n->collOid = InvalidOid; - n->constraints = NIL; - n->location = (yylsp[(1) - (3)]); - (yyval.node) = (PGNode *)n; + PGVariableSetStmt *n = makeNode(PGVariableSetStmt); + n->kind = VAR_RESET; + n->name = (char*) "timezone"; + (yyval.vsetstmt) = n; ;} break; - case 644: -#line 1172 "third_party/libpg_query/grammar/statements/select.y" + case 768: +#line 33 "third_party/libpg_query/grammar/statements/variable_reset.y" { - PGCollateClause *n = makeNode(PGCollateClause); - n->arg = NULL; - n->collname = (yyvsp[(2) - (2)].list); - n->location = (yylsp[(1) - (2)]); - (yyval.node) = (PGNode *) n; + PGVariableSetStmt *n = makeNode(PGVariableSetStmt); + n->kind = VAR_RESET; + n->name = (char*) "transaction_isolation"; + (yyval.vsetstmt) = n; ;} break; - case 645: -#line 1179 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} + case 769: +#line 12 "third_party/libpg_query/grammar/statements/update.y" + { + PGUpdateStmt *n = makeNode(PGUpdateStmt); + n->relation = (yyvsp[(3) - (8)].range); + n->targetList = (yyvsp[(5) - (8)].list); + n->fromClause = (yyvsp[(6) - (8)].list); + n->whereClause = (yyvsp[(7) - (8)].node); + n->returningList = (yyvsp[(8) - (8)].list); + n->withClause = (yyvsp[(1) - (8)].with); + (yyval.node) = (PGNode *)n; + ;} break; - case 646: -#line 1192 "third_party/libpg_query/grammar/statements/select.y" + case 770: +#line 8 "third_party/libpg_query/grammar/statements/deallocate.y" { - (yyval.list) = list_make1(list_make2(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].typnam))); - ;} + PGDeallocateStmt *n = makeNode(PGDeallocateStmt); + n->name = (yyvsp[(2) - (2)].str); + (yyval.node) = (PGNode *) n; + ;} break; - case 647: -#line 1195 "third_party/libpg_query/grammar/statements/select.y" + case 771: +#line 14 "third_party/libpg_query/grammar/statements/deallocate.y" { - (yyval.list) = lappend((yyvsp[(1) - (4)].list), list_make2(makeString((yyvsp[(3) - (4)].str)), (yyvsp[(4) - (4)].typnam))); - ;} + PGDeallocateStmt *n = makeNode(PGDeallocateStmt); + n->name = (yyvsp[(3) - (3)].str); + (yyval.node) = (PGNode *) n; + ;} break; - case 650: -#line 1202 "third_party/libpg_query/grammar/statements/select.y" + case 772: +#line 20 "third_party/libpg_query/grammar/statements/deallocate.y" { - (yyval.typnam) = (yyvsp[(1) - (2)].typnam); - (yyval.typnam)->arrayBounds = (yyvsp[(2) - (2)].list); - ;} + PGDeallocateStmt *n = makeNode(PGDeallocateStmt); + n->name = NULL; + (yyval.node) = (PGNode *) n; + ;} break; - case 651: -#line 1207 "third_party/libpg_query/grammar/statements/select.y" + case 773: +#line 26 "third_party/libpg_query/grammar/statements/deallocate.y" { - (yyval.typnam) = (yyvsp[(2) - (3)].typnam); - (yyval.typnam)->arrayBounds = (yyvsp[(3) - (3)].list); - (yyval.typnam)->setof = true; - ;} + PGDeallocateStmt *n = makeNode(PGDeallocateStmt); + n->name = NULL; + (yyval.node) = (PGNode *) n; + ;} break; - case 652: -#line 1214 "third_party/libpg_query/grammar/statements/select.y" + case 774: +#line 8 "third_party/libpg_query/grammar/statements/pragma.y" { - (yyval.typnam) = (yyvsp[(1) - (5)].typnam); - (yyval.typnam)->arrayBounds = list_make1(makeInteger((yyvsp[(4) - (5)].ival))); + PGPragmaStmt *n = makeNode(PGPragmaStmt); + n->kind = PG_PRAGMA_TYPE_NOTHING; + n->name = (yyvsp[(2) - (2)].str); + (yyval.node) = (PGNode *)n; ;} break; - case 653: -#line 1219 "third_party/libpg_query/grammar/statements/select.y" + case 775: +#line 15 "third_party/libpg_query/grammar/statements/pragma.y" { - (yyval.typnam) = (yyvsp[(2) - (6)].typnam); - (yyval.typnam)->arrayBounds = list_make1(makeInteger((yyvsp[(5) - (6)].ival))); - (yyval.typnam)->setof = true; + PGPragmaStmt *n = makeNode(PGPragmaStmt); + n->kind = PG_PRAGMA_TYPE_ASSIGNMENT; + n->name = (yyvsp[(2) - (4)].str); + n->args = (yyvsp[(4) - (4)].list); + (yyval.node) = (PGNode *)n; ;} break; - case 654: -#line 1225 "third_party/libpg_query/grammar/statements/select.y" + case 776: +#line 23 "third_party/libpg_query/grammar/statements/pragma.y" { - (yyval.typnam) = (yyvsp[(1) - (2)].typnam); - (yyval.typnam)->arrayBounds = list_make1(makeInteger(-1)); + PGPragmaStmt *n = makeNode(PGPragmaStmt); + n->kind = PG_PRAGMA_TYPE_CALL; + n->name = (yyvsp[(2) - (5)].str); + n->args = (yyvsp[(4) - (5)].list); + (yyval.node) = (PGNode *)n; ;} break; - case 655: -#line 1230 "third_party/libpg_query/grammar/statements/select.y" + case 777: +#line 9 "third_party/libpg_query/grammar/statements/create_function.y" { - (yyval.typnam) = (yyvsp[(2) - (3)].typnam); - (yyval.typnam)->arrayBounds = list_make1(makeInteger(-1)); - (yyval.typnam)->setof = true; - ;} + PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); + n->relpersistence=(yyvsp[(2) - (8)].ival); + n->name = (yyvsp[(4) - (8)].range); + n->params = (yyvsp[(5) - (8)].list); + n->function = NULL; + n->query = (yyvsp[(8) - (8)].node); + (yyval.node) = (PGNode *)n; + + ;} break; - case 656: -#line 1235 "third_party/libpg_query/grammar/statements/select.y" + case 778: +#line 21 "third_party/libpg_query/grammar/statements/create_function.y" { - (yyval.typnam) = SystemTypeName("struct"); - (yyval.typnam)->arrayBounds = (yyvsp[(5) - (5)].list); - (yyval.typnam)->typmods = (yyvsp[(3) - (5)].list); - (yyval.typnam)->location = (yylsp[(1) - (5)]); - ;} + PGCreateFunctionStmt *n = makeNode(PGCreateFunctionStmt); + n->relpersistence=(yyvsp[(2) - (7)].ival); + n->name = (yyvsp[(4) - (7)].range); + n->params = (yyvsp[(5) - (7)].list); + n->function = (yyvsp[(7) - (7)].node); + n->query = NULL; + (yyval.node) = (PGNode *)n; + ;} break; - case 657: -#line 1241 "third_party/libpg_query/grammar/statements/select.y" + case 781: +#line 42 "third_party/libpg_query/grammar/statements/create_function.y" { - (yyval.typnam) = SystemTypeName("map"); - (yyval.typnam)->arrayBounds = (yyvsp[(5) - (5)].list); - (yyval.typnam)->typmods = (yyvsp[(3) - (5)].list); - (yyval.typnam)->location = (yylsp[(1) - (5)]); + (yyval.list) = NIL; ;} break; - case 658: -#line 1251 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeInteger(-1)); ;} - break; - - case 659: -#line 1253 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (4)].list), makeInteger((yyvsp[(3) - (4)].ival))); ;} + case 782: +#line 46 "third_party/libpg_query/grammar/statements/create_function.y" + { + (yyval.list) = (yyvsp[(2) - (3)].list); + ;} break; - case 660: -#line 1255 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 783: +#line 10 "third_party/libpg_query/grammar/statements/alter_table.y" + { + PGAlterTableStmt *n = makeNode(PGAlterTableStmt); + n->relation = (yyvsp[(3) - (4)].range); + n->cmds = (yyvsp[(4) - (4)].list); + n->relkind = PG_OBJECT_TABLE; + n->missing_ok = false; + (yyval.node) = (PGNode *)n; + ;} break; - case 661: -#line 1259 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + case 784: +#line 19 "third_party/libpg_query/grammar/statements/alter_table.y" + { + PGAlterTableStmt *n = makeNode(PGAlterTableStmt); + n->relation = (yyvsp[(5) - (6)].range); + n->cmds = (yyvsp[(6) - (6)].list); + n->relkind = PG_OBJECT_TABLE; + n->missing_ok = true; + (yyval.node) = (PGNode *)n; + ;} break; - case 662: -#line 1260 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + case 785: +#line 28 "third_party/libpg_query/grammar/statements/alter_table.y" + { + PGAlterTableStmt *n = makeNode(PGAlterTableStmt); + n->relation = (yyvsp[(3) - (4)].range); + n->cmds = (yyvsp[(4) - (4)].list); + n->relkind = PG_OBJECT_INDEX; + n->missing_ok = false; + (yyval.node) = (PGNode *)n; + ;} break; - case 663: -#line 1261 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + case 786: +#line 37 "third_party/libpg_query/grammar/statements/alter_table.y" + { + PGAlterTableStmt *n = makeNode(PGAlterTableStmt); + n->relation = (yyvsp[(5) - (6)].range); + n->cmds = (yyvsp[(6) - (6)].list); + n->relkind = PG_OBJECT_INDEX; + n->missing_ok = true; + (yyval.node) = (PGNode *)n; + ;} break; - case 664: -#line 1262 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + case 787: +#line 46 "third_party/libpg_query/grammar/statements/alter_table.y" + { + PGAlterTableStmt *n = makeNode(PGAlterTableStmt); + n->relation = (yyvsp[(3) - (4)].range); + n->cmds = (yyvsp[(4) - (4)].list); + n->relkind = PG_OBJECT_SEQUENCE; + n->missing_ok = false; + (yyval.node) = (PGNode *)n; + ;} break; - case 665: -#line 1263 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + case 788: +#line 55 "third_party/libpg_query/grammar/statements/alter_table.y" + { + PGAlterTableStmt *n = makeNode(PGAlterTableStmt); + n->relation = (yyvsp[(5) - (6)].range); + n->cmds = (yyvsp[(6) - (6)].list); + n->relkind = PG_OBJECT_SEQUENCE; + n->missing_ok = true; + (yyval.node) = (PGNode *)n; + ;} break; - case 666: -#line 1265 "third_party/libpg_query/grammar/statements/select.y" + case 789: +#line 64 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = (yyvsp[(1) - (2)].typnam); - (yyval.typnam)->typmods = (yyvsp[(2) - (2)].list); + PGAlterTableStmt *n = makeNode(PGAlterTableStmt); + n->relation = (yyvsp[(3) - (4)].range); + n->cmds = (yyvsp[(4) - (4)].list); + n->relkind = PG_OBJECT_VIEW; + n->missing_ok = false; + (yyval.node) = (PGNode *)n; ;} break; - case 667: -#line 1270 "third_party/libpg_query/grammar/statements/select.y" + case 790: +#line 73 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = (yyvsp[(1) - (4)].typnam); - (yyval.typnam)->typmods = list_make2(makeIntConst(INTERVAL_FULL_RANGE, -1), - makeIntConst((yyvsp[(3) - (4)].ival), (yylsp[(3) - (4)]))); + PGAlterTableStmt *n = makeNode(PGAlterTableStmt); + n->relation = (yyvsp[(5) - (6)].range); + n->cmds = (yyvsp[(6) - (6)].list); + n->relkind = PG_OBJECT_VIEW; + n->missing_ok = true; + (yyval.node) = (PGNode *)n; ;} break; - case 668: -#line 1289 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + case 791: +#line 86 "third_party/libpg_query/grammar/statements/alter_table.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; - case 669: -#line 1290 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + case 792: +#line 88 "third_party/libpg_query/grammar/statements/alter_table.y" + { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].defelt)); ;} break; - case 670: -#line 1291 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + case 793: +#line 93 "third_party/libpg_query/grammar/statements/alter_table.y" + { (yyval.node) = (yyvsp[(3) - (3)].node); ;} break; - case 671: -#line 1292 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + case 794: +#line 94 "third_party/libpg_query/grammar/statements/alter_table.y" + { (yyval.node) = NULL; ;} break; - case 672: -#line 1304 "third_party/libpg_query/grammar/statements/select.y" + case 795: +#line 100 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = makeTypeName((yyvsp[(1) - (2)].str)); - (yyval.typnam)->typmods = (yyvsp[(2) - (2)].list); - (yyval.typnam)->location = (yylsp[(1) - (2)]); + (yyval.defelt) = makeDefElem("restart", NULL, (yylsp[(1) - (1)])); ;} break; - case 673: -#line 1317 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(2) - (3)].list); ;} - break; - - case 674: -#line 1318 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} - break; - - case 675: -#line 1325 "third_party/libpg_query/grammar/statements/select.y" + case 796: +#line 104 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName("int4"); - (yyval.typnam)->location = (yylsp[(1) - (1)]); + (yyval.defelt) = makeDefElem("restart", (PGNode *)(yyvsp[(3) - (3)].value), (yylsp[(1) - (3)])); ;} break; - case 676: -#line 1330 "third_party/libpg_query/grammar/statements/select.y" + case 797: +#line 108 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName("int4"); - (yyval.typnam)->location = (yylsp[(1) - (1)]); + if (strcmp((yyvsp[(2) - (2)].defelt)->defname, "as") == 0 || + strcmp((yyvsp[(2) - (2)].defelt)->defname, "restart") == 0 || + strcmp((yyvsp[(2) - (2)].defelt)->defname, "owned_by") == 0) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("sequence option \"%s\" not supported here", (yyvsp[(2) - (2)].defelt)->defname), + parser_errposition((yylsp[(2) - (2)])))); + (yyval.defelt) = (yyvsp[(2) - (2)].defelt); ;} break; - case 677: -#line 1335 "third_party/libpg_query/grammar/statements/select.y" + case 798: +#line 119 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName("int2"); - (yyval.typnam)->location = (yylsp[(1) - (1)]); + (yyval.defelt) = makeDefElem("generated", (PGNode *) makeInteger((yyvsp[(3) - (3)].ival)), (yylsp[(1) - (3)])); ;} break; - case 678: -#line 1340 "third_party/libpg_query/grammar/statements/select.y" + case 799: +#line 127 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName("int8"); - (yyval.typnam)->location = (yylsp[(1) - (1)]); + (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; - case 679: -#line 1345 "third_party/libpg_query/grammar/statements/select.y" + case 800: +#line 131 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName("float4"); - (yyval.typnam)->location = (yylsp[(1) - (1)]); + (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} break; - case 680: -#line 1350 "third_party/libpg_query/grammar/statements/select.y" + case 801: +#line 140 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = (yyvsp[(2) - (2)].typnam); - (yyval.typnam)->location = (yylsp[(1) - (2)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_AddColumn; + n->def = (yyvsp[(2) - (2)].node); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; ;} break; - case 681: -#line 1355 "third_party/libpg_query/grammar/statements/select.y" + case 802: +#line 149 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName("float8"); - (yyval.typnam)->location = (yylsp[(1) - (2)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_AddColumn; + n->def = (yyvsp[(5) - (5)].node); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; ;} break; - case 682: -#line 1360 "third_party/libpg_query/grammar/statements/select.y" + case 803: +#line 158 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName("numeric"); - (yyval.typnam)->typmods = (yyvsp[(2) - (2)].list); - (yyval.typnam)->location = (yylsp[(1) - (2)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_AddColumn; + n->def = (yyvsp[(3) - (3)].node); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; ;} break; - case 683: -#line 1366 "third_party/libpg_query/grammar/statements/select.y" + case 804: +#line 167 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName("numeric"); - (yyval.typnam)->typmods = (yyvsp[(2) - (2)].list); - (yyval.typnam)->location = (yylsp[(1) - (2)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_AddColumn; + n->def = (yyvsp[(6) - (6)].node); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; ;} break; - case 684: -#line 1372 "third_party/libpg_query/grammar/statements/select.y" + case 805: +#line 176 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName("numeric"); - (yyval.typnam)->typmods = (yyvsp[(2) - (2)].list); - (yyval.typnam)->location = (yylsp[(1) - (2)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_ColumnDefault; + n->name = (yyvsp[(3) - (4)].str); + n->def = (yyvsp[(4) - (4)].node); + (yyval.node) = (PGNode *)n; ;} break; - case 685: -#line 1378 "third_party/libpg_query/grammar/statements/select.y" + case 806: +#line 185 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName("bool"); - (yyval.typnam)->location = (yylsp[(1) - (1)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_DropNotNull; + n->name = (yyvsp[(3) - (6)].str); + (yyval.node) = (PGNode *)n; ;} break; - case 686: -#line 1385 "third_party/libpg_query/grammar/statements/select.y" + case 807: +#line 193 "third_party/libpg_query/grammar/statements/alter_table.y" { - /* - * Check FLOAT() precision limits assuming IEEE floating - * types - thomas 1997-09-18 - */ - if ((yyvsp[(2) - (3)].ival) < 1) - ereport(ERROR, - (errcode(PG_ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("precision for type float must be at least 1 bit"), - parser_errposition((yylsp[(2) - (3)])))); - else if ((yyvsp[(2) - (3)].ival) <= 24) - (yyval.typnam) = SystemTypeName("float4"); - else if ((yyvsp[(2) - (3)].ival) <= 53) - (yyval.typnam) = SystemTypeName("float8"); - else - ereport(ERROR, - (errcode(PG_ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("precision for type float must be less than 54 bits"), - parser_errposition((yylsp[(2) - (3)])))); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_SetNotNull; + n->name = (yyvsp[(3) - (6)].str); + (yyval.node) = (PGNode *)n; ;} break; - case 687: -#line 1406 "third_party/libpg_query/grammar/statements/select.y" + case 808: +#line 201 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName("float4"); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_SetStatistics; + n->name = (yyvsp[(3) - (6)].str); + n->def = (PGNode *) makeInteger((yyvsp[(6) - (6)].ival)); + (yyval.node) = (PGNode *)n; ;} break; - case 688: -#line 1416 "third_party/libpg_query/grammar/statements/select.y" + case 809: +#line 210 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = (yyvsp[(1) - (1)].typnam); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_SetOptions; + n->name = (yyvsp[(3) - (5)].str); + n->def = (PGNode *) (yyvsp[(5) - (5)].list); + (yyval.node) = (PGNode *)n; ;} break; - case 689: -#line 1420 "third_party/libpg_query/grammar/statements/select.y" + case 810: +#line 219 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = (yyvsp[(1) - (1)].typnam); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_ResetOptions; + n->name = (yyvsp[(3) - (5)].str); + n->def = (PGNode *) (yyvsp[(5) - (5)].list); + (yyval.node) = (PGNode *)n; ;} break; - case 690: -#line 1428 "third_party/libpg_query/grammar/statements/select.y" + case 811: +#line 228 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = (yyvsp[(1) - (1)].typnam); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_SetStorage; + n->name = (yyvsp[(3) - (6)].str); + n->def = (PGNode *) makeString((yyvsp[(6) - (6)].str)); + (yyval.node) = (PGNode *)n; ;} break; - case 691: -#line 1432 "third_party/libpg_query/grammar/statements/select.y" + case 812: +#line 237 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = (yyvsp[(1) - (1)].typnam); - (yyval.typnam)->typmods = NIL; - ;} - break; + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + PGConstraint *c = makeNode(PGConstraint); - case 692: -#line 1440 "third_party/libpg_query/grammar/statements/select.y" - { - const char *typname; + c->contype = PG_CONSTR_IDENTITY; + c->generated_when = (yyvsp[(6) - (9)].ival); + c->options = (yyvsp[(9) - (9)].list); + c->location = (yylsp[(5) - (9)]); - typname = (yyvsp[(2) - (5)].boolean) ? "varbit" : "bit"; - (yyval.typnam) = SystemTypeName(typname); - (yyval.typnam)->typmods = (yyvsp[(4) - (5)].list); - (yyval.typnam)->location = (yylsp[(1) - (5)]); + n->subtype = PG_AT_AddIdentity; + n->name = (yyvsp[(3) - (9)].str); + n->def = (PGNode *) c; + + (yyval.node) = (PGNode *)n; ;} break; - case 693: -#line 1452 "third_party/libpg_query/grammar/statements/select.y" + case 813: +#line 254 "third_party/libpg_query/grammar/statements/alter_table.y" { - /* bit defaults to bit(1), varbit to no limit */ - if ((yyvsp[(2) - (2)].boolean)) - { - (yyval.typnam) = SystemTypeName("varbit"); - } - else - { - (yyval.typnam) = SystemTypeName("bit"); - (yyval.typnam)->typmods = list_make1(makeIntConst(1, -1)); - } - (yyval.typnam)->location = (yylsp[(1) - (2)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_SetIdentity; + n->name = (yyvsp[(3) - (4)].str); + n->def = (PGNode *) (yyvsp[(4) - (4)].list); + (yyval.node) = (PGNode *)n; ;} break; - case 694: -#line 1473 "third_party/libpg_query/grammar/statements/select.y" + case 814: +#line 263 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = (yyvsp[(1) - (1)].typnam); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = AT_DropIdentity; + n->name = (yyvsp[(3) - (5)].str); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; ;} break; - case 695: -#line 1477 "third_party/libpg_query/grammar/statements/select.y" + case 815: +#line 272 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = (yyvsp[(1) - (1)].typnam); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = AT_DropIdentity; + n->name = (yyvsp[(3) - (7)].str); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; ;} break; - case 696: -#line 1483 "third_party/libpg_query/grammar/statements/select.y" + case 816: +#line 281 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = (yyvsp[(1) - (1)].typnam); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_DropColumn; + n->name = (yyvsp[(5) - (6)].str); + n->behavior = (yyvsp[(6) - (6)].dbehavior); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; ;} break; - case 697: -#line 1487 "third_party/libpg_query/grammar/statements/select.y" + case 817: +#line 291 "third_party/libpg_query/grammar/statements/alter_table.y" { - /* Length was not specified so allow to be unrestricted. - * This handles problems with fixed-length (bpchar) strings - * which in column definitions must default to a length - * of one, but should not be constrained if the length - * was not specified. - */ - (yyval.typnam) = (yyvsp[(1) - (1)].typnam); - (yyval.typnam)->typmods = NIL; + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_DropColumn; + n->name = (yyvsp[(3) - (4)].str); + n->behavior = (yyvsp[(4) - (4)].dbehavior); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; ;} break; - case 698: -#line 1500 "third_party/libpg_query/grammar/statements/select.y" + case 818: +#line 304 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName((yyvsp[(1) - (4)].conststr)); - (yyval.typnam)->typmods = list_make1(makeIntConst((yyvsp[(3) - (4)].ival), (yylsp[(3) - (4)]))); - (yyval.typnam)->location = (yylsp[(1) - (4)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + PGColumnDef *def = makeNode(PGColumnDef); + n->subtype = PG_AT_AlterColumnType; + n->name = (yyvsp[(3) - (8)].str); + n->def = (PGNode *) def; + /* We only use these fields of the PGColumnDef node */ + def->typeName = (yyvsp[(6) - (8)].typnam); + def->collClause = (PGCollateClause *) (yyvsp[(7) - (8)].node); + def->raw_default = (yyvsp[(8) - (8)].node); + def->location = (yylsp[(3) - (8)]); + (yyval.node) = (PGNode *)n; ;} break; - case 699: -#line 1508 "third_party/libpg_query/grammar/statements/select.y" + case 819: +#line 319 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName((yyvsp[(1) - (1)].conststr)); - /* char defaults to char(1), varchar to no limit */ - if (strcmp((yyvsp[(1) - (1)].conststr), "bpchar") == 0) - (yyval.typnam)->typmods = list_make1(makeIntConst(1, -1)); - (yyval.typnam)->location = (yylsp[(1) - (1)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_AlterColumnGenericOptions; + n->name = (yyvsp[(3) - (4)].str); + n->def = (PGNode *) (yyvsp[(4) - (4)].list); + (yyval.node) = (PGNode *)n; ;} break; - case 700: -#line 1518 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = (yyvsp[(2) - (2)].boolean) ? "varchar": "bpchar"; ;} - break; - - case 701: -#line 1520 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = (yyvsp[(2) - (2)].boolean) ? "varchar": "bpchar"; ;} - break; - - case 702: -#line 1522 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = "varchar"; ;} - break; - - case 703: -#line 1524 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = (yyvsp[(3) - (3)].boolean) ? "varchar": "bpchar"; ;} + case 820: +#line 328 "third_party/libpg_query/grammar/statements/alter_table.y" + { + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_AddConstraint; + n->def = (yyvsp[(2) - (2)].node); + (yyval.node) = (PGNode *)n; + ;} break; - case 704: -#line 1526 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = (yyvsp[(3) - (3)].boolean) ? "varchar": "bpchar"; ;} + case 821: +#line 336 "third_party/libpg_query/grammar/statements/alter_table.y" + { + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + PGConstraint *c = makeNode(PGConstraint); + n->subtype = PG_AT_AlterConstraint; + n->def = (PGNode *) c; + c->contype = PG_CONSTR_FOREIGN; /* others not supported, yet */ + c->conname = (yyvsp[(3) - (4)].str); + processCASbits((yyvsp[(4) - (4)].ival), (yylsp[(4) - (4)]), "ALTER CONSTRAINT statement", + &c->deferrable, + &c->initdeferred, + NULL, NULL, yyscanner); + (yyval.node) = (PGNode *)n; + ;} break; - case 705: -#line 1528 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = (yyvsp[(2) - (2)].boolean) ? "varchar": "bpchar"; ;} + case 822: +#line 351 "third_party/libpg_query/grammar/statements/alter_table.y" + { + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_ValidateConstraint; + n->name = (yyvsp[(3) - (3)].str); + (yyval.node) = (PGNode *)n; + ;} break; - case 706: -#line 1532 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.boolean) = true; ;} + case 823: +#line 359 "third_party/libpg_query/grammar/statements/alter_table.y" + { + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_DropConstraint; + n->name = (yyvsp[(5) - (6)].str); + n->behavior = (yyvsp[(6) - (6)].dbehavior); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; + ;} break; - case 707: -#line 1533 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.boolean) = false; ;} + case 824: +#line 369 "third_party/libpg_query/grammar/statements/alter_table.y" + { + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_DropConstraint; + n->name = (yyvsp[(3) - (4)].str); + n->behavior = (yyvsp[(4) - (4)].dbehavior); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; + ;} break; - case 708: -#line 1541 "third_party/libpg_query/grammar/statements/select.y" + case 825: +#line 379 "third_party/libpg_query/grammar/statements/alter_table.y" { - if ((yyvsp[(5) - (5)].boolean)) - (yyval.typnam) = SystemTypeName("timestamptz"); - else - (yyval.typnam) = SystemTypeName("timestamp"); - (yyval.typnam)->typmods = list_make1(makeIntConst((yyvsp[(3) - (5)].ival), (yylsp[(3) - (5)]))); - (yyval.typnam)->location = (yylsp[(1) - (5)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_SetLogged; + (yyval.node) = (PGNode *)n; ;} break; - case 709: -#line 1550 "third_party/libpg_query/grammar/statements/select.y" + case 826: +#line 386 "third_party/libpg_query/grammar/statements/alter_table.y" { - if ((yyvsp[(2) - (2)].boolean)) - (yyval.typnam) = SystemTypeName("timestamptz"); - else - (yyval.typnam) = SystemTypeName("timestamp"); - (yyval.typnam)->location = (yylsp[(1) - (2)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_SetUnLogged; + (yyval.node) = (PGNode *)n; ;} break; - case 710: -#line 1558 "third_party/libpg_query/grammar/statements/select.y" + case 827: +#line 393 "third_party/libpg_query/grammar/statements/alter_table.y" { - if ((yyvsp[(5) - (5)].boolean)) - (yyval.typnam) = SystemTypeName("timetz"); - else - (yyval.typnam) = SystemTypeName("time"); - (yyval.typnam)->typmods = list_make1(makeIntConst((yyvsp[(3) - (5)].ival), (yylsp[(3) - (5)]))); - (yyval.typnam)->location = (yylsp[(1) - (5)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_SetRelOptions; + n->def = (PGNode *)(yyvsp[(2) - (2)].list); + (yyval.node) = (PGNode *)n; ;} break; - case 711: -#line 1567 "third_party/libpg_query/grammar/statements/select.y" + case 828: +#line 401 "third_party/libpg_query/grammar/statements/alter_table.y" { - if ((yyvsp[(2) - (2)].boolean)) - (yyval.typnam) = SystemTypeName("timetz"); - else - (yyval.typnam) = SystemTypeName("time"); - (yyval.typnam)->location = (yylsp[(1) - (2)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_ResetRelOptions; + n->def = (PGNode *)(yyvsp[(2) - (2)].list); + (yyval.node) = (PGNode *)n; ;} break; - case 712: -#line 1578 "third_party/libpg_query/grammar/statements/select.y" + case 829: +#line 408 "third_party/libpg_query/grammar/statements/alter_table.y" { - (yyval.typnam) = SystemTypeName("interval"); - (yyval.typnam)->location = (yylsp[(1) - (1)]); + PGAlterTableCmd *n = makeNode(PGAlterTableCmd); + n->subtype = PG_AT_GenericOptions; + n->def = (PGNode *)(yyvsp[(1) - (1)].list); + (yyval.node) = (PGNode *) n; ;} break; - case 713: -#line 1585 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.boolean) = true; ;} + case 830: +#line 418 "third_party/libpg_query/grammar/statements/alter_table.y" + { (yyval.node) = (yyvsp[(2) - (2)].node); ;} break; - case 714: -#line 1586 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.boolean) = false; ;} + case 831: +#line 419 "third_party/libpg_query/grammar/statements/alter_table.y" + { (yyval.node) = NULL; ;} break; - case 715: -#line 1587 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.boolean) = false; ;} + case 832: +#line 425 "third_party/libpg_query/grammar/statements/alter_table.y" + { + (yyval.defelt) = (yyvsp[(1) - (1)].defelt); + ;} break; - case 732: -#line 1616 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(YEAR), (yylsp[(1) - (1)]))); ;} + case 833: +#line 429 "third_party/libpg_query/grammar/statements/alter_table.y" + { + (yyval.defelt) = (yyvsp[(2) - (2)].defelt); + (yyval.defelt)->defaction = PG_DEFELEM_SET; + ;} break; - case 733: -#line 1618 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MONTH), (yylsp[(1) - (1)]))); ;} + case 834: +#line 434 "third_party/libpg_query/grammar/statements/alter_table.y" + { + (yyval.defelt) = (yyvsp[(2) - (2)].defelt); + (yyval.defelt)->defaction = PG_DEFELEM_ADD; + ;} break; - case 734: -#line 1620 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY), (yylsp[(1) - (1)]))); ;} + case 835: +#line 439 "third_party/libpg_query/grammar/statements/alter_table.y" + { + (yyval.defelt) = makeDefElemExtended(NULL, (yyvsp[(2) - (2)].str), NULL, DEFELEM_DROP, (yylsp[(2) - (2)])); + ;} break; - case 735: -#line 1622 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(HOUR), (yylsp[(1) - (1)]))); ;} + case 836: +#line 446 "third_party/libpg_query/grammar/statements/alter_table.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 736: -#line 1624 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MINUTE), (yylsp[(1) - (1)]))); ;} + case 837: +#line 447 "third_party/libpg_query/grammar/statements/alter_table.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 737: -#line 1626 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(SECOND), (yylsp[(1) - (1)]))); ;} + case 838: +#line 452 "third_party/libpg_query/grammar/statements/alter_table.y" + { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 738: -#line 1628 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MILLISECOND), (yylsp[(1) - (1)]))); ;} + case 839: +#line 456 "third_party/libpg_query/grammar/statements/alter_table.y" + { (yyval.ival) = 1; ;} break; - case 739: -#line 1630 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MICROSECOND), (yylsp[(1) - (1)]))); ;} + case 840: +#line 457 "third_party/libpg_query/grammar/statements/alter_table.y" + { (yyval.ival) = 0; ;} break; - case 740: -#line 1632 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(YEAR) | - INTERVAL_MASK(MONTH), (yylsp[(1) - (3)]))); - ;} + case 841: +#line 458 "third_party/libpg_query/grammar/statements/alter_table.y" + { (yyval.ival) = 0; ;} break; - case 741: -#line 1637 "third_party/libpg_query/grammar/statements/select.y" + case 842: +#line 8 "third_party/libpg_query/grammar/statements/create_schema.y" { - (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY) | - INTERVAL_MASK(HOUR), (yylsp[(1) - (3)]))); + PGCreateSchemaStmt *n = makeNode(PGCreateSchemaStmt); + /* ...but not both */ + n->schemaname = (yyvsp[(3) - (4)].str); + n->schemaElts = (yyvsp[(4) - (4)].list); + n->onconflict = PG_ERROR_ON_CONFLICT; + (yyval.node) = (PGNode *)n; ;} break; - case 742: -#line 1642 "third_party/libpg_query/grammar/statements/select.y" + case 843: +#line 17 "third_party/libpg_query/grammar/statements/create_schema.y" { - (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY) | - INTERVAL_MASK(HOUR) | - INTERVAL_MASK(MINUTE), (yylsp[(1) - (3)]))); + PGCreateSchemaStmt *n = makeNode(PGCreateSchemaStmt); + /* ...but not here */ + n->schemaname = (yyvsp[(6) - (7)].str); + if ((yyvsp[(7) - (7)].list) != NIL) + ereport(ERROR, + (errcode(PG_ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("CREATE SCHEMA IF NOT EXISTS cannot include schema elements"), + parser_errposition((yylsp[(7) - (7)])))); + n->schemaElts = (yyvsp[(7) - (7)].list); + n->onconflict = PG_IGNORE_ON_CONFLICT; + (yyval.node) = (PGNode *)n; ;} break; - case 743: -#line 1648 "third_party/libpg_query/grammar/statements/select.y" + case 844: +#line 35 "third_party/libpg_query/grammar/statements/create_schema.y" { - (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(DAY) | - INTERVAL_MASK(HOUR) | - INTERVAL_MASK(MINUTE) | - INTERVAL_MASK(SECOND), (yylsp[(1) - (3)]))); + if ((yyloc) < 0) /* see comments for YYLLOC_DEFAULT */ + (yyloc) = (yylsp[(2) - (2)]); + (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 744: -#line 1655 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(HOUR) | - INTERVAL_MASK(MINUTE), (yylsp[(1) - (3)]))); - ;} + case 845: +#line 41 "third_party/libpg_query/grammar/statements/create_schema.y" + { (yyval.list) = NIL; ;} break; - case 745: -#line 1660 "third_party/libpg_query/grammar/statements/select.y" + case 850: +#line 3 "third_party/libpg_query/grammar/statements/variable_show.y" { - (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(HOUR) | - INTERVAL_MASK(MINUTE) | - INTERVAL_MASK(SECOND), (yylsp[(1) - (3)]))); - ;} + PGVariableShowSelectStmt *n = makeNode(PGVariableShowSelectStmt); + n->stmt = (yyvsp[(2) - (2)].node); + n->name = (char*) "select"; + n->is_summary = 0; + (yyval.node) = (PGNode *) n; + ;} break; - case 746: -#line 1666 "third_party/libpg_query/grammar/statements/select.y" + case 851: +#line 10 "third_party/libpg_query/grammar/statements/variable_show.y" { - (yyval.list) = list_make1(makeIntConst(INTERVAL_MASK(MINUTE) | - INTERVAL_MASK(SECOND), (yylsp[(1) - (3)]))); - ;} + PGVariableShowSelectStmt *n = makeNode(PGVariableShowSelectStmt); + n->stmt = (yyvsp[(2) - (2)].node); + n->name = (char*) "select"; + n->is_summary = 1; + (yyval.node) = (PGNode *) n; + ;} break; - case 747: -#line 1671 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 852: +#line 18 "third_party/libpg_query/grammar/statements/variable_show.y" + { + PGVariableShowStmt *n = makeNode(PGVariableShowStmt); + n->name = (yyvsp[(2) - (2)].str); + n->is_summary = 1; + (yyval.node) = (PGNode *) n; + ;} break; - case 748: -#line 1702 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 853: +#line 25 "third_party/libpg_query/grammar/statements/variable_show.y" + { + PGVariableShowStmt *n = makeNode(PGVariableShowStmt); + n->name = (yyvsp[(2) - (2)].str); + n->is_summary = 0; + (yyval.node) = (PGNode *) n; + ;} break; - case 749: -#line 1705 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeTypeCast((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].typnam), 0, (yylsp[(2) - (3)])); ;} + case 854: +#line 32 "third_party/libpg_query/grammar/statements/variable_show.y" + { + PGVariableShowStmt *n = makeNode(PGVariableShowStmt); + n->name = (char*) "timezone"; + n->is_summary = 0; + (yyval.node) = (PGNode *) n; + ;} break; - case 750: -#line 1707 "third_party/libpg_query/grammar/statements/select.y" + case 855: +#line 39 "third_party/libpg_query/grammar/statements/variable_show.y" { - PGCollateClause *n = makeNode(PGCollateClause); - n->arg = (yyvsp[(1) - (3)].node); - n->collname = (yyvsp[(3) - (3)].list); - n->location = (yylsp[(2) - (3)]); - (yyval.node) = (PGNode *) n; - ;} + PGVariableShowStmt *n = makeNode(PGVariableShowStmt); + n->name = (char*) "transaction_isolation"; + n->is_summary = 0; + (yyval.node) = (PGNode *) n; + ;} break; - case 751: -#line 1715 "third_party/libpg_query/grammar/statements/select.y" + case 856: +#line 46 "third_party/libpg_query/grammar/statements/variable_show.y" { - (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("timezone"), - list_make2((yyvsp[(5) - (5)].node), (yyvsp[(1) - (5)].node)), - (yylsp[(2) - (5)])); - ;} + PGVariableShowStmt *n = makeNode(PGVariableShowStmt); + n->name = (char*) "__show_tables_expanded"; + n->is_summary = 0; + (yyval.node) = (PGNode *) n; + ;} break; - case 752: -#line 1730 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + case 857: +#line 53 "third_party/libpg_query/grammar/statements/variable_show.y" + { + PGVariableShowStmt *n = makeNode(PGVariableShowStmt); + n->name = (char*) "__show_tables_expanded"; + n->is_summary = 0; + (yyval.node) = (PGNode *) n; + ;} break; - case 753: -#line 1732 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = doNegate((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + case 860: +#line 63 "third_party/libpg_query/grammar/statements/variable_show.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 754: -#line 1734 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 861: +#line 65 "third_party/libpg_query/grammar/statements/variable_show.y" + { (yyval.str) = psprintf("%s.%s", (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)); ;} break; - case 755: -#line 1736 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "-", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 862: +#line 9 "third_party/libpg_query/grammar/statements/create.y" + { + PGCreateStmt *n = makeNode(PGCreateStmt); + (yyvsp[(4) - (9)].range)->relpersistence = (yyvsp[(2) - (9)].ival); + n->relation = (yyvsp[(4) - (9)].range); + n->tableElts = (yyvsp[(6) - (9)].list); + n->ofTypename = NULL; + n->constraints = NIL; + n->options = (yyvsp[(8) - (9)].list); + n->oncommit = (yyvsp[(9) - (9)].oncommit); + n->onconflict = PG_ERROR_ON_CONFLICT; + (yyval.node) = (PGNode *)n; + ;} break; - case 756: -#line 1738 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "*", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 863: +#line 24 "third_party/libpg_query/grammar/statements/create.y" + { + PGCreateStmt *n = makeNode(PGCreateStmt); + (yyvsp[(7) - (12)].range)->relpersistence = (yyvsp[(2) - (12)].ival); + n->relation = (yyvsp[(7) - (12)].range); + n->tableElts = (yyvsp[(9) - (12)].list); + n->ofTypename = NULL; + n->constraints = NIL; + n->options = (yyvsp[(11) - (12)].list); + n->oncommit = (yyvsp[(12) - (12)].oncommit); + n->onconflict = PG_IGNORE_ON_CONFLICT; + (yyval.node) = (PGNode *)n; + ;} break; - case 757: -#line 1740 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "/", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 864: +#line 39 "third_party/libpg_query/grammar/statements/create.y" + { + PGCreateStmt *n = makeNode(PGCreateStmt); + (yyvsp[(6) - (11)].range)->relpersistence = (yyvsp[(4) - (11)].ival); + n->relation = (yyvsp[(6) - (11)].range); + n->tableElts = (yyvsp[(8) - (11)].list); + n->ofTypename = NULL; + n->constraints = NIL; + n->options = (yyvsp[(10) - (11)].list); + n->oncommit = (yyvsp[(11) - (11)].oncommit); + n->onconflict = PG_REPLACE_ON_CONFLICT; + (yyval.node) = (PGNode *)n; + ;} break; - case 758: -#line 1742 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "%", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 865: +#line 56 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = 0; ;} break; - case 759: -#line 1744 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "^", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 866: +#line 58 "third_party/libpg_query/grammar/statements/create.y" + { + /* + * We must complain about conflicting options. + * We could, but choose not to, complain about redundant + * options (ie, where $2's bit is already set in $1). + */ + int newspec = (yyvsp[(1) - (2)].ival) | (yyvsp[(2) - (2)].ival); + + /* special message for this case */ + if ((newspec & (CAS_NOT_DEFERRABLE | CAS_INITIALLY_DEFERRED)) == (CAS_NOT_DEFERRABLE | CAS_INITIALLY_DEFERRED)) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("constraint declared INITIALLY DEFERRED must be DEFERRABLE"), + parser_errposition((yylsp[(2) - (2)])))); + /* generic message for other conflicts */ + if ((newspec & (CAS_NOT_DEFERRABLE | CAS_DEFERRABLE)) == (CAS_NOT_DEFERRABLE | CAS_DEFERRABLE) || + (newspec & (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED)) == (CAS_INITIALLY_IMMEDIATE | CAS_INITIALLY_DEFERRED)) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("conflicting constraint properties"), + parser_errposition((yylsp[(2) - (2)])))); + (yyval.ival) = newspec; + ;} break; - case 760: -#line 1746 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 867: +#line 84 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.node) = (PGNode *)(yyvsp[(1) - (1)].typnam); ;} break; - case 761: -#line 1748 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 868: +#line 85 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.node) = (PGNode *)makeString(pstrdup((yyvsp[(1) - (1)].keyword))); ;} break; - case 762: -#line 1750 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 869: +#line 86 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.node) = (PGNode *)(yyvsp[(1) - (1)].list); ;} break; - case 763: -#line 1752 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 870: +#line 87 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.node) = (PGNode *)(yyvsp[(1) - (1)].value); ;} break; - case 764: -#line 1754 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 871: +#line 88 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.node) = (PGNode *)makeString((yyvsp[(1) - (1)].str)); ;} break; - case 765: -#line 1756 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<>", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 872: +#line 89 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.node) = (PGNode *)makeString(pstrdup((yyvsp[(1) - (1)].keyword))); ;} break; - case 766: -#line 1759 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (3)].list), (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 873: +#line 93 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 767: -#line 1761 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(1) - (2)].list), NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + case 874: +#line 94 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = NIL; ;} break; - case 768: -#line 1763 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (2)].list), (yyvsp[(1) - (2)].node), NULL, (yylsp[(2) - (2)])); ;} + case 875: +#line 99 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); ;} break; - case 769: -#line 1766 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeAndExpr((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 876: +#line 104 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_FKCONSTR_ACTION_NOACTION; ;} break; - case 770: -#line 1768 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeOrExpr((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 877: +#line 105 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_FKCONSTR_ACTION_RESTRICT; ;} break; - case 771: -#line 1770 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeNotExpr((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + case 878: +#line 106 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_FKCONSTR_ACTION_CASCADE; ;} break; - case 772: -#line 1772 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeNotExpr((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + case 879: +#line 107 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_FKCONSTR_ACTION_SETNULL; ;} break; - case 773: -#line 1775 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_GLOB, "~~~", - (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); - ;} + case 880: +#line 108 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_FKCONSTR_ACTION_SETDEFAULT; ;} break; - case 774: -#line 1780 "third_party/libpg_query/grammar/statements/select.y" + case 881: +#line 114 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_LIKE, "~~", - (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); + PGConstraint *n = castNode(PGConstraint, (yyvsp[(3) - (3)].node)); + n->conname = (yyvsp[(2) - (3)].str); + n->location = (yylsp[(1) - (3)]); + (yyval.node) = (PGNode *) n; ;} break; - case 775: -#line 1785 "third_party/libpg_query/grammar/statements/select.y" - { - PGFuncCall *n = makeFuncCall(SystemFuncName("like_escape"), - list_make3((yyvsp[(1) - (5)].node), (yyvsp[(3) - (5)].node), (yyvsp[(5) - (5)].node)), - (yylsp[(2) - (5)])); - (yyval.node) = (PGNode *) n; - ;} + case 882: +#line 120 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 776: -#line 1792 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_LIKE, "!~~", - (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node), (yylsp[(2) - (4)])); - ;} + case 883: +#line 121 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 777: -#line 1797 "third_party/libpg_query/grammar/statements/select.y" + case 884: +#line 123 "third_party/libpg_query/grammar/statements/create.y" { - PGFuncCall *n = makeFuncCall(SystemFuncName("not_like_escape"), - list_make3((yyvsp[(1) - (6)].node), (yyvsp[(4) - (6)].node), (yyvsp[(6) - (6)].node)), - (yylsp[(2) - (6)])); + /* + * Note: the PGCollateClause is momentarily included in + * the list built by ColQualList, but we split it out + * again in SplitColQualList. + */ + PGCollateClause *n = makeNode(PGCollateClause); + n->arg = NULL; + n->collname = (yyvsp[(2) - (2)].list); + n->location = (yylsp[(1) - (2)]); (yyval.node) = (PGNode *) n; ;} break; - case 778: -#line 1804 "third_party/libpg_query/grammar/statements/select.y" + case 885: +#line 140 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_ILIKE, "~~*", - (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_NOTNULL; + n->location = (yylsp[(1) - (2)]); + (yyval.node) = (PGNode *)n; ;} break; - case 779: -#line 1809 "third_party/libpg_query/grammar/statements/select.y" + case 886: +#line 147 "third_party/libpg_query/grammar/statements/create.y" { - PGFuncCall *n = makeFuncCall(SystemFuncName("like_escape"), - list_make2((yyvsp[(3) - (5)].node), (yyvsp[(5) - (5)].node)), - (yylsp[(2) - (5)])); - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_ILIKE, "~~*", - (yyvsp[(1) - (5)].node), (PGNode *) n, (yylsp[(2) - (5)])); + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_NULL; + n->location = (yylsp[(1) - (1)]); + (yyval.node) = (PGNode *)n; ;} break; - case 780: -#line 1817 "third_party/libpg_query/grammar/statements/select.y" + case 887: +#line 154 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_ILIKE, "!~~*", - (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node), (yylsp[(2) - (4)])); + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_UNIQUE; + n->location = (yylsp[(1) - (2)]); + n->keys = NULL; + n->options = (yyvsp[(2) - (2)].list); + n->indexname = NULL; + (yyval.node) = (PGNode *)n; ;} break; - case 781: -#line 1822 "third_party/libpg_query/grammar/statements/select.y" + case 888: +#line 164 "third_party/libpg_query/grammar/statements/create.y" { - PGFuncCall *n = makeFuncCall(SystemFuncName("not_like_escape"), - list_make2((yyvsp[(4) - (6)].node), (yyvsp[(6) - (6)].node)), - (yylsp[(2) - (6)])); - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_ILIKE, "!~~*", - (yyvsp[(1) - (6)].node), (PGNode *) n, (yylsp[(2) - (6)])); + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_PRIMARY; + n->location = (yylsp[(1) - (3)]); + n->keys = NULL; + n->options = (yyvsp[(3) - (3)].list); + n->indexname = NULL; + (yyval.node) = (PGNode *)n; ;} break; - case 782: -#line 1831 "third_party/libpg_query/grammar/statements/select.y" + case 889: +#line 174 "third_party/libpg_query/grammar/statements/create.y" { - PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), - list_make2((yyvsp[(4) - (4)].node), makeNullAConst(-1)), - (yylsp[(2) - (4)])); - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_SIMILAR, "~", - (yyvsp[(1) - (4)].node), (PGNode *) n, (yylsp[(2) - (4)])); + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_CHECK; + n->location = (yylsp[(1) - (5)]); + n->is_no_inherit = (yyvsp[(5) - (5)].boolean); + n->raw_expr = (yyvsp[(3) - (5)].node); + n->cooked_expr = NULL; + n->skip_validation = false; + n->initially_valid = true; + (yyval.node) = (PGNode *)n; ;} break; - case 783: -#line 1839 "third_party/libpg_query/grammar/statements/select.y" + case 890: +#line 186 "third_party/libpg_query/grammar/statements/create.y" { - PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), - list_make2((yyvsp[(4) - (6)].node), (yyvsp[(6) - (6)].node)), - (yylsp[(2) - (6)])); - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_SIMILAR, "~", - (yyvsp[(1) - (6)].node), (PGNode *) n, (yylsp[(2) - (6)])); + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_COMPRESSION; + n->location = (yylsp[(1) - (3)]); + n->compression_name = (yyvsp[(3) - (3)].str); + (yyval.node) = (PGNode *)n; ;} break; - case 784: -#line 1847 "third_party/libpg_query/grammar/statements/select.y" + case 891: +#line 194 "third_party/libpg_query/grammar/statements/create.y" { - PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), - list_make2((yyvsp[(5) - (5)].node), makeNullAConst(-1)), - (yylsp[(2) - (5)])); - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_SIMILAR, "!~", - (yyvsp[(1) - (5)].node), (PGNode *) n, (yylsp[(2) - (5)])); + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_DEFAULT; + n->location = (yylsp[(1) - (2)]); + n->raw_expr = (yyvsp[(2) - (2)].node); + n->cooked_expr = NULL; + (yyval.node) = (PGNode *)n; ;} break; - case 785: -#line 1855 "third_party/libpg_query/grammar/statements/select.y" + case 892: +#line 203 "third_party/libpg_query/grammar/statements/create.y" { - PGFuncCall *n = makeFuncCall(SystemFuncName("similar_escape"), - list_make2((yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)), - (yylsp[(2) - (7)])); - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_SIMILAR, "!~", - (yyvsp[(1) - (7)].node), (PGNode *) n, (yylsp[(2) - (7)])); + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_IDENTITY; + n->generated_when = (yyvsp[(2) - (5)].ival); + n->options = (yyvsp[(5) - (5)].list); + n->location = (yylsp[(1) - (5)]); + (yyval.node) = (PGNode *)n; ;} break; - case 786: -#line 1873 "third_party/libpg_query/grammar/statements/select.y" + case 893: +#line 212 "third_party/libpg_query/grammar/statements/create.y" { - PGNullTest *n = makeNode(PGNullTest); - n->arg = (PGExpr *) (yyvsp[(1) - (3)].node); - n->nulltesttype = PG_IS_NULL; - n->location = (yylsp[(2) - (3)]); + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_FOREIGN; + n->location = (yylsp[(1) - (5)]); + n->pktable = (yyvsp[(2) - (5)].range); + n->fk_attrs = NIL; + n->pk_attrs = (yyvsp[(3) - (5)].list); + n->fk_matchtype = (yyvsp[(4) - (5)].ival); + n->fk_upd_action = (char) ((yyvsp[(5) - (5)].ival) >> 8); + n->fk_del_action = (char) ((yyvsp[(5) - (5)].ival) & 0xFF); + n->skip_validation = false; + n->initially_valid = true; (yyval.node) = (PGNode *)n; ;} break; - case 787: -#line 1881 "third_party/libpg_query/grammar/statements/select.y" + case 894: +#line 231 "third_party/libpg_query/grammar/statements/create.y" { - PGNullTest *n = makeNode(PGNullTest); - n->arg = (PGExpr *) (yyvsp[(1) - (2)].node); - n->nulltesttype = PG_IS_NULL; - n->location = (yylsp[(2) - (2)]); - (yyval.node) = (PGNode *)n; + (yyval.defelt) = makeDefElem((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 788: -#line 1889 "third_party/libpg_query/grammar/statements/select.y" - { - PGNullTest *n = makeNode(PGNullTest); - n->arg = (PGExpr *) (yyvsp[(1) - (4)].node); - n->nulltesttype = IS_NOT_NULL; - n->location = (yylsp[(2) - (4)]); - (yyval.node) = (PGNode *)n; - ;} + case 895: +#line 237 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = (yyvsp[(3) - (3)].ival); ;} break; - case 789: -#line 1897 "third_party/libpg_query/grammar/statements/select.y" - { - PGNullTest *n = makeNode(PGNullTest); - n->arg = (PGExpr *) (yyvsp[(1) - (3)].node); - n->nulltesttype = IS_NOT_NULL; - n->location = (yylsp[(2) - (3)]); - (yyval.node) = (PGNode *)n; - ;} + case 896: +#line 243 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = ((yyvsp[(1) - (1)].ival) << 8) | (PG_FKCONSTR_ACTION_NOACTION & 0xFF); ;} break; - case 790: -#line 1905 "third_party/libpg_query/grammar/statements/select.y" - { - PGNullTest *n = makeNode(PGNullTest); - n->arg = (PGExpr *) (yyvsp[(1) - (2)].node); - n->nulltesttype = IS_NOT_NULL; - n->location = (yylsp[(2) - (2)]); - (yyval.node) = (PGNode *)n; - ;} + case 897: +#line 245 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = (PG_FKCONSTR_ACTION_NOACTION << 8) | ((yyvsp[(1) - (1)].ival) & 0xFF); ;} break; - case 791: -#line 1912 "third_party/libpg_query/grammar/statements/select.y" - { - PGFuncCall *n = makeFuncCall(SystemFuncName("row"), (yyvsp[(1) - (1)].list), (yylsp[(1) - (1)])); - (yyval.node) = (PGNode *) n; - ;} + case 898: +#line 247 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = ((yyvsp[(1) - (2)].ival) << 8) | ((yyvsp[(2) - (2)].ival) & 0xFF); ;} break; - case 792: -#line 1916 "third_party/libpg_query/grammar/statements/select.y" - { - PGFuncCall *n = makeFuncCall(SystemFuncName("struct_pack"), (yyvsp[(2) - (3)].list), (yylsp[(2) - (3)])); - (yyval.node) = (PGNode *) n; - ;} + case 899: +#line 249 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = ((yyvsp[(2) - (2)].ival) << 8) | ((yyvsp[(1) - (2)].ival) & 0xFF); ;} break; - case 793: -#line 1920 "third_party/libpg_query/grammar/statements/select.y" - { - PGFuncCall *n = makeFuncCall(SystemFuncName("list_value"), (yyvsp[(2) - (3)].list), (yylsp[(2) - (3)])); - (yyval.node) = (PGNode *) n; - ;} + case 900: +#line 251 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = (PG_FKCONSTR_ACTION_NOACTION << 8) | (PG_FKCONSTR_ACTION_NOACTION & 0xFF); ;} break; - case 794: -#line 1925 "third_party/libpg_query/grammar/statements/select.y" - { - PGLambdaFunction *n = makeNode(PGLambdaFunction); - n->parameters = (yyvsp[(1) - (3)].list); - n->function = (yyvsp[(3) - (3)].node); - n->location = (yylsp[(2) - (3)]); - (yyval.node) = (PGNode *) n; - ;} + case 901: +#line 256 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(3) - (4)].list); ;} break; - case 795: -#line 1933 "third_party/libpg_query/grammar/statements/select.y" - { - PGLambdaFunction *n = makeNode(PGLambdaFunction); - n->parameters = list_make1((yyvsp[(1) - (3)].node)); - n->function = (yyvsp[(3) - (3)].node); - n->location = (yylsp[(2) - (3)]); - (yyval.node) = (PGNode *) n; - ;} + case 902: +#line 257 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = NIL; ;} break; - case 796: -#line 1941 "third_party/libpg_query/grammar/statements/select.y" - { - if (list_length((yyvsp[(1) - (3)].list)) != 2) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("wrong number of parameters on left side of OVERLAPS expression"), - parser_errposition((yylsp[(1) - (3)])))); - if (list_length((yyvsp[(3) - (3)].list)) != 2) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("wrong number of parameters on right side of OVERLAPS expression"), - parser_errposition((yylsp[(3) - (3)])))); - (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("overlaps"), - list_concat((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)), - (yylsp[(2) - (3)])); - ;} + case 903: +#line 261 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.oncommit) = ONCOMMIT_DROP; ;} break; - case 797: -#line 1957 "third_party/libpg_query/grammar/statements/select.y" - { - PGBooleanTest *b = makeNode(PGBooleanTest); - b->arg = (PGExpr *) (yyvsp[(1) - (3)].node); - b->booltesttype = PG_IS_TRUE; - b->location = (yylsp[(2) - (3)]); - (yyval.node) = (PGNode *)b; - ;} + case 904: +#line 262 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.oncommit) = PG_ONCOMMIT_DELETE_ROWS; ;} break; - case 798: -#line 1965 "third_party/libpg_query/grammar/statements/select.y" - { - PGBooleanTest *b = makeNode(PGBooleanTest); - b->arg = (PGExpr *) (yyvsp[(1) - (4)].node); - b->booltesttype = IS_NOT_TRUE; - b->location = (yylsp[(2) - (4)]); - (yyval.node) = (PGNode *)b; - ;} + case 905: +#line 263 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.oncommit) = PG_ONCOMMIT_PRESERVE_ROWS; ;} break; - case 799: -#line 1973 "third_party/libpg_query/grammar/statements/select.y" - { - PGBooleanTest *b = makeNode(PGBooleanTest); - b->arg = (PGExpr *) (yyvsp[(1) - (3)].node); - b->booltesttype = IS_FALSE; - b->location = (yylsp[(2) - (3)]); - (yyval.node) = (PGNode *)b; - ;} + case 906: +#line 264 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.oncommit) = PG_ONCOMMIT_NOOP; ;} break; - case 800: -#line 1981 "third_party/libpg_query/grammar/statements/select.y" - { - PGBooleanTest *b = makeNode(PGBooleanTest); - b->arg = (PGExpr *) (yyvsp[(1) - (4)].node); - b->booltesttype = IS_NOT_FALSE; - b->location = (yylsp[(2) - (4)]); - (yyval.node) = (PGNode *)b; - ;} + case 907: +#line 269 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 801: -#line 1989 "third_party/libpg_query/grammar/statements/select.y" - { - PGBooleanTest *b = makeNode(PGBooleanTest); - b->arg = (PGExpr *) (yyvsp[(1) - (3)].node); - b->booltesttype = IS_UNKNOWN; - b->location = (yylsp[(2) - (3)]); - (yyval.node) = (PGNode *)b; - ;} + case 908: +#line 273 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.boolean) = true; ;} break; - case 802: -#line 1997 "third_party/libpg_query/grammar/statements/select.y" - { - PGBooleanTest *b = makeNode(PGBooleanTest); - b->arg = (PGExpr *) (yyvsp[(1) - (4)].node); - b->booltesttype = IS_NOT_UNKNOWN; - b->location = (yylsp[(2) - (4)]); - (yyval.node) = (PGNode *)b; - ;} + case 909: +#line 274 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.boolean) = false; ;} break; - case 803: -#line 2005 "third_party/libpg_query/grammar/statements/select.y" + case 910: +#line 280 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_DISTINCT, "=", (yyvsp[(1) - (5)].node), (yyvsp[(5) - (5)].node), (yylsp[(2) - (5)])); + PGConstraint *n = castNode(PGConstraint, (yyvsp[(3) - (3)].node)); + n->conname = (yyvsp[(2) - (3)].str); + n->location = (yylsp[(1) - (3)]); + (yyval.node) = (PGNode *) n; ;} break; - case 804: -#line 2009 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_DISTINCT, "=", (yyvsp[(1) - (6)].node), (yyvsp[(6) - (6)].node), (yylsp[(2) - (6)])); - ;} + case 911: +#line 286 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 805: -#line 2013 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "=", (yyvsp[(1) - (6)].node), (PGNode *) (yyvsp[(5) - (6)].list), (yylsp[(2) - (6)])); - ;} + case 912: +#line 291 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_CREATE_TABLE_LIKE_COMMENTS; ;} break; - case 806: -#line 2017 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "<>", (yyvsp[(1) - (7)].node), (PGNode *) (yyvsp[(6) - (7)].list), (yylsp[(2) - (7)])); - ;} + case 913: +#line 292 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_CREATE_TABLE_LIKE_CONSTRAINTS; ;} break; - case 807: -#line 2021 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_BETWEEN, - "BETWEEN", - (yyvsp[(1) - (6)].node), - (PGNode *) list_make2((yyvsp[(4) - (6)].node), (yyvsp[(6) - (6)].node)), - (yylsp[(2) - (6)])); - ;} + case 914: +#line 293 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_CREATE_TABLE_LIKE_DEFAULTS; ;} break; - case 808: -#line 2029 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_BETWEEN, - "NOT BETWEEN", - (yyvsp[(1) - (7)].node), - (PGNode *) list_make2((yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)), - (yylsp[(2) - (7)])); - ;} + case 915: +#line 294 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_CREATE_TABLE_LIKE_IDENTITY; ;} break; - case 809: -#line 2037 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_BETWEEN_SYM, - "BETWEEN SYMMETRIC", - (yyvsp[(1) - (6)].node), - (PGNode *) list_make2((yyvsp[(4) - (6)].node), (yyvsp[(6) - (6)].node)), - (yylsp[(2) - (6)])); - ;} + case 916: +#line 295 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_CREATE_TABLE_LIKE_INDEXES; ;} break; - case 810: -#line 2045 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_BETWEEN_SYM, - "NOT BETWEEN SYMMETRIC", - (yyvsp[(1) - (7)].node), - (PGNode *) list_make2((yyvsp[(5) - (7)].node), (yyvsp[(7) - (7)].node)), - (yylsp[(2) - (7)])); - ;} + case 917: +#line 296 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_CREATE_TABLE_LIKE_STATISTICS; ;} break; - case 811: -#line 2053 "third_party/libpg_query/grammar/statements/select.y" - { - /* in_expr returns a PGSubLink or a list of a_exprs */ - if (IsA((yyvsp[(3) - (3)].node), PGSubLink)) - { - /* generate foo = ANY (subquery) */ - PGSubLink *n = (PGSubLink *) (yyvsp[(3) - (3)].node); - n->subLinkType = PG_ANY_SUBLINK; - n->subLinkId = 0; - n->testexpr = (yyvsp[(1) - (3)].node); - n->operName = NIL; /* show it's IN not = ANY */ - n->location = (yylsp[(2) - (3)]); - (yyval.node) = (PGNode *)n; - } - else - { - /* generate scalar IN expression */ - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_IN, "=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); - } - ;} + case 918: +#line 297 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_CREATE_TABLE_LIKE_STORAGE; ;} break; - case 812: -#line 2073 "third_party/libpg_query/grammar/statements/select.y" - { - /* in_expr returns a PGSubLink or a list of a_exprs */ - if (IsA((yyvsp[(4) - (4)].node), PGSubLink)) - { - /* generate NOT (foo = ANY (subquery)) */ - /* Make an = ANY node */ - PGSubLink *n = (PGSubLink *) (yyvsp[(4) - (4)].node); - n->subLinkType = PG_ANY_SUBLINK; - n->subLinkId = 0; - n->testexpr = (yyvsp[(1) - (4)].node); - n->operName = NIL; /* show it's IN not = ANY */ - n->location = (yylsp[(2) - (4)]); - /* Stick a NOT on top; must have same parse location */ - (yyval.node) = makeNotExpr((PGNode *) n, (yylsp[(2) - (4)])); - } - else - { - /* generate scalar NOT IN expression */ - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_IN, "<>", (yyvsp[(1) - (4)].node), (yyvsp[(4) - (4)].node), (yylsp[(2) - (4)])); - } - ;} + case 919: +#line 298 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_CREATE_TABLE_LIKE_ALL; ;} break; - case 813: -#line 2095 "third_party/libpg_query/grammar/statements/select.y" - { - PGSubLink *n = makeNode(PGSubLink); - n->subLinkType = (yyvsp[(3) - (4)].subquerytype); - n->subLinkId = 0; - n->testexpr = (yyvsp[(1) - (4)].node); - n->operName = (yyvsp[(2) - (4)].list); - n->subselect = (yyvsp[(4) - (4)].node); - n->location = (yylsp[(2) - (4)]); - (yyval.node) = (PGNode *)n; - ;} + case 920: +#line 304 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; - case 814: -#line 2106 "third_party/libpg_query/grammar/statements/select.y" - { - if ((yyvsp[(3) - (6)].subquerytype) == PG_ANY_SUBLINK) - (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP_ANY, (yyvsp[(2) - (6)].list), (yyvsp[(1) - (6)].node), (yyvsp[(5) - (6)].node), (yylsp[(2) - (6)])); - else - (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP_ALL, (yyvsp[(2) - (6)].list), (yyvsp[(1) - (6)].node), (yyvsp[(5) - (6)].node), (yylsp[(2) - (6)])); - ;} + case 921: +#line 305 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} break; - case 815: -#line 2113 "third_party/libpg_query/grammar/statements/select.y" + case 922: +#line 309 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.str) = (yyvsp[(3) - (3)].str); ;} + break; + + case 923: +#line 315 "third_party/libpg_query/grammar/statements/create.y" { - /* - * The SQL spec only allows DEFAULT in "contextually typed - * expressions", but for us, it's easier to allow it in - * any a_expr and then throw error during parse analysis - * if it's in an inappropriate context. This way also - * lets us say something smarter than "syntax error". - */ - PGSetToDefault *n = makeNode(PGSetToDefault); - /* parse analysis will fill in the rest */ + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_ATTR_DEFERRABLE; n->location = (yylsp[(1) - (1)]); (yyval.node) = (PGNode *)n; ;} break; - case 816: -#line 2126 "third_party/libpg_query/grammar/statements/select.y" + case 924: +#line 322 "third_party/libpg_query/grammar/statements/create.y" { - PGList *func_name = list_make1(makeString("construct_array")); - PGFuncCall *n = makeFuncCall(func_name, (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); - (yyval.node) = (PGNode *) n; - ;} - break; - - case 817: -#line 2143 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} - break; - - case 818: -#line 2145 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeTypeCast((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].typnam), 0, (yylsp[(2) - (3)])); ;} + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_ATTR_NOT_DEFERRABLE; + n->location = (yylsp[(1) - (2)]); + (yyval.node) = (PGNode *)n; + ;} break; - case 819: -#line 2147 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + case 925: +#line 329 "third_party/libpg_query/grammar/statements/create.y" + { + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_ATTR_DEFERRED; + n->location = (yylsp[(1) - (2)]); + (yyval.node) = (PGNode *)n; + ;} break; - case 820: -#line 2149 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = doNegate((yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + case 926: +#line 336 "third_party/libpg_query/grammar/statements/create.y" + { + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_ATTR_IMMEDIATE; + n->location = (yylsp[(1) - (2)]); + (yyval.node) = (PGNode *)n; + ;} break; - case 821: -#line 2151 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "+", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 927: +#line 347 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 822: -#line 2153 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "-", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 928: +#line 348 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = list_make1(makeDefElem("oids", (PGNode *) makeInteger(true), (yylsp[(1) - (2)]))); ;} break; - case 823: -#line 2155 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "*", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 929: +#line 349 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = list_make1(makeDefElem("oids", (PGNode *) makeInteger(false), (yylsp[(1) - (2)]))); ;} break; - case 824: -#line 2157 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "/", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 930: +#line 350 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = NIL; ;} break; - case 825: -#line 2159 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "%", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 931: +#line 354 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 826: -#line 2161 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "^", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 932: +#line 359 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} break; - case 827: -#line 2163 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 933: +#line 360 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = (yyvsp[(1) - (3)].ival) & ~(yyvsp[(3) - (3)].ival); ;} break; - case 828: -#line 2165 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 934: +#line 361 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = 0; ;} break; - case 829: -#line 2167 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 935: +#line 366 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 830: -#line 2169 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 936: +#line 371 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = CAS_NOT_DEFERRABLE; ;} break; - case 831: -#line 2171 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, ">=", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 937: +#line 372 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = CAS_DEFERRABLE; ;} break; - case 832: -#line 2173 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OP, "<>", (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 938: +#line 373 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = CAS_INITIALLY_IMMEDIATE; ;} break; - case 833: -#line 2175 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (3)].list), (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yylsp[(2) - (3)])); ;} + case 939: +#line 374 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = CAS_INITIALLY_DEFERRED; ;} break; - case 834: -#line 2177 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(1) - (2)].list), NULL, (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} + case 940: +#line 375 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = CAS_NOT_VALID; ;} break; - case 835: -#line 2179 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *) makeAExpr(PG_AEXPR_OP, (yyvsp[(2) - (2)].list), (yyvsp[(1) - (2)].node), NULL, (yylsp[(2) - (2)])); ;} + case 941: +#line 376 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = CAS_NO_INHERIT; ;} break; - case 836: -#line 2181 "third_party/libpg_query/grammar/statements/select.y" + case 942: +#line 382 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_DISTINCT, "=", (yyvsp[(1) - (5)].node), (yyvsp[(5) - (5)].node), (yylsp[(2) - (5)])); + PGColumnDef *n = makeNode(PGColumnDef); + n->colname = (yyvsp[(1) - (4)].str); + n->typeName = (yyvsp[(2) - (4)].typnam); + n->inhcount = 0; + n->is_local = true; + n->is_not_null = false; + n->is_from_type = false; + n->storage = 0; + n->raw_default = NULL; + n->cooked_default = NULL; + n->collOid = InvalidOid; + n->fdwoptions = (yyvsp[(3) - (4)].list); + SplitColQualList((yyvsp[(4) - (4)].list), &n->constraints, &n->collClause, + yyscanner); + n->location = (yylsp[(1) - (4)]); + (yyval.node) = (PGNode *)n; ;} break; - case 837: -#line 2185 "third_party/libpg_query/grammar/statements/select.y" + case 943: +#line 405 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NOT_DISTINCT, "=", (yyvsp[(1) - (6)].node), (yyvsp[(6) - (6)].node), (yylsp[(2) - (6)])); + (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; - case 838: -#line 2189 "third_party/libpg_query/grammar/statements/select.y" + case 944: +#line 409 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "=", (yyvsp[(1) - (6)].node), (PGNode *) (yyvsp[(5) - (6)].list), (yylsp[(2) - (6)])); + (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} break; - case 839: -#line 2193 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_OF, "<>", (yyvsp[(1) - (7)].node), (PGNode *) (yyvsp[(6) - (7)].list), (yylsp[(2) - (7)])); - ;} + case 945: +#line 415 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; - case 840: -#line 2206 "third_party/libpg_query/grammar/statements/select.y" + case 946: +#line 416 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} + break; + + case 947: +#line 420 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + break; + + case 948: +#line 424 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 841: -#line 2207 "third_party/libpg_query/grammar/statements/select.y" + case 949: +#line 425 "third_party/libpg_query/grammar/statements/create.y" { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 842: -#line 2209 "third_party/libpg_query/grammar/statements/select.y" - { - PGPositionalReference *n = makeNode(PGPositionalReference); - n->position = (yyvsp[(2) - (2)].ival); - n->location = (yylsp[(1) - (2)]); - (yyval.node) = (PGNode *) n; - ;} + case 950: +#line 426 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.node) = (yyvsp[(1) - (1)].node); ;} break; - case 843: -#line 2216 "third_party/libpg_query/grammar/statements/select.y" + case 951: +#line 431 "third_party/libpg_query/grammar/statements/create.y" { - if ((yyvsp[(2) - (2)].list)) - { - PGAIndirection *n = makeNode(PGAIndirection); - n->arg = makeParamRef(0, (yylsp[(1) - (2)])); - n->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); - (yyval.node) = (PGNode *) n; - } - else - (yyval.node) = makeParamRef(0, (yylsp[(1) - (2)])); + (yyval.defelt) = makeDefElem((yyvsp[(1) - (3)].str), (PGNode *) (yyvsp[(3) - (3)].node), (yylsp[(1) - (3)])); ;} break; - case 844: -#line 2228 "third_party/libpg_query/grammar/statements/select.y" + case 952: +#line 435 "third_party/libpg_query/grammar/statements/create.y" { - PGParamRef *p = makeNode(PGParamRef); - p->number = (yyvsp[(1) - (2)].ival); - p->location = (yylsp[(1) - (2)]); - if ((yyvsp[(2) - (2)].list)) - { - PGAIndirection *n = makeNode(PGAIndirection); - n->arg = (PGNode *) p; - n->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); - (yyval.node) = (PGNode *) n; - } - else - (yyval.node) = (PGNode *) p; + (yyval.defelt) = makeDefElem((yyvsp[(1) - (1)].str), NULL, (yylsp[(1) - (1)])); ;} break; - case 845: -#line 2243 "third_party/libpg_query/grammar/statements/select.y" - { - if ((yyvsp[(4) - (4)].list)) - { - PGAIndirection *n = makeNode(PGAIndirection); - n->arg = (yyvsp[(2) - (4)].node); - n->indirection = check_indirection((yyvsp[(4) - (4)].list), yyscanner); - (yyval.node) = (PGNode *)n; - } - else - (yyval.node) = (yyvsp[(2) - (4)].node); - ;} + case 953: +#line 442 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 846: -#line 2255 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 954: +#line 443 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = NIL; ;} break; - case 847: -#line 2257 "third_party/libpg_query/grammar/statements/select.y" - { - if ((yyvsp[(2) - (2)].list)) { - PGAIndirection *n = makeNode(PGAIndirection); - n->arg = (yyvsp[(1) - (2)].node); - n->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); - (yyval.node) = (PGNode *)n; - } - else { - (yyval.node) = (yyvsp[(1) - (2)].node); - } - ;} + case 955: +#line 448 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 848: -#line 2269 "third_party/libpg_query/grammar/statements/select.y" - { - PGSubLink *n = makeNode(PGSubLink); - n->subLinkType = PG_EXPR_SUBLINK; - n->subLinkId = 0; - n->testexpr = NULL; - n->operName = NIL; - n->subselect = (yyvsp[(1) - (1)].node); - n->location = (yylsp[(1) - (1)]); - (yyval.node) = (PGNode *)n; - ;} + case 956: +#line 449 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 849: -#line 2280 "third_party/libpg_query/grammar/statements/select.y" - { - /* - * Because the select_with_parens nonterminal is designed - * to "eat" as many levels of parens as possible, the - * '(' a_expr ')' opt_indirection production above will - * fail to match a sub-SELECT with indirection decoration; - * the sub-SELECT won't be regarded as an a_expr as long - * as there are parens around it. To support applying - * subscripting or field selection to a sub-SELECT result, - * we need this redundant-looking production. - */ - PGSubLink *n = makeNode(PGSubLink); - PGAIndirection *a = makeNode(PGAIndirection); - n->subLinkType = PG_EXPR_SUBLINK; - n->subLinkId = 0; - n->testexpr = NULL; - n->operName = NIL; - n->subselect = (yyvsp[(1) - (2)].node); - n->location = (yylsp[(1) - (2)]); - a->arg = (PGNode *)n; - a->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); - (yyval.node) = (PGNode *)a; - ;} + case 957: +#line 450 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = NIL; ;} break; - case 850: -#line 2304 "third_party/libpg_query/grammar/statements/select.y" + case 958: +#line 455 "third_party/libpg_query/grammar/statements/create.y" { - PGSubLink *n = makeNode(PGSubLink); - n->subLinkType = PG_EXISTS_SUBLINK; - n->subLinkId = 0; - n->testexpr = NULL; - n->operName = NIL; - n->subselect = (yyvsp[(2) - (2)].node); - n->location = (yylsp[(1) - (2)]); - (yyval.node) = (PGNode *)n; + (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); ;} break; - case 851: -#line 2315 "third_party/libpg_query/grammar/statements/select.y" - { - PGGroupingFunc *g = makeNode(PGGroupingFunc); - g->args = (yyvsp[(3) - (4)].list); - g->location = (yylsp[(1) - (4)]); - (yyval.node) = (PGNode *)g; - ;} + case 959: +#line 462 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 852: -#line 2324 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = (PGNode *) makeFuncCall((yyvsp[(1) - (3)].list), NIL, (yylsp[(1) - (3)])); - ;} + case 960: +#line 463 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = NIL; ;} break; - case 853: -#line 2328 "third_party/libpg_query/grammar/statements/select.y" - { - PGFuncCall *n = makeFuncCall((yyvsp[(1) - (6)].list), (yyvsp[(3) - (6)].list), (yylsp[(1) - (6)])); - n->agg_order = (yyvsp[(4) - (6)].list); - n->agg_ignore_nulls = (yyvsp[(5) - (6)].boolean); - (yyval.node) = (PGNode *)n; - ;} + case 961: +#line 468 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} break; - case 854: -#line 2335 "third_party/libpg_query/grammar/statements/select.y" - { - PGFuncCall *n = makeFuncCall((yyvsp[(1) - (7)].list), list_make1((yyvsp[(4) - (7)].node)), (yylsp[(1) - (7)])); - n->func_variadic = true; - n->agg_order = (yyvsp[(5) - (7)].list); - n->agg_ignore_nulls = (yyvsp[(6) - (7)].boolean); - (yyval.node) = (PGNode *)n; - ;} + case 962: +#line 469 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = NIL; ;} break; - case 855: -#line 2343 "third_party/libpg_query/grammar/statements/select.y" - { - PGFuncCall *n = makeFuncCall((yyvsp[(1) - (9)].list), lappend((yyvsp[(3) - (9)].list), (yyvsp[(6) - (9)].node)), (yylsp[(1) - (9)])); - n->func_variadic = true; - n->agg_order = (yyvsp[(7) - (9)].list); - n->agg_ignore_nulls = (yyvsp[(8) - (9)].boolean); - (yyval.node) = (PGNode *)n; - ;} + case 963: +#line 473 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = (yyvsp[(3) - (3)].ival); ;} break; - case 856: -#line 2351 "third_party/libpg_query/grammar/statements/select.y" + case 964: +#line 479 "third_party/libpg_query/grammar/statements/create.y" { - PGFuncCall *n = makeFuncCall((yyvsp[(1) - (7)].list), (yyvsp[(4) - (7)].list), (yylsp[(1) - (7)])); - n->agg_order = (yyvsp[(5) - (7)].list); - n->agg_ignore_nulls = (yyvsp[(6) - (7)].boolean); - /* Ideally we'd mark the PGFuncCall node to indicate - * "must be an aggregate", but there's no provision - * for that in PGFuncCall at the moment. - */ - (yyval.node) = (PGNode *)n; + (yyval.defelt) = makeDefElem((yyvsp[(1) - (3)].str), (PGNode *) (yyvsp[(3) - (3)].node), (yylsp[(1) - (3)])); ;} break; - case 857: -#line 2362 "third_party/libpg_query/grammar/statements/select.y" + case 965: +#line 483 "third_party/libpg_query/grammar/statements/create.y" { - PGFuncCall *n = makeFuncCall((yyvsp[(1) - (7)].list), (yyvsp[(4) - (7)].list), (yylsp[(1) - (7)])); - n->agg_order = (yyvsp[(5) - (7)].list); - n->agg_ignore_nulls = (yyvsp[(6) - (7)].boolean); - n->agg_distinct = true; - (yyval.node) = (PGNode *)n; + (yyval.defelt) = makeDefElem((yyvsp[(1) - (1)].str), NULL, (yylsp[(1) - (1)])); ;} break; - case 858: -#line 2370 "third_party/libpg_query/grammar/statements/select.y" + case 966: +#line 487 "third_party/libpg_query/grammar/statements/create.y" { - /* - * We consider AGGREGATE(*) to invoke a parameterless - * aggregate. This does the right thing for COUNT(*), - * and there are no other aggregates in SQL that accept - * '*' as parameter. - * - * The PGFuncCall node is also marked agg_star = true, - * so that later processing can detect what the argument - * really was. - */ - PGFuncCall *n = makeFuncCall((yyvsp[(1) - (4)].list), NIL, (yylsp[(1) - (4)])); - n->agg_star = true; - (yyval.node) = (PGNode *)n; + (yyval.defelt) = makeDefElemExtended((yyvsp[(1) - (5)].str), (yyvsp[(3) - (5)].str), (PGNode *) (yyvsp[(5) - (5)].node), + PG_DEFELEM_UNSPEC, (yylsp[(1) - (5)])); ;} break; - case 859: -#line 2398 "third_party/libpg_query/grammar/statements/select.y" + case 967: +#line 492 "third_party/libpg_query/grammar/statements/create.y" { - PGFuncCall *n = (PGFuncCall *) (yyvsp[(1) - (4)].node); - /* - * The order clause for WITHIN GROUP and the one for - * plain-aggregate ORDER BY share a field, so we have to - * check here that at most one is present. We also check - * for DISTINCT and VARIADIC here to give a better error - * location. Other consistency checks are deferred to - * parse analysis. - */ - if ((yyvsp[(2) - (4)].list) != NIL) - { - if (n->agg_order != NIL) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("cannot use multiple ORDER BY clauses with WITHIN GROUP"), - parser_errposition((yylsp[(2) - (4)])))); - if (n->agg_distinct) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("cannot use DISTINCT with WITHIN GROUP"), - parser_errposition((yylsp[(2) - (4)])))); - if (n->func_variadic) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("cannot use VARIADIC with WITHIN GROUP"), - parser_errposition((yylsp[(2) - (4)])))); - n->agg_order = (yyvsp[(2) - (4)].list); - n->agg_within_group = true; - } - n->agg_filter = (yyvsp[(3) - (4)].node); - n->over = (yyvsp[(4) - (4)].windef); - (yyval.node) = (PGNode *) n; + (yyval.defelt) = makeDefElemExtended((yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str), NULL, PG_DEFELEM_UNSPEC, (yylsp[(1) - (3)])); ;} break; - case 860: -#line 2433 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 968: +#line 499 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 861: -#line 2443 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 969: +#line 500 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 862: -#line 2444 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 970: +#line 504 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 863: -#line 2452 "third_party/libpg_query/grammar/statements/select.y" + case 971: +#line 505 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.list) = (yyvsp[(1) - (2)].list); ;} + break; + + case 972: +#line 509 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.typnam) = (yyvsp[(1) - (1)].typnam); ;} + break; + + case 973: +#line 511 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("pg_collation_for"), - list_make1((yyvsp[(4) - (5)].node)), - (yylsp[(1) - (5)])); + (yyval.typnam) = makeTypeNameFromNameList(lcons(makeString((yyvsp[(1) - (4)].str)), (yyvsp[(2) - (4)].list))); + (yyval.typnam)->pct_type = true; + (yyval.typnam)->location = (yylsp[(1) - (4)]); + ;} + break; + + case 974: +#line 517 "third_party/libpg_query/grammar/statements/create.y" + { + (yyval.typnam) = makeTypeNameFromNameList(lcons(makeString((yyvsp[(2) - (5)].str)), (yyvsp[(3) - (5)].list))); + (yyval.typnam)->pct_type = true; + (yyval.typnam)->setof = true; + (yyval.typnam)->location = (yylsp[(2) - (5)]); + ;} + break; + + case 975: +#line 528 "third_party/libpg_query/grammar/statements/create.y" + { + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_CHECK; + n->location = (yylsp[(1) - (5)]); + n->raw_expr = (yyvsp[(3) - (5)].node); + n->cooked_expr = NULL; + processCASbits((yyvsp[(5) - (5)].ival), (yylsp[(5) - (5)]), "CHECK", + NULL, NULL, &n->skip_validation, + &n->is_no_inherit, yyscanner); + n->initially_valid = !n->skip_validation; + (yyval.node) = (PGNode *)n; + ;} + break; + + case 976: +#line 542 "third_party/libpg_query/grammar/statements/create.y" + { + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_UNIQUE; + n->location = (yylsp[(1) - (6)]); + n->keys = (yyvsp[(3) - (6)].list); + n->options = (yyvsp[(5) - (6)].list); + n->indexname = NULL; + processCASbits((yyvsp[(6) - (6)].ival), (yylsp[(6) - (6)]), "UNIQUE", + &n->deferrable, &n->initdeferred, NULL, + NULL, yyscanner); + (yyval.node) = (PGNode *)n; ;} break; - case 864: -#line 2458 "third_party/libpg_query/grammar/statements/select.y" + case 977: +#line 555 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_DATE, -1, (yylsp[(1) - (1)])); + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_UNIQUE; + n->location = (yylsp[(1) - (3)]); + n->keys = NIL; + n->options = NIL; + n->indexname = (yyvsp[(2) - (3)].str); + n->indexspace = NULL; + processCASbits((yyvsp[(3) - (3)].ival), (yylsp[(3) - (3)]), "UNIQUE", + &n->deferrable, &n->initdeferred, NULL, + NULL, yyscanner); + (yyval.node) = (PGNode *)n; ;} break; - case 865: -#line 2462 "third_party/libpg_query/grammar/statements/select.y" + case 978: +#line 570 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_TIME, -1, (yylsp[(1) - (1)])); + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_PRIMARY; + n->location = (yylsp[(1) - (7)]); + n->keys = (yyvsp[(4) - (7)].list); + n->options = (yyvsp[(6) - (7)].list); + n->indexname = NULL; + processCASbits((yyvsp[(7) - (7)].ival), (yylsp[(7) - (7)]), "PRIMARY KEY", + &n->deferrable, &n->initdeferred, NULL, + NULL, yyscanner); + (yyval.node) = (PGNode *)n; ;} break; - case 866: -#line 2466 "third_party/libpg_query/grammar/statements/select.y" + case 979: +#line 583 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_TIME_N, (yyvsp[(3) - (4)].ival), (yylsp[(1) - (4)])); + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_PRIMARY; + n->location = (yylsp[(1) - (4)]); + n->keys = NIL; + n->options = NIL; + n->indexname = (yyvsp[(3) - (4)].str); + n->indexspace = NULL; + processCASbits((yyvsp[(4) - (4)].ival), (yylsp[(4) - (4)]), "PRIMARY KEY", + &n->deferrable, &n->initdeferred, NULL, + NULL, yyscanner); + (yyval.node) = (PGNode *)n; ;} break; - case 867: -#line 2470 "third_party/libpg_query/grammar/statements/select.y" + case 980: +#line 598 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_TIMESTAMP, -1, (yylsp[(1) - (1)])); + PGConstraint *n = makeNode(PGConstraint); + n->contype = PG_CONSTR_FOREIGN; + n->location = (yylsp[(1) - (11)]); + n->pktable = (yyvsp[(7) - (11)].range); + n->fk_attrs = (yyvsp[(4) - (11)].list); + n->pk_attrs = (yyvsp[(8) - (11)].list); + n->fk_matchtype = (yyvsp[(9) - (11)].ival); + n->fk_upd_action = (char) ((yyvsp[(10) - (11)].ival) >> 8); + n->fk_del_action = (char) ((yyvsp[(10) - (11)].ival) & 0xFF); + processCASbits((yyvsp[(11) - (11)].ival), (yylsp[(11) - (11)]), "FOREIGN KEY", + &n->deferrable, &n->initdeferred, + &n->skip_validation, NULL, + yyscanner); + n->initially_valid = !n->skip_validation; + (yyval.node) = (PGNode *)n; ;} break; - case 868: -#line 2474 "third_party/libpg_query/grammar/statements/select.y" + case 981: +#line 620 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_TIMESTAMP_N, (yyvsp[(3) - (4)].ival), (yylsp[(1) - (4)])); + (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 869: -#line 2478 "third_party/libpg_query/grammar/statements/select.y" + case 982: +#line 624 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_LOCALTIME, -1, (yylsp[(1) - (1)])); + (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 870: -#line 2482 "third_party/libpg_query/grammar/statements/select.y" + case 983: +#line 631 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_LOCALTIME_N, (yyvsp[(3) - (4)].ival), (yylsp[(1) - (4)])); - ;} + (yyval.ival) = PG_FKCONSTR_MATCH_FULL; + ;} break; - case 871: -#line 2486 "third_party/libpg_query/grammar/statements/select.y" + case 984: +#line 635 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_LOCALTIMESTAMP, -1, (yylsp[(1) - (1)])); - ;} + ereport(ERROR, + (errcode(PG_ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("MATCH PARTIAL not yet implemented"), + parser_errposition((yylsp[(1) - (2)])))); + (yyval.ival) = PG_FKCONSTR_MATCH_PARTIAL; + ;} break; - case 872: -#line 2490 "third_party/libpg_query/grammar/statements/select.y" + case 985: +#line 643 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_LOCALTIMESTAMP_N, (yyvsp[(3) - (4)].ival), (yylsp[(1) - (4)])); - ;} + (yyval.ival) = PG_FKCONSTR_MATCH_SIMPLE; + ;} break; - case 873: -#line 2494 "third_party/libpg_query/grammar/statements/select.y" + case 986: +#line 647 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_ROLE, -1, (yylsp[(1) - (1)])); - ;} + (yyval.ival) = PG_FKCONSTR_MATCH_SIMPLE; + ;} break; - case 874: -#line 2498 "third_party/libpg_query/grammar/statements/select.y" + case 987: +#line 655 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_USER, -1, (yylsp[(1) - (1)])); + PGTableLikeClause *n = makeNode(PGTableLikeClause); + n->relation = (yyvsp[(2) - (3)].range); + n->options = (yyvsp[(3) - (3)].ival); + (yyval.node) = (PGNode *)n; ;} break; - case 875: -#line 2502 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_SESSION_USER, -1, (yylsp[(1) - (1)])); - ;} + case 988: +#line 664 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} break; - case 876: -#line 2506 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_USER, -1, (yylsp[(1) - (1)])); - ;} + case 989: +#line 665 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} break; - case 877: -#line 2510 "third_party/libpg_query/grammar/statements/select.y" + case 990: +#line 666 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} + break; + + case 991: +#line 667 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} + break; + + case 992: +#line 669 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_CATALOG, -1, (yylsp[(1) - (1)])); + ereport(PGWARNING, + (errmsg("GLOBAL is deprecated in temporary table creation"), + parser_errposition((yylsp[(1) - (2)])))); + (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} break; - case 878: -#line 2514 "third_party/libpg_query/grammar/statements/select.y" + case 993: +#line 676 "third_party/libpg_query/grammar/statements/create.y" { - (yyval.node) = makeSQLValueFunction(PG_SVFOP_CURRENT_SCHEMA, -1, (yylsp[(1) - (1)])); + ereport(PGWARNING, + (errmsg("GLOBAL is deprecated in temporary table creation"), + parser_errposition((yylsp[(1) - (2)])))); + (yyval.ival) = PG_RELPERSISTENCE_TEMP; ;} break; - case 879: -#line 2518 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeTypeCast((yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].typnam), 0, (yylsp[(1) - (6)])); ;} + case 994: +#line 682 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_RELPERSISTENCE_UNLOGGED; ;} break; - case 880: -#line 2520 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = makeTypeCast((yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].typnam), 1, (yylsp[(1) - (6)])); ;} + case 995: +#line 683 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = RELPERSISTENCE_PERMANENT; ;} break; - case 881: -#line 2522 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("date_part"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); - ;} + case 996: +#line 688 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = PG_ATTRIBUTE_IDENTITY_ALWAYS; ;} break; - case 882: -#line 2526 "third_party/libpg_query/grammar/statements/select.y" - { - /* overlay(A PLACING B FROM C FOR D) is converted to - * overlay(A, B, C, D) - * overlay(A PLACING B FROM C) is converted to - * overlay(A, B, C) - */ - (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("overlay"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); - ;} + case 997: +#line 689 "third_party/libpg_query/grammar/statements/create.y" + { (yyval.ival) = ATTRIBUTE_IDENTITY_BY_DEFAULT; ;} break; - case 883: -#line 2535 "third_party/libpg_query/grammar/statements/select.y" + case 998: +#line 7 "third_party/libpg_query/grammar/statements/rename.y" { - /* position(A in B) is converted to position(B, A) */ - (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("position"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); + PGRenameStmt *n = makeNode(PGRenameStmt); + n->renameType = PG_OBJECT_SCHEMA; + n->subname = (yyvsp[(3) - (6)].str); + n->newname = (yyvsp[(6) - (6)].str); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; ;} break; - case 884: -#line 2540 "third_party/libpg_query/grammar/statements/select.y" + case 999: +#line 16 "third_party/libpg_query/grammar/statements/rename.y" { - /* substring(A from B for C) is converted to - * substring(A, B, C) - thomas 2000-11-28 - */ - (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("substring"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); + PGRenameStmt *n = makeNode(PGRenameStmt); + n->renameType = PG_OBJECT_TABLE; + n->relation = (yyvsp[(3) - (6)].range); + n->subname = NULL; + n->newname = (yyvsp[(6) - (6)].str); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; ;} break; - case 885: -#line 2547 "third_party/libpg_query/grammar/statements/select.y" + case 1000: +#line 26 "third_party/libpg_query/grammar/statements/rename.y" { - /* TREAT(expr AS target) converts expr of a particular type to target, - * which is defined to be a subtype of the original expression. - * In SQL99, this is intended for use with structured UDTs, - * but let's make this a generally useful form allowing stronger - * coercions than are handled by implicit casting. - * - * Convert SystemTypeName() to SystemFuncName() even though - * at the moment they result in the same thing. - */ - (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName(((PGValue *)llast((yyvsp[(5) - (6)].typnam)->names))->val.str), - list_make1((yyvsp[(3) - (6)].node)), - (yylsp[(1) - (6)])); + PGRenameStmt *n = makeNode(PGRenameStmt); + n->renameType = PG_OBJECT_TABLE; + n->relation = (yyvsp[(5) - (8)].range); + n->subname = NULL; + n->newname = (yyvsp[(8) - (8)].str); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; ;} break; - case 886: -#line 2562 "third_party/libpg_query/grammar/statements/select.y" + case 1001: +#line 36 "third_party/libpg_query/grammar/statements/rename.y" { - /* various trim expressions are defined in SQL - * - thomas 1997-07-19 - */ - (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("trim"), (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); + PGRenameStmt *n = makeNode(PGRenameStmt); + n->renameType = PG_OBJECT_SEQUENCE; + n->relation = (yyvsp[(3) - (6)].range); + n->subname = NULL; + n->newname = (yyvsp[(6) - (6)].str); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; ;} break; - case 887: -#line 2569 "third_party/libpg_query/grammar/statements/select.y" + case 1002: +#line 46 "third_party/libpg_query/grammar/statements/rename.y" { - (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("ltrim"), (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); + PGRenameStmt *n = makeNode(PGRenameStmt); + n->renameType = PG_OBJECT_SEQUENCE; + n->relation = (yyvsp[(5) - (8)].range); + n->subname = NULL; + n->newname = (yyvsp[(8) - (8)].str); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; ;} break; - case 888: -#line 2573 "third_party/libpg_query/grammar/statements/select.y" + case 1003: +#line 56 "third_party/libpg_query/grammar/statements/rename.y" { - (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("rtrim"), (yyvsp[(4) - (5)].list), (yylsp[(1) - (5)])); + PGRenameStmt *n = makeNode(PGRenameStmt); + n->renameType = PG_OBJECT_VIEW; + n->relation = (yyvsp[(3) - (6)].range); + n->subname = NULL; + n->newname = (yyvsp[(6) - (6)].str); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; ;} break; - case 889: -#line 2577 "third_party/libpg_query/grammar/statements/select.y" + case 1004: +#line 66 "third_party/libpg_query/grammar/statements/rename.y" { - (yyval.node) = (PGNode *) makeFuncCall(SystemFuncName("trim"), (yyvsp[(3) - (4)].list), (yylsp[(1) - (4)])); + PGRenameStmt *n = makeNode(PGRenameStmt); + n->renameType = PG_OBJECT_VIEW; + n->relation = (yyvsp[(5) - (8)].range); + n->subname = NULL; + n->newname = (yyvsp[(8) - (8)].str); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; ;} break; - case 890: -#line 2581 "third_party/libpg_query/grammar/statements/select.y" + case 1005: +#line 76 "third_party/libpg_query/grammar/statements/rename.y" { - (yyval.node) = (PGNode *) makeSimpleAExpr(PG_AEXPR_NULLIF, "=", (yyvsp[(3) - (6)].node), (yyvsp[(5) - (6)].node), (yylsp[(1) - (6)])); + PGRenameStmt *n = makeNode(PGRenameStmt); + n->renameType = PG_OBJECT_INDEX; + n->relation = (yyvsp[(3) - (6)].range); + n->subname = NULL; + n->newname = (yyvsp[(6) - (6)].str); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; ;} break; - case 891: -#line 2585 "third_party/libpg_query/grammar/statements/select.y" + case 1006: +#line 86 "third_party/libpg_query/grammar/statements/rename.y" { - PGCoalesceExpr *c = makeNode(PGCoalesceExpr); - c->args = (yyvsp[(3) - (4)].list); - c->location = (yylsp[(1) - (4)]); - (yyval.node) = (PGNode *)c; + PGRenameStmt *n = makeNode(PGRenameStmt); + n->renameType = PG_OBJECT_INDEX; + n->relation = (yyvsp[(5) - (8)].range); + n->subname = NULL; + n->newname = (yyvsp[(8) - (8)].str); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; ;} break; - case 892: -#line 2598 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(4) - (5)].list); ;} - break; - - case 893: -#line 2599 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} - break; - - case 894: -#line 2603 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(4) - (5)].node); ;} - break; - - case 895: -#line 2604 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} - break; - - case 896: -#line 2612 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(2) - (2)].list); ;} - break; - - case 897: -#line 2613 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} - break; - - case 898: -#line 2617 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].windef)); ;} - break; - - case 899: -#line 2619 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].windef)); ;} - break; - - case 900: -#line 2624 "third_party/libpg_query/grammar/statements/select.y" + case 1007: +#line 96 "third_party/libpg_query/grammar/statements/rename.y" { - PGWindowDef *n = (yyvsp[(3) - (3)].windef); - n->name = (yyvsp[(1) - (3)].str); - (yyval.windef) = n; + PGRenameStmt *n = makeNode(PGRenameStmt); + n->renameType = PG_OBJECT_COLUMN; + n->relationType = PG_OBJECT_TABLE; + n->relation = (yyvsp[(3) - (8)].range); + n->subname = (yyvsp[(6) - (8)].str); + n->newname = (yyvsp[(8) - (8)].str); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; ;} break; - case 901: -#line 2632 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.windef) = (yyvsp[(2) - (2)].windef); ;} - break; - - case 902: -#line 2634 "third_party/libpg_query/grammar/statements/select.y" + case 1008: +#line 107 "third_party/libpg_query/grammar/statements/rename.y" { - PGWindowDef *n = makeNode(PGWindowDef); - n->name = (yyvsp[(2) - (2)].str); - n->refname = NULL; - n->partitionClause = NIL; - n->orderClause = NIL; - n->frameOptions = FRAMEOPTION_DEFAULTS; - n->startOffset = NULL; - n->endOffset = NULL; - n->location = (yylsp[(2) - (2)]); - (yyval.windef) = n; + PGRenameStmt *n = makeNode(PGRenameStmt); + n->renameType = PG_OBJECT_COLUMN; + n->relationType = PG_OBJECT_TABLE; + n->relation = (yyvsp[(5) - (10)].range); + n->subname = (yyvsp[(8) - (10)].str); + n->newname = (yyvsp[(10) - (10)].str); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; ;} break; - case 903: -#line 2647 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.windef) = NULL; ;} - break; - - case 904: -#line 2652 "third_party/libpg_query/grammar/statements/select.y" + case 1009: +#line 118 "third_party/libpg_query/grammar/statements/rename.y" { - PGWindowDef *n = makeNode(PGWindowDef); - n->name = NULL; - n->refname = (yyvsp[(2) - (6)].str); - n->partitionClause = (yyvsp[(3) - (6)].list); - n->orderClause = (yyvsp[(4) - (6)].list); - /* copy relevant fields of opt_frame_clause */ - n->frameOptions = (yyvsp[(5) - (6)].windef)->frameOptions; - n->startOffset = (yyvsp[(5) - (6)].windef)->startOffset; - n->endOffset = (yyvsp[(5) - (6)].windef)->endOffset; - n->location = (yylsp[(1) - (6)]); - (yyval.windef) = n; + PGRenameStmt *n = makeNode(PGRenameStmt); + n->renameType = PG_OBJECT_TABCONSTRAINT; + n->relation = (yyvsp[(3) - (8)].range); + n->subname = (yyvsp[(6) - (8)].str); + n->newname = (yyvsp[(8) - (8)].str); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; ;} break; - case 905: -#line 2677 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} - break; - - case 906: -#line 2678 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = NULL; ;} + case 1010: +#line 128 "third_party/libpg_query/grammar/statements/rename.y" + { + PGRenameStmt *n = makeNode(PGRenameStmt); + n->renameType = PG_OBJECT_TABCONSTRAINT; + n->relation = (yyvsp[(5) - (10)].range); + n->subname = (yyvsp[(8) - (10)].str); + n->newname = (yyvsp[(10) - (10)].str); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; + ;} break; - case 907: -#line 2681 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(3) - (3)].list); ;} + case 1011: +#line 140 "third_party/libpg_query/grammar/statements/rename.y" + { (yyval.ival) = COLUMN; ;} break; - case 908: -#line 2682 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 1012: +#line 141 "third_party/libpg_query/grammar/statements/rename.y" + { (yyval.ival) = 0; ;} break; - case 909: -#line 2694 "third_party/libpg_query/grammar/statements/select.y" + case 1013: +#line 10 "third_party/libpg_query/grammar/statements/drop.y" { - PGWindowDef *n = (yyvsp[(2) - (2)].windef); - n->frameOptions |= FRAMEOPTION_NONDEFAULT | FRAMEOPTION_RANGE; - (yyval.windef) = n; + PGDropStmt *n = makeNode(PGDropStmt); + n->removeType = (yyvsp[(2) - (6)].objtype); + n->missing_ok = true; + n->objects = (yyvsp[(5) - (6)].list); + n->behavior = (yyvsp[(6) - (6)].dbehavior); + n->concurrent = false; + (yyval.node) = (PGNode *)n; ;} break; - case 910: -#line 2700 "third_party/libpg_query/grammar/statements/select.y" + case 1014: +#line 20 "third_party/libpg_query/grammar/statements/drop.y" { - PGWindowDef *n = (yyvsp[(2) - (2)].windef); - n->frameOptions |= FRAMEOPTION_NONDEFAULT | FRAMEOPTION_ROWS; - (yyval.windef) = n; + PGDropStmt *n = makeNode(PGDropStmt); + n->removeType = (yyvsp[(2) - (4)].objtype); + n->missing_ok = false; + n->objects = (yyvsp[(3) - (4)].list); + n->behavior = (yyvsp[(4) - (4)].dbehavior); + n->concurrent = false; + (yyval.node) = (PGNode *)n; ;} break; - case 911: -#line 2706 "third_party/libpg_query/grammar/statements/select.y" + case 1015: +#line 30 "third_party/libpg_query/grammar/statements/drop.y" { - PGWindowDef *n = makeNode(PGWindowDef); - n->frameOptions = FRAMEOPTION_DEFAULTS; - n->startOffset = NULL; - n->endOffset = NULL; - (yyval.windef) = n; + PGDropStmt *n = makeNode(PGDropStmt); + n->removeType = (yyvsp[(2) - (6)].objtype); + n->missing_ok = true; + n->objects = (yyvsp[(5) - (6)].list); + n->behavior = (yyvsp[(6) - (6)].dbehavior); + n->concurrent = false; + (yyval.node) = (PGNode *)n; ;} break; - case 912: -#line 2716 "third_party/libpg_query/grammar/statements/select.y" + case 1016: +#line 40 "third_party/libpg_query/grammar/statements/drop.y" { - PGWindowDef *n = (yyvsp[(1) - (1)].windef); - /* reject invalid cases */ - if (n->frameOptions & FRAMEOPTION_START_UNBOUNDED_FOLLOWING) - ereport(ERROR, - (errcode(PG_ERRCODE_WINDOWING_ERROR), - errmsg("frame start cannot be UNBOUNDED FOLLOWING"), - parser_errposition((yylsp[(1) - (1)])))); - if (n->frameOptions & FRAMEOPTION_START_VALUE_FOLLOWING) - ereport(ERROR, - (errcode(PG_ERRCODE_WINDOWING_ERROR), - errmsg("frame starting from following row cannot end with current row"), - parser_errposition((yylsp[(1) - (1)])))); - n->frameOptions |= FRAMEOPTION_END_CURRENT_ROW; - (yyval.windef) = n; + PGDropStmt *n = makeNode(PGDropStmt); + n->removeType = (yyvsp[(2) - (4)].objtype); + n->missing_ok = false; + n->objects = (yyvsp[(3) - (4)].list); + n->behavior = (yyvsp[(4) - (4)].dbehavior); + n->concurrent = false; + (yyval.node) = (PGNode *)n; ;} break; - case 913: -#line 2733 "third_party/libpg_query/grammar/statements/select.y" + case 1017: +#line 50 "third_party/libpg_query/grammar/statements/drop.y" { - PGWindowDef *n1 = (yyvsp[(2) - (4)].windef); - PGWindowDef *n2 = (yyvsp[(4) - (4)].windef); - /* form merged options */ - int frameOptions = n1->frameOptions; - /* shift converts START_ options to END_ options */ - frameOptions |= n2->frameOptions << 1; - frameOptions |= FRAMEOPTION_BETWEEN; - /* reject invalid cases */ - if (frameOptions & FRAMEOPTION_START_UNBOUNDED_FOLLOWING) - ereport(ERROR, - (errcode(PG_ERRCODE_WINDOWING_ERROR), - errmsg("frame start cannot be UNBOUNDED FOLLOWING"), - parser_errposition((yylsp[(2) - (4)])))); - if (frameOptions & FRAMEOPTION_END_UNBOUNDED_PRECEDING) - ereport(ERROR, - (errcode(PG_ERRCODE_WINDOWING_ERROR), - errmsg("frame end cannot be UNBOUNDED PRECEDING"), - parser_errposition((yylsp[(4) - (4)])))); - if ((frameOptions & FRAMEOPTION_START_CURRENT_ROW) && - (frameOptions & FRAMEOPTION_END_VALUE_PRECEDING)) - ereport(ERROR, - (errcode(PG_ERRCODE_WINDOWING_ERROR), - errmsg("frame starting from current row cannot have preceding rows"), - parser_errposition((yylsp[(4) - (4)])))); - if ((frameOptions & FRAMEOPTION_START_VALUE_FOLLOWING) && - (frameOptions & (FRAMEOPTION_END_VALUE_PRECEDING | - FRAMEOPTION_END_CURRENT_ROW))) - ereport(ERROR, - (errcode(PG_ERRCODE_WINDOWING_ERROR), - errmsg("frame starting from following row cannot have preceding rows"), - parser_errposition((yylsp[(4) - (4)])))); - n1->frameOptions = frameOptions; - n1->endOffset = n2->startOffset; - (yyval.windef) = n1; + PGDropStmt *n = makeNode(PGDropStmt); + n->removeType = (yyvsp[(2) - (6)].objtype); + n->objects = list_make1(lappend((yyvsp[(5) - (6)].list), makeString((yyvsp[(3) - (6)].str)))); + n->behavior = (yyvsp[(6) - (6)].dbehavior); + n->missing_ok = false; + n->concurrent = false; + (yyval.node) = (PGNode *) n; ;} break; - case 914: -#line 2778 "third_party/libpg_query/grammar/statements/select.y" + case 1018: +#line 60 "third_party/libpg_query/grammar/statements/drop.y" { - PGWindowDef *n = makeNode(PGWindowDef); - n->frameOptions = FRAMEOPTION_START_UNBOUNDED_PRECEDING; - n->startOffset = NULL; - n->endOffset = NULL; - (yyval.windef) = n; + PGDropStmt *n = makeNode(PGDropStmt); + n->removeType = (yyvsp[(2) - (8)].objtype); + n->objects = list_make1(lappend((yyvsp[(7) - (8)].list), makeString((yyvsp[(5) - (8)].str)))); + n->behavior = (yyvsp[(8) - (8)].dbehavior); + n->missing_ok = true; + n->concurrent = false; + (yyval.node) = (PGNode *) n; ;} break; - case 915: -#line 2786 "third_party/libpg_query/grammar/statements/select.y" + case 1019: +#line 70 "third_party/libpg_query/grammar/statements/drop.y" { - PGWindowDef *n = makeNode(PGWindowDef); - n->frameOptions = FRAMEOPTION_START_UNBOUNDED_FOLLOWING; - n->startOffset = NULL; - n->endOffset = NULL; - (yyval.windef) = n; + PGDropStmt *n = makeNode(PGDropStmt); + n->removeType = PG_OBJECT_TYPE; + n->missing_ok = false; + n->objects = (yyvsp[(3) - (4)].list); + n->behavior = (yyvsp[(4) - (4)].dbehavior); + n->concurrent = false; + (yyval.node) = (PGNode *) n; ;} break; - case 916: -#line 2794 "third_party/libpg_query/grammar/statements/select.y" + case 1020: +#line 80 "third_party/libpg_query/grammar/statements/drop.y" { - PGWindowDef *n = makeNode(PGWindowDef); - n->frameOptions = FRAMEOPTION_START_CURRENT_ROW; - n->startOffset = NULL; - n->endOffset = NULL; - (yyval.windef) = n; + PGDropStmt *n = makeNode(PGDropStmt); + n->removeType = PG_OBJECT_TYPE; + n->missing_ok = true; + n->objects = (yyvsp[(5) - (6)].list); + n->behavior = (yyvsp[(6) - (6)].dbehavior); + n->concurrent = false; + (yyval.node) = (PGNode *) n; ;} break; - case 917: -#line 2802 "third_party/libpg_query/grammar/statements/select.y" - { - PGWindowDef *n = makeNode(PGWindowDef); - n->frameOptions = FRAMEOPTION_START_VALUE_PRECEDING; - n->startOffset = (yyvsp[(1) - (2)].node); - n->endOffset = NULL; - (yyval.windef) = n; - ;} + case 1021: +#line 93 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_TABLE; ;} break; - case 918: -#line 2810 "third_party/libpg_query/grammar/statements/select.y" - { - PGWindowDef *n = makeNode(PGWindowDef); - n->frameOptions = FRAMEOPTION_START_VALUE_FOLLOWING; - n->startOffset = (yyvsp[(1) - (2)].node); - n->endOffset = NULL; - (yyval.windef) = n; - ;} + case 1022: +#line 94 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_SEQUENCE; ;} break; - case 919: -#line 2830 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(3) - (4)].list); ;} + case 1023: +#line 95 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_FUNCTION; ;} break; - case 920: -#line 2831 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 1024: +#line 96 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_FUNCTION; ;} break; - case 921: -#line 2834 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(1) - (1)].list);;} + case 1025: +#line 97 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_TABLE_MACRO; ;} break; - case 922: -#line 2835 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(2) - (5)].list), (yyvsp[(4) - (5)].node)); ;} + case 1026: +#line 98 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_VIEW; ;} break; - case 923: -#line 2839 "third_party/libpg_query/grammar/statements/select.y" - { - PGNamedArgExpr *na = makeNode(PGNamedArgExpr); - na->name = (yyvsp[(1) - (3)].str); - na->arg = (PGExpr *) (yyvsp[(3) - (3)].node); - na->argnumber = -1; - na->location = (yylsp[(1) - (3)]); - (yyval.node) = (PGNode *) na; - ;} + case 1027: +#line 99 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_MATVIEW; ;} break; - case 924: -#line 2849 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} + case 1028: +#line 100 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_INDEX; ;} break; - case 925: -#line 2850 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} + case 1029: +#line 101 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_FOREIGN_TABLE; ;} break; - case 926: -#line 2852 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.subquerytype) = PG_ANY_SUBLINK; ;} + case 1030: +#line 102 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_COLLATION; ;} break; - case 927: -#line 2853 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.subquerytype) = PG_ANY_SUBLINK; ;} + case 1031: +#line 103 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_CONVERSION; ;} break; - case 928: -#line 2854 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.subquerytype) = PG_ALL_SUBLINK; ;} + case 1032: +#line 104 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_STATISTIC_EXT; ;} break; - case 929: -#line 2857 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1033: +#line 105 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_TSPARSER; ;} break; - case 930: -#line 2858 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (char*) (yyvsp[(1) - (1)].conststr); ;} + case 1034: +#line 106 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_TSDICTIONARY; ;} break; - case 931: -#line 2861 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = "+"; ;} + case 1035: +#line 107 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_TSTEMPLATE; ;} break; - case 932: -#line 2862 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = "-"; ;} + case 1036: +#line 108 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_TSCONFIGURATION; ;} break; - case 933: -#line 2863 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = "*"; ;} + case 1037: +#line 113 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_ACCESS_METHOD; ;} break; - case 934: -#line 2864 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = "/"; ;} + case 1038: +#line 114 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_EVENT_TRIGGER; ;} break; - case 935: -#line 2865 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = "%"; ;} + case 1039: +#line 115 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_EXTENSION; ;} break; - case 936: -#line 2866 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = "^"; ;} + case 1040: +#line 116 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_FDW; ;} break; - case 937: -#line 2867 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = "<"; ;} + case 1041: +#line 117 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_PUBLICATION; ;} break; - case 938: -#line 2868 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = ">"; ;} + case 1042: +#line 118 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_SCHEMA; ;} break; - case 939: -#line 2869 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = "="; ;} + case 1043: +#line 119 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_FOREIGN_SERVER; ;} break; - case 940: -#line 2870 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = "<="; ;} + case 1044: +#line 124 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} break; - case 941: -#line 2871 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = ">="; ;} + case 1045: +#line 125 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} break; - case 942: -#line 2872 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.conststr) = "<>"; ;} + case 1046: +#line 130 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.dbehavior) = PG_DROP_CASCADE; ;} break; - case 943: -#line 2876 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} + case 1047: +#line 131 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.dbehavior) = PG_DROP_RESTRICT; ;} break; - case 944: -#line 2878 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(3) - (4)].list); ;} + case 1048: +#line 132 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.dbehavior) = PG_DROP_RESTRICT; /* default */ ;} break; - case 945: -#line 2883 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} + case 1049: +#line 137 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_POLICY; ;} break; - case 946: -#line 2885 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(3) - (4)].list); ;} + case 1050: +#line 138 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_RULE; ;} break; - case 947: -#line 2890 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} + case 1051: +#line 139 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.objtype) = PG_OBJECT_TRIGGER; ;} break; - case 948: -#line 2892 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(3) - (4)].list); ;} + case 1052: +#line 142 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].typnam)); ;} break; - case 949: -#line 2894 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString("~~")); ;} + case 1053: +#line 143 "third_party/libpg_query/grammar/statements/drop.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].typnam)); ;} break; - case 950: -#line 2896 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString("!~~")); ;} + case 1054: +#line 8 "third_party/libpg_query/grammar/statements/load.y" + { + PGLoadStmt *n = makeNode(PGLoadStmt); + n->filename = (yyvsp[(2) - (2)].str); + n->load_type = PG_LOAD_TYPE_LOAD; + (yyval.node) = (PGNode *)n; + ;} break; - case 951: -#line 2898 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString("~~~")); ;} + case 1055: +#line 14 "third_party/libpg_query/grammar/statements/load.y" + { + PGLoadStmt *n = makeNode(PGLoadStmt); + n->filename = (yyvsp[(2) - (2)].str); + n->load_type = PG_LOAD_TYPE_INSTALL; + (yyval.node) = (PGNode *)n; + ;} break; - case 952: -#line 2900 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString("!~~~")); ;} + case 1056: +#line 20 "third_party/libpg_query/grammar/statements/load.y" + { + PGLoadStmt *n = makeNode(PGLoadStmt); + n->filename = (yyvsp[(3) - (3)].str); + n->load_type = PG_LOAD_TYPE_FORCE_INSTALL; + (yyval.node) = (PGNode *)n; + ;} break; - case 953: -#line 2902 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString("~~*")); ;} + case 1057: +#line 28 "third_party/libpg_query/grammar/statements/load.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 954: -#line 2904 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString("!~~*")); ;} + case 1058: +#line 29 "third_party/libpg_query/grammar/statements/load.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 955: -#line 2918 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} + case 1059: +#line 10 "third_party/libpg_query/grammar/statements/insert.y" + { + (yyvsp[(5) - (7)].istmt)->relation = (yyvsp[(4) - (7)].range); + (yyvsp[(5) - (7)].istmt)->onConflictClause = (yyvsp[(6) - (7)].onconflict); + (yyvsp[(5) - (7)].istmt)->returningList = (yyvsp[(7) - (7)].list); + (yyvsp[(5) - (7)].istmt)->withClause = (yyvsp[(1) - (7)].with); + (yyval.node) = (PGNode *) (yyvsp[(5) - (7)].istmt); + ;} break; - case 956: -#line 2920 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lcons(makeString((yyvsp[(1) - (3)].str)), (yyvsp[(3) - (3)].list)); ;} + case 1060: +#line 22 "third_party/libpg_query/grammar/statements/insert.y" + { + (yyval.istmt) = makeNode(PGInsertStmt); + (yyval.istmt)->cols = NIL; + (yyval.istmt)->selectStmt = (yyvsp[(1) - (1)].node); + ;} break; - case 957: -#line 2924 "third_party/libpg_query/grammar/statements/select.y" + case 1061: +#line 28 "third_party/libpg_query/grammar/statements/insert.y" { - (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); + (yyval.istmt) = makeNode(PGInsertStmt); + (yyval.istmt)->cols = NIL; + (yyval.istmt)->override = (yyvsp[(2) - (4)].override); + (yyval.istmt)->selectStmt = (yyvsp[(4) - (4)].node); ;} break; - case 958: -#line 2928 "third_party/libpg_query/grammar/statements/select.y" + case 1062: +#line 35 "third_party/libpg_query/grammar/statements/insert.y" { - (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); + (yyval.istmt) = makeNode(PGInsertStmt); + (yyval.istmt)->cols = (yyvsp[(2) - (4)].list); + (yyval.istmt)->selectStmt = (yyvsp[(4) - (4)].node); ;} break; - case 959: -#line 2935 "third_party/libpg_query/grammar/statements/select.y" + case 1063: +#line 41 "third_party/libpg_query/grammar/statements/insert.y" { - (yyval.list) = (yyvsp[(1) - (1)].list); + (yyval.istmt) = makeNode(PGInsertStmt); + (yyval.istmt)->cols = (yyvsp[(2) - (7)].list); + (yyval.istmt)->override = (yyvsp[(5) - (7)].override); + (yyval.istmt)->selectStmt = (yyvsp[(7) - (7)].node); ;} break; - case 960: -#line 2939 "third_party/libpg_query/grammar/statements/select.y" + case 1064: +#line 48 "third_party/libpg_query/grammar/statements/insert.y" { - (yyval.list) = NULL; + (yyval.istmt) = makeNode(PGInsertStmt); + (yyval.istmt)->cols = NIL; + (yyval.istmt)->selectStmt = NULL; ;} break; - case 961: -#line 2947 "third_party/libpg_query/grammar/statements/select.y" + case 1065: +#line 58 "third_party/libpg_query/grammar/statements/insert.y" { - (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); + (yyval.range) = (yyvsp[(1) - (1)].range); ;} break; - case 962: -#line 2951 "third_party/libpg_query/grammar/statements/select.y" + case 1066: +#line 62 "third_party/libpg_query/grammar/statements/insert.y" { - (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); + (yyvsp[(1) - (3)].range)->alias = makeAlias((yyvsp[(3) - (3)].str), NIL); + (yyval.range) = (yyvsp[(1) - (3)].range); ;} break; - case 963: -#line 2957 "third_party/libpg_query/grammar/statements/select.y" + case 1067: +#line 71 "third_party/libpg_query/grammar/statements/insert.y" { - (yyval.node) = (yyvsp[(1) - (1)].node); + (yyval.infer) = makeNode(PGInferClause); + (yyval.infer)->indexElems = (yyvsp[(2) - (4)].list); + (yyval.infer)->whereClause = (yyvsp[(4) - (4)].node); + (yyval.infer)->conname = NULL; + (yyval.infer)->location = (yylsp[(1) - (4)]); ;} break; - case 964: -#line 2961 "third_party/libpg_query/grammar/statements/select.y" + case 1068: +#line 80 "third_party/libpg_query/grammar/statements/insert.y" { - PGNamedArgExpr *na = makeNode(PGNamedArgExpr); - na->name = (yyvsp[(1) - (3)].str); - na->arg = (PGExpr *) (yyvsp[(3) - (3)].node); - na->argnumber = -1; /* until determined */ - na->location = (yylsp[(1) - (3)]); - (yyval.node) = (PGNode *) na; + (yyval.infer) = makeNode(PGInferClause); + (yyval.infer)->indexElems = NIL; + (yyval.infer)->whereClause = NULL; + (yyval.infer)->conname = (yyvsp[(3) - (3)].str); + (yyval.infer)->location = (yylsp[(1) - (3)]); ;} break; - case 965: -#line 2970 "third_party/libpg_query/grammar/statements/select.y" + case 1069: +#line 88 "third_party/libpg_query/grammar/statements/insert.y" { - PGNamedArgExpr *na = makeNode(PGNamedArgExpr); - na->name = (yyvsp[(1) - (3)].str); - na->arg = (PGExpr *) (yyvsp[(3) - (3)].node); - na->argnumber = -1; /* until determined */ - na->location = (yylsp[(1) - (3)]); - (yyval.node) = (PGNode *) na; + (yyval.infer) = NULL; ;} break; - case 966: -#line 2980 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].typnam)); ;} + case 1070: +#line 95 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.with) = (yyvsp[(1) - (1)].with); ;} break; - case 967: -#line 2981 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].typnam)); ;} + case 1071: +#line 96 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.with) = NULL; ;} break; - case 968: -#line 2986 "third_party/libpg_query/grammar/statements/select.y" + case 1072: +#line 102 "third_party/libpg_query/grammar/statements/insert.y" { - (yyval.list) = list_make2(makeStringConst((yyvsp[(1) - (3)].str), (yylsp[(1) - (3)])), (yyvsp[(3) - (3)].node)); + (yyval.target) = makeNode(PGResTarget); + (yyval.target)->name = (yyvsp[(1) - (2)].str); + (yyval.target)->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); + (yyval.target)->val = NULL; + (yyval.target)->location = (yylsp[(1) - (2)]); ;} break; - case 969: -#line 2989 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} - break; - - case 970: -#line 2996 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1073: +#line 114 "third_party/libpg_query/grammar/statements/insert.y" + { + (yyvsp[(1) - (3)].target)->val = (PGNode *) (yyvsp[(3) - (3)].node); + (yyval.list) = list_make1((yyvsp[(1) - (3)].target)); + ;} break; - case 971: -#line 2997 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (char*) "year"; ;} - break; + case 1074: +#line 119 "third_party/libpg_query/grammar/statements/insert.y" + { + int ncolumns = list_length((yyvsp[(2) - (5)].list)); + int i = 1; + PGListCell *col_cell; - case 972: -#line 2998 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (char*) "month"; ;} - break; + /* Create a PGMultiAssignRef source for each target */ + foreach(col_cell, (yyvsp[(2) - (5)].list)) + { + PGResTarget *res_col = (PGResTarget *) lfirst(col_cell); + PGMultiAssignRef *r = makeNode(PGMultiAssignRef); - case 973: -#line 2999 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (char*) "day"; ;} - break; + r->source = (PGNode *) (yyvsp[(5) - (5)].node); + r->colno = i; + r->ncolumns = ncolumns; + res_col->val = (PGNode *) r; + i++; + } - case 974: -#line 3000 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (char*) "hour"; ;} + (yyval.list) = (yyvsp[(2) - (5)].list); + ;} break; - case 975: -#line 3001 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (char*) "minute"; ;} + case 1075: +#line 144 "third_party/libpg_query/grammar/statements/insert.y" + { + (yyval.onconflict) = makeNode(PGOnConflictClause); + (yyval.onconflict)->action = PG_ONCONFLICT_UPDATE; + (yyval.onconflict)->infer = (yyvsp[(3) - (8)].infer); + (yyval.onconflict)->targetList = (yyvsp[(7) - (8)].list); + (yyval.onconflict)->whereClause = (yyvsp[(8) - (8)].node); + (yyval.onconflict)->location = (yylsp[(1) - (8)]); + ;} break; - case 976: -#line 3002 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (char*) "second"; ;} + case 1076: +#line 154 "third_party/libpg_query/grammar/statements/insert.y" + { + (yyval.onconflict) = makeNode(PGOnConflictClause); + (yyval.onconflict)->action = PG_ONCONFLICT_NOTHING; + (yyval.onconflict)->infer = (yyvsp[(3) - (5)].infer); + (yyval.onconflict)->targetList = NIL; + (yyval.onconflict)->whereClause = NULL; + (yyval.onconflict)->location = (yylsp[(1) - (5)]); + ;} break; - case 977: -#line 3003 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (char*) "millisecond"; ;} + case 1077: +#line 163 "third_party/libpg_query/grammar/statements/insert.y" + { + (yyval.onconflict) = NULL; + ;} break; - case 978: -#line 3004 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (char*) "microsecond"; ;} + case 1078: +#line 170 "third_party/libpg_query/grammar/statements/insert.y" + { + (yyval.ielem) = makeNode(PGIndexElem); + (yyval.ielem)->name = (yyvsp[(1) - (5)].str); + (yyval.ielem)->expr = NULL; + (yyval.ielem)->indexcolname = NULL; + (yyval.ielem)->collation = (yyvsp[(2) - (5)].list); + (yyval.ielem)->opclass = (yyvsp[(3) - (5)].list); + (yyval.ielem)->ordering = (yyvsp[(4) - (5)].sortorder); + (yyval.ielem)->nulls_ordering = (yyvsp[(5) - (5)].nullorder); + ;} break; - case 979: -#line 3005 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1079: +#line 181 "third_party/libpg_query/grammar/statements/insert.y" + { + (yyval.ielem) = makeNode(PGIndexElem); + (yyval.ielem)->name = NULL; + (yyval.ielem)->expr = (yyvsp[(1) - (5)].node); + (yyval.ielem)->indexcolname = NULL; + (yyval.ielem)->collation = (yyvsp[(2) - (5)].list); + (yyval.ielem)->opclass = (yyvsp[(3) - (5)].list); + (yyval.ielem)->ordering = (yyvsp[(4) - (5)].sortorder); + (yyval.ielem)->nulls_ordering = (yyvsp[(5) - (5)].nullorder); + ;} break; - case 980: -#line 3016 "third_party/libpg_query/grammar/statements/select.y" + case 1080: +#line 192 "third_party/libpg_query/grammar/statements/insert.y" { - (yyval.list) = list_make4((yyvsp[(1) - (4)].node), (yyvsp[(2) - (4)].node), (yyvsp[(3) - (4)].node), (yyvsp[(4) - (4)].node)); + (yyval.ielem) = makeNode(PGIndexElem); + (yyval.ielem)->name = NULL; + (yyval.ielem)->expr = (yyvsp[(2) - (7)].node); + (yyval.ielem)->indexcolname = NULL; + (yyval.ielem)->collation = (yyvsp[(4) - (7)].list); + (yyval.ielem)->opclass = (yyvsp[(5) - (7)].list); + (yyval.ielem)->ordering = (yyvsp[(6) - (7)].sortorder); + (yyval.ielem)->nulls_ordering = (yyvsp[(7) - (7)].nullorder); ;} break; - case 981: -#line 3020 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.list) = list_make3((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].node), (yyvsp[(3) - (3)].node)); - ;} + case 1081: +#line 206 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 982: -#line 3027 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(2) - (2)].node); ;} + case 1082: +#line 207 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = NIL; ;} break; - case 983: -#line 3033 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make2((yyvsp[(3) - (3)].node), (yyvsp[(1) - (3)].node)); ;} + case 1083: +#line 213 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.override) = PG_OVERRIDING_USER_VALUE; ;} break; - case 984: -#line 3034 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 1084: +#line 214 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.override) = OVERRIDING_SYSTEM_VALUE; ;} break; - case 985: -#line 3051 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.list) = list_make3((yyvsp[(1) - (3)].node), (yyvsp[(2) - (3)].node), (yyvsp[(3) - (3)].node)); - ;} + case 1085: +#line 219 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].target)); ;} break; - case 986: -#line 3055 "third_party/libpg_query/grammar/statements/select.y" - { - /* not legal per SQL99, but might as well allow it */ - (yyval.list) = list_make3((yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node), (yyvsp[(2) - (3)].node)); - ;} + case 1086: +#line 220 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list),(yyvsp[(3) - (3)].target)); ;} break; - case 987: -#line 3060 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.list) = list_make2((yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node)); - ;} + case 1087: +#line 226 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 988: -#line 3064 "third_party/libpg_query/grammar/statements/select.y" - { - /* - * Since there are no cases where this syntax allows - * a textual FOR value, we forcibly cast the argument - * to int4. The possible matches in pg_proc are - * substring(text,int4) and substring(text,text), - * and we don't want the parser to choose the latter, - * which it is likely to do if the second argument - * is unknown or doesn't have an implicit cast to int4. - */ - (yyval.list) = list_make3((yyvsp[(1) - (2)].node), makeIntConst(1, -1), - makeTypeCast((yyvsp[(2) - (2)].node), - SystemTypeName("int4"), 0, -1)); - ;} + case 1088: +#line 227 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = NIL; ;} break; - case 989: -#line 3079 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.list) = (yyvsp[(1) - (1)].list); - ;} + case 1089: +#line 231 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 990: -#line 3083 "third_party/libpg_query/grammar/statements/select.y" + case 1090: +#line 232 "third_party/libpg_query/grammar/statements/insert.y" { (yyval.list) = NIL; ;} break; - case 991: -#line 3087 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(2) - (2)].node); ;} + case 1091: +#line 238 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].target)); ;} break; - case 992: -#line 3090 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(2) - (2)].node); ;} + case 1092: +#line 240 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].target)); ;} break; - case 993: -#line 3093 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(3) - (3)].list), (yyvsp[(1) - (3)].node)); ;} + case 1093: +#line 245 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 994: -#line 3094 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(2) - (2)].list); ;} + case 1094: +#line 246 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = list_concat((yyvsp[(1) - (3)].list),(yyvsp[(3) - (3)].list)); ;} break; - case 995: -#line 3095 "third_party/libpg_query/grammar/statements/select.y" + case 1095: +#line 250 "third_party/libpg_query/grammar/statements/insert.y" { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 996: -#line 3099 "third_party/libpg_query/grammar/statements/select.y" - { - PGSubLink *n = makeNode(PGSubLink); - n->subselect = (yyvsp[(1) - (1)].node); - /* other fields will be filled later */ - (yyval.node) = (PGNode *)n; - ;} + case 1096: +#line 251 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = (yyvsp[(1) - (2)].list); ;} break; - case 997: -#line 3105 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (PGNode *)(yyvsp[(2) - (3)].list); ;} + case 1097: +#line 254 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].ielem)); ;} break; - case 998: -#line 3116 "third_party/libpg_query/grammar/statements/select.y" - { - PGCaseExpr *c = makeNode(PGCaseExpr); - c->casetype = InvalidOid; /* not analyzed yet */ - c->arg = (PGExpr *) (yyvsp[(2) - (5)].node); - c->args = (yyvsp[(3) - (5)].list); - c->defresult = (PGExpr *) (yyvsp[(4) - (5)].node); - c->location = (yylsp[(1) - (5)]); - (yyval.node) = (PGNode *)c; - ;} + case 1098: +#line 255 "third_party/libpg_query/grammar/statements/insert.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].ielem)); ;} break; - case 999: -#line 3129 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} + case 1099: +#line 261 "third_party/libpg_query/grammar/statements/insert.y" + { + (yyval.target) = makeNode(PGResTarget); + (yyval.target)->name = (yyvsp[(1) - (2)].str); + (yyval.target)->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); + (yyval.target)->val = NULL; /* upper production sets this */ + (yyval.target)->location = (yylsp[(1) - (2)]); + ;} break; - case 1000: -#line 3130 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} + case 1100: +#line 8 "third_party/libpg_query/grammar/statements/execute.y" + { + PGExecuteStmt *n = makeNode(PGExecuteStmt); + n->name = (yyvsp[(2) - (3)].str); + n->params = (yyvsp[(3) - (3)].list); + (yyval.node) = (PGNode *) n; + ;} break; - case 1001: -#line 3135 "third_party/libpg_query/grammar/statements/select.y" + case 1101: +#line 16 "third_party/libpg_query/grammar/statements/execute.y" { - PGCaseWhen *w = makeNode(PGCaseWhen); - w->expr = (PGExpr *) (yyvsp[(2) - (4)].node); - w->result = (PGExpr *) (yyvsp[(4) - (4)].node); - w->location = (yylsp[(1) - (4)]); - (yyval.node) = (PGNode *)w; + PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); + PGExecuteStmt *n = makeNode(PGExecuteStmt); + n->name = (yyvsp[(7) - (9)].str); + n->params = (yyvsp[(8) - (9)].list); + ctas->query = (PGNode *) n; + ctas->into = (yyvsp[(4) - (9)].into); + ctas->relkind = PG_OBJECT_TABLE; + ctas->is_select_into = false; + ctas->onconflict = PG_ERROR_ON_CONFLICT; + /* cram additional flags into the PGIntoClause */ + (yyvsp[(4) - (9)].into)->rel->relpersistence = (yyvsp[(2) - (9)].ival); + (yyvsp[(4) - (9)].into)->skipData = !((yyvsp[(9) - (9)].boolean)); + (yyval.node) = (PGNode *) ctas; ;} break; - case 1002: -#line 3145 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(2) - (2)].node); ;} + case 1102: +#line 33 "third_party/libpg_query/grammar/statements/execute.y" + { + PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); + PGExecuteStmt *n = makeNode(PGExecuteStmt); + n->name = (yyvsp[(10) - (12)].str); + n->params = (yyvsp[(11) - (12)].list); + ctas->query = (PGNode *) n; + ctas->into = (yyvsp[(7) - (12)].into); + ctas->relkind = PG_OBJECT_TABLE; + ctas->is_select_into = false; + ctas->onconflict = PG_IGNORE_ON_CONFLICT; + /* cram additional flags into the PGIntoClause */ + (yyvsp[(7) - (12)].into)->rel->relpersistence = (yyvsp[(2) - (12)].ival); + (yyvsp[(7) - (12)].into)->skipData = !((yyvsp[(12) - (12)].boolean)); + (yyval.node) = (PGNode *) ctas; + ;} break; - case 1003: -#line 3146 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} + case 1103: +#line 51 "third_party/libpg_query/grammar/statements/execute.y" + { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 1004: -#line 3149 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 1104: +#line 52 "third_party/libpg_query/grammar/statements/execute.y" + { (yyval.list) = NIL; ;} break; - case 1005: -#line 3150 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} + case 1105: +#line 10 "third_party/libpg_query/grammar/statements/analyze.y" + { + PGVacuumStmt *n = makeNode(PGVacuumStmt); + n->options = PG_VACOPT_ANALYZE; + if ((yyvsp[(2) - (2)].boolean)) + n->options |= PG_VACOPT_VERBOSE; + n->relation = NULL; + n->va_cols = NIL; + (yyval.node) = (PGNode *)n; + ;} break; - case 1006: -#line 3154 "third_party/libpg_query/grammar/statements/select.y" + case 1106: +#line 20 "third_party/libpg_query/grammar/statements/analyze.y" { - (yyval.node) = makeColumnRef((yyvsp[(1) - (1)].str), NIL, (yylsp[(1) - (1)]), yyscanner); + PGVacuumStmt *n = makeNode(PGVacuumStmt); + n->options = PG_VACOPT_ANALYZE; + if ((yyvsp[(2) - (4)].boolean)) + n->options |= PG_VACOPT_VERBOSE; + n->relation = (yyvsp[(3) - (4)].range); + n->va_cols = (yyvsp[(4) - (4)].list); + (yyval.node) = (PGNode *)n; ;} break; - case 1007: -#line 3158 "third_party/libpg_query/grammar/statements/select.y" + case 1107: +#line 8 "third_party/libpg_query/grammar/statements/export.y" { - (yyval.node) = makeColumnRef((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].list), (yylsp[(1) - (2)]), yyscanner); + PGExportStmt *n = makeNode(PGExportStmt); + n->filename = (yyvsp[(3) - (4)].str); + n->options = NIL; + if ((yyvsp[(4) - (4)].list)) { + n->options = list_concat(n->options, (yyvsp[(4) - (4)].list)); + } + (yyval.node) = (PGNode *)n; ;} break; - case 1008: -#line 3165 "third_party/libpg_query/grammar/statements/select.y" + case 1108: +#line 21 "third_party/libpg_query/grammar/statements/export.y" { - (yyval.node) = (PGNode *) makeString((yyvsp[(2) - (2)].str)); + PGImportStmt *n = makeNode(PGImportStmt); + n->filename = (yyvsp[(3) - (3)].str); + (yyval.node) = (PGNode *)n; ;} break; - case 1009: -#line 3169 "third_party/libpg_query/grammar/statements/select.y" + case 1109: +#line 10 "third_party/libpg_query/grammar/statements/explain.y" { - PGAIndices *ai = makeNode(PGAIndices); - ai->is_slice = false; - ai->lidx = NULL; - ai->uidx = (yyvsp[(2) - (3)].node); - (yyval.node) = (PGNode *) ai; + PGExplainStmt *n = makeNode(PGExplainStmt); + n->query = (yyvsp[(2) - (2)].node); + n->options = NIL; + (yyval.node) = (PGNode *) n; ;} break; - case 1010: -#line 3177 "third_party/libpg_query/grammar/statements/select.y" + case 1110: +#line 17 "third_party/libpg_query/grammar/statements/explain.y" { - PGAIndices *ai = makeNode(PGAIndices); - ai->is_slice = true; - ai->lidx = (yyvsp[(2) - (5)].node); - ai->uidx = (yyvsp[(4) - (5)].node); - (yyval.node) = (PGNode *) ai; + PGExplainStmt *n = makeNode(PGExplainStmt); + n->query = (yyvsp[(4) - (4)].node); + n->options = list_make1(makeDefElem("analyze", NULL, (yylsp[(2) - (4)]))); + if ((yyvsp[(3) - (4)].boolean)) + n->options = lappend(n->options, + makeDefElem("verbose", NULL, (yylsp[(3) - (4)]))); + (yyval.node) = (PGNode *) n; ;} break; - case 1011: -#line 3187 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = (yyvsp[(1) - (1)].node); ;} + case 1111: +#line 27 "third_party/libpg_query/grammar/statements/explain.y" + { + PGExplainStmt *n = makeNode(PGExplainStmt); + n->query = (yyvsp[(3) - (3)].node); + n->options = list_make1(makeDefElem("verbose", NULL, (yylsp[(2) - (3)]))); + (yyval.node) = (PGNode *) n; + ;} break; - case 1012: -#line 3188 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.node) = NULL; ;} + case 1112: +#line 34 "third_party/libpg_query/grammar/statements/explain.y" + { + PGExplainStmt *n = makeNode(PGExplainStmt); + n->query = (yyvsp[(5) - (5)].node); + n->options = (yyvsp[(3) - (5)].list); + (yyval.node) = (PGNode *) n; + ;} break; - case 1013: -#line 3192 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} + case 1113: +#line 44 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.boolean) = true; ;} break; - case 1014: -#line 3193 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} + case 1114: +#line 45 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.boolean) = false; ;} break; - case 1015: -#line 3197 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 1115: +#line 50 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); ;} break; - case 1016: -#line 3198 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); ;} + case 1116: +#line 51 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.node) = (PGNode *) (yyvsp[(1) - (1)].value); ;} break; - case 1019: -#line 3212 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(1) - (1)].list); ;} + case 1117: +#line 52 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.node) = NULL; ;} break; - case 1020: -#line 3213 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 1123: +#line 65 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1021: -#line 3217 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].target)); ;} + case 1124: +#line 66 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 1022: -#line 3218 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].target)); ;} + case 1125: +#line 67 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} break; - case 1023: -#line 3222 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.target) = makeNode(PGResTarget); - (yyval.target)->name = (yyvsp[(3) - (3)].str); - (yyval.target)->indirection = NIL; - (yyval.target)->val = (PGNode *)(yyvsp[(1) - (3)].node); - (yyval.target)->location = (yylsp[(1) - (3)]); - ;} + case 1126: +#line 72 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1024: -#line 3238 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.target) = makeNode(PGResTarget); - (yyval.target)->name = (yyvsp[(2) - (2)].str); - (yyval.target)->indirection = NIL; - (yyval.target)->val = (PGNode *)(yyvsp[(1) - (2)].node); - (yyval.target)->location = (yylsp[(1) - (2)]); - ;} + case 1127: +#line 73 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1025: -#line 3246 "third_party/libpg_query/grammar/statements/select.y" + case 1128: +#line 79 "third_party/libpg_query/grammar/statements/explain.y" { - (yyval.target) = makeNode(PGResTarget); - (yyval.target)->name = NULL; - (yyval.target)->indirection = NIL; - (yyval.target)->val = (PGNode *)(yyvsp[(1) - (1)].node); - (yyval.target)->location = (yylsp[(1) - (1)]); + (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; - case 1026: -#line 3254 "third_party/libpg_query/grammar/statements/select.y" + case 1129: +#line 83 "third_party/libpg_query/grammar/statements/explain.y" { - PGColumnRef *n = makeNode(PGColumnRef); - PGAStar *star = makeNode(PGAStar); - n->fields = list_make1(star); - n->location = (yylsp[(1) - (3)]); - star->except_list = (yyvsp[(2) - (3)].list); - star->replace_list = (yyvsp[(3) - (3)].list); - - (yyval.target) = makeNode(PGResTarget); - (yyval.target)->name = NULL; - (yyval.target)->indirection = NIL; - (yyval.target)->val = (PGNode *)n; - (yyval.target)->location = (yylsp[(1) - (3)]); + (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} break; - case 1027: -#line 3269 "third_party/libpg_query/grammar/statements/select.y" - { - PGColumnRef *n = makeNode(PGColumnRef); - PGAStar *star = makeNode(PGAStar); - n->fields = list_make1(star); - n->location = (yylsp[(1) - (5)]); - star->relation = (yyvsp[(1) - (5)].str); - star->except_list = (yyvsp[(4) - (5)].list); - star->replace_list = (yyvsp[(5) - (5)].list); - - (yyval.target) = makeNode(PGResTarget); - (yyval.target)->name = NULL; - (yyval.target)->indirection = NIL; - (yyval.target)->val = (PGNode *)n; - (yyval.target)->location = (yylsp[(1) - (5)]); - ;} + case 1130: +#line 90 "third_party/libpg_query/grammar/statements/explain.y" + {;} break; - case 1028: -#line 3286 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(3) - (4)].list); ;} + case 1131: +#line 91 "third_party/libpg_query/grammar/statements/explain.y" + {;} break; - case 1029: -#line 3287 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString((yyvsp[(2) - (2)].str))); ;} + case 1132: +#line 96 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.str) = (char*) "true"; ;} break; - case 1030: -#line 3290 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(1) - (1)].list); ;} + case 1133: +#line 97 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.str) = (char*) "false"; ;} break; - case 1031: -#line 3291 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NULL; ;} + case 1134: +#line 98 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.str) = (char*) "on"; ;} break; - case 1032: -#line 3294 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make2((yyvsp[(1) - (3)].node), makeString((yyvsp[(3) - (3)].str))); ;} + case 1135: +#line 104 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1033: -#line 3298 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].list)); ;} + case 1136: +#line 110 "third_party/libpg_query/grammar/statements/explain.y" + { + (yyval.defelt) = makeDefElem((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); + ;} break; - case 1034: -#line 3299 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].list)); ;} + case 1137: +#line 117 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1035: -#line 3302 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(3) - (4)].list); ;} + case 1138: +#line 118 "third_party/libpg_query/grammar/statements/explain.y" + { (yyval.str) = (char*) "analyze"; ;} break; - case 1036: -#line 3303 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(2) - (2)].list)); ;} + case 1139: +#line 10 "third_party/libpg_query/grammar/statements/create_sequence.y" + { + PGCreateSeqStmt *n = makeNode(PGCreateSeqStmt); + (yyvsp[(4) - (5)].range)->relpersistence = (yyvsp[(2) - (5)].ival); + n->sequence = (yyvsp[(4) - (5)].range); + n->options = (yyvsp[(5) - (5)].list); + n->ownerId = InvalidOid; + n->onconflict = PG_ERROR_ON_CONFLICT; + (yyval.node) = (PGNode *)n; + ;} break; - case 1037: -#line 3304 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NULL; ;} + case 1140: +#line 20 "third_party/libpg_query/grammar/statements/create_sequence.y" + { + PGCreateSeqStmt *n = makeNode(PGCreateSeqStmt); + (yyvsp[(7) - (8)].range)->relpersistence = (yyvsp[(2) - (8)].ival); + n->sequence = (yyvsp[(7) - (8)].range); + n->options = (yyvsp[(8) - (8)].list); + n->ownerId = InvalidOid; + n->onconflict = PG_IGNORE_ON_CONFLICT; + (yyval.node) = (PGNode *)n; + ;} break; - case 1038: -#line 3314 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].range)); ;} + case 1141: +#line 32 "third_party/libpg_query/grammar/statements/create_sequence.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1039: -#line 3315 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].range)); ;} + case 1142: +#line 33 "third_party/libpg_query/grammar/statements/create_sequence.y" + { (yyval.list) = NIL; ;} break; - case 1040: -#line 3327 "third_party/libpg_query/grammar/statements/select.y" + case 1143: +#line 10 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - (yyval.range) = makeRangeVar(NULL, (yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); + PGAlterSeqStmt *n = makeNode(PGAlterSeqStmt); + n->sequence = (yyvsp[(3) - (4)].range); + n->options = (yyvsp[(4) - (4)].list); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; ;} break; - case 1041: -#line 3331 "third_party/libpg_query/grammar/statements/select.y" + case 1144: +#line 18 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - check_qualified_name((yyvsp[(2) - (2)].list), yyscanner); - (yyval.range) = makeRangeVar(NULL, NULL, (yylsp[(1) - (2)])); - switch (list_length((yyvsp[(2) - (2)].list))) - { - case 1: - (yyval.range)->catalogname = NULL; - (yyval.range)->schemaname = (yyvsp[(1) - (2)].str); - (yyval.range)->relname = strVal(linitial((yyvsp[(2) - (2)].list))); - break; - case 2: - (yyval.range)->catalogname = (yyvsp[(1) - (2)].str); - (yyval.range)->schemaname = strVal(linitial((yyvsp[(2) - (2)].list))); - (yyval.range)->relname = strVal(lsecond((yyvsp[(2) - (2)].list))); - break; - default: - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("improper qualified name (too many dotted names): %s", - NameListToString(lcons(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].list)))), - parser_errposition((yylsp[(1) - (2)])))); - break; - } + PGAlterSeqStmt *n = makeNode(PGAlterSeqStmt); + n->sequence = (yyvsp[(5) - (6)].range); + n->options = (yyvsp[(6) - (6)].list); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; ;} break; - case 1042: -#line 3358 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} + case 1145: +#line 29 "third_party/libpg_query/grammar/statements/alter_sequence.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; - case 1043: -#line 3360 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeString((yyvsp[(3) - (3)].str))); ;} + case 1146: +#line 30 "third_party/libpg_query/grammar/statements/alter_sequence.y" + { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].defelt)); ;} break; - case 1044: -#line 3364 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1147: +#line 34 "third_party/libpg_query/grammar/statements/alter_sequence.y" + {;} break; - case 1045: -#line 3366 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1148: +#line 35 "third_party/libpg_query/grammar/statements/alter_sequence.y" + {;} break; - case 1046: -#line 3377 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} + case 1149: +#line 36 "third_party/libpg_query/grammar/statements/alter_sequence.y" + {;} break; - case 1047: -#line 3380 "third_party/libpg_query/grammar/statements/select.y" - { - (yyval.list) = check_func_name(lcons(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].list)), - yyscanner); - ;} + case 1150: +#line 41 "third_party/libpg_query/grammar/statements/alter_sequence.y" + { (yyval.value) = makeFloat((yyvsp[(1) - (1)].str)); ;} break; - case 1048: -#line 3391 "third_party/libpg_query/grammar/statements/select.y" + case 1151: +#line 42 "third_party/libpg_query/grammar/statements/alter_sequence.y" + { (yyval.value) = makeFloat((yyvsp[(2) - (2)].str)); ;} + break; + + case 1152: +#line 44 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - (yyval.node) = makeIntConst((yyvsp[(1) - (1)].ival), (yylsp[(1) - (1)])); + (yyval.value) = makeFloat((yyvsp[(2) - (2)].str)); + doNegateFloat((yyval.value)); ;} break; - case 1049: -#line 3395 "third_party/libpg_query/grammar/statements/select.y" + case 1153: +#line 48 "third_party/libpg_query/grammar/statements/alter_sequence.y" + { (yyval.value) = makeInteger((yyvsp[(1) - (1)].ival)); ;} + break; + + case 1154: +#line 53 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - (yyval.node) = makeFloatConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); + (yyval.defelt) = makeDefElem("as", (PGNode *)(yyvsp[(2) - (2)].typnam), (yylsp[(1) - (2)])); ;} break; - case 1050: -#line 3399 "third_party/libpg_query/grammar/statements/select.y" + case 1155: +#line 57 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - if ((yyvsp[(2) - (2)].list)) - { - PGAIndirection *n = makeNode(PGAIndirection); - n->arg = makeStringConst((yyvsp[(1) - (2)].str), (yylsp[(1) - (2)])); - n->indirection = check_indirection((yyvsp[(2) - (2)].list), yyscanner); - (yyval.node) = (PGNode *) n; - } - else - (yyval.node) = makeStringConst((yyvsp[(1) - (2)].str), (yylsp[(1) - (2)])); + (yyval.defelt) = makeDefElem("cache", (PGNode *)(yyvsp[(2) - (2)].value), (yylsp[(1) - (2)])); ;} break; - case 1051: -#line 3411 "third_party/libpg_query/grammar/statements/select.y" + case 1156: +#line 61 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - (yyval.node) = makeBitStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); + (yyval.defelt) = makeDefElem("cycle", (PGNode *)makeInteger(true), (yylsp[(1) - (1)])); ;} break; - case 1052: -#line 3415 "third_party/libpg_query/grammar/statements/select.y" + case 1157: +#line 65 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - /* This is a bit constant per SQL99: - * Without Feature F511, "BIT data type", - * a shall not be a - * or a . - */ - (yyval.node) = makeBitStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); + (yyval.defelt) = makeDefElem("cycle", (PGNode *)makeInteger(false), (yylsp[(1) - (2)])); ;} break; - case 1053: -#line 3424 "third_party/libpg_query/grammar/statements/select.y" + case 1158: +#line 69 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - /* generic type 'literal' syntax */ - PGTypeName *t = makeTypeNameFromNameList((yyvsp[(1) - (2)].list)); - t->location = (yylsp[(1) - (2)]); - (yyval.node) = makeStringConstCast((yyvsp[(2) - (2)].str), (yylsp[(2) - (2)]), t); + (yyval.defelt) = makeDefElem("increment", (PGNode *)(yyvsp[(3) - (3)].value), (yylsp[(1) - (3)])); ;} break; - case 1054: -#line 3431 "third_party/libpg_query/grammar/statements/select.y" + case 1159: +#line 73 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - /* generic syntax with a type modifier */ - PGTypeName *t = makeTypeNameFromNameList((yyvsp[(1) - (7)].list)); - PGListCell *lc; - - /* - * We must use func_arg_list and opt_sort_clause in the - * production to avoid reduce/reduce conflicts, but we - * don't actually wish to allow PGNamedArgExpr in this - * context, ORDER BY, nor IGNORE NULLS. - */ - foreach(lc, (yyvsp[(3) - (7)].list)) - { - PGNamedArgExpr *arg = (PGNamedArgExpr *) lfirst(lc); - - if (IsA(arg, PGNamedArgExpr)) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("type modifier cannot have parameter name"), - parser_errposition(arg->location))); - } - if ((yyvsp[(4) - (7)].list) != NIL) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("type modifier cannot have ORDER BY"), - parser_errposition((yylsp[(4) - (7)])))); - if ((yyvsp[(5) - (7)].boolean) != false) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("type modifier cannot have IGNORE NULLS"), - parser_errposition((yylsp[(5) - (7)])))); - - - t->typmods = (yyvsp[(3) - (7)].list); - t->location = (yylsp[(1) - (7)]); - (yyval.node) = makeStringConstCast((yyvsp[(7) - (7)].str), (yylsp[(7) - (7)]), t); + (yyval.defelt) = makeDefElem("maxvalue", (PGNode *)(yyvsp[(2) - (2)].value), (yylsp[(1) - (2)])); ;} break; - case 1055: -#line 3469 "third_party/libpg_query/grammar/statements/select.y" + case 1160: +#line 77 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - (yyval.node) = makeStringConstCast((yyvsp[(2) - (2)].str), (yylsp[(2) - (2)]), (yyvsp[(1) - (2)].typnam)); + (yyval.defelt) = makeDefElem("minvalue", (PGNode *)(yyvsp[(2) - (2)].value), (yylsp[(1) - (2)])); ;} break; - case 1056: -#line 3473 "third_party/libpg_query/grammar/statements/select.y" + case 1161: +#line 81 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - (yyval.node) = makeIntervalNode((yyvsp[(3) - (5)].node), (yylsp[(3) - (5)]), (yyvsp[(5) - (5)].list)); + (yyval.defelt) = makeDefElem("maxvalue", NULL, (yylsp[(1) - (2)])); ;} break; - case 1057: -#line 3477 "third_party/libpg_query/grammar/statements/select.y" + case 1162: +#line 85 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - (yyval.node) = makeIntervalNode((yyvsp[(2) - (3)].ival), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].list)); + (yyval.defelt) = makeDefElem("minvalue", NULL, (yylsp[(1) - (2)])); ;} break; - case 1058: -#line 3481 "third_party/libpg_query/grammar/statements/select.y" + case 1163: +#line 89 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - (yyval.node) = makeIntervalNode((yyvsp[(2) - (3)].str), (yylsp[(2) - (3)]), (yyvsp[(3) - (3)].list)); + (yyval.defelt) = makeDefElem("owned_by", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); ;} break; - case 1059: -#line 3485 "third_party/libpg_query/grammar/statements/select.y" + case 1164: +#line 93 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - (yyval.node) = makeBoolAConst(true, (yylsp[(1) - (1)])); + /* not documented, only used by pg_dump */ + (yyval.defelt) = makeDefElem("sequence_name", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); ;} break; - case 1060: -#line 3489 "third_party/libpg_query/grammar/statements/select.y" + case 1165: +#line 98 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - (yyval.node) = makeBoolAConst(false, (yylsp[(1) - (1)])); + (yyval.defelt) = makeDefElem("start", (PGNode *)(yyvsp[(3) - (3)].value), (yylsp[(1) - (3)])); ;} break; - case 1061: -#line 3493 "third_party/libpg_query/grammar/statements/select.y" + case 1166: +#line 102 "third_party/libpg_query/grammar/statements/alter_sequence.y" { - (yyval.node) = makeNullAConst((yylsp[(1) - (1)])); + (yyval.defelt) = makeDefElem("restart", NULL, (yylsp[(1) - (1)])); ;} break; - case 1062: -#line 3498 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} + case 1167: +#line 106 "third_party/libpg_query/grammar/statements/alter_sequence.y" + { + (yyval.defelt) = makeDefElem("restart", (PGNode *)(yyvsp[(3) - (3)].value), (yylsp[(1) - (3)])); + ;} break; - case 1063: -#line 3499 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1168: +#line 112 "third_party/libpg_query/grammar/statements/alter_sequence.y" + {;} break; - case 1064: -#line 3515 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1169: +#line 113 "third_party/libpg_query/grammar/statements/alter_sequence.y" + {;} break; - case 1065: -#line 3516 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + case 1170: +#line 117 "third_party/libpg_query/grammar/statements/alter_sequence.y" + { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} break; - case 1066: -#line 3517 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + case 1171: +#line 118 "third_party/libpg_query/grammar/statements/alter_sequence.y" + { (yyval.ival) = + (yyvsp[(2) - (2)].ival); ;} break; - case 1067: -#line 3520 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1172: +#line 119 "third_party/libpg_query/grammar/statements/alter_sequence.y" + { (yyval.ival) = - (yyvsp[(2) - (2)].ival); ;} break; - case 1068: -#line 3521 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1173: +#line 8 "third_party/libpg_query/grammar/statements/alter_schema.y" + { + PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); + n->objectType = PG_OBJECT_TABLE; + n->relation = (yyvsp[(3) - (6)].range); + n->newschema = (yyvsp[(6) - (6)].str); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; + ;} break; - case 1069: -#line 3527 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1174: +#line 17 "third_party/libpg_query/grammar/statements/alter_schema.y" + { + PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); + n->objectType = PG_OBJECT_TABLE; + n->relation = (yyvsp[(5) - (8)].range); + n->newschema = (yyvsp[(8) - (8)].str); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; + ;} break; - case 1070: -#line 3528 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + case 1175: +#line 26 "third_party/libpg_query/grammar/statements/alter_schema.y" + { + PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); + n->objectType = PG_OBJECT_SEQUENCE; + n->relation = (yyvsp[(3) - (6)].range); + n->newschema = (yyvsp[(6) - (6)].str); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; + ;} break; - case 1071: -#line 3529 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + case 1176: +#line 35 "third_party/libpg_query/grammar/statements/alter_schema.y" + { + PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); + n->objectType = PG_OBJECT_SEQUENCE; + n->relation = (yyvsp[(5) - (8)].range); + n->newschema = (yyvsp[(8) - (8)].str); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; + ;} break; - case 1072: -#line 3532 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1177: +#line 44 "third_party/libpg_query/grammar/statements/alter_schema.y" + { + PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); + n->objectType = PG_OBJECT_VIEW; + n->relation = (yyvsp[(3) - (6)].range); + n->newschema = (yyvsp[(6) - (6)].str); + n->missing_ok = false; + (yyval.node) = (PGNode *)n; + ;} break; - case 1073: -#line 3533 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + case 1178: +#line 53 "third_party/libpg_query/grammar/statements/alter_schema.y" + { + PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); + n->objectType = PG_OBJECT_VIEW; + n->relation = (yyvsp[(5) - (8)].range); + n->newschema = (yyvsp[(8) - (8)].str); + n->missing_ok = true; + (yyval.node) = (PGNode *)n; + ;} break; - case 1074: -#line 3534 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + case 1179: +#line 8 "third_party/libpg_query/grammar/statements/create_enum.y" + { + PGCreateEnumStmt *n = makeNode(PGCreateEnumStmt); + n->typeName = (yyvsp[(3) - (8)].list); + n->vals = (yyvsp[(7) - (8)].list); + (yyval.node) = (PGNode *)n; + ;} break; - case 1075: -#line 3537 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1180: +#line 17 "third_party/libpg_query/grammar/statements/create_enum.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1076: -#line 3538 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + case 1181: +#line 18 "third_party/libpg_query/grammar/statements/create_enum.y" + { (yyval.list) = NIL; ;} break; - case 1077: -#line 3539 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + case 1182: +#line 22 "third_party/libpg_query/grammar/statements/create_enum.y" + { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} break; - case 1078: -#line 3542 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString((yyvsp[(1) - (1)].str))); ;} + case 1183: +#line 24 "third_party/libpg_query/grammar/statements/create_enum.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeString((yyvsp[(3) - (3)].str))); ;} break; - case 1079: -#line 3543 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lcons(makeString((yyvsp[(1) - (2)].str)), (yyvsp[(2) - (2)].list)); ;} + case 1184: +#line 11 "third_party/libpg_query/grammar/statements/variable_set.y" + { + PGVariableSetStmt *n = (yyvsp[(2) - (2)].vsetstmt); + n->scope = VAR_SET_SCOPE_DEFAULT; + (yyval.node) = (PGNode *) n; + ;} break; - case 1080: -#line 3547 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = list_make1(makeString((yyvsp[(2) - (2)].str))); ;} + case 1185: +#line 17 "third_party/libpg_query/grammar/statements/variable_set.y" + { + PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); + n->scope = VAR_SET_SCOPE_LOCAL; + (yyval.node) = (PGNode *) n; + ;} break; - case 1081: -#line 3549 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), makeString((yyvsp[(3) - (3)].str))); ;} + case 1186: +#line 23 "third_party/libpg_query/grammar/statements/variable_set.y" + { + PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); + n->scope = VAR_SET_SCOPE_SESSION; + (yyval.node) = (PGNode *) n; + ;} break; - case 1082: -#line 3553 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = (yyvsp[(2) - (3)].list); ;} + case 1187: +#line 29 "third_party/libpg_query/grammar/statements/variable_set.y" + { + PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); + n->scope = VAR_SET_SCOPE_GLOBAL; + (yyval.node) = (PGNode *) n; + ;} break; - case 1083: -#line 3554 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.list) = NIL; ;} + case 1188: +#line 38 "third_party/libpg_query/grammar/statements/variable_set.y" + {(yyval.vsetstmt) = (yyvsp[(1) - (1)].vsetstmt);;} break; - case 1085: -#line 3565 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1189: +#line 40 "third_party/libpg_query/grammar/statements/variable_set.y" + { + PGVariableSetStmt *n = makeNode(PGVariableSetStmt); + n->kind = VAR_SET_CURRENT; + n->name = (yyvsp[(1) - (3)].str); + (yyval.vsetstmt) = n; + ;} break; - case 1086: -#line 3566 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + case 1190: +#line 48 "third_party/libpg_query/grammar/statements/variable_set.y" + { + PGVariableSetStmt *n = makeNode(PGVariableSetStmt); + n->kind = VAR_SET_VALUE; + n->name = (char*) "timezone"; + if ((yyvsp[(3) - (3)].node) != NULL) + n->args = list_make1((yyvsp[(3) - (3)].node)); + else + n->kind = VAR_SET_DEFAULT; + (yyval.vsetstmt) = n; + ;} break; - case 1087: -#line 3567 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + case 1191: +#line 59 "third_party/libpg_query/grammar/statements/variable_set.y" + { + PGVariableSetStmt *n = makeNode(PGVariableSetStmt); + n->kind = VAR_SET_VALUE; + n->name = (char*) "search_path"; + n->args = list_make1(makeStringConst((yyvsp[(2) - (2)].str), (yylsp[(2) - (2)]))); + (yyval.vsetstmt) = n; + ;} break; - case 1088: -#line 3568 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} + case 1192: +#line 71 "third_party/libpg_query/grammar/statements/variable_set.y" + { + PGVariableSetStmt *n = makeNode(PGVariableSetStmt); + n->kind = VAR_SET_VALUE; + n->name = (yyvsp[(1) - (3)].str); + n->args = (yyvsp[(3) - (3)].list); + (yyval.vsetstmt) = n; + ;} break; - case 1089: -#line 3571 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1193: +#line 79 "third_party/libpg_query/grammar/statements/variable_set.y" + { + PGVariableSetStmt *n = makeNode(PGVariableSetStmt); + n->kind = VAR_SET_VALUE; + n->name = (yyvsp[(1) - (3)].str); + n->args = (yyvsp[(3) - (3)].list); + (yyval.vsetstmt) = n; + ;} break; - case 1090: -#line 3572 "third_party/libpg_query/grammar/statements/select.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1194: +#line 87 "third_party/libpg_query/grammar/statements/variable_set.y" + { + PGVariableSetStmt *n = makeNode(PGVariableSetStmt); + n->kind = VAR_SET_DEFAULT; + n->name = (yyvsp[(1) - (3)].str); + (yyval.vsetstmt) = n; + ;} break; - case 1091: -#line 8 "third_party/libpg_query/grammar/statements/prepare.y" + case 1195: +#line 94 "third_party/libpg_query/grammar/statements/variable_set.y" { - PGPrepareStmt *n = makeNode(PGPrepareStmt); - n->name = (yyvsp[(2) - (5)].str); - n->argtypes = (yyvsp[(3) - (5)].list); - n->query = (yyvsp[(5) - (5)].node); - (yyval.node) = (PGNode *) n; + PGVariableSetStmt *n = makeNode(PGVariableSetStmt); + n->kind = VAR_SET_DEFAULT; + n->name = (yyvsp[(1) - (3)].str); + (yyval.vsetstmt) = n; ;} break; - case 1092: -#line 18 "third_party/libpg_query/grammar/statements/prepare.y" - { (yyval.list) = (yyvsp[(2) - (3)].list); ;} + case 1196: +#line 104 "third_party/libpg_query/grammar/statements/variable_set.y" + { (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 1093: -#line 19 "third_party/libpg_query/grammar/statements/prepare.y" - { (yyval.list) = NIL; ;} + case 1197: +#line 106 "third_party/libpg_query/grammar/statements/variable_set.y" + { (yyval.node) = makeAConst((yyvsp[(1) - (1)].value), (yylsp[(1) - (1)])); ;} break; - case 1098: -#line 8 "third_party/libpg_query/grammar/statements/create_schema.y" + case 1198: +#line 112 "third_party/libpg_query/grammar/statements/variable_set.y" { - PGCreateSchemaStmt *n = makeNode(PGCreateSchemaStmt); - /* ...but not both */ - n->schemaname = (yyvsp[(3) - (4)].str); - n->schemaElts = (yyvsp[(4) - (4)].list); - n->onconflict = PG_ERROR_ON_CONFLICT; - (yyval.node) = (PGNode *)n; + (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 1099: -#line 17 "third_party/libpg_query/grammar/statements/create_schema.y" + case 1199: +#line 116 "third_party/libpg_query/grammar/statements/variable_set.y" { - PGCreateSchemaStmt *n = makeNode(PGCreateSchemaStmt); - /* ...but not here */ - n->schemaname = (yyvsp[(6) - (7)].str); - if ((yyvsp[(7) - (7)].list) != NIL) - ereport(ERROR, - (errcode(PG_ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("CREATE SCHEMA IF NOT EXISTS cannot include schema elements"), - parser_errposition((yylsp[(7) - (7)])))); - n->schemaElts = (yyvsp[(7) - (7)].list); - n->onconflict = PG_IGNORE_ON_CONFLICT; - (yyval.node) = (PGNode *)n; + (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} break; - case 1100: -#line 35 "third_party/libpg_query/grammar/statements/create_schema.y" + case 1200: +#line 120 "third_party/libpg_query/grammar/statements/variable_set.y" { - if ((yyloc) < 0) /* see comments for YYLLOC_DEFAULT */ - (yyloc) = (yylsp[(2) - (2)]); - (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].node)); + PGTypeName *t = (yyvsp[(1) - (3)].typnam); + if ((yyvsp[(3) - (3)].list) != NIL) + { + PGAConst *n = (PGAConst *) linitial((yyvsp[(3) - (3)].list)); + if ((n->val.val.ival & ~(INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE))) != 0) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("time zone interval must be HOUR or HOUR TO MINUTE"), + parser_errposition((yylsp[(3) - (3)])))); + } + t->typmods = (yyvsp[(3) - (3)].list); + (yyval.node) = makeStringConstCast((yyvsp[(2) - (3)].str), (yylsp[(2) - (3)]), t); ;} break; - case 1101: -#line 41 "third_party/libpg_query/grammar/statements/create_schema.y" - { (yyval.list) = NIL; ;} + case 1201: +#line 135 "third_party/libpg_query/grammar/statements/variable_set.y" + { + PGTypeName *t = (yyvsp[(1) - (5)].typnam); + t->typmods = list_make2(makeIntConst(INTERVAL_FULL_RANGE, -1), + makeIntConst((yyvsp[(3) - (5)].ival), (yylsp[(3) - (5)]))); + (yyval.node) = makeStringConstCast((yyvsp[(5) - (5)].str), (yylsp[(5) - (5)]), t); + ;} break; - case 1106: + case 1202: +#line 141 "third_party/libpg_query/grammar/statements/variable_set.y" + { (yyval.node) = makeAConst((yyvsp[(1) - (1)].value), (yylsp[(1) - (1)])); ;} + break; + + case 1203: +#line 142 "third_party/libpg_query/grammar/statements/variable_set.y" + { (yyval.node) = NULL; ;} + break; + + case 1204: +#line 143 "third_party/libpg_query/grammar/statements/variable_set.y" + { (yyval.node) = NULL; ;} + break; + + case 1205: +#line 147 "third_party/libpg_query/grammar/statements/variable_set.y" + { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} + break; + + case 1206: +#line 148 "third_party/libpg_query/grammar/statements/variable_set.y" + { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} + break; + + case 1207: #line 11 "third_party/libpg_query/grammar/statements/index.y" { PGIndexStmt *n = makeNode(PGIndexStmt); @@ -254258,7 +266209,7 @@ YYLTYPE yylloc; ;} break; - case 1107: + case 1208: #line 36 "third_party/libpg_query/grammar/statements/index.y" { PGIndexStmt *n = makeNode(PGIndexStmt); @@ -254284,134 +266235,62 @@ YYLTYPE yylloc; ;} break; - case 1108: + case 1209: #line 62 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1109: + case 1210: #line 66 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = (yyvsp[(2) - (2)].str); ;} break; - case 1110: + case 1211: #line 67 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = (char*) DEFAULT_INDEX_TYPE; ;} break; - case 1111: + case 1212: #line 72 "third_party/libpg_query/grammar/statements/index.y" { (yyval.boolean) = true; ;} break; - case 1112: + case 1213: #line 73 "third_party/libpg_query/grammar/statements/index.y" { (yyval.boolean) = false; ;} break; - case 1113: + case 1214: #line 78 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1114: + case 1215: #line 79 "third_party/libpg_query/grammar/statements/index.y" { (yyval.str) = NULL; ;} break; - case 1115: + case 1216: #line 83 "third_party/libpg_query/grammar/statements/index.y" { (yyval.list) = (yyvsp[(2) - (2)].list); ;} break; - case 1116: + case 1217: #line 84 "third_party/libpg_query/grammar/statements/index.y" { (yyval.list) = NIL; ;} break; - case 1117: + case 1218: #line 89 "third_party/libpg_query/grammar/statements/index.y" { (yyval.boolean) = true; ;} break; - case 1118: + case 1219: #line 90 "third_party/libpg_query/grammar/statements/index.y" { (yyval.boolean) = false; ;} break; - case 1119: -#line 8 "third_party/libpg_query/grammar/statements/alter_schema.y" - { - PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); - n->objectType = PG_OBJECT_TABLE; - n->relation = (yyvsp[(3) - (6)].range); - n->newschema = (yyvsp[(6) - (6)].str); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} - break; - - case 1120: -#line 17 "third_party/libpg_query/grammar/statements/alter_schema.y" - { - PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); - n->objectType = PG_OBJECT_TABLE; - n->relation = (yyvsp[(5) - (8)].range); - n->newschema = (yyvsp[(8) - (8)].str); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} - break; - - case 1121: -#line 26 "third_party/libpg_query/grammar/statements/alter_schema.y" - { - PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); - n->objectType = PG_OBJECT_SEQUENCE; - n->relation = (yyvsp[(3) - (6)].range); - n->newschema = (yyvsp[(6) - (6)].str); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} - break; - - case 1122: -#line 35 "third_party/libpg_query/grammar/statements/alter_schema.y" - { - PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); - n->objectType = PG_OBJECT_SEQUENCE; - n->relation = (yyvsp[(5) - (8)].range); - n->newschema = (yyvsp[(8) - (8)].str); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} - break; - - case 1123: -#line 44 "third_party/libpg_query/grammar/statements/alter_schema.y" - { - PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); - n->objectType = PG_OBJECT_VIEW; - n->relation = (yyvsp[(3) - (6)].range); - n->newschema = (yyvsp[(6) - (6)].str); - n->missing_ok = false; - (yyval.node) = (PGNode *)n; - ;} - break; - - case 1124: -#line 53 "third_party/libpg_query/grammar/statements/alter_schema.y" - { - PGAlterObjectSchemaStmt *n = makeNode(PGAlterObjectSchemaStmt); - n->objectType = PG_OBJECT_VIEW; - n->relation = (yyvsp[(5) - (8)].range); - n->newschema = (yyvsp[(8) - (8)].str); - n->missing_ok = true; - (yyval.node) = (PGNode *)n; - ;} - break; - - case 1125: + case 1220: #line 6 "third_party/libpg_query/grammar/statements/checkpoint.y" { PGCheckPointStmt *n = makeNode(PGCheckPointStmt); @@ -254420,7 +266299,7 @@ YYLTYPE yylloc; ;} break; - case 1126: + case 1221: #line 12 "third_party/libpg_query/grammar/statements/checkpoint.y" { PGCheckPointStmt *n = makeNode(PGCheckPointStmt); @@ -254429,932 +266308,345 @@ YYLTYPE yylloc; ;} break; - case 1127: -#line 8 "third_party/libpg_query/grammar/statements/export.y" + case 1222: +#line 7 "third_party/libpg_query/grammar/statements/call.y" { - PGExportStmt *n = makeNode(PGExportStmt); - n->filename = (yyvsp[(3) - (4)].str); - n->options = NIL; - if ((yyvsp[(4) - (4)].list)) { - n->options = list_concat(n->options, (yyvsp[(4) - (4)].list)); - } - (yyval.node) = (PGNode *)n; + PGCallStmt *n = makeNode(PGCallStmt); + n->func = (yyvsp[(2) - (2)].node); + (yyval.node) = (PGNode *) n; ;} break; - case 1128: -#line 21 "third_party/libpg_query/grammar/statements/export.y" + case 1223: +#line 3 "third_party/libpg_query/grammar/statements/copy.y" { - PGImportStmt *n = makeNode(PGImportStmt); - n->filename = (yyvsp[(3) - (3)].str); - (yyval.node) = (PGNode *)n; - ;} - break; + PGCopyStmt *n = makeNode(PGCopyStmt); + n->relation = (yyvsp[(3) - (11)].range); + n->query = NULL; + n->attlist = (yyvsp[(4) - (11)].list); + n->is_from = (yyvsp[(6) - (11)].boolean); + n->is_program = (yyvsp[(7) - (11)].boolean); + n->filename = (yyvsp[(8) - (11)].str); + + if (n->is_program && n->filename == NULL) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("STDIN/STDOUT not allowed with PROGRAM"), + parser_errposition((yylsp[(8) - (11)])))); - case 1129: -#line 10 "third_party/libpg_query/grammar/statements/explain.y" - { - PGExplainStmt *n = makeNode(PGExplainStmt); - n->query = (yyvsp[(2) - (2)].node); n->options = NIL; - (yyval.node) = (PGNode *) n; + /* Concatenate user-supplied flags */ + if ((yyvsp[(2) - (11)].defelt)) + n->options = lappend(n->options, (yyvsp[(2) - (11)].defelt)); + if ((yyvsp[(5) - (11)].defelt)) + n->options = lappend(n->options, (yyvsp[(5) - (11)].defelt)); + if ((yyvsp[(9) - (11)].defelt)) + n->options = lappend(n->options, (yyvsp[(9) - (11)].defelt)); + if ((yyvsp[(11) - (11)].list)) + n->options = list_concat(n->options, (yyvsp[(11) - (11)].list)); + (yyval.node) = (PGNode *)n; ;} break; - case 1130: -#line 17 "third_party/libpg_query/grammar/statements/explain.y" + case 1224: +#line 31 "third_party/libpg_query/grammar/statements/copy.y" { - PGExplainStmt *n = makeNode(PGExplainStmt); - n->query = (yyvsp[(4) - (4)].node); - n->options = list_make1(makeDefElem("analyze", NULL, (yylsp[(2) - (4)]))); - if ((yyvsp[(3) - (4)].boolean)) - n->options = lappend(n->options, - makeDefElem("verbose", NULL, (yylsp[(3) - (4)]))); - (yyval.node) = (PGNode *) n; - ;} - break; + PGCopyStmt *n = makeNode(PGCopyStmt); + n->relation = NULL; + n->query = (yyvsp[(3) - (9)].node); + n->attlist = NIL; + n->is_from = false; + n->is_program = (yyvsp[(6) - (9)].boolean); + n->filename = (yyvsp[(7) - (9)].str); + n->options = (yyvsp[(9) - (9)].list); - case 1131: -#line 27 "third_party/libpg_query/grammar/statements/explain.y" - { - PGExplainStmt *n = makeNode(PGExplainStmt); - n->query = (yyvsp[(3) - (3)].node); - n->options = list_make1(makeDefElem("verbose", NULL, (yylsp[(2) - (3)]))); - (yyval.node) = (PGNode *) n; - ;} - break; + if (n->is_program && n->filename == NULL) + ereport(ERROR, + (errcode(PG_ERRCODE_SYNTAX_ERROR), + errmsg("STDIN/STDOUT not allowed with PROGRAM"), + parser_errposition((yylsp[(5) - (9)])))); - case 1132: -#line 34 "third_party/libpg_query/grammar/statements/explain.y" - { - PGExplainStmt *n = makeNode(PGExplainStmt); - n->query = (yyvsp[(5) - (5)].node); - n->options = (yyvsp[(3) - (5)].list); - (yyval.node) = (PGNode *) n; + (yyval.node) = (PGNode *)n; ;} break; - case 1133: -#line 44 "third_party/libpg_query/grammar/statements/explain.y" + case 1225: +#line 53 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.boolean) = true; ;} break; - case 1134: -#line 45 "third_party/libpg_query/grammar/statements/explain.y" + case 1226: +#line 54 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.boolean) = false; ;} break; - case 1135: -#line 50 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); ;} - break; - - case 1136: -#line 51 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.node) = (PGNode *) (yyvsp[(1) - (1)].value); ;} - break; - - case 1137: -#line 52 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.node) = NULL; ;} - break; - - case 1143: -#line 65 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} - break; - - case 1144: -#line 66 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} - break; - - case 1145: -#line 67 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.str) = pstrdup((yyvsp[(1) - (1)].keyword)); ;} - break; - - case 1146: -#line 72 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} - break; - - case 1147: -#line 73 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} - break; - - case 1148: -#line 79 "third_party/libpg_query/grammar/statements/explain.y" - { - (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); - ;} - break; - - case 1149: -#line 83 "third_party/libpg_query/grammar/statements/explain.y" - { - (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); - ;} - break; - - case 1150: -#line 90 "third_party/libpg_query/grammar/statements/explain.y" - {;} - break; - - case 1151: -#line 91 "third_party/libpg_query/grammar/statements/explain.y" - {;} - break; - - case 1152: -#line 96 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.str) = (char*) "true"; ;} - break; - - case 1153: -#line 97 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.str) = (char*) "false"; ;} - break; - - case 1154: -#line 98 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.str) = (char*) "on"; ;} - break; - - case 1155: -#line 104 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} - break; - - case 1156: -#line 110 "third_party/libpg_query/grammar/statements/explain.y" - { - (yyval.defelt) = makeDefElem((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); - ;} - break; - - case 1157: -#line 117 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} - break; - - case 1158: -#line 118 "third_party/libpg_query/grammar/statements/explain.y" - { (yyval.str) = (char*) "analyze"; ;} - break; - - case 1159: -#line 11 "third_party/libpg_query/grammar/statements/variable_set.y" - { - PGVariableSetStmt *n = (yyvsp[(2) - (2)].vsetstmt); - n->scope = VAR_SET_SCOPE_DEFAULT; - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1160: -#line 17 "third_party/libpg_query/grammar/statements/variable_set.y" - { - PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); - n->scope = VAR_SET_SCOPE_LOCAL; - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1161: -#line 23 "third_party/libpg_query/grammar/statements/variable_set.y" - { - PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); - n->scope = VAR_SET_SCOPE_SESSION; - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1162: -#line 29 "third_party/libpg_query/grammar/statements/variable_set.y" + case 1227: +#line 60 "third_party/libpg_query/grammar/statements/copy.y" { - PGVariableSetStmt *n = (yyvsp[(3) - (3)].vsetstmt); - n->scope = VAR_SET_SCOPE_GLOBAL; - (yyval.node) = (PGNode *) n; + (yyval.defelt) = makeDefElem("delimiter", (PGNode *)makeString((yyvsp[(3) - (3)].str)), (yylsp[(2) - (3)])); ;} break; - case 1163: -#line 38 "third_party/libpg_query/grammar/statements/variable_set.y" - {(yyval.vsetstmt) = (yyvsp[(1) - (1)].vsetstmt);;} - break; - - case 1164: -#line 40 "third_party/libpg_query/grammar/statements/variable_set.y" - { - PGVariableSetStmt *n = makeNode(PGVariableSetStmt); - n->kind = VAR_SET_CURRENT; - n->name = (yyvsp[(1) - (3)].str); - (yyval.vsetstmt) = n; - ;} + case 1228: +#line 63 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.defelt) = NULL; ;} break; - case 1165: -#line 48 "third_party/libpg_query/grammar/statements/variable_set.y" + case 1229: +#line 69 "third_party/libpg_query/grammar/statements/copy.y" { - PGVariableSetStmt *n = makeNode(PGVariableSetStmt); - n->kind = VAR_SET_VALUE; - n->name = (char*) "timezone"; - if ((yyvsp[(3) - (3)].node) != NULL) - n->args = list_make1((yyvsp[(3) - (3)].node)); - else - n->kind = VAR_SET_DEFAULT; - (yyval.vsetstmt) = n; + (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} break; - case 1166: -#line 59 "third_party/libpg_query/grammar/statements/variable_set.y" + case 1230: +#line 73 "third_party/libpg_query/grammar/statements/copy.y" { - PGVariableSetStmt *n = makeNode(PGVariableSetStmt); - n->kind = VAR_SET_VALUE; - n->name = (char*) "search_path"; - n->args = list_make1(makeStringConst((yyvsp[(2) - (2)].str), (yylsp[(2) - (2)]))); - (yyval.vsetstmt) = n; + (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} break; - case 1167: -#line 71 "third_party/libpg_query/grammar/statements/variable_set.y" - { - PGVariableSetStmt *n = makeNode(PGVariableSetStmt); - n->kind = VAR_SET_VALUE; - n->name = (yyvsp[(1) - (3)].str); - n->args = (yyvsp[(3) - (3)].list); - (yyval.vsetstmt) = n; - ;} + case 1231: +#line 80 "third_party/libpg_query/grammar/statements/copy.y" + {;} break; - case 1168: -#line 79 "third_party/libpg_query/grammar/statements/variable_set.y" - { - PGVariableSetStmt *n = makeNode(PGVariableSetStmt); - n->kind = VAR_SET_VALUE; - n->name = (yyvsp[(1) - (3)].str); - n->args = (yyvsp[(3) - (3)].list); - (yyval.vsetstmt) = n; - ;} + case 1232: +#line 81 "third_party/libpg_query/grammar/statements/copy.y" + {;} break; - case 1169: -#line 87 "third_party/libpg_query/grammar/statements/variable_set.y" - { - PGVariableSetStmt *n = makeNode(PGVariableSetStmt); - n->kind = VAR_SET_DEFAULT; - n->name = (yyvsp[(1) - (3)].str); - (yyval.vsetstmt) = n; - ;} + case 1233: +#line 85 "third_party/libpg_query/grammar/statements/copy.y" + {;} break; - case 1170: -#line 94 "third_party/libpg_query/grammar/statements/variable_set.y" - { - PGVariableSetStmt *n = makeNode(PGVariableSetStmt); - n->kind = VAR_SET_DEFAULT; - n->name = (yyvsp[(1) - (3)].str); - (yyval.vsetstmt) = n; - ;} + case 1234: +#line 86 "third_party/libpg_query/grammar/statements/copy.y" + {;} break; - case 1171: -#line 104 "third_party/libpg_query/grammar/statements/variable_set.y" - { (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); ;} + case 1235: +#line 91 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.boolean) = true; ;} break; - case 1172: -#line 106 "third_party/libpg_query/grammar/statements/variable_set.y" - { (yyval.node) = makeAConst((yyvsp[(1) - (1)].value), (yylsp[(1) - (1)])); ;} + case 1236: +#line 92 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.boolean) = false; ;} break; - case 1173: -#line 112 "third_party/libpg_query/grammar/statements/variable_set.y" - { - (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); - ;} + case 1237: +#line 96 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.list) = (yyvsp[(1) - (1)].list); ;} break; - case 1174: -#line 116 "third_party/libpg_query/grammar/statements/variable_set.y" - { - (yyval.node) = makeStringConst((yyvsp[(1) - (1)].str), (yylsp[(1) - (1)])); - ;} + case 1238: +#line 97 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.list) = (yyvsp[(2) - (3)].list); ;} break; - case 1175: -#line 120 "third_party/libpg_query/grammar/statements/variable_set.y" - { - PGTypeName *t = (yyvsp[(1) - (3)].typnam); - if ((yyvsp[(3) - (3)].list) != NIL) - { - PGAConst *n = (PGAConst *) linitial((yyvsp[(3) - (3)].list)); - if ((n->val.val.ival & ~(INTERVAL_MASK(HOUR) | INTERVAL_MASK(MINUTE))) != 0) - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("time zone interval must be HOUR or HOUR TO MINUTE"), - parser_errposition((yylsp[(3) - (3)])))); - } - t->typmods = (yyvsp[(3) - (3)].list); - (yyval.node) = makeStringConstCast((yyvsp[(2) - (3)].str), (yylsp[(2) - (3)]), t); - ;} + case 1239: +#line 102 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); ;} break; - case 1176: -#line 135 "third_party/libpg_query/grammar/statements/variable_set.y" - { - PGTypeName *t = (yyvsp[(1) - (5)].typnam); - t->typmods = list_make2(makeIntConst(INTERVAL_FULL_RANGE, -1), - makeIntConst((yyvsp[(3) - (5)].ival), (yylsp[(3) - (5)]))); - (yyval.node) = makeStringConstCast((yyvsp[(5) - (5)].str), (yylsp[(5) - (5)]), t); - ;} + case 1240: +#line 103 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.node) = (PGNode *) (yyvsp[(1) - (1)].value); ;} break; - case 1177: -#line 141 "third_party/libpg_query/grammar/statements/variable_set.y" - { (yyval.node) = makeAConst((yyvsp[(1) - (1)].value), (yylsp[(1) - (1)])); ;} + case 1241: +#line 104 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.node) = (PGNode *) makeNode(PGAStar); ;} break; - case 1178: -#line 142 "third_party/libpg_query/grammar/statements/variable_set.y" - { (yyval.node) = NULL; ;} + case 1242: +#line 105 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.node) = (PGNode *) (yyvsp[(2) - (3)].list); ;} break; - case 1179: -#line 143 "third_party/libpg_query/grammar/statements/variable_set.y" + case 1243: +#line 106 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.node) = NULL; ;} break; - case 1180: -#line 147 "third_party/libpg_query/grammar/statements/variable_set.y" - { (yyval.list) = list_make1((yyvsp[(1) - (1)].node)); ;} - break; - - case 1181: -#line 148 "third_party/libpg_query/grammar/statements/variable_set.y" - { (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].node)); ;} - break; - - case 1182: -#line 8 "third_party/libpg_query/grammar/statements/load.y" + case 1244: +#line 112 "third_party/libpg_query/grammar/statements/copy.y" { - PGLoadStmt *n = makeNode(PGLoadStmt); - n->filename = (yyvsp[(2) - (2)].str); - n->load_type = PG_LOAD_TYPE_LOAD; - (yyval.node) = (PGNode *)n; + (yyval.defelt) = makeDefElem((yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].node), (yylsp[(1) - (2)])); ;} break; - case 1183: -#line 14 "third_party/libpg_query/grammar/statements/load.y" + case 1245: +#line 120 "third_party/libpg_query/grammar/statements/copy.y" { - PGLoadStmt *n = makeNode(PGLoadStmt); - n->filename = (yyvsp[(2) - (2)].str); - n->load_type = PG_LOAD_TYPE_INSTALL; - (yyval.node) = (PGNode *)n; + (yyval.defelt) = makeDefElem("oids", (PGNode *)makeInteger(true), (yylsp[(1) - (2)])); ;} break; - case 1184: -#line 20 "third_party/libpg_query/grammar/statements/load.y" - { - PGLoadStmt *n = makeNode(PGLoadStmt); - n->filename = (yyvsp[(3) - (3)].str); - n->load_type = PG_LOAD_TYPE_FORCE_INSTALL; - (yyval.node) = (PGNode *)n; - ;} + case 1246: +#line 123 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.defelt) = NULL; ;} break; - case 1185: -#line 28 "third_party/libpg_query/grammar/statements/load.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1247: +#line 128 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.list) = lappend((yyvsp[(1) - (2)].list), (yyvsp[(2) - (2)].defelt)); ;} break; - case 1186: -#line 29 "third_party/libpg_query/grammar/statements/load.y" - { (yyval.str) = (yyvsp[(1) - (1)].str); ;} + case 1248: +#line 129 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.list) = NIL; ;} break; - case 1187: -#line 9 "third_party/libpg_query/grammar/statements/vacuum.y" + case 1249: +#line 135 "third_party/libpg_query/grammar/statements/copy.y" { - PGVacuumStmt *n = makeNode(PGVacuumStmt); - n->options = PG_VACOPT_VACUUM; - if ((yyvsp[(2) - (4)].boolean)) - n->options |= PG_VACOPT_FULL; - if ((yyvsp[(3) - (4)].boolean)) - n->options |= PG_VACOPT_FREEZE; - if ((yyvsp[(4) - (4)].boolean)) - n->options |= PG_VACOPT_VERBOSE; - n->relation = NULL; - n->va_cols = NIL; - (yyval.node) = (PGNode *)n; + (yyval.defelt) = makeDefElem("format", (PGNode *)makeString("binary"), (yylsp[(1) - (1)])); ;} break; - case 1188: -#line 23 "third_party/libpg_query/grammar/statements/vacuum.y" - { - PGVacuumStmt *n = makeNode(PGVacuumStmt); - n->options = PG_VACOPT_VACUUM; - if ((yyvsp[(2) - (5)].boolean)) - n->options |= PG_VACOPT_FULL; - if ((yyvsp[(3) - (5)].boolean)) - n->options |= PG_VACOPT_FREEZE; - if ((yyvsp[(4) - (5)].boolean)) - n->options |= PG_VACOPT_VERBOSE; - n->relation = (yyvsp[(5) - (5)].range); - n->va_cols = NIL; - (yyval.node) = (PGNode *)n; - ;} + case 1250: +#line 138 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.defelt) = NULL; ;} break; - case 1189: -#line 37 "third_party/libpg_query/grammar/statements/vacuum.y" + case 1251: +#line 144 "third_party/libpg_query/grammar/statements/copy.y" { - PGVacuumStmt *n = (PGVacuumStmt *) (yyvsp[(5) - (5)].node); - n->options |= PG_VACOPT_VACUUM; - if ((yyvsp[(2) - (5)].boolean)) - n->options |= PG_VACOPT_FULL; - if ((yyvsp[(3) - (5)].boolean)) - n->options |= PG_VACOPT_FREEZE; - if ((yyvsp[(4) - (5)].boolean)) - n->options |= PG_VACOPT_VERBOSE; - (yyval.node) = (PGNode *)n; + (yyval.defelt) = makeDefElem("format", (PGNode *)makeString("binary"), (yylsp[(1) - (1)])); ;} break; - case 1190: -#line 49 "third_party/libpg_query/grammar/statements/vacuum.y" + case 1252: +#line 148 "third_party/libpg_query/grammar/statements/copy.y" { - PGVacuumStmt *n = makeNode(PGVacuumStmt); - n->options = PG_VACOPT_VACUUM | (yyvsp[(3) - (4)].ival); - n->relation = NULL; - n->va_cols = NIL; - (yyval.node) = (PGNode *) n; + (yyval.defelt) = makeDefElem("oids", (PGNode *)makeInteger(true), (yylsp[(1) - (1)])); ;} break; - case 1191: -#line 57 "third_party/libpg_query/grammar/statements/vacuum.y" + case 1253: +#line 152 "third_party/libpg_query/grammar/statements/copy.y" { - PGVacuumStmt *n = makeNode(PGVacuumStmt); - n->options = PG_VACOPT_VACUUM | (yyvsp[(3) - (6)].ival); - n->relation = (yyvsp[(5) - (6)].range); - n->va_cols = (yyvsp[(6) - (6)].list); - if (n->va_cols != NIL) /* implies analyze */ - n->options |= PG_VACOPT_ANALYZE; - (yyval.node) = (PGNode *) n; + (yyval.defelt) = makeDefElem("freeze", (PGNode *)makeInteger(true), (yylsp[(1) - (1)])); ;} break; - case 1192: -#line 70 "third_party/libpg_query/grammar/statements/vacuum.y" - { (yyval.ival) = PG_VACOPT_ANALYZE; ;} - break; - - case 1193: -#line 71 "third_party/libpg_query/grammar/statements/vacuum.y" - { (yyval.ival) = PG_VACOPT_VERBOSE; ;} - break; - - case 1194: -#line 72 "third_party/libpg_query/grammar/statements/vacuum.y" - { (yyval.ival) = PG_VACOPT_FREEZE; ;} - break; - - case 1195: -#line 73 "third_party/libpg_query/grammar/statements/vacuum.y" - { (yyval.ival) = PG_VACOPT_FULL; ;} - break; - - case 1196: -#line 75 "third_party/libpg_query/grammar/statements/vacuum.y" + case 1254: +#line 156 "third_party/libpg_query/grammar/statements/copy.y" { - if (strcmp((yyvsp[(1) - (1)].str), "disable_page_skipping") == 0) - (yyval.ival) = PG_VACOPT_DISABLE_PAGE_SKIPPING; - else - ereport(ERROR, - (errcode(PG_ERRCODE_SYNTAX_ERROR), - errmsg("unrecognized VACUUM option \"%s\"", (yyvsp[(1) - (1)].str)), - parser_errposition((yylsp[(1) - (1)])))); + (yyval.defelt) = makeDefElem("delimiter", (PGNode *)makeString((yyvsp[(3) - (3)].str)), (yylsp[(1) - (3)])); ;} break; - case 1197: -#line 87 "third_party/libpg_query/grammar/statements/vacuum.y" - { (yyval.boolean) = true; ;} - break; - - case 1198: -#line 88 "third_party/libpg_query/grammar/statements/vacuum.y" - { (yyval.boolean) = false; ;} - break; - - case 1199: -#line 93 "third_party/libpg_query/grammar/statements/vacuum.y" - { (yyval.ival) = (yyvsp[(1) - (1)].ival); ;} - break; - - case 1200: -#line 94 "third_party/libpg_query/grammar/statements/vacuum.y" - { (yyval.ival) = (yyvsp[(1) - (3)].ival) | (yyvsp[(3) - (3)].ival); ;} - break; - - case 1201: -#line 98 "third_party/libpg_query/grammar/statements/vacuum.y" - { (yyval.boolean) = true; ;} - break; - - case 1202: -#line 99 "third_party/libpg_query/grammar/statements/vacuum.y" - { (yyval.boolean) = false; ;} - break; - - case 1203: -#line 9 "third_party/libpg_query/grammar/statements/delete.y" + case 1255: +#line 160 "third_party/libpg_query/grammar/statements/copy.y" { - PGDeleteStmt *n = makeNode(PGDeleteStmt); - n->relation = (yyvsp[(4) - (7)].range); - n->usingClause = (yyvsp[(5) - (7)].list); - n->whereClause = (yyvsp[(6) - (7)].node); - n->returningList = (yyvsp[(7) - (7)].list); - n->withClause = (yyvsp[(1) - (7)].with); - (yyval.node) = (PGNode *)n; + (yyval.defelt) = makeDefElem("null", (PGNode *)makeString((yyvsp[(3) - (3)].str)), (yylsp[(1) - (3)])); ;} break; - case 1204: -#line 22 "third_party/libpg_query/grammar/statements/delete.y" + case 1256: +#line 164 "third_party/libpg_query/grammar/statements/copy.y" { - (yyval.range) = (yyvsp[(1) - (1)].range); + (yyval.defelt) = makeDefElem("format", (PGNode *)makeString("csv"), (yylsp[(1) - (1)])); ;} break; - case 1205: -#line 26 "third_party/libpg_query/grammar/statements/delete.y" + case 1257: +#line 168 "third_party/libpg_query/grammar/statements/copy.y" { - PGAlias *alias = makeNode(PGAlias); - alias->aliasname = (yyvsp[(2) - (2)].str); - (yyvsp[(1) - (2)].range)->alias = alias; - (yyval.range) = (yyvsp[(1) - (2)].range); + (yyval.defelt) = makeDefElem("header", (PGNode *)makeInteger(true), (yylsp[(1) - (1)])); ;} break; - case 1206: -#line 33 "third_party/libpg_query/grammar/statements/delete.y" + case 1258: +#line 172 "third_party/libpg_query/grammar/statements/copy.y" { - PGAlias *alias = makeNode(PGAlias); - alias->aliasname = (yyvsp[(3) - (3)].str); - (yyvsp[(1) - (3)].range)->alias = alias; - (yyval.range) = (yyvsp[(1) - (3)].range); + (yyval.defelt) = makeDefElem("quote", (PGNode *)makeString((yyvsp[(3) - (3)].str)), (yylsp[(1) - (3)])); ;} break; - case 1207: -#line 43 "third_party/libpg_query/grammar/statements/delete.y" - { (yyval.node) = (yyvsp[(2) - (2)].node); ;} - break; - - case 1208: -#line 44 "third_party/libpg_query/grammar/statements/delete.y" - { (yyval.node) = NULL; ;} - break; - - case 1209: -#line 50 "third_party/libpg_query/grammar/statements/delete.y" - { (yyval.list) = (yyvsp[(2) - (2)].list); ;} - break; - - case 1210: -#line 51 "third_party/libpg_query/grammar/statements/delete.y" - { (yyval.list) = NIL; ;} - break; - - case 1211: -#line 10 "third_party/libpg_query/grammar/statements/analyze.y" + case 1259: +#line 176 "third_party/libpg_query/grammar/statements/copy.y" { - PGVacuumStmt *n = makeNode(PGVacuumStmt); - n->options = PG_VACOPT_ANALYZE; - if ((yyvsp[(2) - (2)].boolean)) - n->options |= PG_VACOPT_VERBOSE; - n->relation = NULL; - n->va_cols = NIL; - (yyval.node) = (PGNode *)n; + (yyval.defelt) = makeDefElem("escape", (PGNode *)makeString((yyvsp[(3) - (3)].str)), (yylsp[(1) - (3)])); ;} break; - case 1212: -#line 20 "third_party/libpg_query/grammar/statements/analyze.y" + case 1260: +#line 180 "third_party/libpg_query/grammar/statements/copy.y" { - PGVacuumStmt *n = makeNode(PGVacuumStmt); - n->options = PG_VACOPT_ANALYZE; - if ((yyvsp[(2) - (4)].boolean)) - n->options |= PG_VACOPT_VERBOSE; - n->relation = (yyvsp[(3) - (4)].range); - n->va_cols = (yyvsp[(4) - (4)].list); - (yyval.node) = (PGNode *)n; + (yyval.defelt) = makeDefElem("force_quote", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); ;} break; - case 1213: -#line 2 "third_party/libpg_query/grammar/statements/variable_reset.y" - { (yyval.node) = (PGNode *) (yyvsp[(2) - (2)].vsetstmt); ;} - break; - - case 1214: -#line 8 "third_party/libpg_query/grammar/statements/variable_reset.y" + case 1261: +#line 184 "third_party/libpg_query/grammar/statements/copy.y" { - PGVariableSetStmt *n = makeNode(PGVariableSetStmt); - n->kind = VAR_RESET; - n->name = (yyvsp[(1) - (1)].str); - (yyval.vsetstmt) = n; + (yyval.defelt) = makeDefElem("force_quote", (PGNode *)makeNode(PGAStar), (yylsp[(1) - (3)])); ;} break; - case 1215: -#line 15 "third_party/libpg_query/grammar/statements/variable_reset.y" + case 1262: +#line 188 "third_party/libpg_query/grammar/statements/copy.y" { - PGVariableSetStmt *n = makeNode(PGVariableSetStmt); - n->kind = VAR_RESET_ALL; - (yyval.vsetstmt) = n; + (yyval.defelt) = makeDefElem("force_not_null", (PGNode *)(yyvsp[(4) - (4)].list), (yylsp[(1) - (4)])); ;} break; - case 1216: -#line 24 "third_party/libpg_query/grammar/statements/variable_reset.y" - { (yyval.vsetstmt) = (yyvsp[(1) - (1)].vsetstmt); ;} - break; - - case 1217: -#line 26 "third_party/libpg_query/grammar/statements/variable_reset.y" + case 1263: +#line 192 "third_party/libpg_query/grammar/statements/copy.y" { - PGVariableSetStmt *n = makeNode(PGVariableSetStmt); - n->kind = VAR_RESET; - n->name = (char*) "timezone"; - (yyval.vsetstmt) = n; + (yyval.defelt) = makeDefElem("force_null", (PGNode *)(yyvsp[(3) - (3)].list), (yylsp[(1) - (3)])); ;} break; - case 1218: -#line 33 "third_party/libpg_query/grammar/statements/variable_reset.y" + case 1264: +#line 196 "third_party/libpg_query/grammar/statements/copy.y" { - PGVariableSetStmt *n = makeNode(PGVariableSetStmt); - n->kind = VAR_RESET; - n->name = (char*) "transaction_isolation"; - (yyval.vsetstmt) = n; + (yyval.defelt) = makeDefElem("encoding", (PGNode *)makeString((yyvsp[(2) - (2)].str)), (yylsp[(1) - (2)])); ;} break; - case 1219: -#line 3 "third_party/libpg_query/grammar/statements/variable_show.y" - { - PGVariableShowSelectStmt *n = makeNode(PGVariableShowSelectStmt); - n->stmt = (yyvsp[(2) - (2)].node); - n->name = (char*) "select"; - n->is_summary = 0; - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1220: -#line 10 "third_party/libpg_query/grammar/statements/variable_show.y" - { - PGVariableShowSelectStmt *n = makeNode(PGVariableShowSelectStmt); - n->stmt = (yyvsp[(2) - (2)].node); - n->name = (char*) "select"; - n->is_summary = 1; - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1221: -#line 18 "third_party/libpg_query/grammar/statements/variable_show.y" - { - PGVariableShowStmt *n = makeNode(PGVariableShowStmt); - n->name = (yyvsp[(2) - (2)].str); - n->is_summary = 1; - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1222: -#line 25 "third_party/libpg_query/grammar/statements/variable_show.y" - { - PGVariableShowStmt *n = makeNode(PGVariableShowStmt); - n->name = (yyvsp[(2) - (2)].str); - n->is_summary = 0; - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1223: -#line 32 "third_party/libpg_query/grammar/statements/variable_show.y" - { - PGVariableShowStmt *n = makeNode(PGVariableShowStmt); - n->name = (char*) "timezone"; - n->is_summary = 0; - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1224: -#line 39 "third_party/libpg_query/grammar/statements/variable_show.y" - { - PGVariableShowStmt *n = makeNode(PGVariableShowStmt); - n->name = (char*) "transaction_isolation"; - n->is_summary = 0; - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1225: -#line 46 "third_party/libpg_query/grammar/statements/variable_show.y" - { - PGVariableShowStmt *n = makeNode(PGVariableShowStmt); - n->name = (char*) "all"; - n->is_summary = 0; - (yyval.node) = (PGNode *) n; - ;} + case 1265: +#line 203 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.node) = (PGNode *) makeString((yyvsp[(1) - (1)].str)); ;} break; - case 1228: -#line 57 "third_party/libpg_query/grammar/statements/variable_show.y" + case 1266: +#line 209 "third_party/libpg_query/grammar/statements/copy.y" { (yyval.str) = (yyvsp[(1) - (1)].str); ;} break; - case 1229: -#line 59 "third_party/libpg_query/grammar/statements/variable_show.y" - { (yyval.str) = psprintf("%s.%s", (yyvsp[(1) - (3)].str), (yyvsp[(3) - (3)].str)); ;} - break; - - case 1230: -#line 7 "third_party/libpg_query/grammar/statements/call.y" - { - PGCallStmt *n = makeNode(PGCallStmt); - n->func = (yyvsp[(2) - (2)].node); - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1231: -#line 10 "third_party/libpg_query/grammar/statements/view.y" - { - PGViewStmt *n = makeNode(PGViewStmt); - n->view = (yyvsp[(4) - (9)].range); - n->view->relpersistence = (yyvsp[(2) - (9)].ival); - n->aliases = (yyvsp[(5) - (9)].list); - n->query = (yyvsp[(8) - (9)].node); - n->onconflict = PG_ERROR_ON_CONFLICT; - n->options = (yyvsp[(6) - (9)].list); - n->withCheckOption = (yyvsp[(9) - (9)].viewcheckoption); - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1232: -#line 23 "third_party/libpg_query/grammar/statements/view.y" - { - PGViewStmt *n = makeNode(PGViewStmt); - n->view = (yyvsp[(6) - (11)].range); - n->view->relpersistence = (yyvsp[(4) - (11)].ival); - n->aliases = (yyvsp[(7) - (11)].list); - n->query = (yyvsp[(10) - (11)].node); - n->onconflict = PG_REPLACE_ON_CONFLICT; - n->options = (yyvsp[(8) - (11)].list); - n->withCheckOption = (yyvsp[(11) - (11)].viewcheckoption); - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1233: -#line 36 "third_party/libpg_query/grammar/statements/view.y" - { - PGViewStmt *n = makeNode(PGViewStmt); - n->view = (yyvsp[(5) - (12)].range); - n->view->relpersistence = (yyvsp[(2) - (12)].ival); - n->aliases = (yyvsp[(7) - (12)].list); - n->query = makeRecursiveViewSelect(n->view->relname, n->aliases, (yyvsp[(11) - (12)].node)); - n->onconflict = PG_ERROR_ON_CONFLICT; - n->options = (yyvsp[(9) - (12)].list); - n->withCheckOption = (yyvsp[(12) - (12)].viewcheckoption); - if (n->withCheckOption != PG_NO_CHECK_OPTION) - ereport(ERROR, - (errcode(PG_ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("WITH CHECK OPTION not supported on recursive views"), - parser_errposition((yylsp[(12) - (12)])))); - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1234: -#line 54 "third_party/libpg_query/grammar/statements/view.y" - { - PGViewStmt *n = makeNode(PGViewStmt); - n->view = (yyvsp[(7) - (14)].range); - n->view->relpersistence = (yyvsp[(4) - (14)].ival); - n->aliases = (yyvsp[(9) - (14)].list); - n->query = makeRecursiveViewSelect(n->view->relname, n->aliases, (yyvsp[(13) - (14)].node)); - n->onconflict = PG_REPLACE_ON_CONFLICT; - n->options = (yyvsp[(11) - (14)].list); - n->withCheckOption = (yyvsp[(14) - (14)].viewcheckoption); - if (n->withCheckOption != PG_NO_CHECK_OPTION) - ereport(ERROR, - (errcode(PG_ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("WITH CHECK OPTION not supported on recursive views"), - parser_errposition((yylsp[(14) - (14)])))); - (yyval.node) = (PGNode *) n; - ;} - break; - - case 1235: -#line 74 "third_party/libpg_query/grammar/statements/view.y" - { (yyval.viewcheckoption) = CASCADED_CHECK_OPTION; ;} - break; - - case 1236: -#line 75 "third_party/libpg_query/grammar/statements/view.y" - { (yyval.viewcheckoption) = CASCADED_CHECK_OPTION; ;} - break; - - case 1237: -#line 76 "third_party/libpg_query/grammar/statements/view.y" - { (yyval.viewcheckoption) = PG_LOCAL_CHECK_OPTION; ;} - break; - - case 1238: -#line 77 "third_party/libpg_query/grammar/statements/view.y" - { (yyval.viewcheckoption) = PG_NO_CHECK_OPTION; ;} + case 1267: +#line 210 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.str) = NULL; ;} break; - case 1239: -#line 12 "third_party/libpg_query/grammar/statements/create_as.y" - { - PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); - ctas->query = (yyvsp[(6) - (7)].node); - ctas->into = (yyvsp[(4) - (7)].into); - ctas->relkind = PG_OBJECT_TABLE; - ctas->is_select_into = false; - ctas->onconflict = PG_ERROR_ON_CONFLICT; - /* cram additional flags into the PGIntoClause */ - (yyvsp[(4) - (7)].into)->rel->relpersistence = (yyvsp[(2) - (7)].ival); - (yyvsp[(4) - (7)].into)->skipData = !((yyvsp[(7) - (7)].boolean)); - (yyval.node) = (PGNode *) ctas; - ;} + case 1268: +#line 211 "third_party/libpg_query/grammar/statements/copy.y" + { (yyval.str) = NULL; ;} break; - case 1240: -#line 25 "third_party/libpg_query/grammar/statements/create_as.y" + case 1269: +#line 217 "third_party/libpg_query/grammar/statements/copy.y" { - PGCreateTableAsStmt *ctas = makeNode(PGCreateTableAsStmt); - ctas->query = (yyvsp[(9) - (10)].node); - ctas->into = (yyvsp[(7) - (10)].into); - ctas->relkind = PG_OBJECT_TABLE; - ctas->is_select_into = false; - ctas->onconflict = PG_IGNORE_ON_CONFLICT; - /* cram additional flags into the PGIntoClause */ - (yyvsp[(7) - (10)].into)->rel->relpersistence = (yyvsp[(2) - (10)].ival); - (yyvsp[(7) - (10)].into)->skipData = !((yyvsp[(10) - (10)].boolean)); - (yyval.node) = (PGNode *) ctas; + (yyval.list) = list_make1((yyvsp[(1) - (1)].defelt)); ;} break; - case 1241: -#line 41 "third_party/libpg_query/grammar/statements/create_as.y" - { (yyval.boolean) = true; ;} - break; - - case 1242: -#line 42 "third_party/libpg_query/grammar/statements/create_as.y" - { (yyval.boolean) = false; ;} - break; - - case 1243: -#line 43 "third_party/libpg_query/grammar/statements/create_as.y" - { (yyval.boolean) = true; ;} - break; - - case 1244: -#line 49 "third_party/libpg_query/grammar/statements/create_as.y" + case 1270: +#line 221 "third_party/libpg_query/grammar/statements/copy.y" { - (yyval.into) = makeNode(PGIntoClause); - (yyval.into)->rel = (yyvsp[(1) - (4)].range); - (yyval.into)->colNames = (yyvsp[(2) - (4)].list); - (yyval.into)->options = (yyvsp[(3) - (4)].list); - (yyval.into)->onCommit = (yyvsp[(4) - (4)].oncommit); - (yyval.into)->viewQuery = NULL; - (yyval.into)->skipData = false; /* might get changed later */ + (yyval.list) = lappend((yyvsp[(1) - (3)].list), (yyvsp[(3) - (3)].defelt)); ;} break; /* Line 1267 of yacc.c. */ -#line 24860 "third_party/libpg_query/grammar/grammar_out.cpp" +#line 25198 "third_party/libpg_query/grammar/grammar_out.cpp" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -255574,7 +266866,7 @@ YYLTYPE yylloc; } -#line 70 "third_party/libpg_query/grammar/statements/create_as.y" +#line 236 "third_party/libpg_query/grammar/statements/copy.y" #line 1 "third_party/libpg_query/grammar/grammar.cpp" @@ -256331,7 +267623,7 @@ parser_init(base_yy_extra_type *yyext) // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*-------------------------------------------------------------------- @@ -256370,7 +267662,7 @@ parser_init(base_yy_extra_type *yyext) // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list @@ -256512,6 +267804,7 @@ PG_KEYWORD("execute", EXECUTE, UNRESERVED_KEYWORD) PG_KEYWORD("exists", EXISTS, COL_NAME_KEYWORD) PG_KEYWORD("explain", EXPLAIN, UNRESERVED_KEYWORD) PG_KEYWORD("export", EXPORT_P, UNRESERVED_KEYWORD) +PG_KEYWORD("export_state", EXPORT_STATE, UNRESERVED_KEYWORD) PG_KEYWORD("extension", EXTENSION, UNRESERVED_KEYWORD) PG_KEYWORD("external", EXTERNAL, UNRESERVED_KEYWORD) PG_KEYWORD("extract", EXTRACT, COL_NAME_KEYWORD) @@ -256579,6 +267872,7 @@ PG_KEYWORD("is", IS, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("isnull", ISNULL, TYPE_FUNC_NAME_KEYWORD) PG_KEYWORD("isolation", ISOLATION, UNRESERVED_KEYWORD) PG_KEYWORD("join", JOIN, TYPE_FUNC_NAME_KEYWORD) +PG_KEYWORD("json", JSON, UNRESERVED_KEYWORD) PG_KEYWORD("key", KEY, UNRESERVED_KEYWORD) PG_KEYWORD("label", LABEL, UNRESERVED_KEYWORD) PG_KEYWORD("language", LANGUAGE, UNRESERVED_KEYWORD) @@ -257101,11 +268395,10 @@ int base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list #line 2 "third_party/libpg_query/src_backend_parser_scan.cpp" -#line 2 "third_party/libpg_query/scan.l" /*------------------------------------------------------------------------- * * scan.l @@ -257146,7 +268439,7 @@ int base_yylex(YYSTYPE *lvalp, YYLTYPE *llocp, core_yyscan_t yyscanner) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*------------------------------------------------------------------------- @@ -257183,10 +268476,7 @@ typedef unsigned int pg_wchar; #include - - - -#line 48 "third_party/libpg_query/src_backend_parser_scan.cpp" +#line 44 "third_party/libpg_query/src_backend_parser_scan.cpp" #define YY_INT_ALIGNED short int @@ -257194,12 +268484,246 @@ typedef unsigned int pg_wchar; #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif +#ifdef yy_create_buffer +#define core_yy_create_buffer_ALREADY_DEFINED +#else +#define yy_create_buffer core_yy_create_buffer +#endif + +#ifdef yy_delete_buffer +#define core_yy_delete_buffer_ALREADY_DEFINED +#else +#define yy_delete_buffer core_yy_delete_buffer +#endif + +#ifdef yy_scan_buffer +#define core_yy_scan_buffer_ALREADY_DEFINED +#else +#define yy_scan_buffer core_yy_scan_buffer +#endif + +#ifdef yy_scan_string +#define core_yy_scan_string_ALREADY_DEFINED +#else +#define yy_scan_string core_yy_scan_string +#endif + +#ifdef yy_scan_bytes +#define core_yy_scan_bytes_ALREADY_DEFINED +#else +#define yy_scan_bytes core_yy_scan_bytes +#endif + +#ifdef yy_init_buffer +#define core_yy_init_buffer_ALREADY_DEFINED +#else +#define yy_init_buffer core_yy_init_buffer +#endif + +#ifdef yy_flush_buffer +#define core_yy_flush_buffer_ALREADY_DEFINED +#else +#define yy_flush_buffer core_yy_flush_buffer +#endif + +#ifdef yy_load_buffer_state +#define core_yy_load_buffer_state_ALREADY_DEFINED +#else +#define yy_load_buffer_state core_yy_load_buffer_state +#endif + +#ifdef yy_switch_to_buffer +#define core_yy_switch_to_buffer_ALREADY_DEFINED +#else +#define yy_switch_to_buffer core_yy_switch_to_buffer +#endif + +#ifdef yypush_buffer_state +#define core_yypush_buffer_state_ALREADY_DEFINED +#else +#define yypush_buffer_state core_yypush_buffer_state +#endif + +#ifdef yypop_buffer_state +#define core_yypop_buffer_state_ALREADY_DEFINED +#else +#define yypop_buffer_state core_yypop_buffer_state +#endif + +#ifdef yyensure_buffer_stack +#define core_yyensure_buffer_stack_ALREADY_DEFINED +#else +#define yyensure_buffer_stack core_yyensure_buffer_stack +#endif + +#ifdef yylex +#define core_yylex_ALREADY_DEFINED +#else +#define yylex core_yylex +#endif + +#ifdef yyrestart +#define core_yyrestart_ALREADY_DEFINED +#else +#define yyrestart core_yyrestart +#endif + +#ifdef yylex_init +#define core_yylex_init_ALREADY_DEFINED +#else +#define yylex_init core_yylex_init +#endif + +#ifdef yylex_init_extra +#define core_yylex_init_extra_ALREADY_DEFINED +#else +#define yylex_init_extra core_yylex_init_extra +#endif + +#ifdef yylex_destroy +#define core_yylex_destroy_ALREADY_DEFINED +#else +#define yylex_destroy core_yylex_destroy +#endif + +#ifdef yyget_debug +#define core_yyget_debug_ALREADY_DEFINED +#else +#define yyget_debug core_yyget_debug +#endif + +#ifdef yyset_debug +#define core_yyset_debug_ALREADY_DEFINED +#else +#define yyset_debug core_yyset_debug +#endif + +#ifdef yyget_extra +#define core_yyget_extra_ALREADY_DEFINED +#else +#define yyget_extra core_yyget_extra +#endif + +#ifdef yyset_extra +#define core_yyset_extra_ALREADY_DEFINED +#else +#define yyset_extra core_yyset_extra +#endif + +#ifdef yyget_in +#define core_yyget_in_ALREADY_DEFINED +#else +#define yyget_in core_yyget_in +#endif + +#ifdef yyset_in +#define core_yyset_in_ALREADY_DEFINED +#else +#define yyset_in core_yyset_in +#endif + +#ifdef yyget_out +#define core_yyget_out_ALREADY_DEFINED +#else +#define yyget_out core_yyget_out +#endif + +#ifdef yyset_out +#define core_yyset_out_ALREADY_DEFINED +#else +#define yyset_out core_yyset_out +#endif + +#ifdef yyget_leng +#define core_yyget_leng_ALREADY_DEFINED +#else +#define yyget_leng core_yyget_leng +#endif + +#ifdef yyget_text +#define core_yyget_text_ALREADY_DEFINED +#else +#define yyget_text core_yyget_text +#endif + +#ifdef yyget_lineno +#define core_yyget_lineno_ALREADY_DEFINED +#else +#define yyget_lineno core_yyget_lineno +#endif + +#ifdef yyset_lineno +#define core_yyset_lineno_ALREADY_DEFINED +#else +#define yyset_lineno core_yyset_lineno +#endif + +#ifdef yyget_column +#define core_yyget_column_ALREADY_DEFINED +#else +#define yyget_column core_yyget_column +#endif + +#ifdef yyset_column +#define core_yyset_column_ALREADY_DEFINED +#else +#define yyset_column core_yyset_column +#endif + +#ifdef yywrap +#define core_yywrap_ALREADY_DEFINED +#else +#define yywrap core_yywrap +#endif + +#ifdef yyget_lval +#define core_yyget_lval_ALREADY_DEFINED +#else +#define yyget_lval core_yyget_lval +#endif + +#ifdef yyset_lval +#define core_yyset_lval_ALREADY_DEFINED +#else +#define yyset_lval core_yyset_lval +#endif + +#ifdef yyget_lloc +#define core_yyget_lloc_ALREADY_DEFINED +#else +#define yyget_lloc core_yyget_lloc +#endif + +#ifdef yyset_lloc +#define core_yyset_lloc_ALREADY_DEFINED +#else +#define yyset_lloc core_yyset_lloc +#endif + +#ifdef yyalloc +#define core_yyalloc_ALREADY_DEFINED +#else +#define yyalloc core_yyalloc +#endif + +#ifdef yyrealloc +#define core_yyrealloc_ALREADY_DEFINED +#else +#define yyrealloc core_yyrealloc +#endif + +#ifdef yyfree +#define core_yyfree_ALREADY_DEFINED +#else +#define yyfree core_yyfree +#endif + /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -257241,7 +268765,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -257272,38 +268795,32 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! FLEXINT_H */ - -#ifdef __cplusplus - -/* The "const" storage-class-modifier is valid. */ -#define YY_USE_CONST - -#else /* ! __cplusplus */ +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif -/* C99 requires __STDC__ to be defined as 1. */ -#if defined (__STDC__) +#endif /* ! C99 */ -#define YY_USE_CONST +#endif /* ! FLEXINT_H */ -#endif /* defined (__STDC__) */ -#endif /* ! __cplusplus */ +/* begin standard C++ headers. */ -#ifdef YY_USE_CONST +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. */ -#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) /* An opaque pointer. */ #ifndef YY_TYPEDEF_YY_SCANNER_T @@ -257327,25 +268844,29 @@ typedef void* yyscan_t; * definition of BEGIN. */ #define BEGIN yyg->yy_start = 1 + 2 * - /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yyg->yy_start - 1) / 2) #define YYSTATE YY_START - /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) - /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE core_yyrestart(yyin ,yyscanner ) - +#define YY_NEW_FILE yyrestart( yyin , yyscanner ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -257357,11 +268878,17 @@ typedef void* yyscan_t; typedef struct yy_buffer_state *YY_BUFFER_STATE; #endif +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) + #define YY_LINENO_REWIND_TO(ptr) /* Return all but the first "n" matched characters back to the input stream. */ #define yyless(n) \ @@ -257376,14 +268903,8 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) - #define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - #ifndef YY_STRUCT_YY_BUFFER_STATE #define YY_STRUCT_YY_BUFFER_STATE struct yy_buffer_state @@ -257396,7 +268917,7 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. @@ -257424,7 +268945,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -257441,7 +268962,7 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via core_yyrestart()), so that the user can continue scanning by + * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -257458,84 +268979,77 @@ struct yy_buffer_state #define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ : NULL) - /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] -void core_yyrestart (FILE *input_file ,yyscan_t yyscanner ); -void core_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -YY_BUFFER_STATE core_yy_create_buffer (FILE *file,int size ,yyscan_t yyscanner ); -void core_yy_delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void core_yy_flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); -void core_yypush_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); -void core_yypop_buffer_state (yyscan_t yyscanner ); - -static void core_yyensure_buffer_stack (yyscan_t yyscanner ); -static void core_yy_load_buffer_state (yyscan_t yyscanner ); -static void core_yy_init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); +void yyrestart ( FILE *input_file , yyscan_t yyscanner ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner ); +void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner ); +void yypop_buffer_state ( yyscan_t yyscanner ); -#define YY_FLUSH_BUFFER core_yy_flush_buffer(YY_CURRENT_BUFFER ,yyscanner) +static void yyensure_buffer_stack ( yyscan_t yyscanner ); +static void yy_load_buffer_state ( yyscan_t yyscanner ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner) -YY_BUFFER_STATE core_yy_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); -YY_BUFFER_STATE core_yy_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE core_yy_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner ); -void *core_yyalloc (yy_size_t ,yyscan_t yyscanner ); -void *core_yyrealloc (void *,yy_size_t ,yyscan_t yyscanner ); -void core_yyfree (void * ,yyscan_t yyscanner ); - -#define yy_new_buffer core_yy_create_buffer +void *yyalloc ( yy_size_t , yyscan_t yyscanner ); +void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner ); +void yyfree ( void * , yyscan_t yyscanner ); +#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - core_yyensure_buffer_stack (yyscanner); \ + yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - core_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } - #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - core_yyensure_buffer_stack (yyscanner); \ + yyensure_buffer_stack (yyscanner); \ YY_CURRENT_BUFFER_LVALUE = \ - core_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } - #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -#define core_yywrap(n) 1 +#define core_yywrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP - -typedef unsigned char YY_CHAR; +typedef flex_uint8_t YY_CHAR; typedef int yy_state_type; #define yytext_ptr yytext_r -static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); -static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); -static int yy_get_next_buffer (yyscan_t yyscanner ); -static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); +static yy_state_type yy_get_previous_state ( yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner); +static int yy_get_next_buffer ( yyscan_t yyscanner ); +static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ - yyleng = (size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; - #define YY_NUM_RULES 81 #define YY_END_OF_BUFFER 82 /* This struct is not used in this scanner, @@ -257545,7 +269059,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[293] = +static const flex_int16_t yy_accept[293] = { 0, 0, 0, 12, 12, 0, 0, 0, 0, 11, 11, 0, 0, 0, 0, 0, 0, 0, 0, 55, 55, @@ -257582,7 +269096,7 @@ static yyconst flex_int16_t yy_accept[293] = } ; -static yyconst flex_int32_t yy_ec[256] = +static const YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, 4, 1, 1, 1, 1, 1, 1, 1, @@ -257614,7 +269128,7 @@ static yyconst flex_int32_t yy_ec[256] = 30, 30, 30, 30, 30 } ; -static yyconst flex_int32_t yy_meta[39] = +static const YY_CHAR yy_meta[39] = { 0, 1, 1, 2, 2, 3, 4, 5, 3, 3, 6, 1, 7, 3, 3, 1, 7, 8, 8, 1, 3, @@ -257622,7 +269136,7 @@ static yyconst flex_int32_t yy_meta[39] = 10, 10, 10, 10, 10, 11, 10, 10 } ; -static yyconst flex_int16_t yy_base[360] = +static const flex_int16_t yy_base[360] = { 0, 0, 0, 424, 415, 34, 54, 418, 413, 408, 402, 41, 50, 401, 389, 38, 54, 392, 390, 85, 121, @@ -257665,7 +269179,7 @@ static yyconst flex_int16_t yy_base[360] = 1128, 1130, 1139, 1150, 1154, 1163, 1174, 1185, 1196 } ; -static yyconst flex_int16_t yy_def[360] = +static const flex_int16_t yy_def[360] = { 0, 292, 1, 293, 293, 294, 294, 295, 295, 296, 296, 297, 297, 298, 298, 299, 299, 295, 295, 300, 300, @@ -257708,7 +269222,7 @@ static yyconst flex_int16_t yy_def[360] = 292, 292, 292, 292, 292, 292, 292, 292, 292 } ; -static yyconst flex_int16_t yy_nxt[1247] = +static const flex_int16_t yy_nxt[1247] = { 0, 28, 29, 30, 29, 31, 32, 33, 34, 35, 36, 37, 34, 34, 38, 39, 40, 41, 41, 42, 43, @@ -257849,7 +269363,7 @@ static yyconst flex_int16_t yy_nxt[1247] = 292, 292, 292, 292, 292, 292 } ; -static yyconst flex_int16_t yy_chk[1247] = +static const flex_int16_t yy_chk[1247] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -258026,7 +269540,7 @@ bool standard_conforming_strings = true; #define YY_EXTRA_TYPE core_yy_extra_type * /* - * Each call to core_yylex must set yylloc to the location of the found token + * Each call to yylex must set yylloc to the location of the found token * (expressed as a byte offset from the start of the input text). * When we parse a token that requires multiple lexer rules to process, * this should be done in the first such rule, else yylloc will point @@ -258068,6 +269582,7 @@ static void check_escape_warning(core_yyscan_t yyscanner); extern int core_yyget_column(yyscan_t yyscanner); extern void core_yyset_column(int column_no, yyscan_t yyscanner); +#line 1149 "third_party/libpg_query/src_backend_parser_scan.cpp" #define YY_NO_INPUT 1 /* * OK, here is a short description of lex/flex rules behavior. @@ -258097,17 +269612,6 @@ extern void core_yyset_column(int column_no, yyscan_t yyscanner); * The default one is probably not the right thing. */ - - - - - - - - - - - /* * In order to make the world safe for Windows and Mac clients as well as * Unix ones, we accept either \n or \r as a newline. A DOS-style \r\n @@ -258232,7 +269736,7 @@ extern void core_yyset_column(int column_no, yyscan_t yyscanner); * Note that xcstart must appear before operator, as explained above! * Also whitespace (comment) must appear before operator. */ -#line 1093 "third_party/libpg_query/src_backend_parser_scan.cpp" +#line 1303 "third_party/libpg_query/src_backend_parser_scan.cpp" #define INITIAL 0 #define xb 1 @@ -258290,7 +269794,7 @@ struct yyguts_t }; /* end struct yyguts_t */ -static int yy_init_globals (yyscan_t yyscanner ); +static int yy_init_globals ( yyscan_t yyscanner ); /* This must go here because YYSTYPE and YYLTYPE are included * from bison output in section 1.*/ @@ -258298,46 +269802,50 @@ static int yy_init_globals (yyscan_t yyscanner ); # define yylloc yyg->yylloc_r -int core_yylex_init (yyscan_t* scanner); +int yylex_init (yyscan_t* scanner); -int core_yylex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); +int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int core_yylex_destroy (yyscan_t yyscanner ); +int yylex_destroy ( yyscan_t yyscanner ); -int core_yyget_debug (yyscan_t yyscanner ); +int yyget_debug ( yyscan_t yyscanner ); -void core_yyset_debug (int debug_flag ,yyscan_t yyscanner ); +void yyset_debug ( int debug_flag , yyscan_t yyscanner ); -YY_EXTRA_TYPE core_yyget_extra (yyscan_t yyscanner ); +YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner ); -void core_yyset_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); +void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner ); -FILE *core_yyget_in (yyscan_t yyscanner ); +FILE *yyget_in ( yyscan_t yyscanner ); -void core_yyset_in (FILE * in_str ,yyscan_t yyscanner ); +void yyset_in ( FILE * _in_str , yyscan_t yyscanner ); -FILE *core_yyget_out (yyscan_t yyscanner ); +FILE *yyget_out ( yyscan_t yyscanner ); -void core_yyset_out (FILE * out_str ,yyscan_t yyscanner ); +void yyset_out ( FILE * _out_str , yyscan_t yyscanner ); -int core_yyget_leng (yyscan_t yyscanner ); + int yyget_leng ( yyscan_t yyscanner ); -char *core_yyget_text (yyscan_t yyscanner ); +char *yyget_text ( yyscan_t yyscanner ); -int core_yyget_lineno (yyscan_t yyscanner ); +int yyget_lineno ( yyscan_t yyscanner ); -void core_yyset_lineno (int line_number ,yyscan_t yyscanner ); +void yyset_lineno ( int _line_number , yyscan_t yyscanner ); -YYSTYPE * core_yyget_lval (yyscan_t yyscanner ); +int yyget_column ( yyscan_t yyscanner ); -void core_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); +void yyset_column ( int _column_no , yyscan_t yyscanner ); - YYLTYPE *core_yyget_lloc (yyscan_t yyscanner ); +YYSTYPE * yyget_lval ( yyscan_t yyscanner ); + +void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner ); + + YYLTYPE *yyget_lloc ( yyscan_t yyscanner ); - void core_yyset_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); + void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -258345,33 +269853,41 @@ void core_yyset_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int core_yywrap (yyscan_t yyscanner ); +extern "C" int yywrap ( yyscan_t yyscanner ); #else -extern int core_yywrap (yyscan_t yyscanner ); +extern int yywrap ( yyscan_t yyscanner ); +#endif #endif + +#ifndef YY_NO_UNPUT + #endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +static int yy_flex_strlen ( const char * , yyscan_t yyscanner); #endif #ifndef YY_NO_INPUT - #ifdef __cplusplus -static int yyinput (yyscan_t yyscanner ); +static int yyinput ( yyscan_t yyscanner ); #else -static int input (yyscan_t yyscanner ); +static int input ( yyscan_t yyscanner ); #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -258379,7 +269895,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -258403,7 +269919,7 @@ static int input (yyscan_t yyscanner ); else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -258444,10 +269960,10 @@ static int input (yyscan_t yyscanner ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int core_yylex \ - (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); +extern int yylex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner); -#define YY_DECL int core_yylex \ +#define YY_DECL int yylex \ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) #endif /* !YY_DECL */ @@ -258460,7 +269976,7 @@ extern int core_yylex \ /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif #define YY_RULE_SETUP \ @@ -258475,11 +269991,6 @@ YY_DECL int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 401 "third_party/libpg_query/scan.l" - - -#line 1339 "third_party/libpg_query/src_backend_parser_scan.cpp" - yylval = yylval_param; yylloc = yylloc_param; @@ -258495,15 +270006,21 @@ YY_DECL if ( ! yyg->yy_start ) yyg->yy_start = 1; /* first start state */ if ( ! YY_CURRENT_BUFFER ) { - core_yyensure_buffer_stack (yyscanner); + yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - core_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); } - core_yy_load_buffer_state(yyscanner ); + yy_load_buffer_state( yyscanner ); } - while ( 1 ) /* loops until end-of-file is reached */ + { +#line 401 "third_party/libpg_query/scan.l" + + +#line 1592 "third_party/libpg_query/src_backend_parser_scan.cpp" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = yyg->yy_c_buf_p; @@ -258519,7 +270036,7 @@ YY_DECL yy_match: do { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; if ( yy_accept[yy_current_state] ) { yyg->yy_last_accepting_state = yy_current_state; @@ -258529,9 +270046,9 @@ YY_DECL { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 293 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } while ( yy_current_state != 292 ); @@ -259552,7 +271069,7 @@ YY_RULE_SETUP #line 1075 "third_party/libpg_query/scan.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 2420 "third_party/libpg_query/src_backend_parser_scan.cpp" +#line 2643 "third_party/libpg_query/src_backend_parser_scan.cpp" case YY_END_OF_BUFFER: { @@ -259568,7 +271085,7 @@ YY_FATAL_ERROR( "flex scanner jammed" ); /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called - * core_yylex(). If so, then we have to assure + * yylex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a @@ -259629,7 +271146,7 @@ YY_FATAL_ERROR( "flex scanner jammed" ); { yyg->yy_did_buffer_switch_on_eof = 0; - if ( core_yywrap(yyscanner ) ) + if ( yywrap( yyscanner ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up @@ -259682,7 +271199,8 @@ YY_FATAL_ERROR( "flex scanner jammed" ); "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -} /* end of core_yylex */ + } /* end of user's declarations */ +} /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -259725,7 +271243,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1); for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -259745,7 +271263,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER; + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) (yyg->yy_c_buf_p - b->yy_ch_buf); @@ -259761,11 +271279,12 @@ static int yy_get_next_buffer (yyscan_t yyscanner) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - core_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -259783,7 +271302,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, (size_t) num_to_read ); + yyg->yy_n_chars, num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -259793,7 +271312,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - core_yyrestart(yyin ,yyscanner); + yyrestart( yyin , yyscanner); } else @@ -259807,12 +271326,15 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else ret_val = EOB_ACT_CONTINUE_SCAN; - if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ - yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) core_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } yyg->yy_n_chars += number_to_move; @@ -259846,9 +271368,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 293 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; } return yy_current_state; @@ -259875,14 +271397,19 @@ static int yy_get_next_buffer (yyscan_t yyscanner) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 293 ) - yy_c = yy_meta[(unsigned int) yy_c]; + yy_c = yy_meta[yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; yy_is_jam = (yy_current_state == 292); + (void)yyg; return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT + +#endif + #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput (yyscan_t yyscanner) @@ -259908,7 +271435,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { /* need more input */ - int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr); ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) @@ -259925,14 +271452,14 @@ static int yy_get_next_buffer (yyscan_t yyscanner) */ /* Reset buffer status. */ - core_yyrestart(yyin ,yyscanner); + yyrestart( yyin , yyscanner); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( core_yywrap(yyscanner ) ) - return EOF; + if ( yywrap( yyscanner ) ) + return 0; if ( ! yyg->yy_did_buffer_switch_on_eof ) YY_NEW_FILE; @@ -259963,34 +271490,34 @@ static int yy_get_next_buffer (yyscan_t yyscanner) * @param yyscanner The scanner object. * @note This function does not reset the start condition to @c INITIAL . */ - void core_yyrestart (FILE * input_file , yyscan_t yyscanner) + void yyrestart (FILE * input_file , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! YY_CURRENT_BUFFER ){ - core_yyensure_buffer_stack (yyscanner); + yyensure_buffer_stack (yyscanner); YY_CURRENT_BUFFER_LVALUE = - core_yy_create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); } - core_yy_init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); - core_yy_load_buffer_state(yyscanner ); + yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner); + yy_load_buffer_state( yyscanner ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * @param yyscanner The scanner object. */ - void core_yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* TODO. We should be able to replace this entire function body * with - * core_yypop_buffer_state(); - * core_yypush_buffer_state(new_buffer); + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); */ - core_yyensure_buffer_stack (yyscanner); + yyensure_buffer_stack (yyscanner); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -260003,17 +271530,17 @@ static int yy_get_next_buffer (yyscan_t yyscanner) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - core_yy_load_buffer_state(yyscanner ); + yy_load_buffer_state( yyscanner ); /* We don't actually know whether we did this switch during - * EOF (core_yywrap()) processing, but the only time this flag - * is looked at is after core_yywrap() is called, so it's safe + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yyg->yy_did_buffer_switch_on_eof = 1; } -static void core_yy_load_buffer_state (yyscan_t yyscanner) +static void yy_load_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; @@ -260028,35 +271555,35 @@ static void core_yy_load_buffer_state (yyscan_t yyscanner) * @param yyscanner The scanner object. * @return the allocated buffer state. */ - YY_BUFFER_STATE core_yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) core_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in core_yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) core_yyalloc(b->yy_buf_size + 2 ,yyscanner ); + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in core_yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; - core_yy_init_buffer(b,file ,yyscanner); + yy_init_buffer( b, file , yyscanner); return b; } /** Destroy the buffer. - * @param b a buffer created with core_yy_create_buffer() + * @param b a buffer created with yy_create_buffer() * @param yyscanner The scanner object. */ - void core_yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) + void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; @@ -260067,28 +271594,28 @@ static void core_yy_load_buffer_state (yyscan_t yyscanner) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - core_yyfree((void *) b->yy_ch_buf ,yyscanner ); + yyfree( (void *) b->yy_ch_buf , yyscanner ); - core_yyfree((void *) b ,yyscanner ); + yyfree( (void *) b , yyscanner ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a core_yyrestart() or at EOF. + * such as during a yyrestart() or at EOF. */ - static void core_yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) { int oerrno = errno; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - core_yy_flush_buffer(b ,yyscanner); + yy_flush_buffer( b , yyscanner); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then core_yy_init_buffer was _probably_ - * called from core_yyrestart() or through yy_get_next_buffer. + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -260105,7 +271632,7 @@ static void core_yy_load_buffer_state (yyscan_t yyscanner) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * @param yyscanner The scanner object. */ - void core_yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) + void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if ( ! b ) @@ -260126,7 +271653,7 @@ static void core_yy_load_buffer_state (yyscan_t yyscanner) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - core_yy_load_buffer_state(yyscanner ); + yy_load_buffer_state( yyscanner ); } /** Pushes the new state onto the stack. The new state becomes @@ -260135,15 +271662,15 @@ static void core_yy_load_buffer_state (yyscan_t yyscanner) * @param new_buffer The new state. * @param yyscanner The scanner object. */ -void core_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (new_buffer == NULL) return; - core_yyensure_buffer_stack(yyscanner); + yyensure_buffer_stack(yyscanner); - /* This block is copied from core_yy_switch_to_buffer. */ + /* This block is copied from yy_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -260157,8 +271684,8 @@ void core_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) yyg->yy_buffer_stack_top++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from core_yy_switch_to_buffer. */ - core_yy_load_buffer_state(yyscanner ); + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } @@ -260166,19 +271693,19 @@ void core_yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) * The next element becomes the new top. * @param yyscanner The scanner object. */ -void core_yypop_buffer_state (yyscan_t yyscanner) +void yypop_buffer_state (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!YY_CURRENT_BUFFER) return; - core_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner); YY_CURRENT_BUFFER_LVALUE = NULL; if (yyg->yy_buffer_stack_top > 0) --yyg->yy_buffer_stack_top; if (YY_CURRENT_BUFFER) { - core_yy_load_buffer_state(yyscanner ); + yy_load_buffer_state( yyscanner ); yyg->yy_did_buffer_switch_on_eof = 1; } } @@ -260186,9 +271713,9 @@ void core_yypop_buffer_state (yyscan_t yyscanner) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void core_yyensure_buffer_stack (yyscan_t yyscanner) +static void yyensure_buffer_stack (yyscan_t yyscanner) { - int num_to_alloc; + yy_size_t num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -260197,15 +271724,15 @@ static void core_yyensure_buffer_stack (yyscan_t yyscanner) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; - yyg->yy_buffer_stack = (struct yy_buffer_state**)core_yyalloc + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in core_yyensure_buffer_stack()" ); - + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + yyg->yy_buffer_stack_max = num_to_alloc; yyg->yy_buffer_stack_top = 0; return; @@ -260214,15 +271741,15 @@ static void core_yyensure_buffer_stack (yyscan_t yyscanner) if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){ /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = yyg->yy_buffer_stack_max + grow_size; - yyg->yy_buffer_stack = (struct yy_buffer_state**)core_yyrealloc + yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc (yyg->yy_buffer_stack, num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); if ( ! yyg->yy_buffer_stack ) - YY_FATAL_ERROR( "out of dynamic memory in core_yyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); /* zero only the new slots.*/ memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -260234,9 +271761,9 @@ static void core_yyensure_buffer_stack (yyscan_t yyscanner) * @param base the character buffer * @param size the size in bytes of the character buffer * @param yyscanner The scanner object. - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE core_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) { YY_BUFFER_STATE b; @@ -260244,49 +271771,49 @@ YY_BUFFER_STATE core_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yy base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return 0; + return NULL; - b = (YY_BUFFER_STATE) core_yyalloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in core_yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = 0; + b->yy_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - core_yy_switch_to_buffer(b ,yyscanner ); + yy_switch_to_buffer( b , yyscanner ); return b; } -/** Setup the input buffer state to scan a string. The next call to core_yylex() will +/** Setup the input buffer state to scan a string. The next call to yylex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * core_yy_scan_bytes() instead. + * yy_scan_bytes() instead. */ -YY_BUFFER_STATE core_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) +YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner) { - return core_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); + return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner); } -/** Setup the input buffer state to scan the given bytes. The next call to core_yylex() will +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE core_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; @@ -260294,19 +271821,19 @@ YY_BUFFER_STATE core_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; - buf = (char *) core_yyalloc(n ,yyscanner ); + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n , yyscanner ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in core_yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = core_yy_scan_buffer(buf,n ,yyscanner); + b = yy_scan_buffer( buf, n , yyscanner); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in core_yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -260320,9 +271847,11 @@ YY_BUFFER_STATE core_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner) { - //( stderr, "%s\n", msg ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + fprintf( stderr, "%s\n", msg ); throw std::runtime_error(msg); // YY_EXIT_FAILURE ); } @@ -260348,7 +271877,7 @@ static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) /** Get the user-defined data for this scanner. * @param yyscanner The scanner object. */ -YY_EXTRA_TYPE core_yyget_extra (yyscan_t yyscanner) +YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyextra; @@ -260357,10 +271886,10 @@ YY_EXTRA_TYPE core_yyget_extra (yyscan_t yyscanner) /** Get the current line number. * @param yyscanner The scanner object. */ -int core_yyget_lineno (yyscan_t yyscanner) +int yyget_lineno (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - + if (! YY_CURRENT_BUFFER) return 0; @@ -260370,10 +271899,10 @@ int core_yyget_lineno (yyscan_t yyscanner) /** Get the current column number. * @param yyscanner The scanner object. */ -int core_yyget_column (yyscan_t yyscanner) +int yyget_column (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - + if (! YY_CURRENT_BUFFER) return 0; @@ -260383,7 +271912,7 @@ int core_yyget_column (yyscan_t yyscanner) /** Get the input stream. * @param yyscanner The scanner object. */ -FILE *core_yyget_in (yyscan_t yyscanner) +FILE *yyget_in (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyin; @@ -260392,7 +271921,7 @@ FILE *core_yyget_in (yyscan_t yyscanner) /** Get the output stream. * @param yyscanner The scanner object. */ -FILE *core_yyget_out (yyscan_t yyscanner) +FILE *yyget_out (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyout; @@ -260401,7 +271930,7 @@ FILE *core_yyget_out (yyscan_t yyscanner) /** Get the length of the current token. * @param yyscanner The scanner object. */ -int core_yyget_leng (yyscan_t yyscanner) +int yyget_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; @@ -260411,7 +271940,7 @@ int core_yyget_leng (yyscan_t yyscanner) * @param yyscanner The scanner object. */ -char *core_yyget_text (yyscan_t yyscanner) +char *yyget_text (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yytext; @@ -260421,93 +271950,93 @@ char *core_yyget_text (yyscan_t yyscanner) * @param user_defined The data to be associated with this scanner. * @param yyscanner The scanner object. */ -void core_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyextra = user_defined ; } /** Set the current line number. - * @param line_number + * @param _line_number line number * @param yyscanner The scanner object. */ -void core_yyset_lineno (int line_number , yyscan_t yyscanner) +void yyset_lineno (int _line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "core_yyset_lineno called with no buffer" , yyscanner); + YY_FATAL_ERROR( "yyset_lineno called with no buffer" ); - yylineno = line_number; + yylineno = _line_number; } /** Set the current column. - * @param line_number + * @param _column_no column number * @param yyscanner The scanner object. */ -void core_yyset_column (int column_no , yyscan_t yyscanner) +void yyset_column (int _column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "core_yyset_column called with no buffer" , yyscanner); + YY_FATAL_ERROR( "yyset_column called with no buffer" ); - yycolumn = column_no; + yycolumn = _column_no; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * @param yyscanner The scanner object. - * @see core_yy_switch_to_buffer + * @see yy_switch_to_buffer */ -void core_yyset_in (FILE * in_str , yyscan_t yyscanner) +void yyset_in (FILE * _in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyin = in_str ; + yyin = _in_str ; } -void core_yyset_out (FILE * out_str , yyscan_t yyscanner) +void yyset_out (FILE * _out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyout = out_str ; + yyout = _out_str ; } -int core_yyget_debug (yyscan_t yyscanner) +int yyget_debug (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yy_flex_debug; } -void core_yyset_debug (int bdebug , yyscan_t yyscanner) +void yyset_debug (int _bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } /* Accessor methods for yylval and yylloc */ -YYSTYPE * core_yyget_lval (yyscan_t yyscanner) +YYSTYPE * yyget_lval (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yylval; } -void core_yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylval = yylval_param; } -YYLTYPE *core_yyget_lloc (yyscan_t yyscanner) +YYLTYPE *yyget_lloc (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yylloc; } -void core_yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) +void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylloc = yylloc_param; @@ -260515,20 +272044,18 @@ void core_yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) /* User-visible API */ -/* core_yylex_init is special because it creates the scanner itself, so it is +/* yylex_init is special because it creates the scanner itself, so it is * the ONLY reentrant function that doesn't take the scanner as the last argument. * That's why we explicitly handle the declaration, instead of using our macros. */ - -int core_yylex_init(yyscan_t* ptr_yy_globals) - +int yylex_init(yyscan_t* ptr_yy_globals) { if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } - *ptr_yy_globals = (yyscan_t) core_yyalloc ( sizeof( struct yyguts_t ), NULL ); + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL ); if (*ptr_yy_globals == NULL){ errno = ENOMEM; @@ -260541,39 +272068,37 @@ int core_yylex_init(yyscan_t* ptr_yy_globals) return yy_init_globals ( *ptr_yy_globals ); } -/* core_yylex_init_extra has the same functionality as core_yylex_init, but follows the +/* yylex_init_extra has the same functionality as yylex_init, but follows the * convention of taking the scanner as the last argument. Note however, that * this is a *pointer* to a scanner, as it will be allocated by this call (and * is the reason, too, why this function also must handle its own declaration). - * The user defined value in the first argument will be available to core_yyalloc in + * The user defined value in the first argument will be available to yyalloc in * the yyextra field. */ - -int core_yylex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) - +int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals ) { struct yyguts_t dummy_yyguts; - core_yyset_extra (yy_user_defined, &dummy_yyguts); + yyset_extra (yy_user_defined, &dummy_yyguts); if (ptr_yy_globals == NULL){ errno = EINVAL; return 1; } - - *ptr_yy_globals = (yyscan_t) core_yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); - + + *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts ); + if (*ptr_yy_globals == NULL){ errno = ENOMEM; return 1; } - + /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t)); - - core_yyset_extra (yy_user_defined, *ptr_yy_globals); - + + yyset_extra (yy_user_defined, *ptr_yy_globals); + return yy_init_globals ( *ptr_yy_globals ); } @@ -260581,13 +272106,13 @@ static int yy_init_globals (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Initialization is the same as for the non-reentrant scanner. - * This function is called from core_yylex_destroy(), so don't allocate here. + * This function is called from yylex_destroy(), so don't allocate here. */ - yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack = NULL; yyg->yy_buffer_stack_top = 0; yyg->yy_buffer_stack_max = 0; - yyg->yy_c_buf_p = (char *) 0; + yyg->yy_c_buf_p = NULL; yyg->yy_init = 0; yyg->yy_start = 0; @@ -260596,41 +272121,46 @@ static int yy_init_globals (yyscan_t yyscanner) yyg->yy_start_stack = NULL; /* Defined in main.c */ - yyin = (FILE *) 0; - yyout = (FILE *) 0; +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = NULL; + yyout = NULL; +#endif /* For future reference: Set errno on error, since we are called by - * core_yylex_init() + * yylex_init() */ return 0; } -/* core_yylex_destroy is for both reentrant and non-reentrant scanners. */ -int core_yylex_destroy (yyscan_t yyscanner) +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - core_yy_delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner ); YY_CURRENT_BUFFER_LVALUE = NULL; - core_yypop_buffer_state(yyscanner); + yypop_buffer_state(yyscanner); } /* Destroy the stack itself. */ - core_yyfree(yyg->yy_buffer_stack ,yyscanner); + yyfree(yyg->yy_buffer_stack , yyscanner); yyg->yy_buffer_stack = NULL; /* Destroy the start condition stack. */ - core_yyfree(yyg->yy_start_stack ,yyscanner ); + yyfree( yyg->yy_start_stack , yyscanner ); yyg->yy_start_stack = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * core_yylex() is called, initialization will occur. */ + * yylex() is called, initialization will occur. */ yy_init_globals( yyscanner); /* Destroy the main struct (reentrant only). */ - core_yyfree ( yyscanner , yyscanner ); + yyfree ( yyscanner , yyscanner ); yyscanner = NULL; return 0; } @@ -260640,8 +272170,11 @@ int core_yylex_destroy (yyscan_t yyscanner) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; @@ -260649,7 +272182,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +static int yy_flex_strlen (const char * s , yyscan_t yyscanner) { int n; for ( n = 0; s[n]; ++n ) @@ -260664,11 +272197,10 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) #line 1075 "third_party/libpg_query/scan.l" - /* LCOV_EXCL_STOP */ /* - * Arrange access to yyextra for subroutines of the main core_yylex() function. + * Arrange access to yyextra for subroutines of the main yylex() function. * We expect each subroutine to have a yyscanner parameter. Rather than * use the yyget_xxx functions, which might or might not get inlined by the * compiler, we cheat just a bit and cast yyscanner to the right type. @@ -260713,7 +272245,7 @@ scanner_errposition(int location, core_yyscan_t yyscanner) * Report a lexer or grammar error. * * The message's cursor position is whatever YYLLOC was last set to, - * ie, the start of the current token if called within core_yylex(), or the + * ie, the start of the current token if called within yylex(), or the * most recently lexed token if called from the grammar. * This is OK for syntax error messages from the Bison parser, because Bison * parsers report error as soon as the first unparsable token is reached. @@ -260756,8 +272288,8 @@ scanner_init(const char *str, PGSize slen = strlen(str); yyscan_t scanner; - if (core_yylex_init(&scanner) != 0) - elog(ERROR, "core_yylex_init() failed: %m"); + if (yylex_init(&scanner) != 0) + elog(ERROR, "yylex_init() failed: %m"); core_yyset_extra(yyext, scanner); @@ -260775,7 +272307,7 @@ scanner_init(const char *str, yyext->scanbuflen = slen; memcpy(yyext->scanbuf, str, slen); yyext->scanbuf[slen] = yyext->scanbuf[slen + 1] = YY_END_OF_BUFFER_CHAR; - core_yy_scan_buffer(yyext->scanbuf,slen + 2,scanner); + yy_scan_buffer(yyext->scanbuf, slen + 2, scanner); /* initialize literal buffer to a reasonable but expansible size */ yyext->literalalloc = 1024; @@ -260793,7 +272325,7 @@ void scanner_finish(core_yyscan_t yyscanner) { /* - * We don't bother to call core_yylex_destroy(), because all it would do is + * We don't bother to call yylex_destroy(), because all it would do is * pfree a small amount of control storage. It's cheaper to leak the * storage until the parsing context is destroyed. The amount of space * involved is usually negligible compared to the output parse tree @@ -261238,7 +272770,7 @@ core_yyfree(void *ptr, core_yyscan_t yyscanner) // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*-------------------------------------------------------------------- @@ -261370,7 +272902,7 @@ bool scanner_isspace(char ch) { // LICENSE_CHANGE_BEGIN -// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #9 +// The following code up to LICENSE_CHANGE_END is subject to THIRD PARTY LICENSE #10 // See the end of this file for a list /*-------------------------------------------------------------------- @@ -261634,6 +273166,66 @@ THE SOFTWARE. ### THIRD PARTY LICENSE #4 ### +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + + + +### THIRD PARTY LICENSE #5 ### + +// Copyright (c) 2009 The RE2 Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +### THIRD PARTY LICENSE #6 ### + Copyright (c) 2012 Art.sy, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of @@ -261655,7 +273247,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -### THIRD PARTY LICENSE #5 ### +### THIRD PARTY LICENSE #7 ### Apache License Version 2.0, January 2004 @@ -261860,39 +273452,7 @@ SOFTWARE. limitations under the License. -### THIRD PARTY LICENSE #6 ### - -// Copyright (c) 2009 The RE2 Authors. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - -### THIRD PARTY LICENSE #7 ### +### THIRD PARTY LICENSE #8 ### The MIT License (MIT) @@ -261919,7 +273479,7 @@ SOFTWARE. -### THIRD PARTY LICENSE #8 ### +### THIRD PARTY LICENSE #9 ### This license file applies to everything in this repository except that which is explicitly annotated as being written by other authors, i.e. the Boost @@ -261985,7 +273545,7 @@ DEALINGS IN THE SOFTWARE. -### THIRD PARTY LICENSE #9 ### +### THIRD PARTY LICENSE #10 ### Copyright (c) 2015, Lukas Fittl All rights reserved. @@ -262017,7 +273577,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -### THIRD PARTY LICENSE #10 ### +### THIRD PARTY LICENSE #11 ### Apache License Version 2.0, January 2004 diff --git a/libduckdb-sys/duckdb/duckdb.h b/libduckdb-sys/duckdb/duckdb.h index e07095a3..e7c12342 100644 --- a/libduckdb-sys/duckdb/duckdb.h +++ b/libduckdb-sys/duckdb/duckdb.h @@ -74,7 +74,7 @@ typedef enum DUCKDB_TYPE { DUCKDB_TYPE_FLOAT, // double DUCKDB_TYPE_DOUBLE, - // duckdb_timestamp + // duckdb_timestamp, in microseconds DUCKDB_TYPE_TIMESTAMP, // duckdb_date DUCKDB_TYPE_DATE, @@ -87,7 +87,27 @@ typedef enum DUCKDB_TYPE { // const char* DUCKDB_TYPE_VARCHAR, // duckdb_blob - DUCKDB_TYPE_BLOB + DUCKDB_TYPE_BLOB, + // decimal + DUCKDB_TYPE_DECIMAL, + // duckdb_timestamp, in seconds + DUCKDB_TYPE_TIMESTAMP_S, + // duckdb_timestamp, in milliseconds + DUCKDB_TYPE_TIMESTAMP_MS, + // duckdb_timestamp, in nanoseconds + DUCKDB_TYPE_TIMESTAMP_NS, + // enum type, only useful as logical type + DUCKDB_TYPE_ENUM, + // list type, only useful as logical type + DUCKDB_TYPE_LIST, + // struct type, only useful as logical type + DUCKDB_TYPE_STRUCT, + // map type, only useful as logical type + DUCKDB_TYPE_MAP, + // duckdb_hugeint + DUCKDB_TYPE_UUID, + // const char* + DUCKDB_TYPE_JSON, } duckdb_type; //! Days are stored as days since 1970-01-01 @@ -140,6 +160,13 @@ typedef struct { int64_t upper; } duckdb_hugeint; +typedef struct { + uint8_t width; + uint8_t scale; + + duckdb_hugeint value; +} duckdb_decimal; + typedef struct { void *data; idx_t size; @@ -194,6 +221,10 @@ typedef void *duckdb_arrow; typedef void *duckdb_config; typedef void *duckdb_arrow_schema; typedef void *duckdb_arrow_array; +typedef void *duckdb_logical_type; +typedef void *duckdb_data_chunk; +typedef void *duckdb_vector; +typedef void *duckdb_value; typedef enum { DuckDBSuccess = 0, DuckDBError = 1 } duckdb_state; @@ -357,6 +388,19 @@ Returns `DUCKDB_TYPE_INVALID` if the column is out of range. */ DUCKDB_API duckdb_type duckdb_column_type(duckdb_result *result, idx_t col); +/*! +Returns the logical column type of the specified column. + +The return type of this call should be destroyed with `duckdb_destroy_logical_type`. + +Returns `NULL` if the column is out of range. + +* result: The result object to fetch the column type from. +* col: The column index. +* returns: The logical column type of the specified column. +*/ +DUCKDB_API duckdb_logical_type duckdb_column_logical_type(duckdb_result *result, idx_t col); + /*! Returns the number of columns present in a the result object. @@ -383,9 +427,9 @@ queries. For other queries the rows_changed will be 0. DUCKDB_API idx_t duckdb_rows_changed(duckdb_result *result); /*! -Returns the data of a specific column of a result in columnar format. This is the fastest way of accessing data in a -query result, as no conversion or type checking must be performed (outside of the original switch). If performance -is a concern, it is recommended to use this API over the `duckdb_value` functions. +**DEPRECATED**: Prefer using `duckdb_result_get_chunk` instead. + +Returns the data of a specific column of a result in columnar format. The function returns a dense array which contains the result data. The exact type stored in the array depends on the corresponding duckdb_type (as provided by `duckdb_column_type`). For the exact type by which the data should be @@ -404,6 +448,8 @@ printf("Data for row %d: %d\n", row, data[row]); DUCKDB_API void *duckdb_column_data(duckdb_result *result, idx_t col); /*! +**DEPRECATED**: Prefer using `duckdb_result_get_chunk` instead. + Returns the nullmask of a specific column of a result in columnar format. The nullmask indicates for every row whether or not the corresponding row is `NULL`. If a row is `NULL`, the values present in the array provided by `duckdb_column_data` are undefined. @@ -432,17 +478,42 @@ The result of this function must not be freed. It will be cleaned up when `duckd * result: The result object to fetch the nullmask from. * returns: The error of the result. */ -DUCKDB_API char *duckdb_result_error(duckdb_result *result); +DUCKDB_API const char *duckdb_result_error(duckdb_result *result); //===--------------------------------------------------------------------===// // Result Functions //===--------------------------------------------------------------------===// +/*! +Fetches a data chunk from the duckdb_result. This function should be called repeatedly until the result is exhausted. + +This function supersedes all `duckdb_value` functions, as well as the `duckdb_column_data` and `duckdb_nullmask_data` +functions. It results in significantly better performance, and should be preferred in newer code-bases. + +If this function is used, none of the other result functions can be used and vice versa (i.e. this function cannot be +mixed with the legacy result functions). + +Use `duckdb_result_chunk_count` to figure out how many chunks there are in the result. + +* result: The result object to fetch the data chunk from. +* chunk_index: The chunk index to fetch from. +* returns: The resulting data chunk. Returns `NULL` if the chunk index is out of bounds. +*/ +DUCKDB_API duckdb_data_chunk duckdb_result_get_chunk(duckdb_result result, idx_t chunk_index); + +/*! +Returns the number of data chunks present in the result. + +* result: The result object +* returns: The resulting data chunk. Returns `NULL` if the chunk index is out of bounds. +*/ +DUCKDB_API idx_t duckdb_result_chunk_count(duckdb_result result); + // Safe fetch functions // These functions will perform conversions if necessary. // On failure (e.g. if conversion cannot be performed or if the value is NULL) a default value is returned. // Note that these functions are slow since they perform bounds checking and conversion -// For fast access of values prefer using duckdb_column_data and duckdb_nullmask_data +// For fast access of values prefer using `duckdb_result_get_chunk` /*! * returns: The boolean value at the specified location, or false if the value cannot be converted. @@ -474,6 +545,11 @@ DUCKDB_API int64_t duckdb_value_int64(duckdb_result *result, idx_t col, idx_t ro */ DUCKDB_API duckdb_hugeint duckdb_value_hugeint(duckdb_result *result, idx_t col, idx_t row); +/*! + * returns: The duckdb_decimal value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API duckdb_decimal duckdb_value_decimal(duckdb_result *result, idx_t col, idx_t row); + /*! * returns: The uint8_t value at the specified location, or 0 if the value cannot be converted. */ @@ -568,6 +644,14 @@ Free a value returned from `duckdb_malloc`, `duckdb_value_varchar` or `duckdb_va */ DUCKDB_API void duckdb_free(void *ptr); +/*! +The internal vector size used by DuckDB. +This is the amount of tuples that will fit into a data chunk created by `duckdb_create_data_chunk`. + +* returns: The vector size. +*/ +DUCKDB_API idx_t duckdb_vector_size(); + //===--------------------------------------------------------------------===// // Date/Time/Timestamp Helpers //===--------------------------------------------------------------------===// @@ -640,6 +724,17 @@ If the conversion fails because the double value is too big the result will be 0 */ DUCKDB_API duckdb_hugeint duckdb_double_to_hugeint(double val); +//===--------------------------------------------------------------------===// +// Decimal Helpers +//===--------------------------------------------------------------------===// +/*! +Converts a duckdb_decimal object (as obtained from a `DUCKDB_TYPE_DECIMAL` column) into a double. + +* val: The decimal value. +* returns: The converted `double` element. +*/ +DUCKDB_API double duckdb_decimal_to_double(duckdb_decimal val); + //===--------------------------------------------------------------------===// // Prepared Statements //===--------------------------------------------------------------------===// @@ -670,7 +765,7 @@ DUCKDB_API duckdb_state duckdb_prepare(duckdb_connection connection, const char duckdb_prepared_statement *out_prepared_statement); /*! -Closes the prepared statement and de-allocates all memory allocated for that connection. +Closes the prepared statement and de-allocates all memory allocated for the statement. * prepared_statement: The prepared statement to destroy. */ @@ -838,6 +933,694 @@ Executes the prepared statement with the given bound parameters, and returns an DUCKDB_API duckdb_state duckdb_execute_prepared_arrow(duckdb_prepared_statement prepared_statement, duckdb_arrow *out_result); +//===--------------------------------------------------------------------===// +// Value Interface +//===--------------------------------------------------------------------===// +/*! +Destroys the value and de-allocates all memory allocated for that type. + +* value: The value to destroy. +*/ +DUCKDB_API void duckdb_destroy_value(duckdb_value *value); + +/*! +Creates a value from a null-terminated string + +* value: The null-terminated string +* returns: The value. This must be destroyed with `duckdb_destroy_value`. +*/ +DUCKDB_API duckdb_value duckdb_create_varchar(const char *text); + +/*! +Creates a value from a string + +* value: The text +* length: The length of the text +* returns: The value. This must be destroyed with `duckdb_destroy_value`. +*/ +DUCKDB_API duckdb_value duckdb_create_varchar_length(const char *text, idx_t length); + +/*! +Creates a value from an int64 + +* value: The bigint value +* returns: The value. This must be destroyed with `duckdb_destroy_value`. +*/ +DUCKDB_API duckdb_value duckdb_create_int64(int64_t val); + +/*! +Obtains a string representation of the given value. +The result must be destroyed with `duckdb_free`. + +* value: The value +* returns: The string value. This must be destroyed with `duckdb_free`. +*/ +DUCKDB_API char *duckdb_get_varchar(duckdb_value value); + +/*! +Obtains an int64 of the given value. + +* value: The value +* returns: The int64 value, or 0 if no conversion is possible +*/ +DUCKDB_API int64_t duckdb_get_int64(duckdb_value value); + +//===--------------------------------------------------------------------===// +// Logical Type Interface +//===--------------------------------------------------------------------===// + +/*! +Creates a `duckdb_logical_type` from a standard primitive type. +The resulting type should be destroyed with `duckdb_destroy_logical_type`. + +This should not be used with `DUCKDB_TYPE_DECIMAL`. + +* type: The primitive type to create. +* returns: The logical type. +*/ +DUCKDB_API duckdb_logical_type duckdb_create_logical_type(duckdb_type type); + +/*! +Creates a `duckdb_logical_type` of type decimal with the specified width and scale +The resulting type should be destroyed with `duckdb_destroy_logical_type`. + +* width: The width of the decimal type +* scale: The scale of the decimal type +* returns: The logical type. +*/ +DUCKDB_API duckdb_logical_type duckdb_create_decimal_type(uint8_t width, uint8_t scale); + +/*! +Retrieves the type class of a `duckdb_logical_type`. + +* type: The logical type object +* returns: The type id +*/ +DUCKDB_API duckdb_type duckdb_get_type_id(duckdb_logical_type type); + +/*! +Retrieves the width of a decimal type. + +* type: The logical type object +* returns: The width of the decimal type +*/ +DUCKDB_API uint8_t duckdb_decimal_width(duckdb_logical_type type); + +/*! +Retrieves the scale of a decimal type. + +* type: The logical type object +* returns: The scale of the decimal type +*/ +DUCKDB_API uint8_t duckdb_decimal_scale(duckdb_logical_type type); + +/*! +Retrieves the internal storage type of a decimal type. + +* type: The logical type object +* returns: The internal type of the decimal type +*/ +DUCKDB_API duckdb_type duckdb_decimal_internal_type(duckdb_logical_type type); + +/*! +Retrieves the internal storage type of an enum type. + +* type: The logical type object +* returns: The internal type of the enum type +*/ +DUCKDB_API duckdb_type duckdb_enum_internal_type(duckdb_logical_type type); + +/*! +Retrieves the dictionary size of the enum type + +* type: The logical type object +* returns: The dictionary size of the enum type +*/ +DUCKDB_API uint32_t duckdb_enum_dictionary_size(duckdb_logical_type type); + +/*! +Retrieves the dictionary value at the specified position from the enum. + +The result must be freed with `duckdb_free` + +* type: The logical type object +* index: The index in the dictionary +* returns: The string value of the enum type. Must be freed with `duckdb_free`. +*/ +DUCKDB_API char *duckdb_enum_dictionary_value(duckdb_logical_type type, idx_t index); + +/*! +Retrieves the child type of the given list type. + +The result must be freed with `duckdb_destroy_logical_type` + +* type: The logical type object +* returns: The child type of the list type. Must be destroyed with `duckdb_destroy_logical_type`. +*/ +DUCKDB_API duckdb_logical_type duckdb_list_type_child_type(duckdb_logical_type type); + +/*! +Returns the number of children of a struct type. + +* type: The logical type object +* returns: The number of children of a struct type. +*/ +DUCKDB_API idx_t duckdb_struct_type_child_count(duckdb_logical_type type); + +/*! +Retrieves the name of the struct child. + +The result must be freed with `duckdb_free` + +* type: The logical type object +* index: The child index +* returns: The name of the struct type. Must be freed with `duckdb_free`. +*/ +DUCKDB_API char *duckdb_struct_type_child_name(duckdb_logical_type type, idx_t index); + +/*! +Retrieves the child type of the given struct type at the specified index. + +The result must be freed with `duckdb_destroy_logical_type` + +* type: The logical type object +* index: The child index +* returns: The child type of the struct type. Must be destroyed with `duckdb_destroy_logical_type`. +*/ +DUCKDB_API duckdb_logical_type duckdb_struct_type_child_type(duckdb_logical_type type, idx_t index); + +/*! +Destroys the logical type and de-allocates all memory allocated for that type. + +* type: The logical type to destroy. +*/ +DUCKDB_API void duckdb_destroy_logical_type(duckdb_logical_type *type); + +//===--------------------------------------------------------------------===// +// Data Chunk Interface +//===--------------------------------------------------------------------===// +/*! +Creates an empty DataChunk with the specified set of types. + +* types: An array of types of the data chunk. +* column_count: The number of columns. +* returns: The data chunk. +*/ +DUCKDB_API duckdb_data_chunk duckdb_create_data_chunk(duckdb_logical_type *types, idx_t column_count); + +/*! +Destroys the data chunk and de-allocates all memory allocated for that chunk. + +* chunk: The data chunk to destroy. +*/ +DUCKDB_API void duckdb_destroy_data_chunk(duckdb_data_chunk *chunk); + +/*! +Resets a data chunk, clearing the validity masks and setting the cardinality of the data chunk to 0. + +* chunk: The data chunk to reset. +*/ +DUCKDB_API void duckdb_data_chunk_reset(duckdb_data_chunk chunk); + +/*! +Retrieves the number of columns in a data chunk. + +* chunk: The data chunk to get the data from +* returns: The number of columns in the data chunk +*/ +DUCKDB_API idx_t duckdb_data_chunk_get_column_count(duckdb_data_chunk chunk); + +/*! +Retrieves the vector at the specified column index in the data chunk. + +The pointer to the vector is valid for as long as the chunk is alive. +It does NOT need to be destroyed. + +* chunk: The data chunk to get the data from +* returns: The vector +*/ +DUCKDB_API duckdb_vector duckdb_data_chunk_get_vector(duckdb_data_chunk chunk, idx_t col_idx); + +/*! +Retrieves the current number of tuples in a data chunk. + +* chunk: The data chunk to get the data from +* returns: The number of tuples in the data chunk +*/ +DUCKDB_API idx_t duckdb_data_chunk_get_size(duckdb_data_chunk chunk); + +/*! +Sets the current number of tuples in a data chunk. + +* chunk: The data chunk to set the size in +* size: The number of tuples in the data chunk +*/ +DUCKDB_API void duckdb_data_chunk_set_size(duckdb_data_chunk chunk, idx_t size); + +//===--------------------------------------------------------------------===// +// Vector Interface +//===--------------------------------------------------------------------===// +/*! +Retrieves the column type of the specified vector. + +The result must be destroyed with `duckdb_destroy_logical_type`. + +* vector: The vector get the data from +* returns: The type of the vector +*/ +DUCKDB_API duckdb_logical_type duckdb_vector_get_column_type(duckdb_vector vector); + +/*! +Retrieves the data pointer of the vector. + +The data pointer can be used to read or write values from the vector. +How to read or write values depends on the type of the vector. + +* vector: The vector to get the data from +* returns: The data pointer +*/ +DUCKDB_API void *duckdb_vector_get_data(duckdb_vector vector); + +/*! +Retrieves the validity mask pointer of the specified vector. + +If all values are valid, this function MIGHT return NULL! + +The validity mask is a bitset that signifies null-ness within the data chunk. +It is a series of uint64_t values, where each uint64_t value contains validity for 64 tuples. +The bit is set to 1 if the value is valid (i.e. not NULL) or 0 if the value is invalid (i.e. NULL). + +Validity of a specific value can be obtained like this: + +idx_t entry_idx = row_idx / 64; +idx_t idx_in_entry = row_idx % 64; +bool is_valid = validity_mask[entry_idx] & (1 << idx_in_entry); + +Alternatively, the (slower) duckdb_validity_row_is_valid function can be used. + +* vector: The vector to get the data from +* returns: The pointer to the validity mask, or NULL if no validity mask is present +*/ +DUCKDB_API uint64_t *duckdb_vector_get_validity(duckdb_vector vector); + +/*! +Ensures the validity mask is writable by allocating it. + +After this function is called, `duckdb_vector_get_validity` will ALWAYS return non-NULL. +This allows null values to be written to the vector, regardless of whether a validity mask was present before. + +* vector: The vector to alter +*/ +DUCKDB_API void duckdb_vector_ensure_validity_writable(duckdb_vector vector); + +/*! +Assigns a string element in the vector at the specified location. + +* vector: The vector to alter +* index: The row position in the vector to assign the string to +* str: The null-terminated string +*/ +DUCKDB_API void duckdb_vector_assign_string_element(duckdb_vector vector, idx_t index, const char *str); + +/*! +Assigns a string element in the vector at the specified location. + +* vector: The vector to alter +* index: The row position in the vector to assign the string to +* str: The string +* str_len: The length of the string (in bytes) +*/ +DUCKDB_API void duckdb_vector_assign_string_element_len(duckdb_vector vector, idx_t index, const char *str, + idx_t str_len); + +/*! +Retrieves the child vector of a list vector. + +The resulting vector is valid as long as the parent vector is valid. + +* vector: The vector +* returns: The child vector +*/ +DUCKDB_API duckdb_vector duckdb_list_vector_get_child(duckdb_vector vector); + +/*! +Returns the size of the child vector of the list + +* vector: The vector +* returns: The size of the child list +*/ +DUCKDB_API idx_t duckdb_list_vector_get_size(duckdb_vector vector); + +/*! +Retrieves the child vector of a struct vector. + +The resulting vector is valid as long as the parent vector is valid. + +* vector: The vector +* index: The child index +* returns: The child vector +*/ +DUCKDB_API duckdb_vector duckdb_struct_vector_get_child(duckdb_vector vector, idx_t index); + +//===--------------------------------------------------------------------===// +// Validity Mask Functions +//===--------------------------------------------------------------------===// +/*! +Returns whether or not a row is valid (i.e. not NULL) in the given validity mask. + +* validity: The validity mask, as obtained through `duckdb_data_chunk_get_validity` +* row: The row index +* returns: true if the row is valid, false otherwise +*/ +DUCKDB_API bool duckdb_validity_row_is_valid(uint64_t *validity, idx_t row); + +/*! +In a validity mask, sets a specific row to either valid or invalid. + +Note that `duckdb_data_chunk_ensure_validity_writable` should be called before calling `duckdb_data_chunk_get_validity`, +to ensure that there is a validity mask to write to. + +* validity: The validity mask, as obtained through `duckdb_data_chunk_get_validity`. +* row: The row index +* valid: Whether or not to set the row to valid, or invalid +*/ +DUCKDB_API void duckdb_validity_set_row_validity(uint64_t *validity, idx_t row, bool valid); + +/*! +In a validity mask, sets a specific row to invalid. + +Equivalent to `duckdb_validity_set_row_validity` with valid set to false. + +* validity: The validity mask +* row: The row index +*/ +DUCKDB_API void duckdb_validity_set_row_invalid(uint64_t *validity, idx_t row); + +/*! +In a validity mask, sets a specific row to valid. + +Equivalent to `duckdb_validity_set_row_validity` with valid set to true. + +* validity: The validity mask +* row: The row index +*/ +DUCKDB_API void duckdb_validity_set_row_valid(uint64_t *validity, idx_t row); + +//===--------------------------------------------------------------------===// +// Table Functions +//===--------------------------------------------------------------------===// +typedef void *duckdb_table_function; +typedef void *duckdb_bind_info; +typedef void *duckdb_init_info; +typedef void *duckdb_function_info; + +typedef void (*duckdb_table_function_bind_t)(duckdb_bind_info info); +typedef void (*duckdb_table_function_init_t)(duckdb_init_info info); +typedef void (*duckdb_table_function_t)(duckdb_function_info info, duckdb_data_chunk output); +typedef void (*duckdb_delete_callback_t)(void *data); + +/*! +Creates a new empty table function. + +The return value should be destroyed with `duckdb_destroy_table_function`. + +* returns: The table function object. +*/ +DUCKDB_API duckdb_table_function duckdb_create_table_function(); + +/*! +Destroys the given table function object. + +* table_function: The table function to destroy +*/ +DUCKDB_API void duckdb_destroy_table_function(duckdb_table_function *table_function); + +/*! +Sets the name of the given table function. + +* table_function: The table function +* name: The name of the table function +*/ +DUCKDB_API void duckdb_table_function_set_name(duckdb_table_function table_function, const char *name); + +/*! +Adds a parameter to the table function. + +* table_function: The table function +* type: The type of the parameter to add. +*/ +DUCKDB_API void duckdb_table_function_add_parameter(duckdb_table_function table_function, duckdb_logical_type type); + +/*! +Assigns extra information to the table function that can be fetched during binding, etc. + +* table_function: The table function +* extra_info: The extra information +* destroy: The callback that will be called to destroy the bind data (if any) +*/ +DUCKDB_API void duckdb_table_function_set_extra_info(duckdb_table_function table_function, void *extra_info, + duckdb_delete_callback_t destroy); + +/*! +Sets the bind function of the table function + +* table_function: The table function +* bind: The bind function +*/ +DUCKDB_API void duckdb_table_function_set_bind(duckdb_table_function table_function, duckdb_table_function_bind_t bind); + +/*! +Sets the init function of the table function + +* table_function: The table function +* init: The init function +*/ +DUCKDB_API void duckdb_table_function_set_init(duckdb_table_function table_function, duckdb_table_function_init_t init); + +/*! +Sets the main function of the table function + +* table_function: The table function +* function: The function +*/ +DUCKDB_API void duckdb_table_function_set_function(duckdb_table_function table_function, + duckdb_table_function_t function); + +/*! +Sets whether or not the given table function supports projection pushdown. + +If this is set to true, the system will provide a list of all required columns in the `init` stage through +the `duckdb_init_get_column_count` and `duckdb_init_get_column_index` functions. +If this is set to false (the default), the system will expect all columns to be projected. + +* table_function: The table function +* pushdown: True if the table function supports projection pushdown, false otherwise. +*/ +DUCKDB_API void duckdb_table_function_supports_projection_pushdown(duckdb_table_function table_function, bool pushdown); + +/*! +Register the table function object within the given connection. + +The function requires at least a name, a bind function, an init function and a main function. + +If the function is incomplete or a function with this name already exists DuckDBError is returned. + +* con: The connection to register it in. +* function: The function pointer +* returns: Whether or not the registration was successful. +*/ +DUCKDB_API duckdb_state duckdb_register_table_function(duckdb_connection con, duckdb_table_function function); + +//===--------------------------------------------------------------------===// +// Table Function Bind +//===--------------------------------------------------------------------===// +/*! +Retrieves the extra info of the function as set in `duckdb_table_function_set_extra_info` + +* info: The info object +* returns: The extra info +*/ +DUCKDB_API void *duckdb_bind_get_extra_info(duckdb_bind_info info); + +/*! +Adds a result column to the output of the table function. + +* info: The info object +* name: The name of the column +* type: The logical type of the column +*/ +DUCKDB_API void duckdb_bind_add_result_column(duckdb_bind_info info, const char *name, duckdb_logical_type type); + +/*! +Retrieves the number of regular (non-named) parameters to the function. + +* info: The info object +* returns: The number of parameters +*/ +DUCKDB_API idx_t duckdb_bind_get_parameter_count(duckdb_bind_info info); + +/*! +Retrieves the parameter at the given index. + +The result must be destroyed with `duckdb_destroy_value`. + +* info: The info object +* index: The index of the parameter to get +* returns: The value of the parameter. Must be destroyed with `duckdb_destroy_value`. +*/ +DUCKDB_API duckdb_value duckdb_bind_get_parameter(duckdb_bind_info info, idx_t index); + +/*! +Sets the user-provided bind data in the bind object. This object can be retrieved again during execution. + +* info: The info object +* extra_data: The bind data object. +* destroy: The callback that will be called to destroy the bind data (if any) +*/ +DUCKDB_API void duckdb_bind_set_bind_data(duckdb_bind_info info, void *bind_data, duckdb_delete_callback_t destroy); + +/*! +Report that an error has occurred while calling bind. + +* info: The info object +* error: The error message +*/ +DUCKDB_API void duckdb_bind_set_error(duckdb_bind_info info, const char *error); + +//===--------------------------------------------------------------------===// +// Table Function Init +//===--------------------------------------------------------------------===// + +/*! +Retrieves the extra info of the function as set in `duckdb_table_function_set_extra_info` + +* info: The info object +* returns: The extra info +*/ +DUCKDB_API void *duckdb_init_get_extra_info(duckdb_init_info info); + +/*! +Gets the bind data set by `duckdb_bind_set_bind_data` during the bind. + +Note that the bind data should be considered as read-only. +For tracking state, use the init data instead. + +* info: The info object +* returns: The bind data object +*/ +DUCKDB_API void *duckdb_init_get_bind_data(duckdb_init_info info); + +/*! +Sets the user-provided init data in the init object. This object can be retrieved again during execution. + +* info: The info object +* extra_data: The init data object. +* destroy: The callback that will be called to destroy the init data (if any) +*/ +DUCKDB_API void duckdb_init_set_init_data(duckdb_init_info info, void *init_data, duckdb_delete_callback_t destroy); + +/*! +Returns the number of projected columns. + +This function must be used if projection pushdown is enabled to figure out which columns to emit. + +* info: The info object +* returns: The number of projected columns. +*/ +DUCKDB_API idx_t duckdb_init_get_column_count(duckdb_init_info info); + +/*! +Returns the column index of the projected column at the specified position. + +This function must be used if projection pushdown is enabled to figure out which columns to emit. + +* info: The info object +* column_index: The index at which to get the projected column index, from 0..duckdb_init_get_column_count(info) +* returns: The column index of the projected column. +*/ +DUCKDB_API idx_t duckdb_init_get_column_index(duckdb_init_info info, idx_t column_index); + +/*! +Report that an error has occurred while calling init. + +* info: The info object +* error: The error message +*/ +DUCKDB_API void duckdb_init_set_error(duckdb_init_info info, const char *error); + +//===--------------------------------------------------------------------===// +// Table Function +//===--------------------------------------------------------------------===// + +/*! +Retrieves the extra info of the function as set in `duckdb_table_function_set_extra_info` + +* info: The info object +* returns: The extra info +*/ +DUCKDB_API void *duckdb_function_get_extra_info(duckdb_function_info info); +/*! +Gets the bind data set by `duckdb_bind_set_bind_data` during the bind. + +Note that the bind data should be considered as read-only. +For tracking state, use the init data instead. + +* info: The info object +* returns: The bind data object +*/ +DUCKDB_API void *duckdb_function_get_bind_data(duckdb_function_info info); + +/*! +Gets the init data set by `duckdb_bind_set_init_data` during the bind. + +* info: The info object +* returns: The init data object +*/ +DUCKDB_API void *duckdb_function_get_init_data(duckdb_function_info info); + +/*! +Report that an error has occurred while executing the function. + +* info: The info object +* error: The error message +*/ +DUCKDB_API void duckdb_function_set_error(duckdb_function_info info, const char *error); + +//===--------------------------------------------------------------------===// +// Replacement Scans +//===--------------------------------------------------------------------===// +typedef void *duckdb_replacement_scan_info; + +typedef void (*duckdb_replacement_callback_t)(duckdb_replacement_scan_info info, const char *table_name, void *data); + +/*! +Add a replacement scan definition to the specified database + +* db: The database object to add the replacement scan to +* replacement: The replacement scan callback +* extra_data: Extra data that is passed back into the specified callback +* delete_callback: The delete callback to call on the extra data, if any +*/ +DUCKDB_API void duckdb_add_replacement_scan(duckdb_database db, duckdb_replacement_callback_t replacement, + void *extra_data, duckdb_delete_callback_t delete_callback); + +/*! +Sets the replacement function name to use. If this function is called in the replacement callback, + the replacement scan is performed. If it is not called, the replacement callback is not performed. + +* info: The info object +* function_name: The function name to substitute. +*/ +DUCKDB_API void duckdb_replacement_scan_set_function_name(duckdb_replacement_scan_info info, const char *function_name); + +/*! +Adds a parameter to the replacement scan function. + +* info: The info object +* parameter: The parameter to add. +*/ +DUCKDB_API void duckdb_replacement_scan_add_parameter(duckdb_replacement_scan_info info, duckdb_value parameter); + //===--------------------------------------------------------------------===// // Appender //===--------------------------------------------------------------------===// @@ -1005,6 +1788,19 @@ Append a NULL value to the appender (of any type). */ DUCKDB_API duckdb_state duckdb_append_null(duckdb_appender appender); +/*! +Appends a pre-filled data chunk to the specified appender. + +The types of the data chunk must exactly match the types of the table, no casting is performed. +If the types do not match or the appender is in an invalid state, DuckDBError is returned. +If the append is successful, DuckDBSuccess is returned. + +* appender: The appender to append to. +* chunk: The data chunk to append. +* returns: The return state. +*/ +DUCKDB_API duckdb_state duckdb_append_data_chunk(duckdb_appender appender, duckdb_data_chunk chunk); + //===--------------------------------------------------------------------===// // Arrow Interface //===--------------------------------------------------------------------===// diff --git a/libduckdb-sys/duckdb/duckdb.hpp b/libduckdb-sys/duckdb/duckdb.hpp index 51dd5a32..fb8c2d91 100644 --- a/libduckdb-sys/duckdb/duckdb.hpp +++ b/libduckdb-sys/duckdb/duckdb.hpp @@ -10,8 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI #pragma once #define DUCKDB_AMALGAMATION 1 -#define DUCKDB_SOURCE_ID "5aebf7dac" -#define DUCKDB_VERSION "v0.3.2" +#define DUCKDB_SOURCE_ID "fe9ba8003" +#define DUCKDB_VERSION "v0.3.3" //===----------------------------------------------------------------------===// // DuckDB // @@ -260,6 +260,19 @@ enum class ProfilerPrintFormat : uint8_t { NONE, QUERY_TREE, JSON, QUERY_TREE_OP #endif namespace duckdb { + +// explicit fallthrough for switch_statementss +#ifndef __has_cpp_attribute // For backwards compatibility +#define __has_cpp_attribute(x) 0 +#endif +#if __has_cpp_attribute(clang::fallthrough) +#define DUCKDB_EXPLICIT_FALLTHROUGH [[clang::fallthrough]] +#elif __has_cpp_attribute(gnu::fallthrough) +#define DUCKDB_EXPLICIT_FALLTHROUGH [[gnu::fallthrough]] +#else +#define DUCKDB_EXPLICIT_FALLTHROUGH +#endif + #if !defined(_MSC_VER) && (__cplusplus < 201402L) template unique_ptr make_unique(Args &&... args) { @@ -728,7 +741,7 @@ struct hugeint_t { hugeint_t &operator=(const hugeint_t &rhs) = default; hugeint_t &operator=(hugeint_t &&rhs) = default; - string ToString() const; + DUCKDB_API string ToString() const; // comparison operators bool operator==(const hugeint_t &rhs) const; @@ -948,7 +961,7 @@ enum class LogicalTypeId : uint8_t { UBIGINT = 31, TIMESTAMP_TZ = 32, TIME_TZ = 34, - + JSON = 35, HUGEINT = 50, POINTER = 51, @@ -960,11 +973,15 @@ enum class LogicalTypeId : uint8_t { LIST = 101, MAP = 102, TABLE = 103, - ENUM = 104 + ENUM = 104, + AGGREGATE_STATE = 105 }; struct ExtraTypeInfo; + +struct aggregate_state_t; + struct LogicalType { DUCKDB_API LogicalType(); DUCKDB_API LogicalType(LogicalTypeId id); // NOLINT: Allow implicit conversion from `LogicalTypeId` @@ -1060,7 +1077,7 @@ struct LogicalType { static constexpr const LogicalTypeId POINTER = LogicalTypeId::POINTER; static constexpr const LogicalTypeId TABLE = LogicalTypeId::TABLE; static constexpr const LogicalTypeId INVALID = LogicalTypeId::INVALID; - + static constexpr const LogicalTypeId JSON = LogicalTypeId::JSON; static constexpr const LogicalTypeId ROW_TYPE = LogicalTypeId::BIGINT; // explicitly allowing these functions to be capitalized to be in-line with the remaining functions @@ -1068,6 +1085,7 @@ struct LogicalType { DUCKDB_API static LogicalType VARCHAR_COLLATION(string collation); // NOLINT DUCKDB_API static LogicalType LIST( LogicalType child); // NOLINT DUCKDB_API static LogicalType STRUCT( child_list_t children); // NOLINT + DUCKDB_API static LogicalType AGGREGATE_STATE(aggregate_state_t state_type); // NOLINT DUCKDB_API static LogicalType MAP( child_list_t children); // NOLINT DUCKDB_API static LogicalType MAP(LogicalType key, LogicalType value); // NOLINT DUCKDB_API static LogicalType ENUM(const string &enum_name, Vector &ordered_data, idx_t size); // NOLINT @@ -1120,10 +1138,17 @@ struct MapType { DUCKDB_API static const LogicalType &ValueType(const LogicalType &type); }; +struct AggregateStateType { + DUCKDB_API static const string GetTypeName(const LogicalType &type); + DUCKDB_API static const aggregate_state_t &GetStateType(const LogicalType &type); +}; + + +DUCKDB_API string LogicalTypeIdToString(LogicalTypeId type); -string LogicalTypeIdToString(LogicalTypeId type); +DUCKDB_API LogicalTypeId TransformStringToLogicalTypeId(const string &str); -LogicalTypeId TransformStringToLogicalType(const string &str); +DUCKDB_API LogicalType TransformStringToLogicalType(const string &str); //! Returns the PhysicalType for the given type template @@ -1195,6 +1220,15 @@ bool IsIntegerType() { bool ApproxEqual(float l, float r); bool ApproxEqual(double l, double r); +struct aggregate_state_t { + aggregate_state_t(string function_name_p, LogicalType return_type_p, vector bound_argument_types_p) : function_name(move(function_name_p)), return_type(move(return_type_p)), bound_argument_types(move(bound_argument_types_p)) { + } + + string function_name; + LogicalType return_type; + vector bound_argument_types; +}; + } // namespace duckdb @@ -1207,9 +1241,10 @@ enum class ExceptionFormatValueType : uint8_t { }; struct ExceptionFormatValue { - DUCKDB_API ExceptionFormatValue(double dbl_val); // NOLINT - DUCKDB_API ExceptionFormatValue(int64_t int_val); // NOLINT - DUCKDB_API ExceptionFormatValue(string str_val); // NOLINT + DUCKDB_API ExceptionFormatValue(double dbl_val); // NOLINT + DUCKDB_API ExceptionFormatValue(int64_t int_val); // NOLINT + DUCKDB_API ExceptionFormatValue(string str_val); // NOLINT + DUCKDB_API ExceptionFormatValue(hugeint_t hg_val); // NOLINT ExceptionFormatValueType type; @@ -1239,6 +1274,8 @@ template <> DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(const char *value); template <> DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(char *value); +template <> +DUCKDB_API ExceptionFormatValue ExceptionFormatValue::CreateFormatValue(hugeint_t value); } // namespace duckdb @@ -1904,17 +1941,19 @@ class FileSystem { //! Recursively remove a directory and all files in it DUCKDB_API virtual void RemoveDirectory(const string &directory); //! List files in a directory, invoking the callback method for each one with (filename, is_dir) - DUCKDB_API virtual bool ListFiles(const string &directory, const std::function &callback); + DUCKDB_API virtual bool ListFiles(const string &directory, + const std::function &callback); //! Move a file from source path to the target, StorageManager relies on this being an atomic action for ACID //! properties DUCKDB_API virtual void MoveFile(const string &source, const string &target); //! Check if a file exists DUCKDB_API virtual bool FileExists(const string &filename); + //! Check if path is pipe + DUCKDB_API virtual bool IsPipe(const string &filename); //! Remove a file from disk DUCKDB_API virtual void RemoveFile(const string &filename); //! Sync a file handle to disk DUCKDB_API virtual void FileSync(FileHandle &handle); - //! Sets the working directory DUCKDB_API static void SetWorkingDirectory(const string &path); //! Gets the working directory @@ -1933,7 +1972,8 @@ class FileSystem { DUCKDB_API static string ExtractBaseName(const string &path); //! Runs a glob on the file system, returning a list of matching files - DUCKDB_API virtual vector Glob(const string &path); + DUCKDB_API virtual vector Glob(const string &path, FileOpener *opener = nullptr); + DUCKDB_API virtual vector Glob(const string &path, ClientContext &context); //! registers a sub-file system to handle certain file name prefixes, e.g. http:// etc. DUCKDB_API virtual void RegisterSubSystem(unique_ptr sub_fs); @@ -2702,6 +2742,10 @@ class Value { int32_t micros); DUCKDB_API static Value INTERVAL(int32_t months, int32_t days, int64_t micros); DUCKDB_API static Value INTERVAL(interval_t interval); + //! Creates a JSON Value + DUCKDB_API static Value JSON(const char *val); + DUCKDB_API static Value JSON(string_t val); + DUCKDB_API static Value JSON(string val); // Create a enum Value from a specified uint value DUCKDB_API static Value ENUM(uint64_t value, const LogicalType &original_type); @@ -2764,6 +2808,8 @@ class Value { DUCKDB_API hash_t Hash() const; //! Convert this value to a string DUCKDB_API string ToString() const; + //! Convert this value to a SQL-parseable string + DUCKDB_API string ToSQLString() const; DUCKDB_API uintptr_t GetPointer() const; @@ -2797,17 +2843,20 @@ class Value { DUCKDB_API bool operator<=(const int64_t &rhs) const; DUCKDB_API bool operator>=(const int64_t &rhs) const; - DUCKDB_API static bool FloatIsValid(float value); - DUCKDB_API static bool DoubleIsValid(double value); - DUCKDB_API static bool StringIsValid(const char *str, idx_t length); - static bool StringIsValid(const string &str) { - return StringIsValid(str.c_str(), str.size()); + DUCKDB_API static bool FloatIsFinite(float value); + DUCKDB_API static bool DoubleIsFinite(double value); + template + static bool IsNan(T value) { + throw InternalException("Unimplemented template type for Value::IsNan"); } - template - static bool IsValid(T value) { + static bool IsFinite(T value) { return true; } + DUCKDB_API static bool StringIsValid(const char *str, idx_t length); + static bool StringIsValid(const string &str) { + return StringIsValid(str.c_str(), str.size()); + } //! Returns true if the values are (approximately) equivalent. Note this is NOT the SQL equivalence. For this //! function, NULL values are equivalent and floating point values that are close are equivalent. @@ -3094,9 +3143,14 @@ template <> DUCKDB_API interval_t &Value::GetReferenceUnsafe(); template <> -DUCKDB_API bool Value::IsValid(float value); +DUCKDB_API bool Value::IsNan(float input); +template <> +DUCKDB_API bool Value::IsNan(double input); + +template <> +DUCKDB_API bool Value::IsFinite(float input); template <> -DUCKDB_API bool Value::IsValid(double value); +DUCKDB_API bool Value::IsFinite(double input); } // namespace duckdb @@ -3368,7 +3422,7 @@ class VectorBuffer { return aux_data.get(); } - void SetAuxiliaryData(unique_ptr aux_data_p, VectorAuxiliaryDataType aux_type_p) { + void SetAuxiliaryData(unique_ptr aux_data_p) { aux_data = move(aux_data_p); } @@ -3971,6 +4025,9 @@ struct ArrowArrayStream { //! Here we have the internal duckdb classes that interact with Arrow's Internal Header (i.e., duckdb/commons/arrow.hpp) namespace duckdb { +class QueryResult; +class DataChunk; + class ArrowSchemaWrapper { public: ArrowSchema arrow_schema; @@ -4006,6 +4063,14 @@ class ArrowArrayStreamWrapper { arrow_array_stream.release = nullptr; } }; + +class ArrowUtil { +public: + static unique_ptr FetchChunk(QueryResult *result, idx_t chunk_size); + +private: + static unique_ptr FetchNext(QueryResult &result); +}; } // namespace duckdb @@ -4091,6 +4156,9 @@ class DataChunk { //! Splits the DataChunk in two DUCKDB_API void Split(DataChunk &other, idx_t split_idx); + //! Fuses a DataChunk onto the right of this one, and destroys the other. Inverse of Split. + DUCKDB_API void Fuse(DataChunk &other); + //! Turn all the vectors from the chunk into flat vectors DUCKDB_API void Normalify(); @@ -4155,45 +4223,47 @@ struct VectorOperations { //===--------------------------------------------------------------------===// // In-Place Operators //===--------------------------------------------------------------------===// - //! A += B - static void AddInPlace(Vector &A, int64_t B, idx_t count); + //! left += delta + static void AddInPlace(Vector &left, int64_t delta, idx_t count); //===--------------------------------------------------------------------===// // NULL Operators //===--------------------------------------------------------------------===// - //! result = IS NOT NULL(A) - static void IsNotNull(Vector &A, Vector &result, idx_t count); - //! result = IS NULL (A) - static void IsNull(Vector &A, Vector &result, idx_t count); - // Returns whether or not a vector has a NULL value - static bool HasNull(Vector &A, idx_t count); - static bool HasNotNull(Vector &A, idx_t count); + //! result = IS NOT NULL(input) + static void IsNotNull(Vector &arg, Vector &result, idx_t count); + //! result = IS NULL (input) + static void IsNull(Vector &input, Vector &result, idx_t count); + // Returns whether or not arg vector has a NULL value + static bool HasNull(Vector &input, idx_t count); + static bool HasNotNull(Vector &input, idx_t count); + //! Count the number of not-NULL values. + static idx_t CountNotNull(Vector &input, const idx_t count); //===--------------------------------------------------------------------===// // Boolean Operations //===--------------------------------------------------------------------===// - // result = A && B - static void And(Vector &A, Vector &B, Vector &result, idx_t count); - // result = A || B - static void Or(Vector &A, Vector &B, Vector &result, idx_t count); - // result = NOT(A) - static void Not(Vector &A, Vector &result, idx_t count); + // result = left && right + static void And(Vector &left, Vector &right, Vector &result, idx_t count); + // result = left || right + static void Or(Vector &left, Vector &right, Vector &result, idx_t count); + // result = NOT(left) + static void Not(Vector &left, Vector &result, idx_t count); //===--------------------------------------------------------------------===// // Comparison Operations //===--------------------------------------------------------------------===// - // result = A == B - static void Equals(Vector &A, Vector &B, Vector &result, idx_t count); - // result = A != B - static void NotEquals(Vector &A, Vector &B, Vector &result, idx_t count); - // result = A > B - static void GreaterThan(Vector &A, Vector &B, Vector &result, idx_t count); - // result = A >= B - static void GreaterThanEquals(Vector &A, Vector &B, Vector &result, idx_t count); - // result = A < B - static void LessThan(Vector &A, Vector &B, Vector &result, idx_t count); - // result = A <= B - static void LessThanEquals(Vector &A, Vector &B, Vector &result, idx_t count); + // result = left == right + static void Equals(Vector &left, Vector &right, Vector &result, idx_t count); + // result = left != right + static void NotEquals(Vector &left, Vector &right, Vector &result, idx_t count); + // result = left > right + static void GreaterThan(Vector &left, Vector &right, Vector &result, idx_t count); + // result = left >= right + static void GreaterThanEquals(Vector &left, Vector &right, Vector &result, idx_t count); + // result = left < right + static void LessThan(Vector &left, Vector &right, Vector &result, idx_t count); + // result = left <= right + static void LessThanEquals(Vector &left, Vector &right, Vector &result, idx_t count); // result = A != B with nulls being equal static void DistinctFrom(Vector &left, Vector &right, Vector &result, idx_t count); @@ -4253,35 +4323,22 @@ struct VectorOperations { //===--------------------------------------------------------------------===// // Nested Comparisons //===--------------------------------------------------------------------===// - // true := A != B with nulls being equal, inputs selected - static idx_t NestedNotEquals(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, + // true := A != B with nulls being equal + static idx_t NestedNotEquals(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel); - // true := A == B with nulls being equal, inputs selected - static idx_t NestedEquals(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, + // true := A == B with nulls being equal + static idx_t NestedEquals(Vector &left, Vector &right, const SelectionVector &sel, idx_t count, SelectionVector *true_sel, SelectionVector *false_sel); - // true := A > B with nulls being maximal, inputs selected - static idx_t NestedGreaterThan(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, - SelectionVector *true_sel, SelectionVector *false_sel); - // true := A >= B with nulls being maximal, inputs selected - static idx_t NestedGreaterThanEquals(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel); - // true := A < B with nulls being maximal, inputs selected - static idx_t NestedLessThan(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, idx_t count, - SelectionVector *true_sel, SelectionVector *false_sel); - // true := A <= B with nulls being maximal, inputs selected - static idx_t NestedLessThanEquals(Vector &left, Vector &right, idx_t vcount, const SelectionVector &sel, - idx_t count, SelectionVector *true_sel, SelectionVector *false_sel); - //===--------------------------------------------------------------------===// // Hash functions //===--------------------------------------------------------------------===// - // result = HASH(A) + // hashes = HASH(input) static void Hash(Vector &input, Vector &hashes, idx_t count); static void Hash(Vector &input, Vector &hashes, const SelectionVector &rsel, idx_t count); - // A ^= HASH(B) - static void CombineHash(Vector &hashes, Vector &B, idx_t count); - static void CombineHash(Vector &hashes, Vector &B, const SelectionVector &rsel, idx_t count); + // hashes ^= HASH(input) + static void CombineHash(Vector &hashes, Vector &input, idx_t count); + static void CombineHash(Vector &hashes, Vector &input, const SelectionVector &rsel, idx_t count); //===--------------------------------------------------------------------===// // Generate functions @@ -4295,7 +4352,8 @@ struct VectorOperations { //! Cast the data from the source type to the target type. Any elements that could not be converted are turned into //! NULLs. If any elements cannot be converted, returns false and fills in the error_message. If no error message is //! provided, an exception is thrown instead. - static bool TryCast(Vector &source, Vector &result, idx_t count, string *error_message, bool strict = false); + DUCKDB_API static bool TryCast(Vector &source, Vector &result, idx_t count, string *error_message, + bool strict = false); //! Cast the data from the source type to the target type. Throws an exception if the cast fails. static void Cast(Vector &source, Vector &result, idx_t count, bool strict = false); @@ -4359,6 +4417,17 @@ struct BinaryLambdaWrapper { } }; +struct BinaryLambdaWrapperWithNulls { + template + static inline RESULT_TYPE Operation(FUNC fun, LEFT_TYPE left, RIGHT_TYPE right, ValidityMask &mask, idx_t idx) { + return fun(left, right, mask, idx); + } + + static bool AddsNulls() { + return true; + } +}; + struct BinaryExecutor { template @@ -4557,6 +4626,13 @@ struct BinaryExecutor { count, false); } + template > + static void ExecuteWithNulls(Vector &left, Vector &right, Vector &result, idx_t count, FUNC fun) { + ExecuteSwitch(left, right, result, + count, fun); + } + public: template static idx_t SelectConstant(Vector &left, Vector &right, const SelectionVector *sel, idx_t count, @@ -4996,6 +5072,14 @@ struct GenericUnaryWrapper { } }; +struct UnaryLambdaWrapperWithNulls { + template + static inline RESULT_TYPE Operation(INPUT_TYPE input, ValidityMask &mask, idx_t idx, void *dataptr) { + auto fun = (FUNC *)dataptr; + return (*fun)(input, mask, idx); + } +}; + template struct UnaryStringOperator { template @@ -5011,7 +5095,15 @@ struct UnaryExecutor { static inline void ExecuteLoop(INPUT_TYPE *__restrict ldata, RESULT_TYPE *__restrict result_data, idx_t count, const SelectionVector *__restrict sel_vector, ValidityMask &mask, ValidityMask &result_mask, void *dataptr, bool adds_nulls) { - ASSERT_RESTRICT(ldata, ldata + count, result_data, result_data + count); +#ifdef DEBUG + // ldata may point to a compressed dictionary buffer which can be smaller than ldata + count + idx_t max_index = 0; + for (idx_t i = 0; i < count; i++) { + auto idx = sel_vector->get_index(i); + max_index = MaxValue(max_index, idx); + } + ASSERT_RESTRICT(ldata, ldata + max_index, result_data, result_data + count); +#endif if (!mask.AllValid()) { result_mask.EnsureWritable(); @@ -5142,6 +5234,13 @@ struct UnaryExecutor { ExecuteStandard(input, result, count, dataptr, adds_nulls); } + template > + static void ExecuteWithNulls(Vector &input, Vector &result, idx_t count, FUNC fun) { + ExecuteStandard(input, result, count, (void *)&fun, + true); + } + template static void ExecuteString(Vector &input, Vector &result, idx_t count) { UnaryExecutor::GenericExecute>(input, result, count, @@ -5394,10 +5493,9 @@ class CycleCounter { friend struct ExpressionInfo; friend struct ExpressionRootInfo; static constexpr int SAMPLING_RATE = 50; - static constexpr int SAMPLING_VARIANCE = 100; public: - CycleCounter() : random(-1) { + CycleCounter() { } // Next_sample determines if a sample needs to be taken, if so start the profiler void BeginSample() { @@ -5412,7 +5510,7 @@ class CycleCounter { time += Tick() - tmp; } if (current_count >= next_sample) { - next_sample = SAMPLING_RATE + random.NextRandomInteger() % SAMPLING_VARIANCE; + next_sample = SAMPLING_RATE; ++sample_count; sample_tuples_count += chunk_size; current_count = 0; @@ -5438,8 +5536,6 @@ class CycleCounter { uint64_t sample_tuples_count = 0; //! Count the number of ALL tuples uint64_t tuples_count = 0; - //! the random number generator used for sampling - RandomEngine random; }; } // namespace duckdb @@ -5532,6 +5628,9 @@ class StringUtil { } return c; } + DUCKDB_API static char CharacterIsAlpha(char c) { + return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); + } //! Returns true if the needle string exists in the haystack DUCKDB_API static bool Contains(const string &haystack, const string &needle); @@ -5810,6 +5909,7 @@ enum class ExpressionType : uint8_t { ARRAY_SLICE = 154, STRUCT_EXTRACT = 155, ARRAY_CONSTRUCTOR = 156, + ARROW = 157, // ----------------------------- // Subquery IN/EXISTS @@ -5889,7 +5989,7 @@ enum class ExpressionClass : uint8_t { BOUND_EXPRESSION = 50 }; -string ExpressionTypeToString(ExpressionType type); +DUCKDB_API string ExpressionTypeToString(ExpressionType type); string ExpressionTypeToOperator(ExpressionType type); //! Negate a comparison expression, turning e.g. = into !=, or < into >= @@ -5973,6 +6073,157 @@ class BaseExpression { bool operator==(const BaseExpression &rhs) { return this->Equals(&rhs); } + + virtual void Verify() const; +}; + +} // namespace duckdb + + + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/qualified_name.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/keyword_helper.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + +namespace duckdb { + +class KeywordHelper { +public: + //! Returns true if the given text matches a keyword of the parser + static bool IsKeyword(const string &text); + + //! Returns true if the given string needs to be quoted when written as an identifier + static bool RequiresQuotes(const string &text); + + //! Writes a string that is optionally quoted + escaped so it can be used as an identifier + static string WriteOptionallyQuoted(const string &text); +}; + +} // namespace duckdb + + + +namespace duckdb { + +struct QualifiedName { + string schema; + string name; + + //! Parse the (optional) schema and a name from a string in the format of e.g. "schema"."table"; if there is no dot + //! the schema will be set to INVALID_SCHEMA + static QualifiedName Parse(const string &input) { + string schema; + string name; + idx_t idx = 0; + vector entries; + string entry; + normal: + //! quote + for (; idx < input.size(); idx++) { + if (input[idx] == '"') { + idx++; + goto quoted; + } else if (input[idx] == '.') { + goto separator; + } + entry += input[idx]; + } + goto end; + separator: + entries.push_back(entry); + entry = ""; + idx++; + goto normal; + quoted: + //! look for another quote + for (; idx < input.size(); idx++) { + if (input[idx] == '"') { + //! unquote + idx++; + goto normal; + } + entry += input[idx]; + } + throw ParserException("Unterminated quote in qualified name!"); + end: + if (entries.empty()) { + schema = INVALID_SCHEMA; + name = entry; + } else if (entries.size() == 1) { + schema = entries[0]; + name = entry; + } else { + throw ParserException("Expected schema.entry or entry: too many entries found"); + } + return QualifiedName {schema, name}; + } +}; + +struct QualifiedColumnName { + QualifiedColumnName() { + } + QualifiedColumnName(string table_p, string column_p) : table(move(table_p)), column(move(column_p)) { + } + + string schema; + string table; + string column; +}; + +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/expression_util.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + +namespace duckdb { +class ParsedExpression; +class Expression; + +class ExpressionUtil { +public: + //! ListEquals: check if a list of two expressions is equal (order is important) + static bool ListEquals(const vector> &a, + const vector> &b); + static bool ListEquals(const vector> &a, const vector> &b); + //! SetEquals: check if two sets of expressions are equal (order is not important) + static bool SetEquals(const vector> &a, const vector> &b); + static bool SetEquals(const vector> &a, const vector> &b); + +private: + template + static bool ExpressionListEquals(const vector> &a, const vector> &b); + template + static bool ExpressionSetEquals(const vector> &a, const vector> &b); }; } // namespace duckdb @@ -6214,7 +6465,8 @@ class SimpleNamedParameterFunction : public SimpleFunction { class BaseScalarFunction : public SimpleFunction { public: DUCKDB_API BaseScalarFunction(string name, vector arguments, LogicalType return_type, - bool has_side_effects, LogicalType varargs = LogicalType(LogicalTypeId::INVALID)); + bool has_side_effects, LogicalType varargs = LogicalType(LogicalTypeId::INVALID), + bool propagates_null_values = false); DUCKDB_API ~BaseScalarFunction() override; //! Return type of the function @@ -6222,6 +6474,8 @@ class BaseScalarFunction : public SimpleFunction { //! Whether or not the function has side effects (e.g. sequence increments, random() functions, NOW()). Functions //! with side-effects cannot be constant-folded. bool has_side_effects; + //! Whether or not the function propagates null values + bool propagates_null_values; public: DUCKDB_API hash_t Hash() const; @@ -6644,15 +6898,17 @@ struct Equals { struct NotEquals { template static inline bool Operation(T left, T right) { - return left != right; + return !Equals::Operation(left, right); } }; + struct GreaterThan { template static inline bool Operation(T left, T right) { return left > right; } }; + struct GreaterThanEquals { template static inline bool Operation(T left, T right) { @@ -6663,30 +6919,46 @@ struct GreaterThanEquals { struct LessThan { template static inline bool Operation(T left, T right) { - return left < right; + return GreaterThan::Operation(right, left); } }; + struct LessThanEquals { template static inline bool Operation(T left, T right) { - return left <= right; + return GreaterThanEquals::Operation(right, left); } }; +template <> +bool Equals::Operation(float left, float right); +template <> +bool Equals::Operation(double left, double right); + +template <> +bool GreaterThan::Operation(float left, float right); +template <> +bool GreaterThan::Operation(double left, double right); + +template <> +bool GreaterThanEquals::Operation(float left, float right); +template <> +bool GreaterThanEquals::Operation(double left, double right); + // Distinct semantics are from Postgres record sorting. NULL = NULL and not-NULL < NULL // Deferring to the non-distinct operations removes the need for further specialisation. // TODO: To reverse the semantics, swap left_null and right_null for comparisons struct DistinctFrom { template static inline bool Operation(T left, T right, bool left_null, bool right_null) { - return (left_null != right_null) || (!left_null && !right_null && (left != right)); + return (left_null != right_null) || (!left_null && !right_null && NotEquals::Operation(left, right)); } }; struct NotDistinctFrom { template static inline bool Operation(T left, T right, bool left_null, bool right_null) { - return (left_null && right_null) || (!left_null && !right_null && (left == right)); + return (left_null && right_null) || (!left_null && !right_null && Equals::Operation(left, right)); } }; @@ -6963,12 +7235,13 @@ class ScalarFunction : public BaseScalarFunction { scalar_function_t function, bool has_side_effects = false, bind_scalar_function_t bind = nullptr, dependency_function_t dependency = nullptr, function_statistics_t statistics = nullptr, init_local_state_t init_local_state = nullptr, - LogicalType varargs = LogicalType(LogicalTypeId::INVALID)); + LogicalType varargs = LogicalType(LogicalTypeId::INVALID), + bool propagate_null_values = false); DUCKDB_API ScalarFunction(vector arguments, LogicalType return_type, scalar_function_t function, - bool has_side_effects = false, bind_scalar_function_t bind = nullptr, - dependency_function_t dependency = nullptr, function_statistics_t statistics = nullptr, - init_local_state_t init_local_state = nullptr, + bool propagate_null_values = false, bool has_side_effects = false, + bind_scalar_function_t bind = nullptr, dependency_function_t dependency = nullptr, + function_statistics_t statistics = nullptr, init_local_state_t init_local_state = nullptr, LogicalType varargs = LogicalType(LogicalTypeId::INVALID)); //! The main scalar function to execute @@ -7755,6 +8028,7 @@ enum class CatalogType : uint8_t { PRAGMA_FUNCTION_ENTRY = 28, COPY_FUNCTION_ENTRY = 29, MACRO_ENTRY = 30, + TABLE_MACRO_ENTRY = 31, // version info UPDATED_ENTRY = 50, @@ -8219,7 +8493,7 @@ enum class LogicalOperatorType : uint8_t { LOGICAL_LOAD = 180 }; -string LogicalOperatorToString(LogicalOperatorType type); +DUCKDB_API string LogicalOperatorToString(LogicalOperatorType type); } // namespace duckdb @@ -8257,6 +8531,7 @@ class Expression : public BaseExpression { bool IsScalar() const override; bool HasParameter() const override; virtual bool HasSideEffects() const; + virtual bool PropagatesNullValues() const; virtual bool IsFoldable() const; hash_t Hash() const override; @@ -8534,7 +8809,7 @@ class LogicalOperator { virtual string GetName() const; virtual string ParamsToString() const; virtual string ToString() const; - void Print(); + DUCKDB_API void Print(); //! Debug method: verify that the integrity of expressions & child nodes are maintained virtual void Verify(); @@ -8576,42 +8851,32 @@ namespace duckdb { //! A ResultModifier class BoundResultModifier { public: - explicit BoundResultModifier(ResultModifierType type) : type(type) { - } - virtual ~BoundResultModifier() { - } + explicit BoundResultModifier(ResultModifierType type); + virtual ~BoundResultModifier(); ResultModifierType type; }; struct BoundOrderByNode { public: - BoundOrderByNode(OrderType type, OrderByNullType null_order, unique_ptr expression) - : type(type), null_order(null_order), expression(move(expression)) { - } + BoundOrderByNode(OrderType type, OrderByNullType null_order, unique_ptr expression); BoundOrderByNode(OrderType type, OrderByNullType null_order, unique_ptr expression, - unique_ptr stats) - : type(type), null_order(null_order), expression(move(expression)), stats(move(stats)) { - } - - BoundOrderByNode Copy() const { - if (stats) { - return BoundOrderByNode(type, null_order, expression->Copy(), stats->Copy()); - } else { - return BoundOrderByNode(type, null_order, expression->Copy()); - } - } + unique_ptr stats); OrderType type; OrderByNullType null_order; unique_ptr expression; unique_ptr stats; + +public: + BoundOrderByNode Copy() const; + string ToString() const; }; class BoundLimitModifier : public BoundResultModifier { public: - BoundLimitModifier() : BoundResultModifier(ResultModifierType::LIMIT_MODIFIER) { - } + BoundLimitModifier(); + //! LIMIT int64_t limit_val = NumericLimits::Maximum(); //! OFFSET @@ -8624,8 +8889,7 @@ class BoundLimitModifier : public BoundResultModifier { class BoundOrderModifier : public BoundResultModifier { public: - BoundOrderModifier() : BoundResultModifier(ResultModifierType::ORDER_MODIFIER) { - } + BoundOrderModifier(); //! List of order nodes vector orders; @@ -8633,8 +8897,7 @@ class BoundOrderModifier : public BoundResultModifier { class BoundDistinctModifier : public BoundResultModifier { public: - BoundDistinctModifier() : BoundResultModifier(ResultModifierType::DISTINCT_MODIFIER) { - } + BoundDistinctModifier(); //! list of distinct on targets (if any) vector> target_distincts; @@ -8642,8 +8905,8 @@ class BoundDistinctModifier : public BoundResultModifier { class BoundLimitPercentModifier : public BoundResultModifier { public: - BoundLimitPercentModifier() : BoundResultModifier(ResultModifierType::LIMIT_PERCENT_MODIFIER) { - } + BoundLimitPercentModifier(); + //! LIMIT % double limit_percent = 100.0; //! OFFSET @@ -8696,6 +8959,19 @@ typedef void (*aggregate_window_t)(Vector inputs[], FunctionData *bind_data, idx class AggregateFunction : public BaseScalarFunction { public: + DUCKDB_API AggregateFunction(const string &name, const vector &arguments, + const LogicalType &return_type, aggregate_size_t state_size, + aggregate_initialize_t initialize, aggregate_update_t update, + aggregate_combine_t combine, aggregate_finalize_t finalize, + bool propagates_null_values = false, aggregate_simple_update_t simple_update = nullptr, + bind_aggregate_function_t bind = nullptr, aggregate_destructor_t destructor = nullptr, + aggregate_statistics_t statistics = nullptr, aggregate_window_t window = nullptr) + : BaseScalarFunction(name, arguments, return_type, false, LogicalType(LogicalTypeId::INVALID), + propagates_null_values), + state_size(state_size), initialize(initialize), update(update), combine(combine), finalize(finalize), + simple_update(simple_update), window(window), bind(bind), destructor(destructor), statistics(statistics) { + } + DUCKDB_API AggregateFunction(const string &name, const vector &arguments, const LogicalType &return_type, aggregate_size_t state_size, aggregate_initialize_t initialize, aggregate_update_t update, @@ -8703,21 +8979,30 @@ class AggregateFunction : public BaseScalarFunction { aggregate_simple_update_t simple_update = nullptr, bind_aggregate_function_t bind = nullptr, aggregate_destructor_t destructor = nullptr, aggregate_statistics_t statistics = nullptr, aggregate_window_t window = nullptr) - : BaseScalarFunction(name, arguments, return_type, false), state_size(state_size), initialize(initialize), - update(update), combine(combine), finalize(finalize), simple_update(simple_update), window(window), - bind(bind), destructor(destructor), statistics(statistics) { + : BaseScalarFunction(name, arguments, return_type, false, LogicalType(LogicalTypeId::INVALID), false), + state_size(state_size), initialize(initialize), update(update), combine(combine), finalize(finalize), + simple_update(simple_update), window(window), bind(bind), destructor(destructor), statistics(statistics) { } DUCKDB_API AggregateFunction(const vector &arguments, const LogicalType &return_type, aggregate_size_t state_size, aggregate_initialize_t initialize, aggregate_update_t update, aggregate_combine_t combine, aggregate_finalize_t finalize, - aggregate_simple_update_t simple_update = nullptr, + bool propagates_null_values = false, aggregate_simple_update_t simple_update = nullptr, bind_aggregate_function_t bind = nullptr, aggregate_destructor_t destructor = nullptr, aggregate_statistics_t statistics = nullptr, aggregate_window_t window = nullptr) : AggregateFunction(string(), arguments, return_type, state_size, initialize, update, combine, finalize, - simple_update, bind, destructor, statistics, window) { + propagates_null_values, simple_update, bind, destructor, statistics, window) { } + DUCKDB_API AggregateFunction(const vector &arguments, const LogicalType &return_type, + aggregate_size_t state_size, aggregate_initialize_t initialize, + aggregate_update_t update, aggregate_combine_t combine, aggregate_finalize_t finalize, + aggregate_simple_update_t simple_update = nullptr, + bind_aggregate_function_t bind = nullptr, aggregate_destructor_t destructor = nullptr, + aggregate_statistics_t statistics = nullptr, aggregate_window_t window = nullptr) + : AggregateFunction(string(), arguments, return_type, state_size, initialize, update, combine, finalize, false, + simple_update, bind, destructor, statistics, window) { + } //! The hashed aggregate state sizing function aggregate_size_t state_size; //! The hashed aggregate state initialization function @@ -8769,12 +9054,13 @@ class AggregateFunction : public BaseScalarFunction { } template - static AggregateFunction UnaryAggregate(const LogicalType &input_type, LogicalType return_type) { + static AggregateFunction UnaryAggregate(const LogicalType &input_type, LogicalType return_type, + bool propagates_null_values = false) { return AggregateFunction( {input_type}, return_type, AggregateFunction::StateSize, AggregateFunction::StateInitialize, AggregateFunction::UnaryScatterUpdate, AggregateFunction::StateCombine, AggregateFunction::StateFinalize, - AggregateFunction::UnaryUpdate); + propagates_null_values, AggregateFunction::UnaryUpdate); } template @@ -9529,7 +9815,7 @@ class QueryResult : public BaseQueryResult { } } - DUCKDB_API void ToArrowSchema(ArrowSchema *out_array); + DUCKDB_API static void ToArrowSchema(ArrowSchema *out_schema, vector &types, vector &names); private: //! The current chunk used by the iterator @@ -9752,6 +10038,7 @@ enum class PhysicalOperatorType : uint8_t { HASH_JOIN, CROSS_PRODUCT, PIECEWISE_MERGE_JOIN, + IE_JOIN, DELIM_JOIN, INDEX_JOIN, // ----------------------------- @@ -9887,6 +10174,12 @@ class OperatorState { } }; +class GlobalOperatorState { +public: + virtual ~GlobalOperatorState() { + } +}; + class GlobalSinkState { public: GlobalSinkState() : state(SinkFinalizeType::READY) { @@ -9940,6 +10233,8 @@ class PhysicalOperator { idx_t estimated_cardinality; //! The global sink state of this operator unique_ptr sink_state; + //! The global state of this operator + unique_ptr op_state; public: virtual string GetName() const; @@ -9961,8 +10256,9 @@ class PhysicalOperator { public: // Operator interface virtual unique_ptr GetOperatorState(ClientContext &context) const; + virtual unique_ptr GetGlobalOperatorState(ClientContext &context) const; virtual OperatorResultType Execute(ExecutionContext &context, DataChunk &input, DataChunk &chunk, - OperatorState &state) const; + GlobalOperatorState &gstate, OperatorState &state) const; virtual bool ParallelOperator() const { return false; @@ -10047,16 +10343,32 @@ struct FunctionOperatorData { DUCKDB_API virtual ~FunctionOperatorData(); }; +struct TableFunctionInfo { + DUCKDB_API virtual ~TableFunctionInfo(); +}; + struct TableFilterCollection { DUCKDB_API explicit TableFilterCollection(TableFilterSet *table_filters); TableFilterSet *table_filters; }; -typedef unique_ptr (*table_function_bind_t)(ClientContext &context, vector &inputs, - named_parameter_map_t &named_parameters, - vector &input_table_types, - vector &input_table_names, +struct TableFunctionBindInput { + TableFunctionBindInput(vector &inputs, named_parameter_map_t &named_parameters, + vector &input_table_types, vector &input_table_names, + TableFunctionInfo *info) + : inputs(inputs), named_parameters(named_parameters), input_table_types(input_table_types), + input_table_names(input_table_names), info(info) { + } + + vector &inputs; + named_parameter_map_t &named_parameters; + vector &input_table_types; + vector &input_table_names; + TableFunctionInfo *info; +}; + +typedef unique_ptr (*table_function_bind_t)(ClientContext &context, TableFunctionBindInput &input, vector &return_types, vector &names); typedef unique_ptr (*table_function_init_t)(ClientContext &context, const FunctionData *bind_data, const vector &column_ids, @@ -10167,6 +10479,8 @@ class TableFunction : public SimpleNamedParameterFunction { //! Whether or not the table function supports filter pushdown. If not supported a filter will be added //! that applies the table filter directly. bool filter_pushdown; + //! Additional function info, passed to the bind + shared_ptr function_info; }; } // namespace duckdb @@ -10327,7 +10641,7 @@ class Pipeline : public std::enable_shared_from_this { friend class PipelineFinishEvent; public: - Pipeline(Executor &execution_context); + explicit Pipeline(Executor &execution_context); Executor &executor; @@ -10725,7 +11039,7 @@ enum class JoinType : uint8_t { }; //! Convert join type to string -string JoinTypeToString(JoinType type); +DUCKDB_API string JoinTypeToString(JoinType type); //! True if join is left or full outer join bool IsLeftOuterJoin(JoinType type); @@ -10787,136 +11101,42 @@ string RelationTypeToString(RelationType type); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/main/client_context.hpp +// +// +//===----------------------------------------------------------------------===// -#include - -namespace duckdb { -struct BoundStatement; - -class ClientContext; -class Binder; -class LogicalOperator; -class QueryNode; -class TableRef; - -class Relation : public std::enable_shared_from_this { -public: - DUCKDB_API Relation(ClientContext &context, RelationType type) : context(context), type(type) { - } - DUCKDB_API virtual ~Relation() { - } - - ClientContext &context; - RelationType type; - -public: - DUCKDB_API virtual const vector &Columns() = 0; - DUCKDB_API virtual unique_ptr GetQueryNode(); - DUCKDB_API virtual BoundStatement Bind(Binder &binder); - DUCKDB_API virtual string GetAlias(); - - DUCKDB_API unique_ptr Execute(); - DUCKDB_API string ToString(); - DUCKDB_API virtual string ToString(idx_t depth) = 0; - - DUCKDB_API void Print(); - DUCKDB_API void Head(idx_t limit = 10); - - DUCKDB_API shared_ptr CreateView(const string &name, bool replace = true, bool temporary = false); - DUCKDB_API unique_ptr Query(const string &sql); - DUCKDB_API unique_ptr Query(const string &name, const string &sql); - - //! Explain the query plan of this relation - DUCKDB_API unique_ptr Explain(); - - DUCKDB_API virtual unique_ptr GetTableRef(); - DUCKDB_API virtual bool IsReadOnly() { - return true; - } - -public: - // PROJECT - DUCKDB_API shared_ptr Project(const string &select_list); - DUCKDB_API shared_ptr Project(const string &expression, const string &alias); - DUCKDB_API shared_ptr Project(const string &select_list, const vector &aliases); - DUCKDB_API shared_ptr Project(const vector &expressions); - DUCKDB_API shared_ptr Project(const vector &expressions, const vector &aliases); - - // FILTER - DUCKDB_API shared_ptr Filter(const string &expression); - DUCKDB_API shared_ptr Filter(const vector &expressions); - - // LIMIT - DUCKDB_API shared_ptr Limit(int64_t n, int64_t offset = 0); - - // ORDER - DUCKDB_API shared_ptr Order(const string &expression); - DUCKDB_API shared_ptr Order(const vector &expressions); - - // JOIN operation - DUCKDB_API shared_ptr Join(const shared_ptr &other, const string &condition, - JoinType type = JoinType::INNER); - - // CROSS PRODUCT operation - DUCKDB_API shared_ptr CrossProduct(const shared_ptr &other); - // SET operations - DUCKDB_API shared_ptr Union(const shared_ptr &other); - DUCKDB_API shared_ptr Except(const shared_ptr &other); - DUCKDB_API shared_ptr Intersect(const shared_ptr &other); - // DISTINCT operation - DUCKDB_API shared_ptr Distinct(); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +// +// +//===----------------------------------------------------------------------===// - // AGGREGATES - DUCKDB_API shared_ptr Aggregate(const string &aggregate_list); - DUCKDB_API shared_ptr Aggregate(const vector &aggregates); - DUCKDB_API shared_ptr Aggregate(const string &aggregate_list, const string &group_list); - DUCKDB_API shared_ptr Aggregate(const vector &aggregates, const vector &groups); - // ALIAS - DUCKDB_API shared_ptr Alias(const string &alias); - //! Insert the data from this relation into a table - DUCKDB_API void Insert(const string &table_name); - DUCKDB_API void Insert(const string &schema_name, const string &table_name); - //! Insert a row (i.e.,list of values) into a table - DUCKDB_API void Insert(const vector> &values); - //! Create a table and insert the data from this relation into that table - DUCKDB_API void Create(const string &table_name); - DUCKDB_API void Create(const string &schema_name, const string &table_name); - //! Write a relation to a CSV file - DUCKDB_API void WriteCSV(const string &csv_file); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/catalog/catalog_set.hpp +// +// +//===----------------------------------------------------------------------===// - //! Update a table, can only be used on a TableRelation - DUCKDB_API virtual void Update(const string &update, const string &condition = string()); - //! Delete from a table, can only be used on a TableRelation - DUCKDB_API virtual void Delete(const string &condition = string()); - //! Create a relation from calling a table in/out function on the input relation - //! Create a relation from calling a table in/out function on the input relation - DUCKDB_API shared_ptr TableFunction(const std::string &fname, const vector &values); - DUCKDB_API shared_ptr TableFunction(const std::string &fname, const vector &values, - const named_parameter_map_t &named_parameters); -public: - //! Whether or not the relation inherits column bindings from its child or not, only relevant for binding - DUCKDB_API virtual bool InheritsColumnBindings() { - return false; - } - DUCKDB_API virtual Relation *ChildRelation() { - return nullptr; - } -protected: - DUCKDB_API string RenderWhitespace(idx_t depth); -}; -} // namespace duckdb //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/main/stream_query_result.hpp +// duckdb/catalog/default/default_generator.hpp // // //===----------------------------------------------------------------------===// @@ -10927,76 +11147,47 @@ class Relation : public std::enable_shared_from_this { namespace duckdb { - class ClientContext; -class ClientContextLock; -class Executor; -class MaterializedQueryResult; -class PreparedStatementData; - -class StreamQueryResult : public QueryResult { - friend class ClientContext; +class DefaultGenerator { public: - //! Create a successful StreamQueryResult. StreamQueryResults should always be successful initially (it makes no - //! sense to stream an error). - DUCKDB_API StreamQueryResult(StatementType statement_type, shared_ptr context, - vector types, vector names); - DUCKDB_API ~StreamQueryResult() override; + explicit DefaultGenerator(Catalog &catalog) : catalog(catalog), created_all_entries(false) { + } + virtual ~DefaultGenerator() { + } + + Catalog &catalog; + atomic created_all_entries; public: - //! Fetches a DataChunk from the query result. - DUCKDB_API unique_ptr FetchRaw() override; - //! Converts the QueryResult to a string - DUCKDB_API string ToString() override; - //! Materializes the query result and turns it into a materialized query result - DUCKDB_API unique_ptr Materialize(); + //! Creates a default entry with the specified name, or returns nullptr if no such entry can be generated + virtual unique_ptr CreateDefaultEntry(ClientContext &context, const string &entry_name) = 0; + //! Get a list of all default entries in the generator + virtual vector GetDefaultEntries() = 0; +}; + +} // namespace duckdb + + - DUCKDB_API bool IsOpen(); - //! Closes the StreamQueryResult - DUCKDB_API void Close(); -private: - //! The client context this StreamQueryResult belongs to - shared_ptr context; -private: - unique_ptr LockContext(); - void CheckExecutableInternal(ClientContextLock &lock); - bool IsOpenInternal(ClientContextLock &lock); -}; -} // namespace duckdb //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/main/table_description.hpp +// duckdb/catalog/catalog_entry/table_catalog_entry.hpp // // //===----------------------------------------------------------------------===// - - -namespace duckdb { - -struct TableDescription { - //! The schema of the table - string schema; - //! The table name of the table - string table; - //! The columns of the table - vector columns; -}; - -} // namespace duckdb - //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/parser/sql_statement.hpp +// duckdb/catalog/standard_entry.hpp // // //===----------------------------------------------------------------------===// @@ -11005,11 +11196,29 @@ struct TableDescription { +namespace duckdb { +class SchemaCatalogEntry; + +//! A StandardEntry is a catalog entry that is a member of a schema +class StandardEntry : public CatalogEntry { +public: + StandardEntry(CatalogType type, SchemaCatalogEntry *schema, Catalog *catalog, string name) + : CatalogEntry(type, catalog, name), schema(schema) { + } + ~StandardEntry() override { + } + + //! The schema the entry belongs to + SchemaCatalogEntry *schema; +}; +} // namespace duckdb + + //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/common/printer.hpp +// duckdb/parser/constraint.hpp // // //===----------------------------------------------------------------------===// @@ -11018,254 +11227,168 @@ struct TableDescription { -namespace duckdb { - -//! Printer is a static class that allows printing to logs or stdout/stderr -class Printer { -public: - //! Print the object to stderr - DUCKDB_API static void Print(const string &str); - //! Prints Progress - DUCKDB_API static void PrintProgress(int percentage, const char *pbstr, int pbwidth); - //! Prints an empty line when progress bar is done - DUCKDB_API static void FinishProgressBarPrint(const char *pbstr, int pbwidth); - //! Whether or not we are printing to a terminal - DUCKDB_API static bool IsTerminal(); -}; -} // namespace duckdb - namespace duckdb { -//! SQLStatement is the base class of any type of SQL statement. -class SQLStatement { -public: - explicit SQLStatement(StatementType type) : type(type) {}; - virtual ~SQLStatement() { - } - //! The statement type - StatementType type; - //! The statement location within the query string - idx_t stmt_location; - //! The statement length within the query string - idx_t stmt_length; - //! The number of prepared statement parameters (if any) - idx_t n_param; - //! The query text that corresponds to this SQL statement - string query; - -protected: - SQLStatement(const SQLStatement &other) = default; +class Serializer; +class Deserializer; +class FieldWriter; +class FieldReader; -public: - //! Create a copy of this SelectStatement - virtual unique_ptr Copy() const = 0; +//===--------------------------------------------------------------------===// +// Constraint Types +//===--------------------------------------------------------------------===// +enum class ConstraintType : uint8_t { + INVALID = 0, // invalid constraint type + NOT_NULL = 1, // NOT NULL constraint + CHECK = 2, // CHECK constraint + UNIQUE = 3, // UNIQUE constraint + FOREIGN_KEY = 4 // FOREIGN KEY constraint }; -} // namespace duckdb +enum class ForeignKeyType : uint8_t { + FK_TYPE_PRIMARY_KEY_TABLE = 0, // main table + FK_TYPE_FOREIGN_KEY_TABLE = 1, // referencing table + FK_TYPE_SELF_REFERENCE_TABLE = 2 // self refrencing table +}; -namespace duckdb { +struct ForeignKeyInfo { + ForeignKeyType type; + string schema; + //! if type is FK_TYPE_FOREIGN_KEY_TABLE, means main key table, if type is FK_TYPE_PRIMARY_KEY_TABLE, means foreign + //! key table + string table; + //! The set of main key table's column's index + vector pk_keys; + //! The set of foreign key table's column's index + vector fk_keys; +}; -class ChunkCollection; -class ClientContext; -class DatabaseInstance; -class DuckDB; -class LogicalOperator; -class SelectStatement; +//! Constraint is the base class of any type of table constraint. +class Constraint { +public: + DUCKDB_API explicit Constraint(ConstraintType type); + DUCKDB_API virtual ~Constraint(); -typedef void (*warning_callback)(std::string); + ConstraintType type; -//! A connection to a database. This represents a (client) connection that can -//! be used to query the database. -class Connection { public: - DUCKDB_API explicit Connection(DuckDB &database); - DUCKDB_API explicit Connection(DatabaseInstance &database); + DUCKDB_API virtual string ToString() const = 0; + DUCKDB_API void Print() const; - shared_ptr context; - warning_callback warning_cb; + DUCKDB_API virtual unique_ptr Copy() const = 0; + //! Serializes a Constraint to a stand-alone binary blob + DUCKDB_API void Serialize(Serializer &serializer) const; + //! Serializes a Constraint to a stand-alone binary blob + DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0; + //! Deserializes a blob back into a Constraint + DUCKDB_API static unique_ptr Deserialize(Deserializer &source); +}; +} // namespace duckdb -public: - //! Returns query profiling information for the current query - DUCKDB_API string GetProfilingInformation(ProfilerPrintFormat format = ProfilerPrintFormat::QUERY_TREE); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/bound_constraint.hpp +// +// +//===----------------------------------------------------------------------===// - //! Interrupt execution of the current query - DUCKDB_API void Interrupt(); - //! Enable query profiling - DUCKDB_API void EnableProfiling(); - //! Disable query profiling - DUCKDB_API void DisableProfiling(); - DUCKDB_API void SetWarningCallback(warning_callback); - //! Enable aggressive verification/testing of queries, should only be used in testing - DUCKDB_API void EnableQueryVerification(); - DUCKDB_API void DisableQueryVerification(); - //! Force parallel execution, even for smaller tables. Should only be used in testing. - DUCKDB_API void ForceParallelism(); - //! Issues a query to the database and returns a QueryResult. This result can be either a StreamQueryResult or a - //! MaterializedQueryResult. The result can be stepped through with calls to Fetch(). Note that there can only be - //! one active StreamQueryResult per Connection object. Calling SendQuery() will invalidate any previously existing - //! StreamQueryResult. - DUCKDB_API unique_ptr SendQuery(const string &query); - //! Issues a query to the database and materializes the result (if necessary). Always returns a - //! MaterializedQueryResult. - DUCKDB_API unique_ptr Query(const string &query); - //! Issues a query to the database and materializes the result (if necessary). Always returns a - //! MaterializedQueryResult. - DUCKDB_API unique_ptr Query(unique_ptr statement); - // prepared statements - template - unique_ptr Query(const string &query, Args... args) { - vector values; - return QueryParamsRecursive(query, values, args...); + +namespace duckdb { +//! Bound equivalent of Constraint +class BoundConstraint { +public: + explicit BoundConstraint(ConstraintType type) : type(type) {}; + virtual ~BoundConstraint() { } - //! Issues a query to the database and returns a Pending Query Result. Note that "query" may only contain - //! a single statement. - DUCKDB_API unique_ptr PendingQuery(const string &query); - //! Issues a query to the database and returns a Pending Query Result - DUCKDB_API unique_ptr PendingQuery(unique_ptr statement); + ConstraintType type; +}; +} // namespace duckdb - //! Prepare the specified query, returning a prepared statement object - DUCKDB_API unique_ptr Prepare(const string &query); - //! Prepare the specified statement, returning a prepared statement object - DUCKDB_API unique_ptr Prepare(unique_ptr statement); - //! Get the table info of a specific table (in the default schema), or nullptr if it cannot be found - DUCKDB_API unique_ptr TableInfo(const string &table_name); - //! Get the table info of a specific table, or nullptr if it cannot be found - DUCKDB_API unique_ptr TableInfo(const string &schema_name, const string &table_name); - //! Extract a set of SQL statements from a specific query - DUCKDB_API vector> ExtractStatements(const string &query); - //! Extract the logical plan that corresponds to a query - DUCKDB_API unique_ptr ExtractPlan(const string &query); - //! Appends a DataChunk to the specified table - DUCKDB_API void Append(TableDescription &description, DataChunk &chunk); - //! Appends a ChunkCollection to the specified table - DUCKDB_API void Append(TableDescription &description, ChunkCollection &collection); +namespace duckdb { - //! Returns a relation that produces a table from this connection - DUCKDB_API shared_ptr Table(const string &tname); - DUCKDB_API shared_ptr Table(const string &schema_name, const string &table_name); - //! Returns a relation that produces a view from this connection - DUCKDB_API shared_ptr View(const string &tname); - DUCKDB_API shared_ptr View(const string &schema_name, const string &table_name); - //! Returns a relation that calls a specified table function - DUCKDB_API shared_ptr TableFunction(const string &tname); - DUCKDB_API shared_ptr TableFunction(const string &tname, const vector &values, - const named_parameter_map_t &named_parameters); - DUCKDB_API shared_ptr TableFunction(const string &tname, const vector &values); - //! Returns a relation that produces values - DUCKDB_API shared_ptr Values(const vector> &values); - DUCKDB_API shared_ptr Values(const vector> &values, const vector &column_names, - const string &alias = "values"); - DUCKDB_API shared_ptr Values(const string &values); - DUCKDB_API shared_ptr Values(const string &values, const vector &column_names, - const string &alias = "values"); - //! Reads CSV file - DUCKDB_API shared_ptr ReadCSV(const string &csv_file); - DUCKDB_API shared_ptr ReadCSV(const string &csv_file, const vector &columns); - //! Returns a relation from a query - DUCKDB_API shared_ptr RelationFromQuery(const string &query, string alias = "queryrelation", - const string &error = "Expected a single SELECT statement"); - DUCKDB_API shared_ptr RelationFromQuery(unique_ptr select_stmt, - string alias = "queryrelation"); +class ColumnStatistics; +class DataTable; +struct CreateTableInfo; +struct BoundCreateTableInfo; - DUCKDB_API void BeginTransaction(); - DUCKDB_API void Commit(); - DUCKDB_API void Rollback(); - DUCKDB_API void SetAutoCommit(bool auto_commit); - DUCKDB_API bool IsAutoCommit(); +struct RenameColumnInfo; +struct AddColumnInfo; +struct RemoveColumnInfo; +struct SetDefaultInfo; +struct ChangeColumnTypeInfo; +struct AlterForeignKeyInfo; - //! Fetch a list of table names that are required for a given query - DUCKDB_API unordered_set GetTableNames(const string &query); +//! A table catalog entry +class TableCatalogEntry : public StandardEntry { +public: + //! Create a real TableCatalogEntry and initialize storage for it + TableCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, BoundCreateTableInfo *info, + std::shared_ptr inherited_storage = nullptr); - template - void CreateScalarFunction(const string &name, TR (*udf_func)(Args...)) { - scalar_function_t function = UDFWrapper::CreateScalarFunction(name, udf_func); - UDFWrapper::RegisterFunction(name, function, *context); - } + //! A reference to the underlying storage unit used for this table + std::shared_ptr storage; + //! A list of columns that are part of this table + vector columns; + //! A list of constraints that are part of this table + vector> constraints; + //! A list of constraints that are part of this table + vector> bound_constraints; + //! A map of column name to column index + case_insensitive_map_t name_map; - template - void CreateScalarFunction(const string &name, vector args, LogicalType ret_type, - TR (*udf_func)(Args...)) { - scalar_function_t function = - UDFWrapper::CreateScalarFunction(name, args, move(ret_type), udf_func); - UDFWrapper::RegisterFunction(name, args, ret_type, function, *context); - } +public: + unique_ptr AlterEntry(ClientContext &context, AlterInfo *info) override; + //! Returns whether or not a column with the given name exists + bool ColumnExists(const string &name); + //! Returns a reference to the column of the specified name. Throws an + //! exception if the column does not exist. + ColumnDefinition &GetColumn(const string &name); + //! Returns a list of types of the table + vector GetTypes(); + string ToSQL() override; - template - void CreateVectorizedFunction(const string &name, scalar_function_t udf_func, - LogicalType varargs = LogicalType::INVALID) { - UDFWrapper::RegisterFunction(name, udf_func, *context, move(varargs)); - } + //! Serialize the meta information of the TableCatalogEntry a serializer + virtual void Serialize(Serializer &serializer); + //! Deserializes to a CreateTableInfo + static unique_ptr Deserialize(Deserializer &source); - DUCKDB_API void CreateVectorizedFunction(const string &name, vector args, LogicalType ret_type, - scalar_function_t udf_func, LogicalType varargs = LogicalType::INVALID) { - UDFWrapper::RegisterFunction(name, move(args), move(ret_type), udf_func, *context, move(varargs)); - } + unique_ptr Copy(ClientContext &context) override; - //------------------------------------- Aggreate Functions ----------------------------------------// - template - void CreateAggregateFunction(const string &name) { - AggregateFunction function = UDFWrapper::CreateAggregateFunction(name); - UDFWrapper::RegisterAggrFunction(function, *context); - } + void SetAsRoot() override; - template - void CreateAggregateFunction(const string &name) { - AggregateFunction function = UDFWrapper::CreateAggregateFunction(name); - UDFWrapper::RegisterAggrFunction(function, *context); - } + void CommitAlter(AlterInfo &info); + void CommitDrop(); - template - void CreateAggregateFunction(const string &name, LogicalType ret_type, LogicalType input_typeA) { - AggregateFunction function = - UDFWrapper::CreateAggregateFunction(name, ret_type, input_typeA); - UDFWrapper::RegisterAggrFunction(function, *context); - } - - template - void CreateAggregateFunction(const string &name, LogicalType ret_type, LogicalType input_typeA, - LogicalType input_typeB) { - AggregateFunction function = - UDFWrapper::CreateAggregateFunction(name, ret_type, input_typeA, input_typeB); - UDFWrapper::RegisterAggrFunction(function, *context); - } - - DUCKDB_API void CreateAggregateFunction(const string &name, vector arguments, LogicalType return_type, - aggregate_size_t state_size, aggregate_initialize_t initialize, - aggregate_update_t update, aggregate_combine_t combine, - aggregate_finalize_t finalize, - aggregate_simple_update_t simple_update = nullptr, - bind_aggregate_function_t bind = nullptr, - aggregate_destructor_t destructor = nullptr) { - AggregateFunction function = - UDFWrapper::CreateAggregateFunction(name, arguments, return_type, state_size, initialize, update, combine, - finalize, simple_update, bind, destructor); - UDFWrapper::RegisterAggrFunction(function, *context); - } + //! Returns the column index of the specified column name. + //! If the column does not exist: + //! If if_exists is true, returns DConstants::INVALID_INDEX + //! If if_exists is false, throws an exception + idx_t GetColumnIndex(string &name, bool if_exists = false); private: - unique_ptr QueryParamsRecursive(const string &query, vector &values); - - template - unique_ptr QueryParamsRecursive(const string &query, vector &values, T value, Args... args) { - values.push_back(Value::CreateValue(value)); - return QueryParamsRecursive(query, values, args...); - } + unique_ptr RenameColumn(ClientContext &context, RenameColumnInfo &info); + unique_ptr AddColumn(ClientContext &context, AddColumnInfo &info); + unique_ptr RemoveColumn(ClientContext &context, RemoveColumnInfo &info); + unique_ptr SetDefault(ClientContext &context, SetDefaultInfo &info); + unique_ptr ChangeColumnType(ClientContext &context, ChangeColumnTypeInfo &info); + unique_ptr SetForeignKeyConstraint(ClientContext &context, AlterForeignKeyInfo &info); }; - } // namespace duckdb + //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/main/database.hpp +// duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp // // //===----------------------------------------------------------------------===// @@ -11277,7 +11400,7 @@ class Connection { //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/main/config.hpp +// duckdb/parser/parsed_data/create_sequence_info.hpp // // //===----------------------------------------------------------------------===// @@ -11287,124 +11410,121 @@ class Connection { //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/common/allocator.hpp +// duckdb/parser/parsed_data/create_info.hpp // // //===----------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/parsed_data/parse_info.hpp +// +// +//===----------------------------------------------------------------------===// -namespace duckdb { -class Allocator; -class ClientContext; -class DatabaseInstance; -struct PrivateAllocatorData { - virtual ~PrivateAllocatorData() { - } -}; -typedef data_ptr_t (*allocate_function_ptr_t)(PrivateAllocatorData *private_data, idx_t size); -typedef void (*free_function_ptr_t)(PrivateAllocatorData *private_data, data_ptr_t pointer, idx_t size); -typedef data_ptr_t (*reallocate_function_ptr_t)(PrivateAllocatorData *private_data, data_ptr_t pointer, idx_t size); -class AllocatedData { -public: - AllocatedData(Allocator &allocator, data_ptr_t pointer, idx_t allocated_size); - ~AllocatedData(); +namespace duckdb { - data_ptr_t get() { - return pointer; - } - const_data_ptr_t get() const { - return pointer; - } - idx_t GetSize() const { - return allocated_size; +struct ParseInfo { + virtual ~ParseInfo() { } - void Reset(); - -private: - Allocator &allocator; - data_ptr_t pointer; - idx_t allocated_size; }; -class Allocator { -public: - Allocator(); - Allocator(allocate_function_ptr_t allocate_function_p, free_function_ptr_t free_function_p, - reallocate_function_ptr_t reallocate_function_p, unique_ptr private_data); +} // namespace duckdb - data_ptr_t AllocateData(idx_t size); - void FreeData(data_ptr_t pointer, idx_t size); - data_ptr_t ReallocateData(data_ptr_t pointer, idx_t size); - unique_ptr Allocate(idx_t size) { - return make_unique(*this, AllocateData(size), size); - } - static data_ptr_t DefaultAllocate(PrivateAllocatorData *private_data, idx_t size) { - return (data_ptr_t)malloc(size); - } - static void DefaultFree(PrivateAllocatorData *private_data, data_ptr_t pointer, idx_t size) { - free(pointer); - } - static data_ptr_t DefaultReallocate(PrivateAllocatorData *private_data, data_ptr_t pointer, idx_t size) { - return (data_ptr_t)realloc(pointer, size); - } - static Allocator &Get(ClientContext &context); - static Allocator &Get(DatabaseInstance &db); +namespace duckdb { - PrivateAllocatorData *GetPrivateData() { - return private_data.get(); +enum class OnCreateConflict : uint8_t { + // Standard: throw error + ERROR_ON_CONFLICT, + // CREATE IF NOT EXISTS, silently do nothing on conflict + IGNORE_ON_CONFLICT, + // CREATE OR REPLACE + REPLACE_ON_CONFLICT +}; + +struct CreateInfo : public ParseInfo { + explicit CreateInfo(CatalogType type, string schema = DEFAULT_SCHEMA) + : type(type), schema(schema), on_conflict(OnCreateConflict::ERROR_ON_CONFLICT), temporary(false), + internal(false) { + } + ~CreateInfo() override { } -private: - allocate_function_ptr_t allocate_function; - free_function_ptr_t free_function; - reallocate_function_ptr_t reallocate_function; + //! The to-be-created catalog type + CatalogType type; + //! The schema name of the entry + string schema; + //! What to do on create conflict + OnCreateConflict on_conflict; + //! Whether or not the entry is temporary + bool temporary; + //! Whether or not the entry is an internal entry + bool internal; + //! The SQL string of the CREATE statement + string sql; - unique_ptr private_data; +public: + virtual unique_ptr Copy() const = 0; + void CopyProperties(CreateInfo &other) const { + other.type = type; + other.schema = schema; + other.on_conflict = on_conflict; + other.temporary = temporary; + other.internal = internal; + other.sql = sql; + } }; } // namespace duckdb - - - - - -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/function/replacement_scan.hpp -// -// -//===----------------------------------------------------------------------===// - - - - - namespace duckdb { -class TableFunctionRef; +struct CreateSequenceInfo : public CreateInfo { + CreateSequenceInfo() + : CreateInfo(CatalogType::SEQUENCE_ENTRY, INVALID_SCHEMA), name(string()), usage_count(0), increment(1), + min_value(1), max_value(NumericLimits::Maximum()), start_value(1), cycle(false) { + } -typedef unique_ptr (*replacement_scan_t)(const string &table_name, void *data); + //! Sequence name to create + string name; + //! Usage count of the sequence + uint64_t usage_count; + //! The increment value + int64_t increment; + //! The minimum value of the sequence + int64_t min_value; + //! The maximum value of the sequence + int64_t max_value; + //! The start value of the sequence + int64_t start_value; + //! Whether or not the sequence cycles + bool cycle; -//! Replacement table scans are automatically attempted when a table name cannot be found in the schema -//! This allows you to do e.g. SELECT * FROM 'filename.csv', and automatically convert this into a CSV scan -struct ReplacementScan { - explicit ReplacementScan(replacement_scan_t function, void *data = nullptr) : function(function), data(data) { +public: + unique_ptr Copy() const override { + auto result = make_unique(); + CopyProperties(*result); + result->name = name; + result->schema = schema; + result->usage_count = usage_count; + result->increment = increment; + result->min_value = min_value; + result->max_value = max_value; + result->start_value = start_value; + result->cycle = cycle; + return move(result); } - - replacement_scan_t function; - void *data; }; } // namespace duckdb @@ -11412,1506 +11532,1650 @@ struct ReplacementScan { //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/common/set.hpp +// duckdb/parser/parsed_data/alter_table_info.hpp // // //===----------------------------------------------------------------------===// -#include - -namespace duckdb { -using std::set; -} - - -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/enums/optimizer_type.hpp -// -// -//===----------------------------------------------------------------------===// - namespace duckdb { -enum class OptimizerType : uint32_t { +enum class AlterType : uint8_t { INVALID = 0, - EXPRESSION_REWRITER, - FILTER_PULLUP, - FILTER_PUSHDOWN, - REGEX_RANGE, - IN_CLAUSE, - JOIN_ORDER, - DELIMINATOR, - UNUSED_COLUMNS, - STATISTICS_PROPAGATION, - COMMON_SUBEXPRESSIONS, - COMMON_AGGREGATE, - COLUMN_LIFETIME, - TOP_N, - REORDER_FILTER + ALTER_TABLE = 1, + ALTER_VIEW = 2, + ALTER_SEQUENCE = 3, + CHANGE_OWNERSHIP = 4 }; -string OptimizerTypeToString(OptimizerType type); -OptimizerType OptimizerTypeFromString(const string &str); +enum AlterForeignKeyType : uint8_t { AFT_ADD = 0, AFT_DELETE = 1 }; -} // namespace duckdb - -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/enums/window_aggregation_mode.hpp -// -// -//===----------------------------------------------------------------------===// +struct AlterInfo : public ParseInfo { + AlterInfo(AlterType type, string schema, string name); + ~AlterInfo() override; + AlterType type; + //! Schema name to alter + string schema; + //! Entry name to alter + string name; +public: + virtual CatalogType GetCatalogType() const = 0; + virtual unique_ptr Copy() const = 0; + void Serialize(Serializer &serializer) const; + virtual void Serialize(FieldWriter &writer) const = 0; + static unique_ptr Deserialize(Deserializer &source); +}; +//===--------------------------------------------------------------------===// +// Change Ownership +//===--------------------------------------------------------------------===// +struct ChangeOwnershipInfo : public AlterInfo { + ChangeOwnershipInfo(CatalogType entry_catalog_type, string entry_schema, string entry_name, string owner_schema, + string owner_name); + // Catalog type refers to the entry type, since this struct is usually built from an + // ALTER . OWNED BY . statement + // here it is only possible to know the type of who is to be owned + CatalogType entry_catalog_type; -namespace duckdb { + string owner_schema; + string owner_name; -enum class WindowAggregationMode : uint32_t { - //! Use the window aggregate API if available - WINDOW = 0, - //! Don't use window, but use combine if available - COMBINE, - //! Don't use combine or window (compute each frame separately) - SEPARATE +public: + CatalogType GetCatalogType() const override; + unique_ptr Copy() const override; + void Serialize(FieldWriter &writer) const override; }; -} // namespace duckdb - -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/enums/set_scope.hpp -// -// -//===----------------------------------------------------------------------===// +//===--------------------------------------------------------------------===// +// Alter Table +//===--------------------------------------------------------------------===// +enum class AlterTableType : uint8_t { + INVALID = 0, + RENAME_COLUMN = 1, + RENAME_TABLE = 2, + ADD_COLUMN = 3, + REMOVE_COLUMN = 4, + ALTER_COLUMN_TYPE = 5, + SET_DEFAULT = 6, + FOREIGN_KEY_CONSTRAINT = 7 +}; +struct AlterTableInfo : public AlterInfo { + AlterTableInfo(AlterTableType type, string schema, string table); + ~AlterTableInfo() override; + AlterTableType alter_table_type; +public: + CatalogType GetCatalogType() const override; + void Serialize(FieldWriter &writer) const override; + virtual void SerializeAlterTable(FieldWriter &writer) const = 0; + static unique_ptr Deserialize(FieldReader &reader); +}; +//===--------------------------------------------------------------------===// +// RenameColumnInfo +//===--------------------------------------------------------------------===// +struct RenameColumnInfo : public AlterTableInfo { + RenameColumnInfo(string schema, string table, string old_name_p, string new_name_p); + ~RenameColumnInfo() override; -namespace duckdb { + //! Column old name + string old_name; + //! Column new name + string new_name; -enum class SetScope : uint8_t { - AUTOMATIC = 0, - LOCAL = 1, /* unused */ - SESSION = 2, - GLOBAL = 3 +public: + unique_ptr Copy() const override; + void SerializeAlterTable(FieldWriter &writer) const override; + static unique_ptr Deserialize(FieldReader &reader, string schema, string table); }; -} // namespace duckdb +//===--------------------------------------------------------------------===// +// RenameTableInfo +//===--------------------------------------------------------------------===// +struct RenameTableInfo : public AlterTableInfo { + RenameTableInfo(string schema, string table, string new_name); + ~RenameTableInfo() override; + //! Relation new name + string new_table_name; -namespace duckdb { -class ClientContext; -class TableFunctionRef; -class CompressionFunction; +public: + unique_ptr Copy() const override; + void SerializeAlterTable(FieldWriter &writer) const override; + static unique_ptr Deserialize(FieldReader &reader, string schema, string table); +}; -struct CompressionFunctionSet; -struct DBConfig; +//===--------------------------------------------------------------------===// +// AddColumnInfo +//===--------------------------------------------------------------------===// +struct AddColumnInfo : public AlterTableInfo { + AddColumnInfo(string schema, string table, ColumnDefinition new_column); + ~AddColumnInfo() override; -enum class AccessMode : uint8_t { UNDEFINED = 0, AUTOMATIC = 1, READ_ONLY = 2, READ_WRITE = 3 }; + //! New column + ColumnDefinition new_column; -enum class CheckpointAbort : uint8_t { - NO_ABORT = 0, - DEBUG_ABORT_BEFORE_TRUNCATE = 1, - DEBUG_ABORT_BEFORE_HEADER = 2, - DEBUG_ABORT_AFTER_FREE_LIST_WRITE = 3 +public: + unique_ptr Copy() const override; + void SerializeAlterTable(FieldWriter &writer) const override; + static unique_ptr Deserialize(FieldReader &reader, string schema, string table); }; -typedef void (*set_global_function_t)(DatabaseInstance *db, DBConfig &config, const Value ¶meter); -typedef void (*set_local_function_t)(ClientContext &context, const Value ¶meter); -typedef Value (*get_setting_function_t)(ClientContext &context); +//===--------------------------------------------------------------------===// +// RemoveColumnInfo +//===--------------------------------------------------------------------===// +struct RemoveColumnInfo : public AlterTableInfo { + RemoveColumnInfo(string schema, string table, string removed_column, bool if_exists); + ~RemoveColumnInfo() override; -struct ConfigurationOption { - const char *name; - const char *description; - LogicalTypeId parameter_type; - set_global_function_t set_global; - set_local_function_t set_local; - get_setting_function_t get_setting; + //! The column to remove + string removed_column; + //! Whether or not an error should be thrown if the column does not exist + bool if_exists; + +public: + unique_ptr Copy() const override; + void SerializeAlterTable(FieldWriter &writer) const override; + static unique_ptr Deserialize(FieldReader &reader, string schema, string table); }; -typedef void (*set_option_callback_t)(ClientContext &context, SetScope scope, Value ¶meter); +//===--------------------------------------------------------------------===// +// ChangeColumnTypeInfo +//===--------------------------------------------------------------------===// +struct ChangeColumnTypeInfo : public AlterTableInfo { + ChangeColumnTypeInfo(string schema, string table, string column_name, LogicalType target_type, + unique_ptr expression); + ~ChangeColumnTypeInfo() override; -struct ExtensionOption { - ExtensionOption(string description_p, LogicalType type_p, set_option_callback_t set_function_p) - : description(move(description_p)), type(move(type_p)), set_function(set_function_p) { - } + //! The column name to alter + string column_name; + //! The target type of the column + LogicalType target_type; + //! The expression used for data conversion + unique_ptr expression; - string description; - LogicalType type; - set_option_callback_t set_function; +public: + unique_ptr Copy() const override; + void SerializeAlterTable(FieldWriter &writer) const override; + static unique_ptr Deserialize(FieldReader &reader, string schema, string table); }; -struct DBConfig { - friend class DatabaseInstance; - friend class StorageManager; +//===--------------------------------------------------------------------===// +// SetDefaultInfo +//===--------------------------------------------------------------------===// +struct SetDefaultInfo : public AlterTableInfo { + SetDefaultInfo(string schema, string table, string column_name, unique_ptr new_default); + ~SetDefaultInfo() override; -public: - DUCKDB_API DBConfig(); - DUCKDB_API ~DBConfig(); + //! The column name to alter + string column_name; + //! The expression used for data conversion + unique_ptr expression; - //! Access mode of the database (AUTOMATIC, READ_ONLY or READ_WRITE) - AccessMode access_mode = AccessMode::AUTOMATIC; - //! The allocator used by the system - Allocator allocator; - // Checkpoint when WAL reaches this size (default: 16MB) - idx_t checkpoint_wal_size = 1 << 24; - //! Whether or not to use Direct IO, bypassing operating system buffers - bool use_direct_io = false; - //! Whether extensions should be loaded on start-up - bool load_extensions = true; - //! The FileSystem to use, can be overwritten to allow for injecting custom file systems for testing purposes (e.g. - //! RamFS or something similar) - unique_ptr file_system; - //! The maximum memory used by the database system (in bytes). Default: 80% of System available memory - idx_t maximum_memory = (idx_t)-1; - //! The maximum amount of CPU threads used by the database system. Default: all available. - idx_t maximum_threads = (idx_t)-1; - //! Whether or not to create and use a temporary directory to store intermediates that do not fit in memory - bool use_temporary_directory = true; - //! Directory to store temporary structures that do not fit in memory - string temporary_directory; - //! The collation type of the database - string collation = string(); - //! The order type used when none is specified (default: ASC) - OrderType default_order_type = OrderType::ASCENDING; - //! Null ordering used when none is specified (default: NULLS FIRST) - OrderByNullType default_null_order = OrderByNullType::NULLS_FIRST; - //! enable COPY and related commands - bool enable_external_access = true; - //! Whether or not object cache is used - bool object_cache_enable = false; - //! Force checkpoint when CHECKPOINT is called or on shutdown, even if no changes have been made - bool force_checkpoint = false; - //! Run a checkpoint on successful shutdown and delete the WAL, to leave only a single database file behind - bool checkpoint_on_shutdown = true; - //! Debug flag that decides when a checkpoing should be aborted. Only used for testing purposes. - CheckpointAbort checkpoint_abort = CheckpointAbort::NO_ABORT; - //! Replacement table scans are automatically attempted when a table name cannot be found in the schema - vector replacement_scans; - //! Initialize the database with the standard set of DuckDB functions - //! You should probably not touch this unless you know what you are doing - bool initialize_default_database = true; - //! The set of disabled optimizers (default empty) - set disabled_optimizers; - //! Force a specific compression method to be used when checkpointing (if available) - CompressionType force_compression = CompressionType::COMPRESSION_AUTO; - //! Debug flag that adds additional (unnecessary) free_list blocks to the storage - bool debug_many_free_list_blocks = false; - //! Debug setting for window aggregation mode: (window, combine, separate) - WindowAggregationMode window_mode = WindowAggregationMode::WINDOW; +public: + unique_ptr Copy() const override; + void SerializeAlterTable(FieldWriter &writer) const override; + static unique_ptr Deserialize(FieldReader &reader, string schema, string table); +}; - //! Extra parameters that can be SET for loaded extensions - case_insensitive_map_t extension_parameters; - //! Database configuration variables as controlled by SET - case_insensitive_map_t set_variables; +//===--------------------------------------------------------------------===// +// AlterForeignKeyInfo +//===--------------------------------------------------------------------===// +struct AlterForeignKeyInfo : public AlterTableInfo { + AlterForeignKeyInfo(string schema, string table, string fk_table, vector pk_columns, + vector fk_columns, vector pk_keys, vector fk_keys, + AlterForeignKeyType type); + ~AlterForeignKeyInfo() override; - DUCKDB_API void AddExtensionOption(string name, string description, LogicalType parameter, - set_option_callback_t function = nullptr); + string fk_table; + vector pk_columns; + vector fk_columns; + vector pk_keys; + vector fk_keys; + AlterForeignKeyType type; public: - DUCKDB_API static DBConfig &GetConfig(ClientContext &context); - DUCKDB_API static DBConfig &GetConfig(DatabaseInstance &db); - DUCKDB_API static vector GetOptions(); - DUCKDB_API static idx_t GetOptionCount(); - - //! Fetch an option by index. Returns a pointer to the option, or nullptr if out of range - DUCKDB_API static ConfigurationOption *GetOptionByIndex(idx_t index); - //! Fetch an option by name. Returns a pointer to the option, or nullptr if none exists. - DUCKDB_API static ConfigurationOption *GetOptionByName(const string &name); - - DUCKDB_API void SetOption(const ConfigurationOption &option, const Value &value); - - DUCKDB_API static idx_t ParseMemoryLimit(const string &arg); - - //! Return the list of possible compression functions for the specific physical type - DUCKDB_API vector GetCompressionFunctions(PhysicalType data_type); - //! Return the compression function for the specified compression type/physical type combo - DUCKDB_API CompressionFunction *GetCompressionFunction(CompressionType type, PhysicalType data_type); - -private: - unique_ptr compression_functions; + unique_ptr Copy() const override; + void SerializeAlterTable(FieldWriter &writer) const override; + static unique_ptr Deserialize(FieldReader &reader, string schema, string table); }; -} // namespace duckdb - -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/main/extension.hpp -// -// -//===----------------------------------------------------------------------===// - - - - +//===--------------------------------------------------------------------===// +// Alter View +//===--------------------------------------------------------------------===// +enum class AlterViewType : uint8_t { INVALID = 0, RENAME_VIEW = 1 }; +struct AlterViewInfo : public AlterInfo { + AlterViewInfo(AlterViewType type, string schema, string view); + ~AlterViewInfo() override; -namespace duckdb { -class DuckDB; + AlterViewType alter_view_type; -//! The Extension class is the base class used to define extensions -class Extension { public: - DUCKDB_API virtual ~Extension(); - - DUCKDB_API virtual void Load(DuckDB &db) = 0; - DUCKDB_API virtual std::string Name() = 0; + CatalogType GetCatalogType() const override; + void Serialize(FieldWriter &writer) const override; + virtual void SerializeAlterView(FieldWriter &writer) const = 0; + static unique_ptr Deserialize(FieldReader &reader); }; -} // namespace duckdb - -namespace duckdb { -class StorageManager; -class Catalog; -class TransactionManager; -class ConnectionManager; -class FileSystem; -class TaskScheduler; -class ObjectCache; - -class DatabaseInstance : public std::enable_shared_from_this { - friend class DuckDB; - -public: - DUCKDB_API DatabaseInstance(); - DUCKDB_API ~DatabaseInstance(); +//===--------------------------------------------------------------------===// +// RenameViewInfo +//===--------------------------------------------------------------------===// +struct RenameViewInfo : public AlterViewInfo { + RenameViewInfo(string schema, string view, string new_name); + ~RenameViewInfo() override; - DBConfig config; + //! Relation new name + string new_view_name; public: - DUCKDB_API StorageManager &GetStorageManager(); - DUCKDB_API Catalog &GetCatalog(); - DUCKDB_API FileSystem &GetFileSystem(); - DUCKDB_API TransactionManager &GetTransactionManager(); - DUCKDB_API TaskScheduler &GetScheduler(); - DUCKDB_API ObjectCache &GetObjectCache(); - DUCKDB_API ConnectionManager &GetConnectionManager(); + unique_ptr Copy() const override; + void SerializeAlterView(FieldWriter &writer) const override; + static unique_ptr Deserialize(FieldReader &reader, string schema, string table); +}; - idx_t NumberOfThreads(); +} // namespace duckdb - DUCKDB_API static DatabaseInstance &GetDatabase(ClientContext &context); -private: - void Initialize(const char *path, DBConfig *config); +namespace duckdb { +class Serializer; +class Deserializer; - void Configure(DBConfig &config); +struct SequenceValue { + SequenceValue() : usage_count(0), counter(-1) { + } + SequenceValue(uint64_t usage_count, int64_t counter) : usage_count(usage_count), counter(counter) { + } -private: - unique_ptr storage; - unique_ptr catalog; - unique_ptr transaction_manager; - unique_ptr scheduler; - unique_ptr object_cache; - unique_ptr connection_manager; - unordered_set loaded_extensions; + uint64_t usage_count; + int64_t counter; }; -//! The database object. This object holds the catalog and all the -//! database-specific meta information. -class DuckDB { +//! A sequence catalog entry +class SequenceCatalogEntry : public StandardEntry { public: - DUCKDB_API explicit DuckDB(const char *path = nullptr, DBConfig *config = nullptr); - DUCKDB_API explicit DuckDB(const string &path, DBConfig *config = nullptr); - DUCKDB_API explicit DuckDB(DatabaseInstance &instance); - - DUCKDB_API ~DuckDB(); + //! Create a real TableCatalogEntry and initialize storage for it + SequenceCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateSequenceInfo *info); - //! Reference to the actual database instance - shared_ptr instance; + //! Lock for getting a value on the sequence + mutex lock; + //! The amount of times the sequence has been used + uint64_t usage_count; + //! The sequence counter + int64_t counter; + //! The most recently returned value + int64_t last_value; + //! The increment value + int64_t increment; + //! The minimum value of the sequence + int64_t start_value; + //! The minimum value of the sequence + int64_t min_value; + //! The maximum value of the sequence + int64_t max_value; + //! Whether or not the sequence cycles + bool cycle; public: - template - void LoadExtension() { - T extension; - if (ExtensionIsLoaded(extension.Name())) { - return; - } - extension.Load(*this); - SetExtensionLoaded(extension.Name()); - } + //! Serialize the meta information of the SequenceCatalogEntry a serializer + virtual void Serialize(Serializer &serializer); + //! Deserializes to a CreateTableInfo + static unique_ptr Deserialize(Deserializer &source); - DUCKDB_API FileSystem &GetFileSystem(); + string ToSQL() override; - DUCKDB_API idx_t NumberOfThreads(); - DUCKDB_API static const char *SourceID(); - DUCKDB_API static const char *LibraryVersion(); - DUCKDB_API static string Platform(); - DUCKDB_API bool ExtensionIsLoaded(const std::string &name); - DUCKDB_API void SetExtensionLoaded(const std::string &name); + CatalogEntry *AlterOwnership(ClientContext &context, AlterInfo *info); }; - } // namespace duckdb - //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/main/loadable_extension.hpp +// duckdb/transaction/transaction.hpp // // //===----------------------------------------------------------------------===// -#if defined(DUCKDB_BUILD_LOADABLE_EXTENSION) && defined(DUCKDB_EXTENSION_MAIN) -#ifdef _WIN32 -#ifndef NOMINMAX -#define NOMINMAX -#endif -#ifndef _WINSOCKAPI_ -#define _WINSOCKAPI_ -#endif -#include -#undef CreateDirectory -#undef MoveFile -#undef RemoveDirectory -#include +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/transaction/undo_buffer.hpp +// +// +//===----------------------------------------------------------------------===// -extern "C" { -/* -This is interesting: Windows would normally require a duckdb.dll being on the DLL search path when we load an extension -using LoadLibrary(). However, there is likely no such dll, because DuckDB was statically linked, or is running as part -of an R or Python module with a completely different name (that we don't know) or something of the sorts. Amazingly, -Windows supports lazy-loading DLLs by linking them with /DELAYLOAD. Then a callback will be triggered whenever we access -symbols in the extension. Since DuckDB is already running in the host process (hopefully), we can use -GetModuleHandle(NULL) to return the current process so the symbols are looked for there. See here for another -explanation of this crazy process: -* https://docs.microsoft.com/en-us/cpp/build/reference/linker-support-for-delay-loaded-dlls?view=msvc-160 -* https://docs.microsoft.com/en-us/cpp/build/reference/understanding-the-helper-function?view=msvc-160 -*/ -FARPROC WINAPI duckdb_dllimport_delay_hook(unsigned dliNotify, PDelayLoadInfo pdli) { - switch (dliNotify) { - case dliNotePreLoadLibrary: - if (strcmp(pdli->szDll, "duckdb.dll") != 0) { - return NULL; - } - return (FARPROC)GetModuleHandle(NULL); - default: - return NULL; - } - return NULL; -} -ExternC const PfnDliHook __pfnDliNotifyHook2 = duckdb_dllimport_delay_hook; -ExternC const PfnDliHook __pfnDliFailureHook2 = duckdb_dllimport_delay_hook; -} -#endif -#endif //===----------------------------------------------------------------------===// -// // DuckDB // -// duckdb.h +// duckdb/common/enums/undo_flags.hpp // // //===----------------------------------------------------------------------===// -// duplicate of duckdb/main/winapi.hpp -#ifndef DUCKDB_API -#ifdef _WIN32 -#if defined(DUCKDB_BUILD_LIBRARY) && !defined(DUCKDB_BUILD_LOADABLE_EXTENSION) -#define DUCKDB_API __declspec(dllexport) -#else -#define DUCKDB_API __declspec(dllimport) -#endif -#else -#define DUCKDB_API -#endif -#endif - -// duplicate of duckdb/common/constants.hpp -#ifndef DUCKDB_API_0_3_1 -#define DUCKDB_API_0_3_1 1 -#endif -#ifndef DUCKDB_API_0_3_2 -#define DUCKDB_API_0_3_2 2 -#endif -#ifndef DUCKDB_API_LATEST -#define DUCKDB_API_LATEST DUCKDB_API_0_3_2 -#endif - -#ifndef DUCKDB_API_VERSION -#define DUCKDB_API_VERSION DUCKDB_API_LATEST -#endif -#include -#include -#include -#ifdef __cplusplus -extern "C" { -#endif +namespace duckdb { + +enum class UndoFlags : uint32_t { // far to big but aligned (TM) + EMPTY_ENTRY = 0, + CATALOG_ENTRY = 1, + INSERT_TUPLE = 2, + DELETE_TUPLE = 3, + UPDATE_TUPLE = 4 +}; + +} // namespace duckdb + + +namespace duckdb { + +class WriteAheadLog; + +struct UndoChunk { + explicit UndoChunk(idx_t size); + ~UndoChunk(); + + data_ptr_t WriteEntry(UndoFlags type, uint32_t len); + + unique_ptr data; + idx_t current_position; + idx_t maximum_size; + unique_ptr next; + UndoChunk *prev; +}; + +//! The undo buffer of a transaction is used to hold previous versions of tuples +//! that might be required in the future (because of rollbacks or previous +//! transactions accessing them) +class UndoBuffer { +public: + struct IteratorState { + UndoChunk *current; + data_ptr_t start; + data_ptr_t end; + }; + +public: + UndoBuffer(); + + //! Reserve space for an entry of the specified type and length in the undo + //! buffer + data_ptr_t CreateEntry(UndoFlags type, idx_t len); + + bool ChangesMade(); + idx_t EstimatedSize(); + + //! Cleanup the undo buffer + void Cleanup(); + //! Commit the changes made in the UndoBuffer: should be called on commit + void Commit(UndoBuffer::IteratorState &iterator_state, WriteAheadLog *log, transaction_t commit_id); + //! Revert committed changes made in the UndoBuffer up until the currently committed state + void RevertCommit(UndoBuffer::IteratorState &iterator_state, transaction_t transaction_id); + //! Rollback the changes made in this UndoBuffer: should be called on + //! rollback + void Rollback() noexcept; + +private: + unique_ptr head; + UndoChunk *tail; + +private: + template + void IterateEntries(UndoBuffer::IteratorState &state, T &&callback); + template + void IterateEntries(UndoBuffer::IteratorState &state, UndoBuffer::IteratorState &end_state, T &&callback); + template + void ReverseIterateEntries(T &&callback); +}; + +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/transaction/local_storage.hpp +// +// +//===----------------------------------------------------------------------===// + + + + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/storage/table/scan_state.hpp +// +// +//===----------------------------------------------------------------------===// + + + + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/storage/buffer/buffer_handle.hpp +// +// +//===----------------------------------------------------------------------===// + + + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/storage/storage_info.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + +namespace duckdb { +class Serializer; +class Deserializer; +struct FileHandle; + +//! The version number of the database storage format +extern const uint64_t VERSION_NUMBER; + +using block_id_t = int64_t; + +#define INVALID_BLOCK (-1) + +// maximum block id, 2^62 +#define MAXIMUM_BLOCK 4611686018427388000LL + +//! The MainHeader is the first header in the storage file. The MainHeader is typically written only once for a database +//! file. +struct MainHeader { + static constexpr idx_t MAGIC_BYTE_SIZE = 4; + static constexpr idx_t MAGIC_BYTE_OFFSET = sizeof(uint64_t); + static constexpr idx_t FLAG_COUNT = 4; + // the magic bytes in front of the file + // should be "DUCK" + static const char MAGIC_BYTES[]; + //! The version of the database + uint64_t version_number; + //! The set of flags used by the database + uint64_t flags[FLAG_COUNT]; + + static void CheckMagicBytes(FileHandle &handle); + + void Serialize(Serializer &ser); + static MainHeader Deserialize(Deserializer &source); +}; + +//! The DatabaseHeader contains information about the current state of the database. Every storage file has two +//! DatabaseHeaders. On startup, the DatabaseHeader with the highest iteration count is used as the active header. When +//! a checkpoint is performed, the active DatabaseHeader is switched by increasing the iteration count of the +//! DatabaseHeader. +struct DatabaseHeader { + //! The iteration count, increases by 1 every time the storage is checkpointed. + uint64_t iteration; + //! A pointer to the initial meta block + block_id_t meta_block; + //! A pointer to the block containing the free list + block_id_t free_list; + //! The number of blocks that is in the file as of this database header. If the file is larger than BLOCK_SIZE * + //! block_count any blocks appearing AFTER block_count are implicitly part of the free_list. + uint64_t block_count; + + void Serialize(Serializer &ser); + static DatabaseHeader Deserialize(Deserializer &source); +}; + +} // namespace duckdb + + +namespace duckdb { +class BlockHandle; +class FileBuffer; + +class BufferHandle { +public: + BufferHandle(shared_ptr handle, FileBuffer *node); + DUCKDB_API ~BufferHandle(); + + //! The block handle + shared_ptr handle; + //! The managed buffer node + FileBuffer *node; + DUCKDB_API data_ptr_t Ptr(); +}; + +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/storage/storage_lock.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + + +namespace duckdb { +class StorageLock; + +enum class StorageLockType { SHARED = 0, EXCLUSIVE = 1 }; + +class StorageLockKey { +public: + StorageLockKey(StorageLock &lock, StorageLockType type); + ~StorageLockKey(); + +private: + StorageLock &lock; + StorageLockType type; +}; + +class StorageLock { + friend class StorageLockKey; + +public: + StorageLock(); + + //! Get an exclusive lock + unique_ptr GetExclusiveLock(); + //! Get a shared lock + unique_ptr GetSharedLock(); + +private: + mutex exclusive_lock; + atomic read_count; + +private: + //! Release an exclusive lock + void ReleaseExclusiveLock(); + //! Release a shared lock + void ReleaseSharedLock(); +}; + +} // namespace duckdb + + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/execution/adaptive_filter.hpp +// +// +//===----------------------------------------------------------------------===// + + + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_aggregate_expression.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + +#include + +namespace duckdb { +class BoundAggregateExpression : public Expression { +public: + BoundAggregateExpression(AggregateFunction function, vector> children, + unique_ptr filter, unique_ptr bind_info, bool distinct); + + //! The bound function expression + AggregateFunction function; + //! List of arguments to the function + vector> children; + //! The bound function data (if any) + unique_ptr bind_info; + //! True to aggregate on distinct values + bool distinct; + + //! Filter for this aggregate + unique_ptr filter; + +public: + bool IsAggregate() const override { + return true; + } + bool IsFoldable() const override { + return false; + } + bool PropagatesNullValues() const override; + + string ToString() const override; + + hash_t Hash() const override; + bool Equals(const BaseExpression *other) const override; + unique_ptr Copy() override; +}; +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_between_expression.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + +namespace duckdb { + +class BoundBetweenExpression : public Expression { +public: + BoundBetweenExpression(unique_ptr input, unique_ptr lower, unique_ptr upper, + bool lower_inclusive, bool upper_inclusive); + + unique_ptr input; + unique_ptr lower; + unique_ptr upper; + bool lower_inclusive; + bool upper_inclusive; + +public: + string ToString() const override; + + bool Equals(const BaseExpression *other) const override; + + unique_ptr Copy() override; + +public: + ExpressionType LowerComparisonType() { + return lower_inclusive ? ExpressionType::COMPARE_GREATERTHANOREQUALTO : ExpressionType::COMPARE_GREATERTHAN; + } + ExpressionType UpperComparisonType() { + return upper_inclusive ? ExpressionType::COMPARE_LESSTHANOREQUALTO : ExpressionType::COMPARE_LESSTHAN; + } +}; +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_case_expression.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + +namespace duckdb { + +struct BoundCaseCheck { + unique_ptr when_expr; + unique_ptr then_expr; +}; + +class BoundCaseExpression : public Expression { +public: + BoundCaseExpression(LogicalType type); + BoundCaseExpression(unique_ptr when_expr, unique_ptr then_expr, + unique_ptr else_expr); + + vector case_checks; + unique_ptr else_expr; + +public: + string ToString() const override; + + bool Equals(const BaseExpression *other) const override; + + unique_ptr Copy() override; +}; +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_cast_expression.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + +namespace duckdb { + +class BoundCastExpression : public Expression { +public: + BoundCastExpression(unique_ptr child, LogicalType target_type, bool try_cast = false); + + //! The child type + unique_ptr child; + //! Whether to use try_cast or not. try_cast converts cast failures into NULLs instead of throwing an error. + bool try_cast; + +public: + LogicalType source_type() { + return child->return_type; + } + + //! Cast an expression to the specified SQL type if required + static unique_ptr AddCastToType(unique_ptr expr, const LogicalType &target_type); + //! Returns true if a cast is invertible (i.e. CAST(s -> t -> s) = s for all values of s). This is not true for e.g. + //! boolean casts, because that can be e.g. -1 -> TRUE -> 1. This is necessary to prevent some optimizer bugs. + static bool CastIsInvertible(const LogicalType &source_type, const LogicalType &target_type); + + string ToString() const override; + + bool Equals(const BaseExpression *other) const override; + + unique_ptr Copy() override; +}; +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_columnref_expression.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + +namespace duckdb { + +//! A BoundColumnRef expression represents a ColumnRef expression that was bound to an actual table and column index. It +//! is not yet executable, however. The ColumnBindingResolver transforms the BoundColumnRefExpressions into +//! BoundExpressions, which refer to indexes into the physical chunks that pass through the executor. +class BoundColumnRefExpression : public Expression { +public: + BoundColumnRefExpression(LogicalType type, ColumnBinding binding, idx_t depth = 0); + BoundColumnRefExpression(string alias, LogicalType type, ColumnBinding binding, idx_t depth = 0); + + //! Column index set by the binder, used to generate the final BoundExpression + ColumnBinding binding; + //! The subquery depth (i.e. depth 0 = current query, depth 1 = parent query, depth 2 = parent of parent, etc...). + //! This is only non-zero for correlated expressions inside subqueries. + idx_t depth; + +public: + bool IsScalar() const override { + return false; + } + bool IsFoldable() const override { + return false; + } + + string ToString() const override; + + bool Equals(const BaseExpression *other) const override; + hash_t Hash() const override; + + unique_ptr Copy() override; +}; +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_comparison_expression.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + +namespace duckdb { + +class BoundComparisonExpression : public Expression { +public: + BoundComparisonExpression(ExpressionType type, unique_ptr left, unique_ptr right); + + unique_ptr left; + unique_ptr right; + +public: + string ToString() const override; + + bool Equals(const BaseExpression *other) const override; + + unique_ptr Copy() override; + +public: + static LogicalType BindComparison(LogicalType left_type, LogicalType right_type); +}; +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_conjunction_expression.hpp +// +// +//===----------------------------------------------------------------------===// -//===--------------------------------------------------------------------===// -// Type Information -//===--------------------------------------------------------------------===// -typedef uint64_t idx_t; -typedef enum DUCKDB_TYPE { - DUCKDB_TYPE_INVALID = 0, - // bool - DUCKDB_TYPE_BOOLEAN, - // int8_t - DUCKDB_TYPE_TINYINT, - // int16_t - DUCKDB_TYPE_SMALLINT, - // int32_t - DUCKDB_TYPE_INTEGER, - // int64_t - DUCKDB_TYPE_BIGINT, - // uint8_t - DUCKDB_TYPE_UTINYINT, - // uint16_t - DUCKDB_TYPE_USMALLINT, - // uint32_t - DUCKDB_TYPE_UINTEGER, - // uint64_t - DUCKDB_TYPE_UBIGINT, - // float - DUCKDB_TYPE_FLOAT, - // double - DUCKDB_TYPE_DOUBLE, - // duckdb_timestamp - DUCKDB_TYPE_TIMESTAMP, - // duckdb_date - DUCKDB_TYPE_DATE, - // duckdb_time - DUCKDB_TYPE_TIME, - // duckdb_interval - DUCKDB_TYPE_INTERVAL, - // duckdb_hugeint - DUCKDB_TYPE_HUGEINT, - // const char* - DUCKDB_TYPE_VARCHAR, - // duckdb_blob - DUCKDB_TYPE_BLOB -} duckdb_type; -//! Days are stored as days since 1970-01-01 -//! Use the duckdb_from_date/duckdb_to_date function to extract individual information -typedef struct { - int32_t days; -} duckdb_date; -typedef struct { - int32_t year; - int8_t month; - int8_t day; -} duckdb_date_struct; -//! Time is stored as microseconds since 00:00:00 -//! Use the duckdb_from_time/duckdb_to_time function to extract individual information -typedef struct { - int64_t micros; -} duckdb_time; +namespace duckdb { -typedef struct { - int8_t hour; - int8_t min; - int8_t sec; - int32_t micros; -} duckdb_time_struct; +class BoundConjunctionExpression : public Expression { +public: + explicit BoundConjunctionExpression(ExpressionType type); + BoundConjunctionExpression(ExpressionType type, unique_ptr left, unique_ptr right); -//! Timestamps are stored as microseconds since 1970-01-01 -//! Use the duckdb_from_timestamp/duckdb_to_timestamp function to extract individual information -typedef struct { - int64_t micros; -} duckdb_timestamp; + vector> children; -typedef struct { - duckdb_date_struct date; - duckdb_time_struct time; -} duckdb_timestamp_struct; +public: + string ToString() const override; -typedef struct { - int32_t months; - int32_t days; - int64_t micros; -} duckdb_interval; + bool Equals(const BaseExpression *other) const override; -//! Hugeints are composed in a (lower, upper) component -//! The value of the hugeint is upper * 2^64 + lower -//! For easy usage, the functions duckdb_hugeint_to_double/duckdb_double_to_hugeint are recommended -typedef struct { - uint64_t lower; - int64_t upper; -} duckdb_hugeint; + bool PropagatesNullValues() const override; -typedef struct { - void *data; - idx_t size; -} duckdb_blob; + unique_ptr Copy() override; +}; +} // namespace duckdb -typedef struct { -#if DUCKDB_API_VERSION < DUCKDB_API_0_3_2 - void *data; - bool *nullmask; - duckdb_type type; - char *name; -#else - // deprecated, use duckdb_column_data - void *__deprecated_data; - // deprecated, use duckdb_nullmask_data - bool *__deprecated_nullmask; - // deprecated, use duckdb_column_type - duckdb_type __deprecated_type; - // deprecated, use duckdb_column_name - char *__deprecated_name; -#endif - void *internal_data; -} duckdb_column; +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_constant_expression.hpp +// +// +//===----------------------------------------------------------------------===// -typedef struct { -#if DUCKDB_API_VERSION < DUCKDB_API_0_3_2 - idx_t column_count; - idx_t row_count; - idx_t rows_changed; - duckdb_column *columns; - char *error_message; -#else - // deprecated, use duckdb_column_count - idx_t __deprecated_column_count; - // deprecated, use duckdb_row_count - idx_t __deprecated_row_count; - // deprecated, use duckdb_rows_changed - idx_t __deprecated_rows_changed; - // deprecated, use duckdb_column_ family of functions - duckdb_column *__deprecated_columns; - // deprecated, use duckdb_result_error - char *__deprecated_error_message; -#endif - void *internal_data; -} duckdb_result; -typedef void *duckdb_database; -typedef void *duckdb_connection; -typedef void *duckdb_prepared_statement; -typedef void *duckdb_appender; -typedef void *duckdb_arrow; -typedef void *duckdb_config; -typedef void *duckdb_arrow_schema; -typedef void *duckdb_arrow_array; -typedef enum { DuckDBSuccess = 0, DuckDBError = 1 } duckdb_state; -//===--------------------------------------------------------------------===// -// Open/Connect -//===--------------------------------------------------------------------===// -/*! -Creates a new database or opens an existing database file stored at the the given path. -If no path is given a new in-memory database is created instead. -* path: Path to the database file on disk, or `nullptr` or `:memory:` to open an in-memory database. -* out_database: The result database object. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_open(const char *path, duckdb_database *out_database); +namespace duckdb { -/*! -Extended version of duckdb_open. Creates a new database or opens an existing database file stored at the the given path. +class BoundConstantExpression : public Expression { +public: + explicit BoundConstantExpression(Value value); + + Value value; + +public: + string ToString() const override; + + bool Equals(const BaseExpression *other) const override; + hash_t Hash() const override; + + unique_ptr Copy() override; +}; +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_default_expression.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + +namespace duckdb { + +class BoundDefaultExpression : public Expression { +public: + explicit BoundDefaultExpression(LogicalType type = LogicalType()) + : Expression(ExpressionType::VALUE_DEFAULT, ExpressionClass::BOUND_DEFAULT, type) { + } + +public: + bool IsScalar() const override { + return false; + } + bool IsFoldable() const override { + return false; + } + + string ToString() const override { + return "DEFAULT"; + } + + unique_ptr Copy() override { + return make_unique(return_type); + } +}; +} // namespace duckdb + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_function_expression.hpp +// +// +//===----------------------------------------------------------------------===// + + + + + + +namespace duckdb { +class ScalarFunctionCatalogEntry; + +//! Represents a function call that has been bound to a base function +class BoundFunctionExpression : public Expression { +public: + BoundFunctionExpression(LogicalType return_type, ScalarFunction bound_function, + vector> arguments, unique_ptr bind_info, + bool is_operator = false); + + // The bound function expression + ScalarFunction function; + //! List of child-expressions of the function + vector> children; + //! The bound function data (if any) + unique_ptr bind_info; + //! Whether or not the function is an operator, only used for rendering + bool is_operator; + +public: + bool HasSideEffects() const override; + bool IsFoldable() const override; + string ToString() const override; + bool PropagatesNullValues() const override; + hash_t Hash() const override; + bool Equals(const BaseExpression *other) const override; -* path: Path to the database file on disk, or `nullptr` or `:memory:` to open an in-memory database. -* out_database: The result database object. -* config: (Optional) configuration used to start up the database system. -* out_error: If set and the function returns DuckDBError, this will contain the reason why the start-up failed. -Note that the error must be freed using `duckdb_free`. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_open_ext(const char *path, duckdb_database *out_database, duckdb_config config, - char **out_error); + unique_ptr Copy() override; + void Verify() const override; +}; +} // namespace duckdb -/*! -Closes the specified database and de-allocates all memory allocated for that database. -This should be called after you are done with any database allocated through `duckdb_open`. -Note that failing to call `duckdb_close` (in case of e.g. a program crash) will not cause data corruption. -Still it is recommended to always correctly close a database object after you are done with it. +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_operator_expression.hpp +// +// +//===----------------------------------------------------------------------===// -* database: The database object to shut down. -*/ -DUCKDB_API void duckdb_close(duckdb_database *database); -/*! -Opens a connection to a database. Connections are required to query the database, and store transactional state -associated with the connection. -* database: The database file to connect to. -* out_connection: The result connection object. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_connect(duckdb_database database, duckdb_connection *out_connection); -/*! -Closes the specified connection and de-allocates all memory allocated for that connection. -* connection: The connection to close. -*/ -DUCKDB_API void duckdb_disconnect(duckdb_connection *connection); +namespace duckdb { -//===--------------------------------------------------------------------===// -// Configuration -//===--------------------------------------------------------------------===// -/*! -Initializes an empty configuration object that can be used to provide start-up options for the DuckDB instance -through `duckdb_open_ext`. +class BoundOperatorExpression : public Expression { +public: + BoundOperatorExpression(ExpressionType type, LogicalType return_type); -This will always succeed unless there is a malloc failure. + vector> children; -* out_config: The result configuration object. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_create_config(duckdb_config *out_config); +public: + string ToString() const override; -/*! -This returns the total amount of configuration options available for usage with `duckdb_get_config_flag`. + bool Equals(const BaseExpression *other) const override; -This should not be called in a loop as it internally loops over all the options. + unique_ptr Copy() override; +}; +} // namespace duckdb -* returns: The amount of config options available. -*/ -DUCKDB_API size_t duckdb_config_count(); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_parameter_expression.hpp +// +// +//===----------------------------------------------------------------------===// -/*! -Obtains a human-readable name and description of a specific configuration option. This can be used to e.g. -display configuration options. This will succeed unless `index` is out of range (i.e. `>= duckdb_config_count`). -The result name or description MUST NOT be freed. -* index: The index of the configuration option (between 0 and `duckdb_config_count`) -* out_name: A name of the configuration flag. -* out_description: A description of the configuration flag. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_get_config_flag(size_t index, const char **out_name, const char **out_description); -/*! -Sets the specified option for the specified configuration. The configuration option is indicated by name. -To obtain a list of config options, see `duckdb_get_config_flag`. -In the source code, configuration options are defined in `config.cpp`. -This can fail if either the name is invalid, or if the value provided for the option is invalid. +namespace duckdb { -* duckdb_config: The configuration object to set the option on. -* name: The name of the configuration flag to set. -* option: The value to set the configuration flag to. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_set_config(duckdb_config config, const char *name, const char *option); +class BoundParameterExpression : public Expression { +public: + explicit BoundParameterExpression(idx_t parameter_nr); -/*! -Destroys the specified configuration option and de-allocates all memory allocated for the object. + idx_t parameter_nr; + Value *value; -* config: The configuration object to destroy. -*/ -DUCKDB_API void duckdb_destroy_config(duckdb_config *config); +public: + bool IsScalar() const override; + bool HasParameter() const override; + bool IsFoldable() const override; -//===--------------------------------------------------------------------===// -// Query Execution -//===--------------------------------------------------------------------===// -/*! -Executes a SQL query within a connection and stores the full (materialized) result in the out_result pointer. -If the query fails to execute, DuckDBError is returned and the error message can be retrieved by calling -`duckdb_result_error`. + string ToString() const override; -Note that after running `duckdb_query`, `duckdb_destroy_result` must be called on the result object even if the -query fails, otherwise the error stored within the result will not be freed correctly. + bool Equals(const BaseExpression *other) const override; + hash_t Hash() const override; -* connection: The connection to perform the query in. -* query: The SQL query to run. -* out_result: The query result. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_query(duckdb_connection connection, const char *query, duckdb_result *out_result); + unique_ptr Copy() override; +}; +} // namespace duckdb -/*! -Closes the result and de-allocates all memory allocated for that connection. +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_reference_expression.hpp +// +// +//===----------------------------------------------------------------------===// -* result: The result to destroy. -*/ -DUCKDB_API void duckdb_destroy_result(duckdb_result *result); -/*! -Returns the column name of the specified column. The result should not need be freed; the column names will -automatically be destroyed when the result is destroyed. -Returns `NULL` if the column is out of range. -* result: The result object to fetch the column name from. -* col: The column index. -* returns: The column name of the specified column. -*/ -DUCKDB_API const char *duckdb_column_name(duckdb_result *result, idx_t col); -/*! -Returns the column type of the specified column. +namespace duckdb { -Returns `DUCKDB_TYPE_INVALID` if the column is out of range. +//! A BoundReferenceExpression represents a physical index into a DataChunk +class BoundReferenceExpression : public Expression { +public: + BoundReferenceExpression(string alias, LogicalType type, idx_t index); + BoundReferenceExpression(LogicalType type, idx_t index); -* result: The result object to fetch the column type from. -* col: The column index. -* returns: The column type of the specified column. -*/ -DUCKDB_API duckdb_type duckdb_column_type(duckdb_result *result, idx_t col); + //! Index used to access data in the chunks + idx_t index; -/*! -Returns the number of columns present in a the result object. +public: + bool IsScalar() const override { + return false; + } + bool IsFoldable() const override { + return false; + } -* result: The result object. -* returns: The number of columns present in the result object. -*/ -DUCKDB_API idx_t duckdb_column_count(duckdb_result *result); + string ToString() const override; -/*! -Returns the number of rows present in a the result object. + hash_t Hash() const override; + bool Equals(const BaseExpression *other) const override; -* result: The result object. -* returns: The number of rows present in the result object. -*/ -DUCKDB_API idx_t duckdb_row_count(duckdb_result *result); + unique_ptr Copy() override; +}; +} // namespace duckdb -/*! -Returns the number of rows changed by the query stored in the result. This is relevant only for INSERT/UPDATE/DELETE -queries. For other queries the rows_changed will be 0. +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_subquery_expression.hpp +// +// +//===----------------------------------------------------------------------===// -* result: The result object. -* returns: The number of rows changed. -*/ -DUCKDB_API idx_t duckdb_rows_changed(duckdb_result *result); -/*! -Returns the data of a specific column of a result in columnar format. This is the fastest way of accessing data in a -query result, as no conversion or type checking must be performed (outside of the original switch). If performance -is a concern, it is recommended to use this API over the `duckdb_value` functions. -The function returns a dense array which contains the result data. The exact type stored in the array depends on the -corresponding duckdb_type (as provided by `duckdb_column_type`). For the exact type by which the data should be -accessed, see the comments in [the types section](types) or the `DUCKDB_TYPE` enum. +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/enums/subquery_type.hpp +// +// +//===----------------------------------------------------------------------===// -For example, for a column of type `DUCKDB_TYPE_INTEGER`, rows can be accessed in the following manner: -```c -int32_t *data = (int32_t *) duckdb_column_data(&result, 0); -printf("Data for row %d: %d\n", row, data[row]); -``` -* result: The result object to fetch the column data from. -* col: The column index. -* returns: The column data of the specified column. -*/ -DUCKDB_API void *duckdb_column_data(duckdb_result *result, idx_t col); -/*! -Returns the nullmask of a specific column of a result in columnar format. The nullmask indicates for every row -whether or not the corresponding row is `NULL`. If a row is `NULL`, the values present in the array provided -by `duckdb_column_data` are undefined. -```c -int32_t *data = (int32_t *) duckdb_column_data(&result, 0); -bool *nullmask = duckdb_nullmask_data(&result, 0); -if (nullmask[row]) { - printf("Data for row %d: NULL\n", row); -} else { - printf("Data for row %d: %d\n", row, data[row]); -} -``` -* result: The result object to fetch the nullmask from. -* col: The column index. -* returns: The nullmask of the specified column. -*/ -DUCKDB_API bool *duckdb_nullmask_data(duckdb_result *result, idx_t col); +namespace duckdb { + +//===--------------------------------------------------------------------===// +// Subquery Types +//===--------------------------------------------------------------------===// +enum class SubqueryType : uint8_t { + INVALID = 0, + SCALAR = 1, // Regular scalar subquery + EXISTS = 2, // EXISTS (SELECT...) + NOT_EXISTS = 3, // NOT EXISTS(SELECT...) + ANY = 4, // x = ANY(SELECT...) OR x IN (SELECT...) +}; -/*! -Returns the error message contained within the result. The error is only set if `duckdb_query` returns `DuckDBError`. +} // namespace duckdb -The result of this function must not be freed. It will be cleaned up when `duckdb_destroy_result` is called. +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/binder.hpp +// +// +//===----------------------------------------------------------------------===// -* result: The result object to fetch the nullmask from. -* returns: The error of the result. -*/ -DUCKDB_API char *duckdb_result_error(duckdb_result *result); -//===--------------------------------------------------------------------===// -// Result Functions -//===--------------------------------------------------------------------===// -// Safe fetch functions -// These functions will perform conversions if necessary. -// On failure (e.g. if conversion cannot be performed or if the value is NULL) a default value is returned. -// Note that these functions are slow since they perform bounds checking and conversion -// For fast access of values prefer using duckdb_column_data and duckdb_nullmask_data -/*! - * returns: The boolean value at the specified location, or false if the value cannot be converted. - */ -DUCKDB_API bool duckdb_value_boolean(duckdb_result *result, idx_t col, idx_t row); -/*! - * returns: The int8_t value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API int8_t duckdb_value_int8(duckdb_result *result, idx_t col, idx_t row); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/tokens.hpp +// +// +//===----------------------------------------------------------------------===// -/*! - * returns: The int16_t value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API int16_t duckdb_value_int16(duckdb_result *result, idx_t col, idx_t row); -/*! - * returns: The int32_t value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API int32_t duckdb_value_int32(duckdb_result *result, idx_t col, idx_t row); -/*! - * returns: The int64_t value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API int64_t duckdb_value_int64(duckdb_result *result, idx_t col, idx_t row); +namespace duckdb { -/*! - * returns: The duckdb_hugeint value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API duckdb_hugeint duckdb_value_hugeint(duckdb_result *result, idx_t col, idx_t row); +//===--------------------------------------------------------------------===// +// Statements +//===--------------------------------------------------------------------===// +class SQLStatement; -/*! - * returns: The uint8_t value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API uint8_t duckdb_value_uint8(duckdb_result *result, idx_t col, idx_t row); +class AlterStatement; +class CallStatement; +class CopyStatement; +class CreateStatement; +class DeleteStatement; +class DropStatement; +class InsertStatement; +class SelectStatement; +class TransactionStatement; +class UpdateStatement; +class PrepareStatement; +class ExecuteStatement; +class PragmaStatement; +class ShowStatement; +class ExplainStatement; +class ExportStatement; +class VacuumStatement; +class RelationStatement; +class SetStatement; +class LoadStatement; -/*! - * returns: The uint16_t value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API uint16_t duckdb_value_uint16(duckdb_result *result, idx_t col, idx_t row); +//===--------------------------------------------------------------------===// +// Query Node +//===--------------------------------------------------------------------===// +class QueryNode; +class SelectNode; +class SetOperationNode; +class RecursiveCTENode; -/*! - * returns: The uint32_t value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API uint32_t duckdb_value_uint32(duckdb_result *result, idx_t col, idx_t row); +//===--------------------------------------------------------------------===// +// Expressions +//===--------------------------------------------------------------------===// +class ParsedExpression; -/*! - * returns: The uint64_t value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API uint64_t duckdb_value_uint64(duckdb_result *result, idx_t col, idx_t row); +class BetweenExpression; +class CaseExpression; +class CastExpression; +class CollateExpression; +class ColumnRefExpression; +class ComparisonExpression; +class ConjunctionExpression; +class ConstantExpression; +class DefaultExpression; +class FunctionExpression; +class LambdaExpression; +class OperatorExpression; +class ParameterExpression; +class PositionalReferenceExpression; +class StarExpression; +class SubqueryExpression; +class WindowExpression; -/*! - * returns: The float value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API float duckdb_value_float(duckdb_result *result, idx_t col, idx_t row); +//===--------------------------------------------------------------------===// +// Constraints +//===--------------------------------------------------------------------===// +class Constraint; -/*! - * returns: The double value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API double duckdb_value_double(duckdb_result *result, idx_t col, idx_t row); +class NotNullConstraint; +class CheckConstraint; +class UniqueConstraint; +class ForeignKeyConstraint; -/*! - * returns: The duckdb_date value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API duckdb_date duckdb_value_date(duckdb_result *result, idx_t col, idx_t row); +//===--------------------------------------------------------------------===// +// TableRefs +//===--------------------------------------------------------------------===// +class TableRef; -/*! - * returns: The duckdb_time value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API duckdb_time duckdb_value_time(duckdb_result *result, idx_t col, idx_t row); +class BaseTableRef; +class CrossProductRef; +class JoinRef; +class SubqueryRef; +class TableFunctionRef; +class EmptyTableRef; +class ExpressionListRef; -/*! - * returns: The duckdb_timestamp value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API duckdb_timestamp duckdb_value_timestamp(duckdb_result *result, idx_t col, idx_t row); +//===--------------------------------------------------------------------===// +// Other +//===--------------------------------------------------------------------===// +struct SampleOptions; -/*! - * returns: The duckdb_interval value at the specified location, or 0 if the value cannot be converted. - */ -DUCKDB_API duckdb_interval duckdb_value_interval(duckdb_result *result, idx_t col, idx_t row); +} // namespace duckdb -/*! -* returns: The char* value at the specified location, or nullptr if the value cannot be converted. -The result must be freed with `duckdb_free`. -*/ -DUCKDB_API char *duckdb_value_varchar(duckdb_result *result, idx_t col, idx_t row); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/bind_context.hpp +// +// +//===----------------------------------------------------------------------===// -/*! -* returns: The char* value at the specified location. ONLY works on VARCHAR columns and does not auto-cast. -If the column is NOT a VARCHAR column this function will return NULL. -The result must NOT be freed. -*/ -DUCKDB_API char *duckdb_value_varchar_internal(duckdb_result *result, idx_t col, idx_t row); -/*! -* returns: The duckdb_blob value at the specified location. Returns a blob with blob.data set to nullptr if the -value cannot be converted. The resulting "blob.data" must be freed with `duckdb_free.` -*/ -DUCKDB_API duckdb_blob duckdb_value_blob(duckdb_result *result, idx_t col, idx_t row); -/*! - * returns: Returns true if the value at the specified index is NULL, and false otherwise. - */ -DUCKDB_API bool duckdb_value_is_null(duckdb_result *result, idx_t col, idx_t row); -//===--------------------------------------------------------------------===// -// Helpers -//===--------------------------------------------------------------------===// -/*! -Allocate `size` bytes of memory using the duckdb internal malloc function. Any memory allocated in this manner -should be freed using `duckdb_free`. +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp +// +// +//===----------------------------------------------------------------------===// -* size: The number of bytes to allocate. -* returns: A pointer to the allocated memory region. -*/ -DUCKDB_API void *duckdb_malloc(size_t size); -/*! -Free a value returned from `duckdb_malloc`, `duckdb_value_varchar` or `duckdb_value_blob`. -* ptr: The memory region to de-allocate. -*/ -DUCKDB_API void duckdb_free(void *ptr); -//===--------------------------------------------------------------------===// -// Date/Time/Timestamp Helpers -//===--------------------------------------------------------------------===// -/*! -Decompose a `duckdb_date` object into year, month and date (stored as `duckdb_date_struct`). -* date: The date object, as obtained from a `DUCKDB_TYPE_DATE` column. -* returns: The `duckdb_date_struct` with the decomposed elements. -*/ -DUCKDB_API duckdb_date_struct duckdb_from_date(duckdb_date date); -/*! -Re-compose a `duckdb_date` from year, month and date (`duckdb_date_struct`). -* date: The year, month and date stored in a `duckdb_date_struct`. -* returns: The `duckdb_date` element. -*/ -DUCKDB_API duckdb_date duckdb_to_date(duckdb_date_struct date); +namespace duckdb { -/*! -Decompose a `duckdb_time` object into hour, minute, second and microsecond (stored as `duckdb_time_struct`). +class Catalog; +class Constraint; -* time: The time object, as obtained from a `DUCKDB_TYPE_TIME` column. -* returns: The `duckdb_time_struct` with the decomposed elements. -*/ -DUCKDB_API duckdb_time_struct duckdb_from_time(duckdb_time time); +struct CreateTableFunctionInfo; -/*! -Re-compose a `duckdb_time` from hour, minute, second and microsecond (`duckdb_time_struct`). +//! A table function in the catalog +class TableFunctionCatalogEntry : public StandardEntry { +public: + TableFunctionCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateTableFunctionInfo *info); -* time: The hour, minute, second and microsecond in a `duckdb_time_struct`. -* returns: The `duckdb_time` element. -*/ -DUCKDB_API duckdb_time duckdb_to_time(duckdb_time_struct time); + //! The table function + vector functions; +}; +} // namespace duckdb -/*! -Decompose a `duckdb_timestamp` object into a `duckdb_timestamp_struct`. -* ts: The ts object, as obtained from a `DUCKDB_TYPE_TIMESTAMP` column. -* returns: The `duckdb_timestamp_struct` with the decomposed elements. -*/ -DUCKDB_API duckdb_timestamp_struct duckdb_from_timestamp(duckdb_timestamp ts); -/*! -Re-compose a `duckdb_timestamp` from a duckdb_timestamp_struct. -* ts: The de-composed elements in a `duckdb_timestamp_struct`. -* returns: The `duckdb_timestamp` element. -*/ -DUCKDB_API duckdb_timestamp duckdb_to_timestamp(duckdb_timestamp_struct ts); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/expression/columnref_expression.hpp +// +// +//===----------------------------------------------------------------------===// -//===--------------------------------------------------------------------===// -// Hugeint Helpers -//===--------------------------------------------------------------------===// -/*! -Converts a duckdb_hugeint object (as obtained from a `DUCKDB_TYPE_HUGEINT` column) into a double. -* val: The hugeint value. -* returns: The converted `double` element. -*/ -DUCKDB_API double duckdb_hugeint_to_double(duckdb_hugeint val); -/*! -Converts a double value to a duckdb_hugeint object. -If the conversion fails because the double value is too big the result will be 0. -* val: The double value. -* returns: The converted `duckdb_hugeint` element. -*/ -DUCKDB_API duckdb_hugeint duckdb_double_to_hugeint(double val); -//===--------------------------------------------------------------------===// -// Prepared Statements -//===--------------------------------------------------------------------===// -// A prepared statement is a parameterized query that allows you to bind parameters to it. -// * This is useful to easily supply parameters to functions and avoid SQL injection attacks. -// * This is useful to speed up queries that you will execute several times with different parameters. -// Because the query will only be parsed, bound, optimized and planned once during the prepare stage, -// rather than once per execution. -// For example: -// SELECT * FROM tbl WHERE id=? -// Or a query with multiple parameters: -// SELECT * FROM tbl WHERE id=$1 OR name=$2 +namespace duckdb { -/*! -Create a prepared statement object from a query. +//! Represents a reference to a column from either the FROM clause or from an +//! alias +class ColumnRefExpression : public ParsedExpression { +public: + //! Specify both the column and table name + ColumnRefExpression(string column_name, string table_name); + //! Only specify the column name, the table name will be derived later + explicit ColumnRefExpression(string column_name); + //! Specify a set of names + explicit ColumnRefExpression(vector column_names); -Note that after calling `duckdb_prepare`, the prepared statement should always be destroyed using -`duckdb_destroy_prepare`, even if the prepare fails. + //! The stack of names in order of which they appear (column_names[0].column_names[1].column_names[2]....) + vector column_names; -If the prepare fails, `duckdb_prepare_error` can be called to obtain the reason why the prepare failed. +public: + bool IsQualified() const; + const string &GetColumnName() const; + const string &GetTableName() const; + bool IsScalar() const override { + return false; + } -* connection: The connection object -* query: The SQL query to prepare -* out_prepared_statement: The resulting prepared statement object -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_prepare(duckdb_connection connection, const char *query, - duckdb_prepared_statement *out_prepared_statement); + string GetName() const override; + string ToString() const override; -/*! -Closes the prepared statement and de-allocates all memory allocated for that connection. + static bool Equals(const ColumnRefExpression *a, const ColumnRefExpression *b); + hash_t Hash() const override; -* prepared_statement: The prepared statement to destroy. -*/ -DUCKDB_API void duckdb_destroy_prepare(duckdb_prepared_statement *prepared_statement); + unique_ptr Copy() const override; -/*! -Returns the error message associated with the given prepared statement. -If the prepared statement has no error message, this returns `nullptr` instead. + void Serialize(FieldWriter &writer) const override; + static unique_ptr Deserialize(ExpressionType type, FieldReader &source); +}; +} // namespace duckdb -The error message should not be freed. It will be de-allocated when `duckdb_destroy_prepare` is called. -* prepared_statement: The prepared statement to obtain the error from. -* returns: The error message, or `nullptr` if there is none. -*/ -DUCKDB_API const char *duckdb_prepare_error(duckdb_prepared_statement prepared_statement); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/qualified_name_set.hpp +// +// +//===----------------------------------------------------------------------===// -/*! -Returns the number of parameters that can be provided to the given prepared statement. -Returns 0 if the query was not successfully prepared. -* prepared_statement: The prepared statement to obtain the number of parameters for. -*/ -DUCKDB_API idx_t duckdb_nparams(duckdb_prepared_statement prepared_statement); -/*! -Returns the parameter type for the parameter at the given index. +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/types/hash.hpp +// +// +//===----------------------------------------------------------------------===// -Returns `DUCKDB_TYPE_INVALID` if the parameter index is out of range or the statement was not successfully prepared. -* prepared_statement: The prepared statement. -* param_idx: The parameter index. -* returns: The parameter type -*/ -DUCKDB_API duckdb_type duckdb_param_type(duckdb_prepared_statement prepared_statement, idx_t param_idx); -/*! -Binds a bool value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_boolean(duckdb_prepared_statement prepared_statement, idx_t param_idx, bool val); -/*! -Binds an int8_t value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_int8(duckdb_prepared_statement prepared_statement, idx_t param_idx, int8_t val); -/*! -Binds an int16_t value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_int16(duckdb_prepared_statement prepared_statement, idx_t param_idx, int16_t val); -/*! -Binds an int32_t value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_int32(duckdb_prepared_statement prepared_statement, idx_t param_idx, int32_t val); +namespace duckdb { -/*! -Binds an int64_t value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_int64(duckdb_prepared_statement prepared_statement, idx_t param_idx, int64_t val); +struct string_t; -/*! -Binds an duckdb_hugeint value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_hugeint(duckdb_prepared_statement prepared_statement, idx_t param_idx, - duckdb_hugeint val); +// efficient hash function that maximizes the avalanche effect and minimizes +// bias +// see: https://nullprogram.com/blog/2018/07/31/ -/*! -Binds an uint8_t value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_uint8(duckdb_prepared_statement prepared_statement, idx_t param_idx, uint8_t val); +inline hash_t murmurhash64(uint64_t x) { + return x * UINT64_C(0xbf58476d1ce4e5b9); +} -/*! -Binds an uint16_t value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_uint16(duckdb_prepared_statement prepared_statement, idx_t param_idx, uint16_t val); +inline hash_t murmurhash32(uint32_t x) { + return murmurhash64(x); +} -/*! -Binds an uint32_t value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_uint32(duckdb_prepared_statement prepared_statement, idx_t param_idx, uint32_t val); +template +hash_t Hash(T value) { + return murmurhash32(value); +} -/*! -Binds an uint64_t value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_uint64(duckdb_prepared_statement prepared_statement, idx_t param_idx, uint64_t val); +//! Combine two hashes by XORing them +inline hash_t CombineHash(hash_t left, hash_t right) { + return left ^ right; +} -/*! -Binds an float value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_float(duckdb_prepared_statement prepared_statement, idx_t param_idx, float val); +template <> +hash_t Hash(uint64_t val); +template <> +hash_t Hash(int64_t val); +template <> +hash_t Hash(hugeint_t val); +template <> +hash_t Hash(float val); +template <> +hash_t Hash(double val); +template <> +hash_t Hash(const char *val); +template <> +hash_t Hash(char *val); +template <> +hash_t Hash(string_t val); +template <> +hash_t Hash(interval_t val); +hash_t Hash(const char *val, size_t size); +hash_t Hash(uint8_t *val, size_t size); -/*! -Binds an double value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_double(duckdb_prepared_statement prepared_statement, idx_t param_idx, double val); +} // namespace duckdb -/*! -Binds a duckdb_date value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_date(duckdb_prepared_statement prepared_statement, idx_t param_idx, - duckdb_date val); -/*! -Binds a duckdb_time value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_time(duckdb_prepared_statement prepared_statement, idx_t param_idx, - duckdb_time val); -/*! -Binds a duckdb_timestamp value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_timestamp(duckdb_prepared_statement prepared_statement, idx_t param_idx, - duckdb_timestamp val); +namespace duckdb { -/*! -Binds a duckdb_interval value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_interval(duckdb_prepared_statement prepared_statement, idx_t param_idx, - duckdb_interval val); +struct QualifiedColumnHashFunction { + uint64_t operator()(const QualifiedColumnName &a) const { + std::hash str_hasher; + return str_hasher(a.schema) ^ str_hasher(a.table) ^ str_hasher(a.column); + } +}; -/*! -Binds a null-terminated varchar value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_varchar(duckdb_prepared_statement prepared_statement, idx_t param_idx, - const char *val); +struct QualifiedColumnEquality { + bool operator()(const QualifiedColumnName &a, const QualifiedColumnName &b) const { + return a.schema == b.schema && a.table == b.table && a.column == b.column; + } +}; -/*! -Binds a varchar value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_varchar_length(duckdb_prepared_statement prepared_statement, idx_t param_idx, - const char *val, idx_t length); +using qualified_column_set_t = unordered_set; -/*! -Binds a blob value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_blob(duckdb_prepared_statement prepared_statement, idx_t param_idx, - const void *data, idx_t length); +} // namespace duckdb -/*! -Binds a NULL value to the prepared statement at the specified index. -*/ -DUCKDB_API duckdb_state duckdb_bind_null(duckdb_prepared_statement prepared_statement, idx_t param_idx); -/*! -Executes the prepared statement with the given bound parameters, and returns a materialized query result. +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression_binder.hpp +// +// +//===----------------------------------------------------------------------===// -This method can be called multiple times for each prepared statement, and the parameters can be modified -between calls to this function. -* prepared_statement: The prepared statement to execute. -* out_result: The query result. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_execute_prepared(duckdb_prepared_statement prepared_statement, - duckdb_result *out_result); -/*! -Executes the prepared statement with the given bound parameters, and returns an arrow query result. -* prepared_statement: The prepared statement to execute. -* out_result: The query result. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_execute_prepared_arrow(duckdb_prepared_statement prepared_statement, - duckdb_arrow *out_result); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/expression/bound_expression.hpp +// +// +//===----------------------------------------------------------------------===// -//===--------------------------------------------------------------------===// -// Appender -//===--------------------------------------------------------------------===// -// Appenders are the most efficient way of loading data into DuckDB from within the C interface, and are recommended for -// fast data loading. The appender is much faster than using prepared statements or individual `INSERT INTO` statements. -// Appends are made in row-wise format. For every column, a `duckdb_append_[type]` call should be made, after which -// the row should be finished by calling `duckdb_appender_end_row`. After all rows have been appended, -// `duckdb_appender_destroy` should be used to finalize the appender and clean up the resulting memory. -// Note that `duckdb_appender_destroy` should always be called on the resulting appender, even if the function returns -// `DuckDBError`. -/*! -Creates an appender object. -* connection: The connection context to create the appender in. -* schema: The schema of the table to append to, or `nullptr` for the default schema. -* table: The table name to append to. -* out_appender: The resulting appender object. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_appender_create(duckdb_connection connection, const char *schema, const char *table, - duckdb_appender *out_appender); -/*! -Returns the error message associated with the given appender. -If the appender has no error message, this returns `nullptr` instead. +namespace duckdb { -The error message should not be freed. It will be de-allocated when `duckdb_appender_destroy` is called. +//! BoundExpression is an intermediate dummy class used by the binder. It is a ParsedExpression but holds an Expression. +//! It represents a successfully bound expression. It is used in the Binder to prevent re-binding of already bound parts +//! when dealing with subqueries. +class BoundExpression : public ParsedExpression { +public: + BoundExpression(unique_ptr expr) + : ParsedExpression(ExpressionType::INVALID, ExpressionClass::BOUND_EXPRESSION), expr(move(expr)) { + } -* appender: The appender to get the error from. -* returns: The error message, or `nullptr` if there is none. -*/ -DUCKDB_API const char *duckdb_appender_error(duckdb_appender appender); + unique_ptr expr; -/*! -Flush the appender to the table, forcing the cache of the appender to be cleared and the data to be appended to the -base table. +public: + string ToString() const override { + if (!expr) { + throw InternalException("ToString(): BoundExpression does not have a child"); + } + return expr->ToString(); + } -This should generally not be used unless you know what you are doing. Instead, call `duckdb_appender_destroy` when you -are done with the appender. + bool Equals(const BaseExpression *other) const override { + return false; + } + hash_t Hash() const override { + return 0; + } -* appender: The appender to flush. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_appender_flush(duckdb_appender appender); + unique_ptr Copy() const override { + throw SerializationException("Cannot copy or serialize bound expression"); + } -/*! -Close the appender, flushing all intermediate state in the appender to the table and closing it for further appends. + void Serialize(FieldWriter &writer) const override { + throw SerializationException("Cannot copy or serialize bound expression"); + } +}; -This is generally not necessary. Call `duckdb_appender_destroy` instead. +} // namespace duckdb -* appender: The appender to flush and close. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_appender_close(duckdb_appender appender); -/*! -Close the appender and destroy it. Flushing all intermediate state in the appender to the table, and de-allocating -all memory associated with the appender. -* appender: The appender to flush, close and destroy. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_appender_destroy(duckdb_appender *appender); -/*! -A nop function, provided for backwards compatibility reasons. Does nothing. Only `duckdb_appender_end_row` is required. -*/ -DUCKDB_API duckdb_state duckdb_appender_begin_row(duckdb_appender appender); -/*! -Finish the current row of appends. After end_row is called, the next row can be appended. -* appender: The appender. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_appender_end_row(duckdb_appender appender); +namespace duckdb { -/*! -Append a bool value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_bool(duckdb_appender appender, bool value); +class Binder; +class ClientContext; +class QueryNode; -/*! -Append an int8_t value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_int8(duckdb_appender appender, int8_t value); -/*! -Append an int16_t value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_int16(duckdb_appender appender, int16_t value); -/*! -Append an int32_t value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_int32(duckdb_appender appender, int32_t value); -/*! -Append an int64_t value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_int64(duckdb_appender appender, int64_t value); -/*! -Append a duckdb_hugeint value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_hugeint(duckdb_appender appender, duckdb_hugeint value); +class ScalarFunctionCatalogEntry; +class AggregateFunctionCatalogEntry; +class ScalarMacroCatalogEntry; +class CatalogEntry; +class SimpleFunction; -/*! -Append a uint8_t value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_uint8(duckdb_appender appender, uint8_t value); -/*! -Append a uint16_t value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_uint16(duckdb_appender appender, uint16_t value); -/*! -Append a uint32_t value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_uint32(duckdb_appender appender, uint32_t value); -/*! -Append a uint64_t value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_uint64(duckdb_appender appender, uint64_t value); +struct MacroBinding; -/*! -Append a float value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_float(duckdb_appender appender, float value); -/*! -Append a double value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_double(duckdb_appender appender, double value); +struct BoundColumnReferenceInfo { + string name; + idx_t query_location; +}; -/*! -Append a duckdb_date value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_date(duckdb_appender appender, duckdb_date value); -/*! -Append a duckdb_time value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_time(duckdb_appender appender, duckdb_time value); -/*! -Append a duckdb_timestamp value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_timestamp(duckdb_appender appender, duckdb_timestamp value); -/*! -Append a duckdb_interval value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_interval(duckdb_appender appender, duckdb_interval value); +struct BindResult { + BindResult() { + } + explicit BindResult(string error) : error(error) { + } + explicit BindResult(unique_ptr expr) : expression(move(expr)) { + } -/*! -Append a varchar value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_varchar(duckdb_appender appender, const char *val); -/*! -Append a varchar value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_varchar_length(duckdb_appender appender, const char *val, idx_t length); -/*! -Append a blob value to the appender. -*/ -DUCKDB_API duckdb_state duckdb_append_blob(duckdb_appender appender, const void *data, idx_t length); -/*! -Append a NULL value to the appender (of any type). -*/ -DUCKDB_API duckdb_state duckdb_append_null(duckdb_appender appender); + bool HasError() { + return !error.empty(); + } -//===--------------------------------------------------------------------===// -// Arrow Interface -//===--------------------------------------------------------------------===// -/*! -Executes a SQL query within a connection and stores the full (materialized) result in an arrow structure. -If the query fails to execute, DuckDBError is returned and the error message can be retrieved by calling -`duckdb_query_arrow_error`. + unique_ptr expression; + string error; +}; + +class ExpressionBinder { +public: + ExpressionBinder(Binder &binder, ClientContext &context, bool replace_binder = false); + virtual ~ExpressionBinder(); -Note that after running `duckdb_query_arrow`, `duckdb_destroy_arrow` must be called on the result object even if the -query fails, otherwise the error stored within the result will not be freed correctly. + //! The target type that should result from the binder. If the result is not of this type, a cast to this type will + //! be added. Defaults to INVALID. + LogicalType target_type; -* connection: The connection to perform the query in. -* query: The SQL query to run. -* out_result: The query result. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_query_arrow(duckdb_connection connection, const char *query, duckdb_arrow *out_result); + MacroBinding *macro_binding; -/*! -Fetch the internal arrow schema from the arrow result. +public: + unique_ptr Bind(unique_ptr &expr, LogicalType *result_type = nullptr, + bool root_expression = true); -* result: The result to fetch the schema from. -* out_schema: The output schema. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_query_arrow_schema(duckdb_arrow result, duckdb_arrow_schema *out_schema); + //! Returns whether or not any columns have been bound by the expression binder + bool HasBoundColumns() { + return !bound_columns.empty(); + } + const vector &GetBoundColumns() { + return bound_columns; + } -/*! -Fetch an internal arrow array from the arrow result. + string Bind(unique_ptr *expr, idx_t depth, bool root_expression = false); -This function can be called multiple time to get next chunks, which will free the previous out_array. -So consume the out_array before calling this function again. + unique_ptr CreateStructExtract(unique_ptr base, string field_name); + BindResult BindQualifiedColumnName(ColumnRefExpression &colref, const string &table_name); -* result: The result to fetch the array from. -* out_array: The output array. -* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. -*/ -DUCKDB_API duckdb_state duckdb_query_arrow_array(duckdb_arrow result, duckdb_arrow_array *out_array); + unique_ptr QualifyColumnName(const string &column_name, string &error_message); + unique_ptr QualifyColumnName(ColumnRefExpression &colref, string &error_message); -/*! -Returns the number of columns present in a the arrow result object. + // Bind table names to ColumnRefExpressions + void QualifyColumnNames(unique_ptr &expr); + static void QualifyColumnNames(Binder &binder, unique_ptr &expr); -* result: The result object. -* returns: The number of columns present in the result object. -*/ -DUCKDB_API idx_t duckdb_arrow_column_count(duckdb_arrow result); + static unique_ptr PushCollation(ClientContext &context, unique_ptr source, + const string &collation, bool equality_only = false); + static void TestCollation(ClientContext &context, const string &collation); -/*! -Returns the number of rows present in a the arrow result object. + bool BindCorrelatedColumns(unique_ptr &expr); -* result: The result object. -* returns: The number of rows present in the result object. -*/ -DUCKDB_API idx_t duckdb_arrow_row_count(duckdb_arrow result); + void BindChild(unique_ptr &expr, idx_t depth, string &error); + static void ExtractCorrelatedExpressions(Binder &binder, Expression &expr); -/*! -Returns the number of rows changed by the query stored in the arrow result. This is relevant only for -INSERT/UPDATE/DELETE queries. For other queries the rows_changed will be 0. + static bool ContainsNullType(const LogicalType &type); + static LogicalType ExchangeNullType(const LogicalType &type); + static bool ContainsType(const LogicalType &type, LogicalTypeId target); + static LogicalType ExchangeType(const LogicalType &type, LogicalTypeId target, LogicalType new_type); -* result: The result object. -* returns: The number of rows changed. -*/ -DUCKDB_API idx_t duckdb_arrow_rows_changed(duckdb_arrow result); + static void ResolveParameterType(LogicalType &type); + static void ResolveParameterType(unique_ptr &expr); -/*! -Returns the error message contained within the result. The error is only set if `duckdb_query_arrow` returns -`DuckDBError`. + //! Bind the given expresion. Unlike Bind(), this does *not* mute the given ParsedExpression. + //! Exposed to be used from sub-binders that aren't subclasses of ExpressionBinder. + virtual BindResult BindExpression(unique_ptr *expr_ptr, idx_t depth, + bool root_expression = false); -The error message should not be freed. It will be de-allocated when `duckdb_destroy_arrow` is called. + void ReplaceMacroParametersRecursive(unique_ptr &expr); -* result: The result object to fetch the nullmask from. -* returns: The error of the result. -*/ -DUCKDB_API const char *duckdb_query_arrow_error(duckdb_arrow result); +protected: + BindResult BindExpression(BetweenExpression &expr, idx_t depth); + BindResult BindExpression(CaseExpression &expr, idx_t depth); + BindResult BindExpression(CollateExpression &expr, idx_t depth); + BindResult BindExpression(CastExpression &expr, idx_t depth); + BindResult BindExpression(ColumnRefExpression &expr, idx_t depth); + BindResult BindExpression(ComparisonExpression &expr, idx_t depth); + BindResult BindExpression(ConjunctionExpression &expr, idx_t depth); + BindResult BindExpression(ConstantExpression &expr, idx_t depth); + BindResult BindExpression(FunctionExpression &expr, idx_t depth, unique_ptr *expr_ptr); + BindResult BindExpression(LambdaExpression &expr, idx_t depth); + BindResult BindExpression(OperatorExpression &expr, idx_t depth); + BindResult BindExpression(ParameterExpression &expr, idx_t depth); + BindResult BindExpression(PositionalReferenceExpression &ref, idx_t depth); + BindResult BindExpression(StarExpression &expr, idx_t depth); + BindResult BindExpression(SubqueryExpression &expr, idx_t depth); -/*! -Closes the result and de-allocates all memory allocated for the arrow result. +protected: + virtual BindResult BindGroupingFunction(OperatorExpression &op, idx_t depth); + virtual BindResult BindFunction(FunctionExpression &expr, ScalarFunctionCatalogEntry *function, idx_t depth); + virtual BindResult BindAggregate(FunctionExpression &expr, AggregateFunctionCatalogEntry *function, idx_t depth); + virtual BindResult BindUnnest(FunctionExpression &expr, idx_t depth); + virtual BindResult BindMacro(FunctionExpression &expr, ScalarMacroCatalogEntry *macro, idx_t depth, + unique_ptr *expr_ptr); -* result: The result to destroy. -*/ -DUCKDB_API void duckdb_destroy_arrow(duckdb_arrow *result); + virtual string UnsupportedAggregateMessage(); + virtual string UnsupportedUnnestMessage(); + + Binder &binder; + ClientContext &context; + ExpressionBinder *stored_binder; + vector bound_columns; +}; + +} // namespace duckdb -#ifdef __cplusplus -} -#endif //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/common/types/date.hpp +// duckdb/planner/table_binding.hpp // // //===----------------------------------------------------------------------===// @@ -12923,374 +13187,491 @@ DUCKDB_API void duckdb_destroy_arrow(duckdb_arrow *result); + namespace duckdb { +class BindContext; +class BoundQueryNode; +class ColumnRefExpression; +class SubqueryRef; +class LogicalGet; +class TableCatalogEntry; +class TableFunctionCatalogEntry; +class BoundTableFunction; + +//! A Binding represents a binding to a table, table-producing function or subquery with a specified table index. +struct Binding { + Binding(const string &alias, vector types, vector names, idx_t index); + virtual ~Binding() = default; + + //! The alias of the binding + string alias; + //! The table index of the binding + idx_t index; + vector types; + //! Column names of the subquery + vector names; + //! Name -> index for the names + case_insensitive_map_t name_map; -//! The Date class is a static class that holds helper functions for the Date type. -class Date { public: - static const string_t MONTH_NAMES[12]; - static const string_t MONTH_NAMES_ABBREVIATED[12]; - static const string_t DAY_NAMES[7]; - static const string_t DAY_NAMES_ABBREVIATED[7]; - static const int32_t NORMAL_DAYS[13]; - static const int32_t CUMULATIVE_DAYS[13]; - static const int32_t LEAP_DAYS[13]; - static const int32_t CUMULATIVE_LEAP_DAYS[13]; - static const int32_t CUMULATIVE_YEAR_DAYS[401]; - static const int8_t MONTH_PER_DAY_OF_YEAR[365]; - static const int8_t LEAP_MONTH_PER_DAY_OF_YEAR[366]; + bool TryGetBindingIndex(const string &column_name, column_t &column_index); + column_t GetBindingIndex(const string &column_name); + bool HasMatchingBinding(const string &column_name); + virtual string ColumnNotFoundError(const string &column_name) const; + virtual BindResult Bind(ColumnRefExpression &colref, idx_t depth); + virtual TableCatalogEntry *GetTableEntry(); +}; - // min date is 5877642-06-23 (BC) (-2^31) - constexpr static const int32_t DATE_MIN_YEAR = -5877641; - constexpr static const int32_t DATE_MIN_MONTH = 6; - constexpr static const int32_t DATE_MIN_DAY = 23; - // max date is 5881580-07-11 (2^31) - constexpr static const int32_t DATE_MAX_YEAR = 5881580; - constexpr static const int32_t DATE_MAX_MONTH = 7; - constexpr static const int32_t DATE_MAX_DAY = 11; - constexpr static const int32_t EPOCH_YEAR = 1970; +//! TableBinding is exactly like the Binding, except it keeps track of which columns were bound in the linked LogicalGet +//! node for projection pushdown purposes. +struct TableBinding : public Binding { + TableBinding(const string &alias, vector types, vector names, LogicalGet &get, idx_t index, + bool add_row_id = false); - constexpr static const int32_t YEAR_INTERVAL = 400; - constexpr static const int32_t DAYS_PER_YEAR_INTERVAL = 146097; + //! the underlying LogicalGet + LogicalGet &get; + +public: + BindResult Bind(ColumnRefExpression &colref, idx_t depth) override; + TableCatalogEntry *GetTableEntry() override; + string ColumnNotFoundError(const string &column_name) const override; +}; + +//! MacroBinding is like the Binding, except the alias and index are set by default. Used for binding Macro +//! Params/Arguments. +struct MacroBinding : public Binding { + static constexpr const char *MACRO_NAME = "0_macro_parameters"; + +public: + MacroBinding(vector types_p, vector names_p, string macro_name); + + //! Arguments + vector> arguments; + //! The name of the macro + string macro_name; + +public: + BindResult Bind(ColumnRefExpression &colref, idx_t depth) override; + + //! Given the parameter colref, returns a copy of the argument that was supplied for this parameter + unique_ptr ParamToArg(ColumnRefExpression &colref); +}; + +} // namespace duckdb + + +namespace duckdb { +class Binder; +class LogicalGet; +class BoundQueryNode; + +class StarExpression; + +struct UsingColumnSet { + string primary_binding; + unordered_set bindings; +}; + +//! The BindContext object keeps track of all the tables and columns that are +//! encountered during the binding process. +class BindContext { +public: + //! Keep track of recursive CTE references + case_insensitive_map_t> cte_references; + +public: + //! Given a column name, find the matching table it belongs to. Throws an + //! exception if no table has a column of the given name. + string GetMatchingBinding(const string &column_name); + //! Like GetMatchingBinding, but instead of throwing an error if multiple tables have the same binding it will + //! return a list of all the matching ones + unordered_set GetMatchingBindings(const string &column_name); + //! Like GetMatchingBindings, but returns the top 3 most similar bindings (in levenshtein distance) instead of the + //! matching ones + vector GetSimilarBindings(const string &column_name); + + Binding *GetCTEBinding(const string &ctename); + //! Binds a column expression to the base table. Returns the bound expression + //! or throws an exception if the column could not be bound. + BindResult BindColumn(ColumnRefExpression &colref, idx_t depth); + string BindColumn(PositionalReferenceExpression &ref, string &table_name, string &column_name); + BindResult BindColumn(PositionalReferenceExpression &ref, idx_t depth); -public: - //! Convert a string in the format "YYYY-MM-DD" to a date object - DUCKDB_API static date_t FromString(const string &str, bool strict = false); - //! Convert a string in the format "YYYY-MM-DD" to a date object - DUCKDB_API static date_t FromCString(const char *str, idx_t len, bool strict = false); - //! Convert a date object to a string in the format "YYYY-MM-DD" - DUCKDB_API static string ToString(date_t date); - //! Try to convert text in a buffer to a date; returns true if parsing was successful - DUCKDB_API static bool TryConvertDate(const char *buf, idx_t len, idx_t &pos, date_t &result, bool strict = false); + unique_ptr CreateColumnReference(const string &table_name, const string &column_name); + unique_ptr CreateColumnReference(const string &schema_name, const string &table_name, + const string &column_name); - //! Create a string "YYYY-MM-DD" from a specified (year, month, day) - //! combination - DUCKDB_API static string Format(int32_t year, int32_t month, int32_t day); + //! Generate column expressions for all columns that are present in the + //! referenced tables. This is used to resolve the * expression in a + //! selection list. + void GenerateAllColumnExpressions(StarExpression &expr, vector> &new_select_list); + //! Check if the given (binding, column_name) is in the exclusion/replacement lists. + //! Returns true if it is in one of these lists, and should therefore be skipped. + bool CheckExclusionList(StarExpression &expr, Binding *binding, const string &column_name, + vector> &new_select_list, + case_insensitive_set_t &excluded_columns); - //! Extract the year, month and day from a given date object - DUCKDB_API static void Convert(date_t date, int32_t &out_year, int32_t &out_month, int32_t &out_day); - //! Create a Date object from a specified (year, month, day) combination - DUCKDB_API static date_t FromDate(int32_t year, int32_t month, int32_t day); - DUCKDB_API static bool TryFromDate(int32_t year, int32_t month, int32_t day, date_t &result); + const vector> &GetBindingsList() { + return bindings_list; + } - //! Returns true if (year) is a leap year, and false otherwise - DUCKDB_API static bool IsLeapYear(int32_t year); + //! Adds a base table with the given alias to the BindContext. + void AddBaseTable(idx_t index, const string &alias, const vector &names, const vector &types, + LogicalGet &get); + //! Adds a call to a table function with the given alias to the BindContext. + void AddTableFunction(idx_t index, const string &alias, const vector &names, + const vector &types, LogicalGet &get); + //! Adds a subquery with a given alias to the BindContext. + void AddSubquery(idx_t index, const string &alias, SubqueryRef &ref, BoundQueryNode &subquery); + //! Adds a subquery with a given alias to the BindContext. + void AddSubquery(idx_t index, const string &alias, TableFunctionRef &ref, BoundQueryNode &subquery); + //! Adds a base table with the given alias to the BindContext. + void AddGenericBinding(idx_t index, const string &alias, const vector &names, + const vector &types); - //! Returns true if the specified (year, month, day) combination is a valid - //! date - DUCKDB_API static bool IsValid(int32_t year, int32_t month, int32_t day); + //! Adds a base table with the given alias to the CTE BindContext. + //! We need this to correctly bind recursive CTEs with multiple references. + void AddCTEBinding(idx_t index, const string &alias, const vector &names, const vector &types); - //! The max number of days in a month of a given year - DUCKDB_API static int32_t MonthDays(int32_t year, int32_t month); + //! Add an implicit join condition (e.g. USING (x)) + void AddUsingBinding(const string &column_name, UsingColumnSet *set); - //! Extract the epoch from the date (seconds since 1970-01-01) - DUCKDB_API static int64_t Epoch(date_t date); - //! Extract the epoch from the date (nanoseconds since 1970-01-01) - DUCKDB_API static int64_t EpochNanoseconds(date_t date); - //! Convert the epoch (seconds since 1970-01-01) to a date_t - DUCKDB_API static date_t EpochToDate(int64_t epoch); + void AddUsingBindingSet(unique_ptr set); - //! Extract the number of days since epoch (days since 1970-01-01) - DUCKDB_API static int32_t EpochDays(date_t date); - //! Convert the epoch number of days to a date_t - DUCKDB_API static date_t EpochDaysToDate(int32_t epoch); + //! Returns any using column set for the given column name, or nullptr if there is none. On conflict (multiple using + //! column sets with the same name) throw an exception. + UsingColumnSet *GetUsingBinding(const string &column_name); + //! Returns any using column set for the given column name, or nullptr if there is none + UsingColumnSet *GetUsingBinding(const string &column_name, const string &binding_name); + //! Erase a using binding from the set of using bindings + void RemoveUsingBinding(const string &column_name, UsingColumnSet *set); + //! Finds the using bindings for a given column. Returns true if any exists, false otherwise. + bool FindUsingBinding(const string &column_name, unordered_set **using_columns); + //! Transfer a using binding from one bind context to this bind context + void TransferUsingBinding(BindContext ¤t_context, UsingColumnSet *current_set, UsingColumnSet *new_set, + const string &binding, const string &using_column); - //! Extract year of a date entry - DUCKDB_API static int32_t ExtractYear(date_t date); - //! Extract year of a date entry, but optimized to first try the last year found - DUCKDB_API static int32_t ExtractYear(date_t date, int32_t *last_year); - DUCKDB_API static int32_t ExtractYear(timestamp_t ts, int32_t *last_year); - //! Extract month of a date entry - DUCKDB_API static int32_t ExtractMonth(date_t date); - //! Extract day of a date entry - DUCKDB_API static int32_t ExtractDay(date_t date); - //! Extract the day of the week (1-7) - DUCKDB_API static int32_t ExtractISODayOfTheWeek(date_t date); - //! Extract the day of the year - DUCKDB_API static int32_t ExtractDayOfTheYear(date_t date); - //! Extract the ISO week number - //! ISO weeks start on Monday and the first week of a year - //! contains January 4 of that year. - //! In the ISO week-numbering system, it is possible for early-January dates - //! to be part of the 52nd or 53rd week of the previous year. - DUCKDB_API static void ExtractISOYearWeek(date_t date, int32_t &year, int32_t &week); - DUCKDB_API static int32_t ExtractISOWeekNumber(date_t date); - DUCKDB_API static int32_t ExtractISOYearNumber(date_t date); - //! Extract the week number as Python handles it. - //! Either Monday or Sunday is the first day of the week, - //! and any date before the first Monday/Sunday returns week 0 - //! This is a bit more consistent because week numbers in a year are always incrementing - DUCKDB_API static int32_t ExtractWeekNumberRegular(date_t date, bool monday_first = true); - //! Returns the date of the monday of the current week. - DUCKDB_API static date_t GetMondayOfCurrentWeek(date_t date); + //! Fetch the actual column name from the given binding, or throws if none exists + //! This can be different from "column_name" because of case insensitivity + //! (e.g. "column_name" might return "COLUMN_NAME") + string GetActualColumnName(const string &binding, const string &column_name); - //! Helper function to parse two digits from a string (e.g. "30" -> 30, "03" -> 3, "3" -> 3) - DUCKDB_API static bool ParseDoubleDigit(const char *buf, idx_t len, idx_t &pos, int32_t &result); + case_insensitive_map_t> GetCTEBindings() { + return cte_bindings; + } + void SetCTEBindings(case_insensitive_map_t> bindings) { + cte_bindings = bindings; + } - DUCKDB_API static string ConversionError(const string &str); - DUCKDB_API static string ConversionError(string_t str); + //! Alias a set of column names for the specified table, using the original names if there are not enough aliases + //! specified. + static vector AliasColumnNames(const string &table_name, const vector &names, + const vector &column_aliases); -private: - static void ExtractYearOffset(int32_t &n, int32_t &year, int32_t &year_offset); -}; -} // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/types/blob.hpp -// -// -//===----------------------------------------------------------------------===// + //! Add all the bindings from a BindContext to this BindContext. The other BindContext is destroyed in the process. + void AddContext(BindContext other); + //! Gets a binding of the specified name. Returns a nullptr and sets the out_error if the binding could not be + //! found. + Binding *GetBinding(const string &name, string &out_error); +private: + void AddBinding(const string &alias, unique_ptr binding); +private: + //! The set of bindings + case_insensitive_map_t> bindings; + //! The list of bindings in insertion order + vector> bindings_list; + //! The set of columns used in USING join conditions + case_insensitive_map_t> using_columns; + //! Using column sets + vector> using_column_sets; + //! The set of CTE bindings + case_insensitive_map_t> cte_bindings; +}; +} // namespace duckdb -namespace duckdb { -//! The Blob class is a static class that holds helper functions for the Blob type. -class Blob { -public: - // map of integer -> hex value - static constexpr const char *HEX_TABLE = "0123456789ABCDEF"; - // reverse map of byte -> integer value, or -1 for invalid hex values - static const int HEX_MAP[256]; - //! map of index -> base64 character - static constexpr const char *BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - //! padding character used in base64 encoding - static constexpr const char BASE64_PADDING = '='; -public: - //! Returns the string size of a blob -> string conversion - static idx_t GetStringSize(string_t blob); - //! Converts a blob to a string, writing the output to the designated output string. - //! The string needs to have space for at least GetStringSize(blob) bytes. - static void ToString(string_t blob, char *output); - //! Convert a blob object to a string - static string ToString(string_t blob); - //! Returns the blob size of a string -> blob conversion - static bool TryGetBlobSize(string_t str, idx_t &result_size, string *error_message); - static idx_t GetBlobSize(string_t str); - //! Convert a string to a blob. This function should ONLY be called after calling GetBlobSize, since it does NOT - //! perform data validation. - static void ToBlob(string_t str, data_ptr_t output); - //! Convert a string object to a blob - static string ToBlob(string_t str); - // base 64 conversion functions - //! Returns the string size of a blob -> base64 conversion - static idx_t ToBase64Size(string_t blob); - //! Converts a blob to a base64 string, output should have space for at least ToBase64Size(blob) bytes - static void ToBase64(string_t blob, char *output); - //! Returns the string size of a base64 string -> blob conversion - static idx_t FromBase64Size(string_t str); - //! Converts a base64 string to a blob, output should have space for at least FromBase64Size(blob) bytes - static void FromBase64(string_t str, data_ptr_t output, idx_t output_size); -}; -} // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/types/decimal.hpp -// -// -//===----------------------------------------------------------------------===// +//#include "duckdb/catalog/catalog_entry/table_macro_catalog_entry.hpp" +namespace duckdb { +class BoundResultModifier; +class BoundSelectNode; +class ClientContext; +class ExpressionBinder; +class LimitModifier; +class OrderBinder; +class TableCatalogEntry; +class ViewCatalogEntry; +class TableMacroCatalogEntry; +struct CreateInfo; +struct BoundCreateTableInfo; +struct BoundCreateFunctionInfo; +struct CommonTableExpressionInfo; +enum class BindingMode : uint8_t { STANDARD_BINDING, EXTRACT_NAMES }; -namespace duckdb { +struct CorrelatedColumnInfo { + ColumnBinding binding; + LogicalType type; + string name; + idx_t depth; -//! The Decimal class is a static class that holds helper functions for the Decimal type -class Decimal { -public: - static constexpr uint8_t MAX_WIDTH_INT16 = 4; - static constexpr uint8_t MAX_WIDTH_INT32 = 9; - static constexpr uint8_t MAX_WIDTH_INT64 = 18; - static constexpr uint8_t MAX_WIDTH_INT128 = 38; - static constexpr uint8_t MAX_WIDTH_DECIMAL = MAX_WIDTH_INT128; + explicit CorrelatedColumnInfo(BoundColumnRefExpression &expr) + : binding(expr.binding), type(expr.return_type), name(expr.GetName()), depth(expr.depth) { + } -public: - static string ToString(int16_t value, uint8_t scale); - static string ToString(int32_t value, uint8_t scale); - static string ToString(int64_t value, uint8_t scale); - static string ToString(hugeint_t value, uint8_t scale); + bool operator==(const CorrelatedColumnInfo &rhs) const { + return binding == rhs.binding; + } }; -} // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/types/uuid.hpp -// -// -//===----------------------------------------------------------------------===// +//! Bind the parsed query tree to the actual columns present in the catalog. +/*! + The binder is responsible for binding tables and columns to actual physical + tables and columns in the catalog. In the process, it also resolves types of + all expressions. +*/ +class Binder : public std::enable_shared_from_this { + friend class ExpressionBinder; + friend class SelectBinder; + friend class RecursiveSubqueryPlanner; +public: + static shared_ptr CreateBinder(ClientContext &context, Binder *parent = nullptr, bool inherit_ctes = true); + //! The client context + ClientContext &context; + //! A mapping of names to common table expressions + case_insensitive_map_t CTE_bindings; + //! The CTEs that have already been bound + unordered_set bound_ctes; + //! The bind context + BindContext bind_context; + //! The set of correlated columns bound by this binder (FIXME: this should probably be an unordered_set and not a + //! vector) + vector correlated_columns; + //! The set of parameter expressions bound by this binder + vector *parameters; + //! Whether or not the bound statement is read-only + bool read_only; + //! Whether or not the statement requires a valid transaction to run + bool requires_valid_transaction; + //! Whether or not the statement can be streamed to the client + bool allow_stream_result; + //! The alias for the currently processing subquery, if it exists + string alias; + //! Macro parameter bindings (if any) + MacroBinding *macro_binding = nullptr; +public: + BoundStatement Bind(SQLStatement &statement); + BoundStatement Bind(QueryNode &node); + unique_ptr BindCreateTableInfo(unique_ptr info); + void BindCreateViewInfo(CreateViewInfo &base); + SchemaCatalogEntry *BindSchema(CreateInfo &info); + SchemaCatalogEntry *BindCreateFunctionInfo(CreateInfo &info); -namespace duckdb { + //! Check usage, and cast named parameters to their types + static void BindNamedParameters(named_parameter_type_map_t &types, named_parameter_map_t &values, + QueryErrorContext &error_context, string &func_name); -//! The UUID class contains static operations for the UUID type -class UUID { -public: - constexpr static const uint8_t STRING_SIZE = 36; - //! Convert a uuid string to a hugeint object - static bool FromString(string str, hugeint_t &result); - //! Convert a uuid string to a hugeint object - static bool FromCString(const char *str, idx_t len, hugeint_t &result) { - return FromString(string(str, 0, len), result); - } - //! Convert a hugeint object to a uuid style string - static void ToString(hugeint_t input, char *buf); + unique_ptr Bind(TableRef &ref); + unique_ptr CreatePlan(BoundTableRef &ref); - //! Convert a hugeint object to a uuid style string - static string ToString(hugeint_t input) { - char buff[STRING_SIZE]; - ToString(input, buff); - return string(buff, STRING_SIZE); - } + //! Generates an unused index for a table + idx_t GenerateTableIndex(); - static hugeint_t FromString(string str) { - hugeint_t result; - FromString(str, result); - return result; - } -}; + //! Add a common table expression to the binder + void AddCTE(const string &name, CommonTableExpressionInfo *cte); + //! Find a common table expression by name; returns nullptr if none exists + CommonTableExpressionInfo *FindCTE(const string &name, bool skip = false); -} // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/types/timestamp.hpp -// -// -//===----------------------------------------------------------------------===// + bool CTEIsAlreadyBound(CommonTableExpressionInfo *cte); + //! Add the view to the set of currently bound views - used for detecting recursive view definitions + void AddBoundView(ViewCatalogEntry *view); + void PushExpressionBinder(ExpressionBinder *binder); + void PopExpressionBinder(); + void SetActiveBinder(ExpressionBinder *binder); + ExpressionBinder *GetActiveBinder(); + bool HasActiveBinder(); + vector &GetActiveBinders(); + void MergeCorrelatedColumns(vector &other); + //! Add a correlated column to this binder (if it does not exist) + void AddCorrelatedColumn(const CorrelatedColumnInfo &info); + string FormatError(ParsedExpression &expr_context, const string &message); + string FormatError(TableRef &ref_context, const string &message); + string FormatErrorRecursive(idx_t query_location, const string &message, vector &values); + template + string FormatErrorRecursive(idx_t query_location, const string &msg, vector &values, T param, + Args... params) { + values.push_back(ExceptionFormatValue::CreateFormatValue(param)); + return FormatErrorRecursive(query_location, msg, values, params...); + } -namespace duckdb { + template + string FormatError(idx_t query_location, const string &msg, Args... params) { + vector values; + return FormatErrorRecursive(query_location, msg, values, params...); + } -struct timestamp_struct { - int32_t year; - int8_t month; - int8_t day; - int8_t hour; - int8_t min; - int8_t sec; - int16_t msec; -}; -//! The Timestamp class is a static class that holds helper functions for the Timestamp -//! type. -class Timestamp { -public: - // min timestamp is 290308-12-22 (BC) - constexpr static const int32_t MIN_YEAR = -290308; - constexpr static const int32_t MIN_MONTH = 12; - constexpr static const int32_t MIN_DAY = 22; + static void BindLogicalType(ClientContext &context, LogicalType &type, const string &schema = ""); -public: - //! Convert a string in the format "YYYY-MM-DD hh:mm:ss" to a timestamp object - DUCKDB_API static timestamp_t FromString(const string &str); - DUCKDB_API static bool TryConvertTimestamp(const char *str, idx_t len, timestamp_t &result); - DUCKDB_API static timestamp_t FromCString(const char *str, idx_t len); - //! Convert a date object to a string in the format "YYYY-MM-DD hh:mm:ss" - DUCKDB_API static string ToString(timestamp_t timestamp); + bool HasMatchingBinding(const string &table_name, const string &column_name, string &error_message); + bool HasMatchingBinding(const string &schema_name, const string &table_name, const string &column_name, + string &error_message); - DUCKDB_API static date_t GetDate(timestamp_t timestamp); + void SetBindingMode(BindingMode mode); + BindingMode GetBindingMode(); + void AddTableName(string table_name); + const unordered_set &GetTableNames(); - DUCKDB_API static dtime_t GetTime(timestamp_t timestamp); - //! Create a Timestamp object from a specified (date, time) combination - DUCKDB_API static timestamp_t FromDatetime(date_t date, dtime_t time); - DUCKDB_API static bool TryFromDatetime(date_t date, dtime_t time, timestamp_t &result); +private: + //! The parent binder (if any) + shared_ptr parent; + //! The vector of active binders + vector active_binders; + //! The count of bound_tables + idx_t bound_tables; + //! Whether or not the binder has any unplanned subqueries that still need to be planned + bool has_unplanned_subqueries = false; + //! Whether or not subqueries should be planned already + bool plan_subquery = true; + //! Whether CTEs should reference the parent binder (if it exists) + bool inherit_ctes = true; + //! Whether or not the binder can contain NULLs as the root of expressions + bool can_contain_nulls = false; + //! The root statement of the query that is currently being parsed + SQLStatement *root_statement = nullptr; + //! Binding mode + BindingMode mode = BindingMode::STANDARD_BINDING; + //! Table names extracted for BindingMode::EXTRACT_NAMES + unordered_set table_names; + //! The set of bound views + unordered_set bound_views; - //! Extract the date and time from a given timestamp object - DUCKDB_API static void Convert(timestamp_t date, date_t &out_date, dtime_t &out_time); - //! Returns current timestamp - DUCKDB_API static timestamp_t GetCurrentTimestamp(); +private: + //! Bind the default values of the columns of a table + void BindDefaultValues(vector &columns, vector> &bound_defaults); + //! Bind a limit value (LIMIT or OFFSET) + unique_ptr BindDelimiter(ClientContext &context, OrderBinder &order_binder, + unique_ptr delimiter, const LogicalType &type, + Value &delimiter_value); - //! Convert the epoch (in sec) to a timestamp - DUCKDB_API static timestamp_t FromEpochSeconds(int64_t ms); - //! Convert the epoch (in ms) to a timestamp - DUCKDB_API static timestamp_t FromEpochMs(int64_t ms); - //! Convert the epoch (in microseconds) to a timestamp - DUCKDB_API static timestamp_t FromEpochMicroSeconds(int64_t micros); - //! Convert the epoch (in nanoseconds) to a timestamp - DUCKDB_API static timestamp_t FromEpochNanoSeconds(int64_t micros); + //! Move correlated expressions from the child binder to this binder + void MoveCorrelatedExpressions(Binder &other); - //! Convert the epoch (in seconds) to a timestamp - DUCKDB_API static int64_t GetEpochSeconds(timestamp_t timestamp); - //! Convert the epoch (in ms) to a timestamp - DUCKDB_API static int64_t GetEpochMs(timestamp_t timestamp); - //! Convert a timestamp to epoch (in microseconds) - DUCKDB_API static int64_t GetEpochMicroSeconds(timestamp_t timestamp); - //! Convert a timestamp to epoch (in nanoseconds) - DUCKDB_API static int64_t GetEpochNanoSeconds(timestamp_t timestamp); + BoundStatement Bind(SelectStatement &stmt); + BoundStatement Bind(InsertStatement &stmt); + BoundStatement Bind(CopyStatement &stmt); + BoundStatement Bind(DeleteStatement &stmt); + BoundStatement Bind(UpdateStatement &stmt); + BoundStatement Bind(CreateStatement &stmt); + BoundStatement Bind(DropStatement &stmt); + BoundStatement Bind(AlterStatement &stmt); + BoundStatement Bind(TransactionStatement &stmt); + BoundStatement Bind(PragmaStatement &stmt); + BoundStatement Bind(ExplainStatement &stmt); + BoundStatement Bind(VacuumStatement &stmt); + BoundStatement Bind(RelationStatement &stmt); + BoundStatement Bind(ShowStatement &stmt); + BoundStatement Bind(CallStatement &stmt); + BoundStatement Bind(ExportStatement &stmt); + BoundStatement Bind(SetStatement &stmt); + BoundStatement Bind(LoadStatement &stmt); + BoundStatement BindReturning(vector> returning_list, TableCatalogEntry *table, + idx_t update_table_index, unique_ptr child_operator, + BoundStatement result); - DUCKDB_API static bool TryParseUTCOffset(const char *str, idx_t &pos, idx_t len, int &hour_offset, - int &minute_offset); + unique_ptr BindTableMacro(FunctionExpression &function, TableMacroCatalogEntry *macro_func, idx_t depth); - DUCKDB_API static string ConversionError(const string &str); - DUCKDB_API static string ConversionError(string_t str); -}; -} // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/types/time.hpp -// -// -//===----------------------------------------------------------------------===// + unique_ptr BindNode(SelectNode &node); + unique_ptr BindNode(SetOperationNode &node); + unique_ptr BindNode(RecursiveCTENode &node); + unique_ptr BindNode(QueryNode &node); + unique_ptr VisitQueryNode(BoundQueryNode &node, unique_ptr root); + unique_ptr CreatePlan(BoundRecursiveCTENode &node); + unique_ptr CreatePlan(BoundSelectNode &statement); + unique_ptr CreatePlan(BoundSetOperationNode &node); + unique_ptr CreatePlan(BoundQueryNode &node); + unique_ptr Bind(BaseTableRef &ref); + unique_ptr Bind(CrossProductRef &ref); + unique_ptr Bind(JoinRef &ref); + unique_ptr Bind(SubqueryRef &ref, CommonTableExpressionInfo *cte = nullptr); + unique_ptr Bind(TableFunctionRef &ref); + unique_ptr Bind(EmptyTableRef &ref); + unique_ptr Bind(ExpressionListRef &ref); + bool BindFunctionParameters(vector> &expressions, vector &arguments, + vector ¶meters, named_parameter_map_t &named_parameters, + unique_ptr &subquery, string &error); + unique_ptr CreatePlan(BoundBaseTableRef &ref); + unique_ptr CreatePlan(BoundCrossProductRef &ref); + unique_ptr CreatePlan(BoundJoinRef &ref); + unique_ptr CreatePlan(BoundSubqueryRef &ref); + unique_ptr CreatePlan(BoundTableFunction &ref); + unique_ptr CreatePlan(BoundEmptyTableRef &ref); + unique_ptr CreatePlan(BoundExpressionListRef &ref); + unique_ptr CreatePlan(BoundCTERef &ref); + BoundStatement BindCopyTo(CopyStatement &stmt); + BoundStatement BindCopyFrom(CopyStatement &stmt); + void BindModifiers(OrderBinder &order_binder, QueryNode &statement, BoundQueryNode &result); + void BindModifierTypes(BoundQueryNode &result, const vector &sql_types, idx_t projection_index); -namespace duckdb { + BoundStatement BindSummarize(ShowStatement &stmt); + unique_ptr BindLimit(OrderBinder &order_binder, LimitModifier &limit_mod); + unique_ptr BindLimitPercent(OrderBinder &order_binder, LimitPercentModifier &limit_mod); + unique_ptr BindOrderExpression(OrderBinder &order_binder, unique_ptr expr); -//! The Time class is a static class that holds helper functions for the Time -//! type. -class Time { -public: - //! Convert a string in the format "hh:mm:ss" to a time object - DUCKDB_API static dtime_t FromString(const string &str, bool strict = false); - DUCKDB_API static dtime_t FromCString(const char *buf, idx_t len, bool strict = false); - DUCKDB_API static bool TryConvertTime(const char *buf, idx_t len, idx_t &pos, dtime_t &result, bool strict = false); + unique_ptr PlanFilter(unique_ptr condition, unique_ptr root); - //! Convert a time object to a string in the format "hh:mm:ss" - DUCKDB_API static string ToString(dtime_t time); - //! Convert a UTC offset to ±HH[:MM] - DUCKDB_API static string ToUTCOffset(int hour_offset, int minute_offset); + void PlanSubqueries(unique_ptr *expr, unique_ptr *root); + unique_ptr PlanSubquery(BoundSubqueryExpression &expr, unique_ptr &root); - DUCKDB_API static dtime_t FromTime(int32_t hour, int32_t minute, int32_t second, int32_t microseconds = 0); + unique_ptr CastLogicalOperatorToTypes(vector &source_types, + vector &target_types, + unique_ptr op); - //! Extract the time from a given timestamp object - DUCKDB_API static void Convert(dtime_t time, int32_t &out_hour, int32_t &out_min, int32_t &out_sec, - int32_t &out_micros); + string FindBinding(const string &using_column, const string &join_side); + bool TryFindBinding(const string &using_column, const string &join_side, string &result); - DUCKDB_API static string ConversionError(const string &str); - DUCKDB_API static string ConversionError(string_t str); + void AddUsingBindingSet(unique_ptr set); + string RetrieveUsingBinding(Binder ¤t_binder, UsingColumnSet *current_set, const string &column_name, + const string &join_side, UsingColumnSet *new_set); -private: - static bool TryConvertInternal(const char *buf, idx_t len, idx_t &pos, dtime_t &result, bool strict); +public: + // This should really be a private constructor, but make_shared does not allow it... + // If you are thinking about calling this, you should probably call Binder::CreateBinder + Binder(bool I_know_what_I_am_doing, ClientContext &context, shared_ptr parent, bool inherit_ctes); }; } // namespace duckdb + //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/common/serializer/buffered_serializer.hpp +// duckdb/planner/bound_query_node.hpp // // //===----------------------------------------------------------------------===// @@ -13299,228 +13680,128 @@ class Time { -namespace duckdb { - -#define SERIALIZER_DEFAULT_SIZE 1024 - -struct BinaryData { - unique_ptr data; - idx_t size; -}; +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/query_node.hpp +// +// +//===----------------------------------------------------------------------===// -class BufferedSerializer : public Serializer { -public: - //! Serializes to a buffer allocated by the serializer, will expand when - //! writing past the initial threshold - explicit BufferedSerializer(idx_t maximum_size = SERIALIZER_DEFAULT_SIZE); - //! Serializes to a provided (owned) data pointer - BufferedSerializer(unique_ptr data, idx_t size); - BufferedSerializer(data_ptr_t data, idx_t size); - idx_t maximum_size; - data_ptr_t data; - BinaryData blob; -public: - void WriteData(const_data_ptr_t buffer, uint64_t write_size) override; - //! Retrieves the data after the writing has been completed - BinaryData GetData() { - return std::move(blob); - } - void Reset() { - blob.size = 0; - } -}; -} // namespace duckdb //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/main/appender.hpp +// duckdb/parser/common_table_expression_info.hpp // // //===----------------------------------------------------------------------===// +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/statement/select_statement.hpp +// +// +//===----------------------------------------------------------------------===// -namespace duckdb { - -class ClientContext; -class DuckDB; -class TableCatalogEntry; -class Connection; - -//! The Appender class can be used to append elements to a table. -class BaseAppender { -protected: - //! The amount of chunks that will be gathered in the chunk collection before flushing - static constexpr const idx_t FLUSH_COUNT = 100; - - //! The append types - vector types; - //! The buffered data for the append - ChunkCollection collection; - //! Internal chunk used for appends - unique_ptr chunk; - //! The current column to append to - idx_t column = 0; - -public: - DUCKDB_API BaseAppender(); - DUCKDB_API BaseAppender(vector types); - DUCKDB_API virtual ~BaseAppender(); - //! Begins a new row append, after calling this the other AppendX() functions - //! should be called the correct amount of times. After that, - //! EndRow() should be called. - DUCKDB_API void BeginRow(); - //! Finishes appending the current row. - DUCKDB_API void EndRow(); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/parser/sql_statement.hpp +// +// +//===----------------------------------------------------------------------===// - // Append functions - template - void Append(T value) { - throw Exception("Undefined type for Appender::Append!"); - } - DUCKDB_API void Append(const char *value, uint32_t length); - // prepared statements - template - void AppendRow(Args... args) { - BeginRow(); - AppendRowRecursive(args...); - } - //! Commit the changes made by the appender. - DUCKDB_API void Flush(); - //! Flush the changes made by the appender and close it. The appender cannot be used after this point - DUCKDB_API void Close(); - DUCKDB_API vector &GetTypes() { - return types; - } - DUCKDB_API idx_t CurrentColumn() { - return column; - } -protected: - void Destructor(); - virtual void FlushInternal(ChunkCollection &collection) = 0; - void InitializeChunk(); - void FlushChunk(); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/printer.hpp +// +// +//===----------------------------------------------------------------------===// - template - void AppendValueInternal(T value); - template - void AppendValueInternal(Vector &vector, SRC input); - void AppendRowRecursive() { - EndRow(); - } - template - void AppendRowRecursive(T value, Args... args) { - Append(value); - AppendRowRecursive(args...); - } - void AppendValue(const Value &value); -}; -class Appender : public BaseAppender { - //! A reference to a database connection that created this appender - shared_ptr context; - //! The table description (including column names) - unique_ptr description; +namespace duckdb { +//! Printer is a static class that allows printing to logs or stdout/stderr +class Printer { public: - DUCKDB_API Appender(Connection &con, const string &schema_name, const string &table_name); - DUCKDB_API Appender(Connection &con, const string &table_name); - DUCKDB_API ~Appender() override; - -protected: - void FlushInternal(ChunkCollection &collection) override; + //! Print the object to stderr + DUCKDB_API static void Print(const string &str); + //! Prints Progress + DUCKDB_API static void PrintProgress(int percentage, const char *pbstr, int pbwidth); + //! Prints an empty line when progress bar is done + DUCKDB_API static void FinishProgressBarPrint(const char *pbstr, int pbwidth); + //! Whether or not we are printing to a terminal + DUCKDB_API static bool IsTerminal(); }; +} // namespace duckdb -class InternalAppender : public BaseAppender { - //! The client context - ClientContext &context; - //! The internal table entry to append to - TableCatalogEntry &table; +namespace duckdb { +//! SQLStatement is the base class of any type of SQL statement. +class SQLStatement { public: - DUCKDB_API InternalAppender(ClientContext &context, TableCatalogEntry &table); - DUCKDB_API ~InternalAppender() override; - -protected: - void FlushInternal(ChunkCollection &collection) override; -}; + explicit SQLStatement(StatementType type) : type(type) {}; + virtual ~SQLStatement() { + } -template <> -DUCKDB_API void BaseAppender::Append(bool value); -template <> -DUCKDB_API void BaseAppender::Append(int8_t value); -template <> -DUCKDB_API void BaseAppender::Append(int16_t value); -template <> -DUCKDB_API void BaseAppender::Append(int32_t value); -template <> -DUCKDB_API void BaseAppender::Append(int64_t value); -template <> -DUCKDB_API void BaseAppender::Append(hugeint_t value); -template <> -DUCKDB_API void BaseAppender::Append(uint8_t value); -template <> -DUCKDB_API void BaseAppender::Append(uint16_t value); -template <> -DUCKDB_API void BaseAppender::Append(uint32_t value); -template <> -DUCKDB_API void BaseAppender::Append(uint64_t value); -template <> -DUCKDB_API void BaseAppender::Append(float value); -template <> -DUCKDB_API void BaseAppender::Append(double value); -template <> -DUCKDB_API void BaseAppender::Append(date_t value); -template <> -DUCKDB_API void BaseAppender::Append(dtime_t value); -template <> -DUCKDB_API void BaseAppender::Append(timestamp_t value); -template <> -DUCKDB_API void BaseAppender::Append(interval_t value); -template <> -DUCKDB_API void BaseAppender::Append(const char *value); -template <> -DUCKDB_API void BaseAppender::Append(string_t value); -template <> -DUCKDB_API void BaseAppender::Append(Value value); -template <> -DUCKDB_API void BaseAppender::Append(std::nullptr_t value); + //! The statement type + StatementType type; + //! The statement location within the query string + idx_t stmt_location; + //! The statement length within the query string + idx_t stmt_length; + //! The number of prepared statement parameters (if any) + idx_t n_param; + //! The query text that corresponds to this SQL statement + string query; + +protected: + SQLStatement(const SQLStatement &other) = default; +public: + //! Create a copy of this SelectStatement + virtual unique_ptr Copy() const = 0; +}; } // namespace duckdb + //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/main/client_context.hpp +// duckdb/parser/tableref.hpp // // //===----------------------------------------------------------------------===// + //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/catalog/catalog_entry/schema_catalog_entry.hpp +// duckdb/common/enums/tableref_type.hpp // // //===----------------------------------------------------------------------===// @@ -13528,21 +13809,30 @@ DUCKDB_API void BaseAppender::Append(std::nullptr_t value); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/catalog/catalog_set.hpp -// -// -//===----------------------------------------------------------------------===// +namespace duckdb { +//===--------------------------------------------------------------------===// +// Table Reference Types +//===--------------------------------------------------------------------===// +enum class TableReferenceType : uint8_t { + INVALID = 0, // invalid table reference type + BASE_TABLE = 1, // base table reference + SUBQUERY = 2, // output of a subquery + JOIN = 3, // output of join + CROSS_PRODUCT = 4, // out of cartesian product + TABLE_FUNCTION = 5, // table producing function + EXPRESSION_LIST = 6, // expression list + CTE = 7, // Recursive CTE + EMPTY = 8 // placeholder for empty FROM +}; +} // namespace duckdb //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/catalog/default/default_generator.hpp +// duckdb/parser/parsed_data/sample_options.hpp // // //===----------------------------------------------------------------------===// @@ -13552,79 +13842,279 @@ DUCKDB_API void BaseAppender::Append(std::nullptr_t value); + + namespace duckdb { -class ClientContext; -class DefaultGenerator { +enum class SampleMethod : uint8_t { SYSTEM_SAMPLE = 0, BERNOULLI_SAMPLE = 1, RESERVOIR_SAMPLE = 2 }; + +string SampleMethodToString(SampleMethod method); + +struct SampleOptions { + Value sample_size; + bool is_percentage; + SampleMethod method; + int64_t seed = -1; + + unique_ptr Copy(); + void Serialize(Serializer &serializer); + static unique_ptr Deserialize(Deserializer &source); + static bool Equals(SampleOptions *a, SampleOptions *b); +}; + +} // namespace duckdb + + +namespace duckdb { +class Deserializer; +class Serializer; + +//! Represents a generic expression that returns a table. +class TableRef { public: - explicit DefaultGenerator(Catalog &catalog) : catalog(catalog), created_all_entries(false) { + explicit TableRef(TableReferenceType type) : type(type) { } - virtual ~DefaultGenerator() { + virtual ~TableRef() { } - Catalog &catalog; - atomic created_all_entries; + TableReferenceType type; + string alias; + //! Sample options (if any) + unique_ptr sample; + //! The location in the query (if any) + idx_t query_location = DConstants::INVALID_INDEX; public: - //! Creates a default entry with the specified name, or returns nullptr if no such entry can be generated - virtual unique_ptr CreateDefaultEntry(ClientContext &context, const string &entry_name) = 0; - //! Get a list of all default entries in the generator - virtual vector GetDefaultEntries() = 0; + //! Convert the object to a string + virtual string ToString() const; + void Print(); + + virtual bool Equals(const TableRef *other) const; + + virtual unique_ptr Copy() = 0; + + //! Serializes a TableRef to a stand-alone binary blob + DUCKDB_API void Serialize(Serializer &serializer) const; + //! Serializes a TableRef to a stand-alone binary blob + DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0; + //! Deserializes a blob back into a TableRef + DUCKDB_API static unique_ptr Deserialize(Deserializer &source); + + //! Copy the properties of this table ref to the target + void CopyProperties(TableRef &target) const; +}; +} // namespace duckdb + + +namespace duckdb { + +class QueryNode; + +//! SelectStatement is a typical SELECT clause +class SelectStatement : public SQLStatement { +public: + SelectStatement() : SQLStatement(StatementType::SELECT_STATEMENT) { + } + + //! The main query node + unique_ptr node; + +protected: + SelectStatement(const SelectStatement &other); + +public: + //! Create a copy of this SelectStatement + unique_ptr Copy() const override; + //! Serializes a SelectStatement to a stand-alone binary blob + void Serialize(Serializer &serializer) const; + //! Deserializes a blob back into a SelectStatement, returns nullptr if + //! deserialization is not possible + static unique_ptr Deserialize(Deserializer &source); + //! Whether or not the statements are equivalent + bool Equals(const SQLStatement *other) const; +}; +} // namespace duckdb + + +namespace duckdb { + +class SelectStatement; + +struct CommonTableExpressionInfo { + vector aliases; + unique_ptr query; +}; + +} // namespace duckdb + + +namespace duckdb { + +enum QueryNodeType : uint8_t { + SELECT_NODE = 1, + SET_OPERATION_NODE = 2, + BOUND_SUBQUERY_NODE = 3, + RECURSIVE_CTE_NODE = 4 +}; + +class QueryNode { +public: + explicit QueryNode(QueryNodeType type) : type(type) { + } + virtual ~QueryNode() { + } + + //! The type of the query node, either SetOperation or Select + QueryNodeType type; + //! The set of result modifiers associated with this query node + vector> modifiers; + //! CTEs (used by SelectNode and SetOperationNode) + unordered_map> cte_map; + + virtual const vector> &GetSelectList() const = 0; + +public: + virtual bool Equals(const QueryNode *other) const; + + //! Create a copy of this QueryNode + virtual unique_ptr Copy() const = 0; + //! Serializes a QueryNode to a stand-alone binary blob + DUCKDB_API void Serialize(Serializer &serializer) const; + //! Serializes a QueryNode to a stand-alone binary blob + DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0; + //! Deserializes a blob back into a QueryNode + DUCKDB_API static unique_ptr Deserialize(Deserializer &source); + +protected: + //! Copy base QueryNode properties from another expression to this one, + //! used in Copy method + void CopyProperties(QueryNode &other) const; +}; + +} // namespace duckdb + + +namespace duckdb { + +//! Bound equivalent of QueryNode +class BoundQueryNode { +public: + explicit BoundQueryNode(QueryNodeType type) : type(type) { + } + virtual ~BoundQueryNode() { + } + + //! The type of the query node, either SetOperation or Select + QueryNodeType type; + //! The result modifiers that should be applied to this query node + vector> modifiers; + + //! The names returned by this QueryNode. + vector names; + //! The types returned by this QueryNode. + vector types; + +public: + virtual idx_t GetRootIndex() = 0; }; } // namespace duckdb +namespace duckdb { + +class BoundSubqueryExpression : public Expression { +public: + explicit BoundSubqueryExpression(LogicalType return_type); + + bool IsCorrelated() { + return binder->correlated_columns.size() > 0; + } + + //! The binder used to bind the subquery node + shared_ptr binder; + //! The bound subquery node + unique_ptr subquery; + //! The subquery type + SubqueryType subquery_type; + //! the child expression to compare with (in case of IN, ANY, ALL operators) + unique_ptr child; + //! The comparison type of the child expression with the subquery (in case of ANY, ALL operators) + ExpressionType comparison_type; + //! The LogicalType of the subquery result. Only used for ANY expressions. + LogicalType child_type; + //! The target LogicalType of the subquery result (i.e. to which type it should be casted, if child_type <> + //! child_target). Only used for ANY expressions. + LogicalType child_target; + +public: + bool HasSubquery() const override { + return true; + } + bool IsScalar() const override { + return false; + } + bool IsFoldable() const override { + return false; + } + + string ToString() const override; + bool Equals(const BaseExpression *other) const override; + unique_ptr Copy() override; + bool PropagatesNullValues() const override; +}; +} // namespace duckdb //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/catalog/catalog_entry/table_catalog_entry.hpp +// duckdb/planner/expression/bound_unnest_expression.hpp // // //===----------------------------------------------------------------------===// -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/catalog/standard_entry.hpp -// -// -//===----------------------------------------------------------------------===// - +namespace duckdb { +//! Represents a function call that has been bound to a base function +class BoundUnnestExpression : public Expression { +public: + explicit BoundUnnestExpression(LogicalType return_type); -namespace duckdb { -class SchemaCatalogEntry; + unique_ptr child; -//! A StandardEntry is a catalog entry that is a member of a schema -class StandardEntry : public CatalogEntry { public: - StandardEntry(CatalogType type, SchemaCatalogEntry *schema, Catalog *catalog, string name) - : CatalogEntry(type, catalog, name), schema(schema) { - } - ~StandardEntry() override { - } + bool IsFoldable() const override; + string ToString() const override; - //! The schema the entry belongs to - SchemaCatalogEntry *schema; + hash_t Hash() const override; + bool Equals(const BaseExpression *other) const override; + + unique_ptr Copy() override; }; } // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/planner/expression/bound_window_expression.hpp +// +// +//===----------------------------------------------------------------------===// + //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/parser/constraint.hpp +// duckdb/parser/expression/window_expression.hpp // // //===----------------------------------------------------------------------===// @@ -13633,1981 +14123,2815 @@ class StandardEntry : public CatalogEntry { -namespace duckdb { -class Serializer; -class Deserializer; -class FieldWriter; -class FieldReader; +namespace duckdb { -//===--------------------------------------------------------------------===// -// Constraint Types -//===--------------------------------------------------------------------===// -enum class ConstraintType : uint8_t { - INVALID = 0, // invalid constraint type - NOT_NULL = 1, // NOT NULL constraint - CHECK = 2, // CHECK constraint - UNIQUE = 3, // UNIQUE constraint - FOREIGN_KEY = 4 // FOREIGN KEY constraint +enum class WindowBoundary : uint8_t { + INVALID = 0, + UNBOUNDED_PRECEDING = 1, + UNBOUNDED_FOLLOWING = 2, + CURRENT_ROW_RANGE = 3, + CURRENT_ROW_ROWS = 4, + EXPR_PRECEDING_ROWS = 5, + EXPR_FOLLOWING_ROWS = 6, + EXPR_PRECEDING_RANGE = 7, + EXPR_FOLLOWING_RANGE = 8 }; -//! Constraint is the base class of any type of table constraint. -class Constraint { +//! The WindowExpression represents a window function in the query. They are a special case of aggregates which is why +//! they inherit from them. +class WindowExpression : public ParsedExpression { public: - DUCKDB_API explicit Constraint(ConstraintType type); - DUCKDB_API virtual ~Constraint(); + WindowExpression(ExpressionType type, string schema_name, const string &function_name); - ConstraintType type; + //! Schema of the aggregate function + string schema; + //! Name of the aggregate function + string function_name; + //! The child expression of the main window aggregate + vector> children; + //! The set of expressions to partition by + vector> partitions; + //! The set of ordering clauses + vector orders; + //! True to ignore NULL values + bool ignore_nulls; + //! The window boundaries + WindowBoundary start = WindowBoundary::INVALID; + WindowBoundary end = WindowBoundary::INVALID; + + unique_ptr start_expr; + unique_ptr end_expr; + //! Offset and default expressions for WINDOW_LEAD and WINDOW_LAG functions + unique_ptr offset_expr; + unique_ptr default_expr; public: - DUCKDB_API virtual string ToString() const = 0; - DUCKDB_API void Print() const; + bool IsWindow() const override { + return true; + } - DUCKDB_API virtual unique_ptr Copy() const = 0; - //! Serializes a Constraint to a stand-alone binary blob - DUCKDB_API void Serialize(Serializer &serializer) const; - //! Serializes a Constraint to a stand-alone binary blob - DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0; - //! Deserializes a blob back into a Constraint - DUCKDB_API static unique_ptr Deserialize(Deserializer &source); -}; -} // namespace duckdb + //! Convert the Expression to a String + string ToString() const override; -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/bound_constraint.hpp -// -// -//===----------------------------------------------------------------------===// + static bool Equals(const WindowExpression *a, const WindowExpression *b); + unique_ptr Copy() const override; + void Serialize(FieldWriter &writer) const override; + static unique_ptr Deserialize(ExpressionType type, FieldReader &source); +public: + template + static string ToString(const T &entry, const string &schema, const string &function_name) { + // Start with function call + string result = schema.empty() ? function_name : schema + "." + function_name; + result += "("; + result += StringUtil::Join(entry.children, entry.children.size(), ", ", + [](const unique_ptr &child) { return child->ToString(); }); + // Lead/Lag extra arguments + if (entry.offset_expr.get()) { + result += ", "; + result += entry.offset_expr->ToString(); + } + if (entry.default_expr.get()) { + result += ", "; + result += entry.default_expr->ToString(); + } + // IGNORE NULLS + if (entry.ignore_nulls) { + result += " IGNORE NULLS"; + } + // Over clause + result += ") OVER("; + string sep; + + // Partitions + if (!entry.partitions.empty()) { + result += "PARTITION BY "; + result += StringUtil::Join(entry.partitions, entry.partitions.size(), ", ", + [](const unique_ptr &partition) { return partition->ToString(); }); + sep = " "; + } + // Orders + if (!entry.orders.empty()) { + result += sep; + result += "ORDER BY "; + result += StringUtil::Join(entry.orders, entry.orders.size(), ", ", + [](const ORDER_NODE &order) { return order.ToString(); }); + sep = " "; + } + // Rows/Range + string units = "ROWS"; + string from; + switch (entry.start) { + case WindowBoundary::CURRENT_ROW_RANGE: + case WindowBoundary::CURRENT_ROW_ROWS: + from = "CURRENT ROW"; + units = (entry.start == WindowBoundary::CURRENT_ROW_RANGE) ? "RANGE" : "ROWS"; + break; + case WindowBoundary::UNBOUNDED_PRECEDING: + if (entry.end != WindowBoundary::CURRENT_ROW_RANGE) { + from = "UNBOUNDED PRECEDING"; + } + break; + case WindowBoundary::EXPR_PRECEDING_ROWS: + case WindowBoundary::EXPR_PRECEDING_RANGE: + from = entry.start_expr->ToString() + " PRECEDING"; + units = (entry.start == WindowBoundary::EXPR_PRECEDING_RANGE) ? "RANGE" : "ROWS"; + break; + case WindowBoundary::EXPR_FOLLOWING_ROWS: + case WindowBoundary::EXPR_FOLLOWING_RANGE: + from = entry.start_expr->ToString() + " FOLLOWING"; + units = (entry.start == WindowBoundary::EXPR_FOLLOWING_RANGE) ? "RANGE" : "ROWS"; + break; + default: + throw InternalException("Unrecognized FROM in WindowExpression"); + } -namespace duckdb { -//! Bound equivalent of Constraint -class BoundConstraint { -public: - explicit BoundConstraint(ConstraintType type) : type(type) {}; - virtual ~BoundConstraint() { - } + string to; + switch (entry.end) { + case WindowBoundary::CURRENT_ROW_RANGE: + if (entry.start != WindowBoundary::UNBOUNDED_PRECEDING) { + to = "CURRENT ROW"; + units = "RANGE"; + } + break; + case WindowBoundary::CURRENT_ROW_ROWS: + to = "CURRENT ROW"; + units = "ROWS"; + break; + case WindowBoundary::UNBOUNDED_PRECEDING: + to = "UNBOUNDED PRECEDING"; + break; + case WindowBoundary::UNBOUNDED_FOLLOWING: + to = "UNBOUNDED FOLLOWING"; + break; + case WindowBoundary::EXPR_PRECEDING_ROWS: + case WindowBoundary::EXPR_PRECEDING_RANGE: + to = entry.end_expr->ToString() + " PRECEDING"; + units = (entry.end == WindowBoundary::EXPR_PRECEDING_RANGE) ? "RANGE" : "ROWS"; + break; + case WindowBoundary::EXPR_FOLLOWING_ROWS: + case WindowBoundary::EXPR_FOLLOWING_RANGE: + to = entry.end_expr->ToString() + " FOLLOWING"; + units = (entry.end == WindowBoundary::EXPR_FOLLOWING_RANGE) ? "RANGE" : "ROWS"; + break; + default: + throw InternalException("Unrecognized TO in WindowExpression"); + } - ConstraintType type; + if (!from.empty() || !to.empty()) { + result += sep + units; + } + if (!from.empty() && !to.empty()) { + result += " BETWEEN "; + result += from; + result += " AND "; + result += to; + } else if (!from.empty()) { + result += " "; + result += from; + } else if (!to.empty()) { + result += " "; + result += to; + } + + result += ")"; + + return result; + } }; } // namespace duckdb + namespace duckdb { +class AggregateFunction; -class ColumnStatistics; -class DataTable; -struct CreateTableInfo; -struct BoundCreateTableInfo; +class BoundWindowExpression : public Expression { +public: + BoundWindowExpression(ExpressionType type, LogicalType return_type, unique_ptr aggregate, + unique_ptr bind_info); -struct RenameColumnInfo; -struct AddColumnInfo; -struct RemoveColumnInfo; -struct SetDefaultInfo; -struct ChangeColumnTypeInfo; + //! The bound aggregate function + unique_ptr aggregate; + //! The bound function info + unique_ptr bind_info; + //! The child expressions of the main window aggregate + vector> children; + //! The set of expressions to partition by + vector> partitions; + //! Statistics belonging to the partitions expressions + vector> partitions_stats; + //! The set of ordering clauses + vector orders; + //! True to ignore NULL values + bool ignore_nulls; + //! The window boundaries + WindowBoundary start = WindowBoundary::INVALID; + WindowBoundary end = WindowBoundary::INVALID; + + unique_ptr start_expr; + unique_ptr end_expr; + //! Offset and default expressions for WINDOW_LEAD and WINDOW_LAG functions + unique_ptr offset_expr; + unique_ptr default_expr; -//! A table catalog entry -class TableCatalogEntry : public StandardEntry { public: - //! Create a real TableCatalogEntry and initialize storage for it - TableCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, BoundCreateTableInfo *info, - std::shared_ptr inherited_storage = nullptr); + bool IsWindow() const override { + return true; + } + bool IsFoldable() const override { + return false; + } - //! A reference to the underlying storage unit used for this table - std::shared_ptr storage; - //! A list of columns that are part of this table - vector columns; - //! A list of constraints that are part of this table - vector> constraints; - //! A list of constraints that are part of this table - vector> bound_constraints; - //! A map of column name to column index - case_insensitive_map_t name_map; + string ToString() const override; -public: - unique_ptr AlterEntry(ClientContext &context, AlterInfo *info) override; - //! Returns whether or not a column with the given name exists - bool ColumnExists(const string &name); - //! Returns a reference to the column of the specified name. Throws an - //! exception if the column does not exist. - ColumnDefinition &GetColumn(const string &name); - //! Returns a list of types of the table - vector GetTypes(); - string ToSQL() override; + bool KeysAreCompatible(const BoundWindowExpression *other) const; + bool Equals(const BaseExpression *other) const override; - //! Serialize the meta information of the TableCatalogEntry a serializer - virtual void Serialize(Serializer &serializer); - //! Deserializes to a CreateTableInfo - static unique_ptr Deserialize(Deserializer &source); + unique_ptr Copy() override; +}; +} // namespace duckdb - unique_ptr Copy(ClientContext &context) override; - void SetAsRoot() override; - void CommitAlter(AlterInfo &info); - void CommitDrop(); +#include +namespace duckdb { - //! Returns the column index of the specified column name. - //! If the column does not exist: - //! If if_exists is true, returns DConstants::INVALID_INDEX - //! If if_exists is false, throws an exception - idx_t GetColumnIndex(string &name, bool if_exists = false); +class AdaptiveFilter { +public: + explicit AdaptiveFilter(const Expression &expr); + explicit AdaptiveFilter(TableFilterSet *table_filters); + void AdaptRuntimeStatistics(double duration); + vector permutation; private: - unique_ptr RenameColumn(ClientContext &context, RenameColumnInfo &info); - unique_ptr AddColumn(ClientContext &context, AddColumnInfo &info); - unique_ptr RemoveColumn(ClientContext &context, RemoveColumnInfo &info); - unique_ptr SetDefault(ClientContext &context, SetDefaultInfo &info); - unique_ptr ChangeColumnType(ClientContext &context, ChangeColumnTypeInfo &info); + //! used for adaptive expression reordering + idx_t iteration_count; + idx_t swap_idx; + idx_t right_random_border; + idx_t observe_interval; + idx_t execute_interval; + double runtime_sum; + double prev_mean; + bool observe; + bool warmup; + vector swap_likeliness; + std::default_random_engine generator; }; } // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/catalog/catalog_entry/sequence_catalog_entry.hpp -// -// -//===----------------------------------------------------------------------===// +namespace duckdb { +class ColumnSegment; +class LocalTableStorage; +class Index; +class RowGroup; +class UpdateSegment; +class TableScanState; +class ColumnSegment; +class ValiditySegment; +class TableFilterSet; +struct SegmentScanState { + virtual ~SegmentScanState() { + } +}; +struct IndexScanState { + virtual ~IndexScanState() { + } +}; +typedef unordered_map> buffer_handle_set_t; -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/parsed_data/create_sequence_info.hpp -// -// -//===----------------------------------------------------------------------===// +struct ColumnScanState { + //! The column segment that is currently being scanned + ColumnSegment *current; + //! The current row index of the scan + idx_t row_index; + //! The internal row index (i.e. the position of the SegmentScanState) + idx_t internal_index; + //! Segment scan state + unique_ptr scan_state; + //! Child states of the vector + vector child_states; + //! Whether or not InitializeState has been called for this segment + bool initialized = false; + //! If this segment has already been checked for skipping purposes + bool segment_checked = false; +public: + //! Move the scan state forward by "count" rows (including all child states) + void Next(idx_t count); + //! Move ONLY this state forward by "count" rows (i.e. not the child states) + void NextInternal(idx_t count); + //! Move the scan state forward by STANDARD_VECTOR_SIZE rows + void NextVector(); +}; +struct ColumnFetchState { + //! The set of pinned block handles for this set of fetches + buffer_handle_set_t handles; + //! Any child states of the fetch + vector> child_states; +}; -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/parsed_data/create_info.hpp -// -// -//===----------------------------------------------------------------------===// +struct LocalScanState { + ~LocalScanState(); + void SetStorage(shared_ptr storage); + LocalTableStorage *GetStorage() { + return storage.get(); + } + idx_t chunk_index; + idx_t max_index; + idx_t last_chunk_count; + TableFilterSet *table_filters; -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/parsed_data/parse_info.hpp -// -// -//===----------------------------------------------------------------------===// +private: + shared_ptr storage; +}; + +class RowGroupScanState { +public: + RowGroupScanState(TableScanState &parent_p) : parent(parent_p), vector_index(0), max_row(0) { + } + //! The parent scan state + TableScanState &parent; + //! The current row_group we are scanning + RowGroup *row_group; + //! The vector index within the row_group + idx_t vector_index; + //! The maximum row index of this row_group scan + idx_t max_row; + //! Child column scans + unique_ptr column_scans; +public: + //! Move to the next vector, skipping past the current one + void NextVector(); +}; +class TableScanState { +public: + TableScanState() : row_group_scan_state(*this), max_row(0) {}; + //! The row_group scan state + RowGroupScanState row_group_scan_state; + //! The total maximum row index + idx_t max_row; + //! The column identifiers of the scan + vector column_ids; + //! The table filters (if any) + TableFilterSet *table_filters = nullptr; + //! Adaptive filter info (if any) + unique_ptr adaptive_filter; + //! Transaction-local scan state + LocalScanState local_state; -namespace duckdb { +public: + //! Move to the next vector + void NextVector(); +}; -struct ParseInfo { - virtual ~ParseInfo() { - } +class CreateIndexScanState : public TableScanState { +public: + vector> locks; + unique_lock append_lock; + unique_lock delete_lock; }; } // namespace duckdb - namespace duckdb { +class DataTable; +class WriteAheadLog; +struct TableAppendState; -enum class OnCreateConflict : uint8_t { - // Standard: throw error - ERROR_ON_CONFLICT, - // CREATE IF NOT EXISTS, silently do nothing on conflict - IGNORE_ON_CONFLICT, - // CREATE OR REPLACE - REPLACE_ON_CONFLICT +class LocalTableStorage : public std::enable_shared_from_this { +public: + explicit LocalTableStorage(DataTable &table); + ~LocalTableStorage(); + + DataTable &table; + //! The main chunk collection holding the data + ChunkCollection collection; + //! The set of unique indexes + vector> indexes; + //! The set of deleted entries + unordered_map> deleted_entries; + //! The number of deleted rows + idx_t deleted_rows; + //! The number of active scans + atomic active_scans; + +public: + void InitializeScan(LocalScanState &state, TableFilterSet *table_filters = nullptr); + idx_t EstimatedSize(); + + void Clear(); }; -struct CreateInfo : public ParseInfo { - explicit CreateInfo(CatalogType type, string schema = DEFAULT_SCHEMA) - : type(type), schema(schema), on_conflict(OnCreateConflict::ERROR_ON_CONFLICT), temporary(false), - internal(false) { +//! The LocalStorage class holds appends that have not been committed yet +class LocalStorage { +public: + struct CommitState { + unordered_map> append_states; + }; + +public: + explicit LocalStorage(Transaction &transaction) : transaction(transaction) { } - ~CreateInfo() override { + + //! Initialize a scan of the local storage + void InitializeScan(DataTable *table, LocalScanState &state, TableFilterSet *table_filters); + //! Scan + void Scan(LocalScanState &state, const vector &column_ids, DataChunk &result); + + //! Append a chunk to the local storage + void Append(DataTable *table, DataChunk &chunk); + //! Delete a set of rows from the local storage + idx_t Delete(DataTable *table, Vector &row_ids, idx_t count); + //! Update a set of rows in the local storage + void Update(DataTable *table, Vector &row_ids, const vector &column_ids, DataChunk &data); + + //! Commits the local storage, writing it to the WAL and completing the commit + void Commit(LocalStorage::CommitState &commit_state, Transaction &transaction, WriteAheadLog *log, + transaction_t commit_id); + + bool ChangesMade() noexcept { + return table_storage.size() > 0; } + idx_t EstimatedSize(); - //! The to-be-created catalog type - CatalogType type; - //! The schema name of the entry - string schema; - //! What to do on create conflict - OnCreateConflict on_conflict; - //! Whether or not the entry is temporary - bool temporary; - //! Whether or not the entry is an internal entry - bool internal; - //! The SQL string of the CREATE statement - string sql; + bool Find(DataTable *table) { + return table_storage.find(table) != table_storage.end(); + } -public: - virtual unique_ptr Copy() const = 0; - void CopyProperties(CreateInfo &other) const { - other.type = type; - other.schema = schema; - other.on_conflict = on_conflict; - other.temporary = temporary; - other.internal = internal; - other.sql = sql; + idx_t AddedRows(DataTable *table) { + auto entry = table_storage.find(table); + if (entry == table_storage.end()) { + return 0; + } + return entry->second->collection.Count() - entry->second->deleted_rows; } -}; - -} // namespace duckdb + void AddColumn(DataTable *old_dt, DataTable *new_dt, ColumnDefinition &new_column, Expression *default_value); + void ChangeType(DataTable *old_dt, DataTable *new_dt, idx_t changed_idx, const LogicalType &target_type, + const vector &bound_columns, Expression &cast_expr); + void FetchChunk(DataTable *table, Vector &row_ids, idx_t count, DataChunk &chunk); + vector> &GetIndexes(DataTable *table); -namespace duckdb { +private: + LocalTableStorage *GetStorage(DataTable *table); -struct CreateSequenceInfo : public CreateInfo { - CreateSequenceInfo() - : CreateInfo(CatalogType::SEQUENCE_ENTRY, INVALID_SCHEMA), name(string()), usage_count(0), increment(1), - min_value(1), max_value(NumericLimits::Maximum()), start_value(1), cycle(false) { - } + template + bool ScanTableStorage(DataTable &table, LocalTableStorage &storage, T &&fun); - //! Sequence name to create - string name; - //! Usage count of the sequence - uint64_t usage_count; - //! The increment value - int64_t increment; - //! The minimum value of the sequence - int64_t min_value; - //! The maximum value of the sequence - int64_t max_value; - //! The start value of the sequence - int64_t start_value; - //! Whether or not the sequence cycles - bool cycle; +private: + Transaction &transaction; + unordered_map> table_storage; -public: - unique_ptr Copy() const override { - auto result = make_unique(); - CopyProperties(*result); - result->name = name; - result->schema = schema; - result->usage_count = usage_count; - result->increment = increment; - result->min_value = min_value; - result->max_value = max_value; - result->start_value = start_value; - result->cycle = cycle; - return move(result); - } + void Flush(DataTable &table, LocalTableStorage &storage); }; } // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/parsed_data/alter_table_info.hpp -// -// -//===----------------------------------------------------------------------===// - - +namespace duckdb { +class SequenceCatalogEntry; +class ColumnData; +class ClientContext; +class CatalogEntry; +class DataTable; +class DatabaseInstance; +class WriteAheadLog; +class ChunkVectorInfo; -namespace duckdb { +struct DeleteInfo; +struct UpdateInfo; -enum class AlterType : uint8_t { - INVALID = 0, - ALTER_TABLE = 1, - ALTER_VIEW = 2, - ALTER_SEQUENCE = 3, - CHANGE_OWNERSHIP = 4 -}; +//! The transaction object holds information about a currently running or past +//! transaction -struct AlterInfo : public ParseInfo { - AlterInfo(AlterType type, string schema, string name); - ~AlterInfo() override; +class Transaction { +public: + Transaction(weak_ptr context, transaction_t start_time, transaction_t transaction_id, + timestamp_t start_timestamp, idx_t catalog_version) + : context(move(context)), start_time(start_time), transaction_id(transaction_id), commit_id(0), + highest_active_query(0), active_query(MAXIMUM_QUERY_ID), start_timestamp(start_timestamp), + catalog_version(catalog_version), storage(*this), is_invalidated(false) { + } - AlterType type; - //! Schema name to alter - string schema; - //! Entry name to alter - string name; + weak_ptr context; + //! The start timestamp of this transaction + transaction_t start_time; + //! The transaction id of this transaction + transaction_t transaction_id; + //! The commit id of this transaction, if it has successfully been committed + transaction_t commit_id; + //! Highest active query when the transaction finished, used for cleaning up + transaction_t highest_active_query; + //! The current active query for the transaction. Set to MAXIMUM_QUERY_ID if + //! no query is active. + atomic active_query; + //! The timestamp when the transaction started + timestamp_t start_timestamp; + //! The catalog version when the transaction was started + idx_t catalog_version; + //! The set of uncommitted appends for the transaction + LocalStorage storage; + //! Map of all sequences that were used during the transaction and the value they had in this transaction + unordered_map sequence_usage; + //! Whether or not the transaction has been invalidated + bool is_invalidated; public: - virtual CatalogType GetCatalogType() const = 0; - virtual unique_ptr Copy() const = 0; - void Serialize(Serializer &serializer) const; - virtual void Serialize(FieldWriter &writer) const = 0; - static unique_ptr Deserialize(Deserializer &source); -}; + static Transaction &GetTransaction(ClientContext &context); -//===--------------------------------------------------------------------===// -// Change Ownership -//===--------------------------------------------------------------------===// -struct ChangeOwnershipInfo : public AlterInfo { - ChangeOwnershipInfo(CatalogType entry_catalog_type, string entry_schema, string entry_name, string owner_schema, - string owner_name); + void PushCatalogEntry(CatalogEntry *entry, data_ptr_t extra_data = nullptr, idx_t extra_data_size = 0); - // Catalog type refers to the entry type, since this struct is usually built from an - // ALTER . OWNED BY . statement - // here it is only possible to know the type of who is to be owned - CatalogType entry_catalog_type; + //! Commit the current transaction with the given commit identifier. Returns an error message if the transaction + //! commit failed, or an empty string if the commit was sucessful + string Commit(DatabaseInstance &db, transaction_t commit_id, bool checkpoint) noexcept; + //! Returns whether or not a commit of this transaction should trigger an automatic checkpoint + bool AutomaticCheckpoint(DatabaseInstance &db); - string owner_schema; - string owner_name; + //! Rollback + void Rollback() noexcept { + undo_buffer.Rollback(); + } + //! Cleanup the undo buffer + void Cleanup() { + undo_buffer.Cleanup(); + } -public: - CatalogType GetCatalogType() const override; - unique_ptr Copy() const override; - void Serialize(FieldWriter &writer) const override; -}; + void Invalidate() { + is_invalidated = true; + } + bool IsInvalidated() { + return is_invalidated; + } + bool ChangesMade(); -//===--------------------------------------------------------------------===// -// Alter Table -//===--------------------------------------------------------------------===// -enum class AlterTableType : uint8_t { - INVALID = 0, - RENAME_COLUMN = 1, - RENAME_TABLE = 2, - ADD_COLUMN = 3, - REMOVE_COLUMN = 4, - ALTER_COLUMN_TYPE = 5, - SET_DEFAULT = 6 -}; + timestamp_t GetCurrentTransactionStartTimestamp() { + return start_timestamp; + } -struct AlterTableInfo : public AlterInfo { - AlterTableInfo(AlterTableType type, string schema, string table); - ~AlterTableInfo() override; + void PushDelete(DataTable *table, ChunkVectorInfo *vinfo, row_t rows[], idx_t count, idx_t base_row); + void PushAppend(DataTable *table, idx_t row_start, idx_t row_count); + UpdateInfo *CreateUpdateInfo(idx_t type_size, idx_t entries); - AlterTableType alter_table_type; +private: + //! The undo buffer is used to store old versions of rows that are updated + //! or deleted + UndoBuffer undo_buffer; -public: - CatalogType GetCatalogType() const override; - void Serialize(FieldWriter &writer) const override; - virtual void SerializeAlterTable(FieldWriter &writer) const = 0; - static unique_ptr Deserialize(FieldReader &reader); + Transaction(const Transaction &) = delete; }; -//===--------------------------------------------------------------------===// -// RenameColumnInfo -//===--------------------------------------------------------------------===// -struct RenameColumnInfo : public AlterTableInfo { - RenameColumnInfo(string schema, string table, string old_name_p, string new_name_p); - ~RenameColumnInfo() override; - - //! Column old name - string old_name; - //! Column new name - string new_name; - -public: - unique_ptr Copy() const override; - void SerializeAlterTable(FieldWriter &writer) const override; - static unique_ptr Deserialize(FieldReader &reader, string schema, string table); -}; +} // namespace duckdb -//===--------------------------------------------------------------------===// -// RenameTableInfo -//===--------------------------------------------------------------------===// -struct RenameTableInfo : public AlterTableInfo { - RenameTableInfo(string schema, string table, string new_name); - ~RenameTableInfo() override; +#include +#include - //! Relation new name - string new_table_name; +namespace duckdb { +struct AlterInfo; -public: - unique_ptr Copy() const override; - void SerializeAlterTable(FieldWriter &writer) const override; - static unique_ptr Deserialize(FieldReader &reader, string schema, string table); -}; +class ClientContext; -//===--------------------------------------------------------------------===// -// AddColumnInfo -//===--------------------------------------------------------------------===// -struct AddColumnInfo : public AlterTableInfo { - AddColumnInfo(string schema, string table, ColumnDefinition new_column); - ~AddColumnInfo() override; +typedef unordered_map> set_lock_map_t; - //! New column - ColumnDefinition new_column; +struct MappingValue { + explicit MappingValue(idx_t index_) : index(index_), timestamp(0), deleted(false), parent(nullptr) { + } -public: - unique_ptr Copy() const override; - void SerializeAlterTable(FieldWriter &writer) const override; - static unique_ptr Deserialize(FieldReader &reader, string schema, string table); + idx_t index; + transaction_t timestamp; + bool deleted; + unique_ptr child; + MappingValue *parent; }; -//===--------------------------------------------------------------------===// -// RemoveColumnInfo -//===--------------------------------------------------------------------===// -struct RemoveColumnInfo : public AlterTableInfo { - RemoveColumnInfo(string schema, string table, string removed_column, bool if_exists); - ~RemoveColumnInfo() override; - - //! The column to remove - string removed_column; - //! Whether or not an error should be thrown if the column does not exist - bool if_exists; +//! The Catalog Set stores (key, value) map of a set of CatalogEntries +class CatalogSet { + friend class DependencyManager; + friend class EntryDropper; public: - unique_ptr Copy() const override; - void SerializeAlterTable(FieldWriter &writer) const override; - static unique_ptr Deserialize(FieldReader &reader, string schema, string table); -}; + DUCKDB_API explicit CatalogSet(Catalog &catalog, unique_ptr defaults = nullptr); -//===--------------------------------------------------------------------===// -// ChangeColumnTypeInfo -//===--------------------------------------------------------------------===// -struct ChangeColumnTypeInfo : public AlterTableInfo { - ChangeColumnTypeInfo(string schema, string table, string column_name, LogicalType target_type, - unique_ptr expression); - ~ChangeColumnTypeInfo() override; + //! Create an entry in the catalog set. Returns whether or not it was + //! successful. + DUCKDB_API bool CreateEntry(ClientContext &context, const string &name, unique_ptr value, + unordered_set &dependencies); - //! The column name to alter - string column_name; - //! The target type of the column - LogicalType target_type; - //! The expression used for data conversion - unique_ptr expression; + DUCKDB_API bool AlterEntry(ClientContext &context, const string &name, AlterInfo *alter_info); -public: - unique_ptr Copy() const override; - void SerializeAlterTable(FieldWriter &writer) const override; - static unique_ptr Deserialize(FieldReader &reader, string schema, string table); -}; + DUCKDB_API bool DropEntry(ClientContext &context, const string &name, bool cascade); -//===--------------------------------------------------------------------===// -// SetDefaultInfo -//===--------------------------------------------------------------------===// -struct SetDefaultInfo : public AlterTableInfo { - SetDefaultInfo(string schema, string table, string column_name, unique_ptr new_default); - ~SetDefaultInfo() override; + bool AlterOwnership(ClientContext &context, ChangeOwnershipInfo *info); - //! The column name to alter - string column_name; - //! The expression used for data conversion - unique_ptr expression; + void CleanupEntry(CatalogEntry *catalog_entry); -public: - unique_ptr Copy() const override; - void SerializeAlterTable(FieldWriter &writer) const override; - static unique_ptr Deserialize(FieldReader &reader, string schema, string table); -}; + //! Returns the entry with the specified name + DUCKDB_API CatalogEntry *GetEntry(ClientContext &context, const string &name); -//===--------------------------------------------------------------------===// -// Alter View -//===--------------------------------------------------------------------===// -enum class AlterViewType : uint8_t { INVALID = 0, RENAME_VIEW = 1 }; + //! Gets the entry that is most similar to the given name (i.e. smallest levenshtein distance), or empty string if + //! none is found. The returned pair consists of the entry name and the distance (smaller means closer). + pair SimilarEntry(ClientContext &context, const string &name); -struct AlterViewInfo : public AlterInfo { - AlterViewInfo(AlterViewType type, string schema, string view); - ~AlterViewInfo() override; + //! Rollback to be the currently valid entry for a certain catalog + //! entry + void Undo(CatalogEntry *entry); - AlterViewType alter_view_type; + //! Scan the catalog set, invoking the callback method for every committed entry + DUCKDB_API void Scan(const std::function &callback); + //! Scan the catalog set, invoking the callback method for every entry + DUCKDB_API void Scan(ClientContext &context, const std::function &callback); -public: - CatalogType GetCatalogType() const override; - void Serialize(FieldWriter &writer) const override; - virtual void SerializeAlterView(FieldWriter &writer) const = 0; - static unique_ptr Deserialize(FieldReader &reader); -}; + template + vector GetEntries(ClientContext &context) { + vector result; + Scan(context, [&](CatalogEntry *entry) { result.push_back((T *)entry); }); + return result; + } -//===--------------------------------------------------------------------===// -// RenameViewInfo -//===--------------------------------------------------------------------===// -struct RenameViewInfo : public AlterViewInfo { - RenameViewInfo(string schema, string view, string new_name); - ~RenameViewInfo() override; + DUCKDB_API static bool HasConflict(ClientContext &context, transaction_t timestamp); + DUCKDB_API static bool UseTimestamp(ClientContext &context, transaction_t timestamp); - //! Relation new name - string new_view_name; + CatalogEntry *GetEntryFromIndex(idx_t index); + void UpdateTimestamp(CatalogEntry *entry, transaction_t timestamp); -public: - unique_ptr Copy() const override; - void SerializeAlterView(FieldWriter &writer) const override; - static unique_ptr Deserialize(FieldReader &reader, string schema, string table); -}; +private: + //! Adjusts table dependencies on the event of an UNDO + void AdjustTableDependencies(CatalogEntry *entry); + //! Adjust one dependency + void AdjustDependency(CatalogEntry *entry, TableCatalogEntry *table, ColumnDefinition &column, bool remove); + //! Adjust Enum dependency + void AdjustEnumDependency(CatalogEntry *entry, ColumnDefinition &column, bool remove); + //! Given a root entry, gets the entry valid for this transaction + CatalogEntry *GetEntryForTransaction(ClientContext &context, CatalogEntry *current); + CatalogEntry *GetCommittedEntry(CatalogEntry *current); + bool GetEntryInternal(ClientContext &context, const string &name, idx_t &entry_index, CatalogEntry *&entry); + bool GetEntryInternal(ClientContext &context, idx_t entry_index, CatalogEntry *&entry); + //! Drops an entry from the catalog set; must hold the catalog_lock to safely call this + void DropEntryInternal(ClientContext &context, idx_t entry_index, CatalogEntry &entry, bool cascade); + CatalogEntry *CreateEntryInternal(ClientContext &context, unique_ptr entry); + MappingValue *GetMapping(ClientContext &context, const string &name, bool get_latest = false); + void PutMapping(ClientContext &context, const string &name, idx_t entry_index); + void DeleteMapping(ClientContext &context, const string &name); + void DropEntryDependencies(ClientContext &context, idx_t entry_index, CatalogEntry &entry, bool cascade); +private: + Catalog &catalog; + //! The catalog lock is used to make changes to the data + mutex catalog_lock; + //! Mapping of string to catalog entry + case_insensitive_map_t> mapping; + //! The set of catalog entries + unordered_map> entries; + //! The current catalog entry index + idx_t current_entry = 0; + //! The generator used to generate default internal entries + unique_ptr defaults; +}; } // namespace duckdb + namespace duckdb { +class ClientContext; + +class StandardEntry; +class TableCatalogEntry; +class TableFunctionCatalogEntry; +class SequenceCatalogEntry; class Serializer; class Deserializer; -struct SequenceValue { - SequenceValue() : usage_count(0), counter(-1) { - } - SequenceValue(uint64_t usage_count, int64_t counter) : usage_count(usage_count), counter(counter) { - } +enum class OnCreateConflict : uint8_t; - uint64_t usage_count; - int64_t counter; -}; +struct AlterTableInfo; +struct CreateIndexInfo; +struct CreateFunctionInfo; +struct CreateCollationInfo; +struct CreateViewInfo; +struct BoundCreateTableInfo; +struct CreatePragmaFunctionInfo; +struct CreateSequenceInfo; +struct CreateSchemaInfo; +struct CreateTableFunctionInfo; +struct CreateCopyFunctionInfo; +struct CreateTypeInfo; + +struct DropInfo; + +//! A schema in the catalog +class SchemaCatalogEntry : public CatalogEntry { + friend class Catalog; -//! A sequence catalog entry -class SequenceCatalogEntry : public StandardEntry { public: - //! Create a real TableCatalogEntry and initialize storage for it - SequenceCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateSequenceInfo *info); + SchemaCatalogEntry(Catalog *catalog, string name, bool is_internal); - //! Lock for getting a value on the sequence - mutex lock; - //! The amount of times the sequence has been used - uint64_t usage_count; - //! The sequence counter - int64_t counter; - //! The most recently returned value - int64_t last_value; - //! The increment value - int64_t increment; - //! The minimum value of the sequence - int64_t start_value; - //! The minimum value of the sequence - int64_t min_value; - //! The maximum value of the sequence - int64_t max_value; - //! Whether or not the sequence cycles - bool cycle; +private: + //! The catalog set holding the tables + CatalogSet tables; + //! The catalog set holding the indexes + CatalogSet indexes; + //! The catalog set holding the table functions + CatalogSet table_functions; + //! The catalog set holding the copy functions + CatalogSet copy_functions; + //! The catalog set holding the pragma functions + CatalogSet pragma_functions; + //! The catalog set holding the scalar and aggregate functions + CatalogSet functions; + //! The catalog set holding the sequences + CatalogSet sequences; + //! The catalog set holding the collations + CatalogSet collations; + //! The catalog set holding the types + CatalogSet types; public: - //! Serialize the meta information of the SequenceCatalogEntry a serializer + //! Scan the specified catalog set, invoking the callback method for every entry + void Scan(ClientContext &context, CatalogType type, const std::function &callback); + //! Scan the specified catalog set, invoking the callback method for every committed entry + void Scan(CatalogType type, const std::function &callback); + + //! Serialize the meta information of the SchemaCatalogEntry a serializer virtual void Serialize(Serializer &serializer); - //! Deserializes to a CreateTableInfo - static unique_ptr Deserialize(Deserializer &source); + //! Deserializes to a CreateSchemaInfo + static unique_ptr Deserialize(Deserializer &source); + + string ToSQL() override; + + //! Creates an index with the given name in the schema + CatalogEntry *CreateIndex(ClientContext &context, CreateIndexInfo *info, TableCatalogEntry *table); + +private: + //! Create a scalar or aggregate function within the given schema + CatalogEntry *CreateFunction(ClientContext &context, CreateFunctionInfo *info); + //! Creates a table with the given name in the schema + CatalogEntry *CreateTable(ClientContext &context, BoundCreateTableInfo *info); + //! Creates a view with the given name in the schema + CatalogEntry *CreateView(ClientContext &context, CreateViewInfo *info); + //! Creates a sequence with the given name in the schema + CatalogEntry *CreateSequence(ClientContext &context, CreateSequenceInfo *info); + //! Create a table function within the given schema + CatalogEntry *CreateTableFunction(ClientContext &context, CreateTableFunctionInfo *info); + //! Create a copy function within the given schema + CatalogEntry *CreateCopyFunction(ClientContext &context, CreateCopyFunctionInfo *info); + //! Create a pragma function within the given schema + CatalogEntry *CreatePragmaFunction(ClientContext &context, CreatePragmaFunctionInfo *info); + //! Create a collation within the given schema + CatalogEntry *CreateCollation(ClientContext &context, CreateCollationInfo *info); + //! Create a enum within the given schema + CatalogEntry *CreateType(ClientContext &context, CreateTypeInfo *info); + + //! Drops an entry from the schema + void DropEntry(ClientContext &context, DropInfo *info); + + //! Append a scalar or aggregate function within the given schema + CatalogEntry *AddFunction(ClientContext &context, CreateFunctionInfo *info); + + //! Alters a catalog entry + void Alter(ClientContext &context, AlterInfo *info); - string ToSQL() override; + //! Add a catalog entry to this schema + CatalogEntry *AddEntry(ClientContext &context, unique_ptr entry, OnCreateConflict on_conflict); + //! Add a catalog entry to this schema + CatalogEntry *AddEntry(ClientContext &context, unique_ptr entry, OnCreateConflict on_conflict, + unordered_set dependencies); - CatalogEntry *AlterOwnership(ClientContext &context, AlterInfo *info); + //! Get the catalog set for the specified type + CatalogSet &GetCatalogSet(CatalogType type); }; } // namespace duckdb + + //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/transaction/transaction.hpp +// duckdb/common/deque.hpp // // //===----------------------------------------------------------------------===// +#include - +namespace duckdb { +using std::deque; +} //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/transaction/undo_buffer.hpp +// duckdb/common/progress_bar.hpp // // //===----------------------------------------------------------------------===// - //===----------------------------------------------------------------------===// +// // DuckDB // -// duckdb/common/enums/undo_flags.hpp +// duckdb.h // // //===----------------------------------------------------------------------===// +// duplicate of duckdb/main/winapi.hpp +#ifndef DUCKDB_API +#ifdef _WIN32 +#if defined(DUCKDB_BUILD_LIBRARY) && !defined(DUCKDB_BUILD_LOADABLE_EXTENSION) +#define DUCKDB_API __declspec(dllexport) +#else +#define DUCKDB_API __declspec(dllimport) +#endif +#else +#define DUCKDB_API +#endif +#endif + +// duplicate of duckdb/common/constants.hpp +#ifndef DUCKDB_API_0_3_1 +#define DUCKDB_API_0_3_1 1 +#endif +#ifndef DUCKDB_API_0_3_2 +#define DUCKDB_API_0_3_2 2 +#endif +#ifndef DUCKDB_API_LATEST +#define DUCKDB_API_LATEST DUCKDB_API_0_3_2 +#endif + +#ifndef DUCKDB_API_VERSION +#define DUCKDB_API_VERSION DUCKDB_API_LATEST +#endif + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +//===--------------------------------------------------------------------===// +// Type Information +//===--------------------------------------------------------------------===// +typedef uint64_t idx_t; + +typedef enum DUCKDB_TYPE { + DUCKDB_TYPE_INVALID = 0, + // bool + DUCKDB_TYPE_BOOLEAN, + // int8_t + DUCKDB_TYPE_TINYINT, + // int16_t + DUCKDB_TYPE_SMALLINT, + // int32_t + DUCKDB_TYPE_INTEGER, + // int64_t + DUCKDB_TYPE_BIGINT, + // uint8_t + DUCKDB_TYPE_UTINYINT, + // uint16_t + DUCKDB_TYPE_USMALLINT, + // uint32_t + DUCKDB_TYPE_UINTEGER, + // uint64_t + DUCKDB_TYPE_UBIGINT, + // float + DUCKDB_TYPE_FLOAT, + // double + DUCKDB_TYPE_DOUBLE, + // duckdb_timestamp, in microseconds + DUCKDB_TYPE_TIMESTAMP, + // duckdb_date + DUCKDB_TYPE_DATE, + // duckdb_time + DUCKDB_TYPE_TIME, + // duckdb_interval + DUCKDB_TYPE_INTERVAL, + // duckdb_hugeint + DUCKDB_TYPE_HUGEINT, + // const char* + DUCKDB_TYPE_VARCHAR, + // duckdb_blob + DUCKDB_TYPE_BLOB, + // decimal + DUCKDB_TYPE_DECIMAL, + // duckdb_timestamp, in seconds + DUCKDB_TYPE_TIMESTAMP_S, + // duckdb_timestamp, in milliseconds + DUCKDB_TYPE_TIMESTAMP_MS, + // duckdb_timestamp, in nanoseconds + DUCKDB_TYPE_TIMESTAMP_NS, + // enum type, only useful as logical type + DUCKDB_TYPE_ENUM, + // list type, only useful as logical type + DUCKDB_TYPE_LIST, + // struct type, only useful as logical type + DUCKDB_TYPE_STRUCT, + // map type, only useful as logical type + DUCKDB_TYPE_MAP, + // duckdb_hugeint + DUCKDB_TYPE_UUID, + // const char* + DUCKDB_TYPE_JSON, +} duckdb_type; + +//! Days are stored as days since 1970-01-01 +//! Use the duckdb_from_date/duckdb_to_date function to extract individual information +typedef struct { + int32_t days; +} duckdb_date; + +typedef struct { + int32_t year; + int8_t month; + int8_t day; +} duckdb_date_struct; + +//! Time is stored as microseconds since 00:00:00 +//! Use the duckdb_from_time/duckdb_to_time function to extract individual information +typedef struct { + int64_t micros; +} duckdb_time; + +typedef struct { + int8_t hour; + int8_t min; + int8_t sec; + int32_t micros; +} duckdb_time_struct; + +//! Timestamps are stored as microseconds since 1970-01-01 +//! Use the duckdb_from_timestamp/duckdb_to_timestamp function to extract individual information +typedef struct { + int64_t micros; +} duckdb_timestamp; + +typedef struct { + duckdb_date_struct date; + duckdb_time_struct time; +} duckdb_timestamp_struct; + +typedef struct { + int32_t months; + int32_t days; + int64_t micros; +} duckdb_interval; + +//! Hugeints are composed in a (lower, upper) component +//! The value of the hugeint is upper * 2^64 + lower +//! For easy usage, the functions duckdb_hugeint_to_double/duckdb_double_to_hugeint are recommended +typedef struct { + uint64_t lower; + int64_t upper; +} duckdb_hugeint; + +typedef struct { + uint8_t width; + uint8_t scale; + + duckdb_hugeint value; +} duckdb_decimal; + +typedef struct { + void *data; + idx_t size; +} duckdb_blob; + +typedef struct { +#if DUCKDB_API_VERSION < DUCKDB_API_0_3_2 + void *data; + bool *nullmask; + duckdb_type type; + char *name; +#else + // deprecated, use duckdb_column_data + void *__deprecated_data; + // deprecated, use duckdb_nullmask_data + bool *__deprecated_nullmask; + // deprecated, use duckdb_column_type + duckdb_type __deprecated_type; + // deprecated, use duckdb_column_name + char *__deprecated_name; +#endif + void *internal_data; +} duckdb_column; + +typedef struct { +#if DUCKDB_API_VERSION < DUCKDB_API_0_3_2 + idx_t column_count; + idx_t row_count; + idx_t rows_changed; + duckdb_column *columns; + char *error_message; +#else + // deprecated, use duckdb_column_count + idx_t __deprecated_column_count; + // deprecated, use duckdb_row_count + idx_t __deprecated_row_count; + // deprecated, use duckdb_rows_changed + idx_t __deprecated_rows_changed; + // deprecated, use duckdb_column_ family of functions + duckdb_column *__deprecated_columns; + // deprecated, use duckdb_result_error + char *__deprecated_error_message; +#endif + void *internal_data; +} duckdb_result; + +typedef void *duckdb_database; +typedef void *duckdb_connection; +typedef void *duckdb_prepared_statement; +typedef void *duckdb_appender; +typedef void *duckdb_arrow; +typedef void *duckdb_config; +typedef void *duckdb_arrow_schema; +typedef void *duckdb_arrow_array; +typedef void *duckdb_logical_type; +typedef void *duckdb_data_chunk; +typedef void *duckdb_vector; +typedef void *duckdb_value; + +typedef enum { DuckDBSuccess = 0, DuckDBError = 1 } duckdb_state; + +//===--------------------------------------------------------------------===// +// Open/Connect +//===--------------------------------------------------------------------===// + +/*! +Creates a new database or opens an existing database file stored at the the given path. +If no path is given a new in-memory database is created instead. + +* path: Path to the database file on disk, or `nullptr` or `:memory:` to open an in-memory database. +* out_database: The result database object. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_open(const char *path, duckdb_database *out_database); + +/*! +Extended version of duckdb_open. Creates a new database or opens an existing database file stored at the the given path. + +* path: Path to the database file on disk, or `nullptr` or `:memory:` to open an in-memory database. +* out_database: The result database object. +* config: (Optional) configuration used to start up the database system. +* out_error: If set and the function returns DuckDBError, this will contain the reason why the start-up failed. +Note that the error must be freed using `duckdb_free`. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_open_ext(const char *path, duckdb_database *out_database, duckdb_config config, + char **out_error); + +/*! +Closes the specified database and de-allocates all memory allocated for that database. +This should be called after you are done with any database allocated through `duckdb_open`. +Note that failing to call `duckdb_close` (in case of e.g. a program crash) will not cause data corruption. +Still it is recommended to always correctly close a database object after you are done with it. + +* database: The database object to shut down. +*/ +DUCKDB_API void duckdb_close(duckdb_database *database); + +/*! +Opens a connection to a database. Connections are required to query the database, and store transactional state +associated with the connection. + +* database: The database file to connect to. +* out_connection: The result connection object. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_connect(duckdb_database database, duckdb_connection *out_connection); +/*! +Closes the specified connection and de-allocates all memory allocated for that connection. -namespace duckdb { +* connection: The connection to close. +*/ +DUCKDB_API void duckdb_disconnect(duckdb_connection *connection); -enum class UndoFlags : uint32_t { // far to big but aligned (TM) - EMPTY_ENTRY = 0, - CATALOG_ENTRY = 1, - INSERT_TUPLE = 2, - DELETE_TUPLE = 3, - UPDATE_TUPLE = 4 -}; +//===--------------------------------------------------------------------===// +// Configuration +//===--------------------------------------------------------------------===// +/*! +Initializes an empty configuration object that can be used to provide start-up options for the DuckDB instance +through `duckdb_open_ext`. -} // namespace duckdb +This will always succeed unless there is a malloc failure. +* out_config: The result configuration object. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_create_config(duckdb_config *out_config); -namespace duckdb { +/*! +This returns the total amount of configuration options available for usage with `duckdb_get_config_flag`. -class WriteAheadLog; +This should not be called in a loop as it internally loops over all the options. -struct UndoChunk { - explicit UndoChunk(idx_t size); - ~UndoChunk(); +* returns: The amount of config options available. +*/ +DUCKDB_API size_t duckdb_config_count(); - data_ptr_t WriteEntry(UndoFlags type, uint32_t len); +/*! +Obtains a human-readable name and description of a specific configuration option. This can be used to e.g. +display configuration options. This will succeed unless `index` is out of range (i.e. `>= duckdb_config_count`). - unique_ptr data; - idx_t current_position; - idx_t maximum_size; - unique_ptr next; - UndoChunk *prev; -}; +The result name or description MUST NOT be freed. -//! The undo buffer of a transaction is used to hold previous versions of tuples -//! that might be required in the future (because of rollbacks or previous -//! transactions accessing them) -class UndoBuffer { -public: - struct IteratorState { - UndoChunk *current; - data_ptr_t start; - data_ptr_t end; - }; +* index: The index of the configuration option (between 0 and `duckdb_config_count`) +* out_name: A name of the configuration flag. +* out_description: A description of the configuration flag. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_get_config_flag(size_t index, const char **out_name, const char **out_description); -public: - UndoBuffer(); +/*! +Sets the specified option for the specified configuration. The configuration option is indicated by name. +To obtain a list of config options, see `duckdb_get_config_flag`. - //! Reserve space for an entry of the specified type and length in the undo - //! buffer - data_ptr_t CreateEntry(UndoFlags type, idx_t len); +In the source code, configuration options are defined in `config.cpp`. - bool ChangesMade(); - idx_t EstimatedSize(); +This can fail if either the name is invalid, or if the value provided for the option is invalid. - //! Cleanup the undo buffer - void Cleanup(); - //! Commit the changes made in the UndoBuffer: should be called on commit - void Commit(UndoBuffer::IteratorState &iterator_state, WriteAheadLog *log, transaction_t commit_id); - //! Revert committed changes made in the UndoBuffer up until the currently committed state - void RevertCommit(UndoBuffer::IteratorState &iterator_state, transaction_t transaction_id); - //! Rollback the changes made in this UndoBuffer: should be called on - //! rollback - void Rollback() noexcept; +* duckdb_config: The configuration object to set the option on. +* name: The name of the configuration flag to set. +* option: The value to set the configuration flag to. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_set_config(duckdb_config config, const char *name, const char *option); -private: - unique_ptr head; - UndoChunk *tail; +/*! +Destroys the specified configuration option and de-allocates all memory allocated for the object. -private: - template - void IterateEntries(UndoBuffer::IteratorState &state, T &&callback); - template - void IterateEntries(UndoBuffer::IteratorState &state, UndoBuffer::IteratorState &end_state, T &&callback); - template - void ReverseIterateEntries(T &&callback); -}; +* config: The configuration object to destroy. +*/ +DUCKDB_API void duckdb_destroy_config(duckdb_config *config); -} // namespace duckdb +//===--------------------------------------------------------------------===// +// Query Execution +//===--------------------------------------------------------------------===// +/*! +Executes a SQL query within a connection and stores the full (materialized) result in the out_result pointer. +If the query fails to execute, DuckDBError is returned and the error message can be retrieved by calling +`duckdb_result_error`. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/transaction/local_storage.hpp -// -// -//===----------------------------------------------------------------------===// +Note that after running `duckdb_query`, `duckdb_destroy_result` must be called on the result object even if the +query fails, otherwise the error stored within the result will not be freed correctly. +* connection: The connection to perform the query in. +* query: The SQL query to run. +* out_result: The query result. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_query(duckdb_connection connection, const char *query, duckdb_result *out_result); +/*! +Closes the result and de-allocates all memory allocated for that connection. +* result: The result to destroy. +*/ +DUCKDB_API void duckdb_destroy_result(duckdb_result *result); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/storage/table/scan_state.hpp -// -// -//===----------------------------------------------------------------------===// +/*! +Returns the column name of the specified column. The result should not need be freed; the column names will +automatically be destroyed when the result is destroyed. +Returns `NULL` if the column is out of range. +* result: The result object to fetch the column name from. +* col: The column index. +* returns: The column name of the specified column. +*/ +DUCKDB_API const char *duckdb_column_name(duckdb_result *result, idx_t col); +/*! +Returns the column type of the specified column. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/storage/buffer/buffer_handle.hpp -// -// -//===----------------------------------------------------------------------===// +Returns `DUCKDB_TYPE_INVALID` if the column is out of range. +* result: The result object to fetch the column type from. +* col: The column index. +* returns: The column type of the specified column. +*/ +DUCKDB_API duckdb_type duckdb_column_type(duckdb_result *result, idx_t col); +/*! +Returns the logical column type of the specified column. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/storage/storage_info.hpp -// -// -//===----------------------------------------------------------------------===// +The return type of this call should be destroyed with `duckdb_destroy_logical_type`. +Returns `NULL` if the column is out of range. +* result: The result object to fetch the column type from. +* col: The column index. +* returns: The logical column type of the specified column. +*/ +DUCKDB_API duckdb_logical_type duckdb_column_logical_type(duckdb_result *result, idx_t col); +/*! +Returns the number of columns present in a the result object. +* result: The result object. +* returns: The number of columns present in the result object. +*/ +DUCKDB_API idx_t duckdb_column_count(duckdb_result *result); -namespace duckdb { -class Serializer; -class Deserializer; -struct FileHandle; +/*! +Returns the number of rows present in a the result object. -//! The version number of the database storage format -extern const uint64_t VERSION_NUMBER; +* result: The result object. +* returns: The number of rows present in the result object. +*/ +DUCKDB_API idx_t duckdb_row_count(duckdb_result *result); -using block_id_t = int64_t; +/*! +Returns the number of rows changed by the query stored in the result. This is relevant only for INSERT/UPDATE/DELETE +queries. For other queries the rows_changed will be 0. -#define INVALID_BLOCK (-1) +* result: The result object. +* returns: The number of rows changed. +*/ +DUCKDB_API idx_t duckdb_rows_changed(duckdb_result *result); -// maximum block id, 2^62 -#define MAXIMUM_BLOCK 4611686018427388000LL +/*! +**DEPRECATED**: Prefer using `duckdb_result_get_chunk` instead. -//! The MainHeader is the first header in the storage file. The MainHeader is typically written only once for a database -//! file. -struct MainHeader { - static constexpr idx_t MAGIC_BYTE_SIZE = 4; - static constexpr idx_t MAGIC_BYTE_OFFSET = sizeof(uint64_t); - static constexpr idx_t FLAG_COUNT = 4; - // the magic bytes in front of the file - // should be "DUCK" - static const char MAGIC_BYTES[]; - //! The version of the database - uint64_t version_number; - //! The set of flags used by the database - uint64_t flags[FLAG_COUNT]; +Returns the data of a specific column of a result in columnar format. - static void CheckMagicBytes(FileHandle &handle); +The function returns a dense array which contains the result data. The exact type stored in the array depends on the +corresponding duckdb_type (as provided by `duckdb_column_type`). For the exact type by which the data should be +accessed, see the comments in [the types section](types) or the `DUCKDB_TYPE` enum. - void Serialize(Serializer &ser); - static MainHeader Deserialize(Deserializer &source); -}; +For example, for a column of type `DUCKDB_TYPE_INTEGER`, rows can be accessed in the following manner: +```c +int32_t *data = (int32_t *) duckdb_column_data(&result, 0); +printf("Data for row %d: %d\n", row, data[row]); +``` -//! The DatabaseHeader contains information about the current state of the database. Every storage file has two -//! DatabaseHeaders. On startup, the DatabaseHeader with the highest iteration count is used as the active header. When -//! a checkpoint is performed, the active DatabaseHeader is switched by increasing the iteration count of the -//! DatabaseHeader. -struct DatabaseHeader { - //! The iteration count, increases by 1 every time the storage is checkpointed. - uint64_t iteration; - //! A pointer to the initial meta block - block_id_t meta_block; - //! A pointer to the block containing the free list - block_id_t free_list; - //! The number of blocks that is in the file as of this database header. If the file is larger than BLOCK_SIZE * - //! block_count any blocks appearing AFTER block_count are implicitly part of the free_list. - uint64_t block_count; +* result: The result object to fetch the column data from. +* col: The column index. +* returns: The column data of the specified column. +*/ +DUCKDB_API void *duckdb_column_data(duckdb_result *result, idx_t col); - void Serialize(Serializer &ser); - static DatabaseHeader Deserialize(Deserializer &source); -}; +/*! +**DEPRECATED**: Prefer using `duckdb_result_get_chunk` instead. -} // namespace duckdb +Returns the nullmask of a specific column of a result in columnar format. The nullmask indicates for every row +whether or not the corresponding row is `NULL`. If a row is `NULL`, the values present in the array provided +by `duckdb_column_data` are undefined. +```c +int32_t *data = (int32_t *) duckdb_column_data(&result, 0); +bool *nullmask = duckdb_nullmask_data(&result, 0); +if (nullmask[row]) { + printf("Data for row %d: NULL\n", row); +} else { + printf("Data for row %d: %d\n", row, data[row]); +} +``` -namespace duckdb { -class BlockHandle; -class FileBuffer; +* result: The result object to fetch the nullmask from. +* col: The column index. +* returns: The nullmask of the specified column. +*/ +DUCKDB_API bool *duckdb_nullmask_data(duckdb_result *result, idx_t col); -class BufferHandle { -public: - BufferHandle(shared_ptr handle, FileBuffer *node); - ~BufferHandle(); +/*! +Returns the error message contained within the result. The error is only set if `duckdb_query` returns `DuckDBError`. - //! The block handle - shared_ptr handle; - //! The managed buffer node - FileBuffer *node; - data_ptr_t Ptr(); -}; +The result of this function must not be freed. It will be cleaned up when `duckdb_destroy_result` is called. -} // namespace duckdb +* result: The result object to fetch the nullmask from. +* returns: The error of the result. +*/ +DUCKDB_API const char *duckdb_result_error(duckdb_result *result); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/storage/storage_lock.hpp -// -// -//===----------------------------------------------------------------------===// +//===--------------------------------------------------------------------===// +// Result Functions +//===--------------------------------------------------------------------===// +/*! +Fetches a data chunk from the duckdb_result. This function should be called repeatedly until the result is exhausted. +This function supersedes all `duckdb_value` functions, as well as the `duckdb_column_data` and `duckdb_nullmask_data` +functions. It results in significantly better performance, and should be preferred in newer code-bases. +If this function is used, none of the other result functions can be used and vice versa (i.e. this function cannot be +mixed with the legacy result functions). +Use `duckdb_result_chunk_count` to figure out how many chunks there are in the result. +* result: The result object to fetch the data chunk from. +* chunk_index: The chunk index to fetch from. +* returns: The resulting data chunk. Returns `NULL` if the chunk index is out of bounds. +*/ +DUCKDB_API duckdb_data_chunk duckdb_result_get_chunk(duckdb_result result, idx_t chunk_index); +/*! +Returns the number of data chunks present in the result. -namespace duckdb { -class StorageLock; +* result: The result object +* returns: The resulting data chunk. Returns `NULL` if the chunk index is out of bounds. +*/ +DUCKDB_API idx_t duckdb_result_chunk_count(duckdb_result result); -enum class StorageLockType { SHARED = 0, EXCLUSIVE = 1 }; +// Safe fetch functions +// These functions will perform conversions if necessary. +// On failure (e.g. if conversion cannot be performed or if the value is NULL) a default value is returned. +// Note that these functions are slow since they perform bounds checking and conversion +// For fast access of values prefer using `duckdb_result_get_chunk` -class StorageLockKey { -public: - StorageLockKey(StorageLock &lock, StorageLockType type); - ~StorageLockKey(); +/*! + * returns: The boolean value at the specified location, or false if the value cannot be converted. + */ +DUCKDB_API bool duckdb_value_boolean(duckdb_result *result, idx_t col, idx_t row); -private: - StorageLock &lock; - StorageLockType type; -}; +/*! + * returns: The int8_t value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API int8_t duckdb_value_int8(duckdb_result *result, idx_t col, idx_t row); -class StorageLock { - friend class StorageLockKey; +/*! + * returns: The int16_t value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API int16_t duckdb_value_int16(duckdb_result *result, idx_t col, idx_t row); -public: - StorageLock(); +/*! + * returns: The int32_t value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API int32_t duckdb_value_int32(duckdb_result *result, idx_t col, idx_t row); - //! Get an exclusive lock - unique_ptr GetExclusiveLock(); - //! Get a shared lock - unique_ptr GetSharedLock(); +/*! + * returns: The int64_t value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API int64_t duckdb_value_int64(duckdb_result *result, idx_t col, idx_t row); -private: - mutex exclusive_lock; - atomic read_count; +/*! + * returns: The duckdb_hugeint value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API duckdb_hugeint duckdb_value_hugeint(duckdb_result *result, idx_t col, idx_t row); -private: - //! Release an exclusive lock - void ReleaseExclusiveLock(); - //! Release a shared lock - void ReleaseSharedLock(); -}; +/*! + * returns: The duckdb_decimal value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API duckdb_decimal duckdb_value_decimal(duckdb_result *result, idx_t col, idx_t row); -} // namespace duckdb +/*! + * returns: The uint8_t value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API uint8_t duckdb_value_uint8(duckdb_result *result, idx_t col, idx_t row); +/*! + * returns: The uint16_t value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API uint16_t duckdb_value_uint16(duckdb_result *result, idx_t col, idx_t row); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/execution/adaptive_filter.hpp -// -// -//===----------------------------------------------------------------------===// +/*! + * returns: The uint32_t value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API uint32_t duckdb_value_uint32(duckdb_result *result, idx_t col, idx_t row); +/*! + * returns: The uint64_t value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API uint64_t duckdb_value_uint64(duckdb_result *result, idx_t col, idx_t row); +/*! + * returns: The float value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API float duckdb_value_float(duckdb_result *result, idx_t col, idx_t row); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_aggregate_expression.hpp -// -// -//===----------------------------------------------------------------------===// +/*! + * returns: The double value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API double duckdb_value_double(duckdb_result *result, idx_t col, idx_t row); +/*! + * returns: The duckdb_date value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API duckdb_date duckdb_value_date(duckdb_result *result, idx_t col, idx_t row); +/*! + * returns: The duckdb_time value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API duckdb_time duckdb_value_time(duckdb_result *result, idx_t col, idx_t row); +/*! + * returns: The duckdb_timestamp value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API duckdb_timestamp duckdb_value_timestamp(duckdb_result *result, idx_t col, idx_t row); +/*! + * returns: The duckdb_interval value at the specified location, or 0 if the value cannot be converted. + */ +DUCKDB_API duckdb_interval duckdb_value_interval(duckdb_result *result, idx_t col, idx_t row); -#include +/*! +* returns: The char* value at the specified location, or nullptr if the value cannot be converted. +The result must be freed with `duckdb_free`. +*/ +DUCKDB_API char *duckdb_value_varchar(duckdb_result *result, idx_t col, idx_t row); -namespace duckdb { -class BoundAggregateExpression : public Expression { -public: - BoundAggregateExpression(AggregateFunction function, vector> children, - unique_ptr filter, unique_ptr bind_info, bool distinct); +/*! +* returns: The char* value at the specified location. ONLY works on VARCHAR columns and does not auto-cast. +If the column is NOT a VARCHAR column this function will return NULL. - //! The bound function expression - AggregateFunction function; - //! List of arguments to the function - vector> children; - //! The bound function data (if any) - unique_ptr bind_info; - //! True to aggregate on distinct values - bool distinct; +The result must NOT be freed. +*/ +DUCKDB_API char *duckdb_value_varchar_internal(duckdb_result *result, idx_t col, idx_t row); - //! Filter for this aggregate - unique_ptr filter; +/*! +* returns: The duckdb_blob value at the specified location. Returns a blob with blob.data set to nullptr if the +value cannot be converted. The resulting "blob.data" must be freed with `duckdb_free.` +*/ +DUCKDB_API duckdb_blob duckdb_value_blob(duckdb_result *result, idx_t col, idx_t row); -public: - bool IsAggregate() const override { - return true; - } - bool IsFoldable() const override { - return false; - } +/*! + * returns: Returns true if the value at the specified index is NULL, and false otherwise. + */ +DUCKDB_API bool duckdb_value_is_null(duckdb_result *result, idx_t col, idx_t row); - string ToString() const override; +//===--------------------------------------------------------------------===// +// Helpers +//===--------------------------------------------------------------------===// +/*! +Allocate `size` bytes of memory using the duckdb internal malloc function. Any memory allocated in this manner +should be freed using `duckdb_free`. - hash_t Hash() const override; - bool Equals(const BaseExpression *other) const override; - unique_ptr Copy() override; -}; -} // namespace duckdb +* size: The number of bytes to allocate. +* returns: A pointer to the allocated memory region. +*/ +DUCKDB_API void *duckdb_malloc(size_t size); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_between_expression.hpp -// -// -//===----------------------------------------------------------------------===// +/*! +Free a value returned from `duckdb_malloc`, `duckdb_value_varchar` or `duckdb_value_blob`. +* ptr: The memory region to de-allocate. +*/ +DUCKDB_API void duckdb_free(void *ptr); +/*! +The internal vector size used by DuckDB. +This is the amount of tuples that will fit into a data chunk created by `duckdb_create_data_chunk`. +* returns: The vector size. +*/ +DUCKDB_API idx_t duckdb_vector_size(); +//===--------------------------------------------------------------------===// +// Date/Time/Timestamp Helpers +//===--------------------------------------------------------------------===// +/*! +Decompose a `duckdb_date` object into year, month and date (stored as `duckdb_date_struct`). -namespace duckdb { +* date: The date object, as obtained from a `DUCKDB_TYPE_DATE` column. +* returns: The `duckdb_date_struct` with the decomposed elements. +*/ +DUCKDB_API duckdb_date_struct duckdb_from_date(duckdb_date date); -class BoundBetweenExpression : public Expression { -public: - BoundBetweenExpression(unique_ptr input, unique_ptr lower, unique_ptr upper, - bool lower_inclusive, bool upper_inclusive); +/*! +Re-compose a `duckdb_date` from year, month and date (`duckdb_date_struct`). - unique_ptr input; - unique_ptr lower; - unique_ptr upper; - bool lower_inclusive; - bool upper_inclusive; +* date: The year, month and date stored in a `duckdb_date_struct`. +* returns: The `duckdb_date` element. +*/ +DUCKDB_API duckdb_date duckdb_to_date(duckdb_date_struct date); -public: - string ToString() const override; +/*! +Decompose a `duckdb_time` object into hour, minute, second and microsecond (stored as `duckdb_time_struct`). - bool Equals(const BaseExpression *other) const override; +* time: The time object, as obtained from a `DUCKDB_TYPE_TIME` column. +* returns: The `duckdb_time_struct` with the decomposed elements. +*/ +DUCKDB_API duckdb_time_struct duckdb_from_time(duckdb_time time); - unique_ptr Copy() override; +/*! +Re-compose a `duckdb_time` from hour, minute, second and microsecond (`duckdb_time_struct`). -public: - ExpressionType LowerComparisonType() { - return lower_inclusive ? ExpressionType::COMPARE_GREATERTHANOREQUALTO : ExpressionType::COMPARE_GREATERTHAN; - } - ExpressionType UpperComparisonType() { - return upper_inclusive ? ExpressionType::COMPARE_LESSTHANOREQUALTO : ExpressionType::COMPARE_LESSTHAN; - } -}; -} // namespace duckdb +* time: The hour, minute, second and microsecond in a `duckdb_time_struct`. +* returns: The `duckdb_time` element. +*/ +DUCKDB_API duckdb_time duckdb_to_time(duckdb_time_struct time); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_case_expression.hpp -// -// -//===----------------------------------------------------------------------===// +/*! +Decompose a `duckdb_timestamp` object into a `duckdb_timestamp_struct`. +* ts: The ts object, as obtained from a `DUCKDB_TYPE_TIMESTAMP` column. +* returns: The `duckdb_timestamp_struct` with the decomposed elements. +*/ +DUCKDB_API duckdb_timestamp_struct duckdb_from_timestamp(duckdb_timestamp ts); +/*! +Re-compose a `duckdb_timestamp` from a duckdb_timestamp_struct. +* ts: The de-composed elements in a `duckdb_timestamp_struct`. +* returns: The `duckdb_timestamp` element. +*/ +DUCKDB_API duckdb_timestamp duckdb_to_timestamp(duckdb_timestamp_struct ts); +//===--------------------------------------------------------------------===// +// Hugeint Helpers +//===--------------------------------------------------------------------===// +/*! +Converts a duckdb_hugeint object (as obtained from a `DUCKDB_TYPE_HUGEINT` column) into a double. -namespace duckdb { +* val: The hugeint value. +* returns: The converted `double` element. +*/ +DUCKDB_API double duckdb_hugeint_to_double(duckdb_hugeint val); -struct BoundCaseCheck { - unique_ptr when_expr; - unique_ptr then_expr; -}; +/*! +Converts a double value to a duckdb_hugeint object. -class BoundCaseExpression : public Expression { -public: - BoundCaseExpression(LogicalType type); - BoundCaseExpression(unique_ptr when_expr, unique_ptr then_expr, - unique_ptr else_expr); +If the conversion fails because the double value is too big the result will be 0. - vector case_checks; - unique_ptr else_expr; +* val: The double value. +* returns: The converted `duckdb_hugeint` element. +*/ +DUCKDB_API duckdb_hugeint duckdb_double_to_hugeint(double val); -public: - string ToString() const override; +//===--------------------------------------------------------------------===// +// Decimal Helpers +//===--------------------------------------------------------------------===// +/*! +Converts a duckdb_decimal object (as obtained from a `DUCKDB_TYPE_DECIMAL` column) into a double. - bool Equals(const BaseExpression *other) const override; +* val: The decimal value. +* returns: The converted `double` element. +*/ +DUCKDB_API double duckdb_decimal_to_double(duckdb_decimal val); - unique_ptr Copy() override; -}; -} // namespace duckdb +//===--------------------------------------------------------------------===// +// Prepared Statements +//===--------------------------------------------------------------------===// +// A prepared statement is a parameterized query that allows you to bind parameters to it. +// * This is useful to easily supply parameters to functions and avoid SQL injection attacks. +// * This is useful to speed up queries that you will execute several times with different parameters. +// Because the query will only be parsed, bound, optimized and planned once during the prepare stage, +// rather than once per execution. +// For example: +// SELECT * FROM tbl WHERE id=? +// Or a query with multiple parameters: +// SELECT * FROM tbl WHERE id=$1 OR name=$2 -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_cast_expression.hpp -// -// -//===----------------------------------------------------------------------===// +/*! +Create a prepared statement object from a query. +Note that after calling `duckdb_prepare`, the prepared statement should always be destroyed using +`duckdb_destroy_prepare`, even if the prepare fails. +If the prepare fails, `duckdb_prepare_error` can be called to obtain the reason why the prepare failed. +* connection: The connection object +* query: The SQL query to prepare +* out_prepared_statement: The resulting prepared statement object +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_prepare(duckdb_connection connection, const char *query, + duckdb_prepared_statement *out_prepared_statement); +/*! +Closes the prepared statement and de-allocates all memory allocated for the statement. -namespace duckdb { +* prepared_statement: The prepared statement to destroy. +*/ +DUCKDB_API void duckdb_destroy_prepare(duckdb_prepared_statement *prepared_statement); -class BoundCastExpression : public Expression { -public: - BoundCastExpression(unique_ptr child, LogicalType target_type, bool try_cast = false); +/*! +Returns the error message associated with the given prepared statement. +If the prepared statement has no error message, this returns `nullptr` instead. - //! The child type - unique_ptr child; - //! Whether to use try_cast or not. try_cast converts cast failures into NULLs instead of throwing an error. - bool try_cast; +The error message should not be freed. It will be de-allocated when `duckdb_destroy_prepare` is called. -public: - LogicalType source_type() { - return child->return_type; - } +* prepared_statement: The prepared statement to obtain the error from. +* returns: The error message, or `nullptr` if there is none. +*/ +DUCKDB_API const char *duckdb_prepare_error(duckdb_prepared_statement prepared_statement); - //! Cast an expression to the specified SQL type if required - static unique_ptr AddCastToType(unique_ptr expr, const LogicalType &target_type); - //! Returns true if a cast is invertible (i.e. CAST(s -> t -> s) = s for all values of s). This is not true for e.g. - //! boolean casts, because that can be e.g. -1 -> TRUE -> 1. This is necessary to prevent some optimizer bugs. - static bool CastIsInvertible(const LogicalType &source_type, const LogicalType &target_type); +/*! +Returns the number of parameters that can be provided to the given prepared statement. - string ToString() const override; +Returns 0 if the query was not successfully prepared. - bool Equals(const BaseExpression *other) const override; +* prepared_statement: The prepared statement to obtain the number of parameters for. +*/ +DUCKDB_API idx_t duckdb_nparams(duckdb_prepared_statement prepared_statement); - unique_ptr Copy() override; -}; -} // namespace duckdb +/*! +Returns the parameter type for the parameter at the given index. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_columnref_expression.hpp -// -// -//===----------------------------------------------------------------------===// +Returns `DUCKDB_TYPE_INVALID` if the parameter index is out of range or the statement was not successfully prepared. +* prepared_statement: The prepared statement. +* param_idx: The parameter index. +* returns: The parameter type +*/ +DUCKDB_API duckdb_type duckdb_param_type(duckdb_prepared_statement prepared_statement, idx_t param_idx); +/*! +Binds a bool value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_boolean(duckdb_prepared_statement prepared_statement, idx_t param_idx, bool val); +/*! +Binds an int8_t value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_int8(duckdb_prepared_statement prepared_statement, idx_t param_idx, int8_t val); +/*! +Binds an int16_t value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_int16(duckdb_prepared_statement prepared_statement, idx_t param_idx, int16_t val); +/*! +Binds an int32_t value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_int32(duckdb_prepared_statement prepared_statement, idx_t param_idx, int32_t val); -namespace duckdb { +/*! +Binds an int64_t value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_int64(duckdb_prepared_statement prepared_statement, idx_t param_idx, int64_t val); -//! A BoundColumnRef expression represents a ColumnRef expression that was bound to an actual table and column index. It -//! is not yet executable, however. The ColumnBindingResolver transforms the BoundColumnRefExpressions into -//! BoundExpressions, which refer to indexes into the physical chunks that pass through the executor. -class BoundColumnRefExpression : public Expression { -public: - BoundColumnRefExpression(LogicalType type, ColumnBinding binding, idx_t depth = 0); - BoundColumnRefExpression(string alias, LogicalType type, ColumnBinding binding, idx_t depth = 0); +/*! +Binds an duckdb_hugeint value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_hugeint(duckdb_prepared_statement prepared_statement, idx_t param_idx, + duckdb_hugeint val); - //! Column index set by the binder, used to generate the final BoundExpression - ColumnBinding binding; - //! The subquery depth (i.e. depth 0 = current query, depth 1 = parent query, depth 2 = parent of parent, etc...). - //! This is only non-zero for correlated expressions inside subqueries. - idx_t depth; +/*! +Binds an uint8_t value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_uint8(duckdb_prepared_statement prepared_statement, idx_t param_idx, uint8_t val); -public: - bool IsScalar() const override { - return false; - } - bool IsFoldable() const override { - return false; - } +/*! +Binds an uint16_t value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_uint16(duckdb_prepared_statement prepared_statement, idx_t param_idx, uint16_t val); - string ToString() const override; +/*! +Binds an uint32_t value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_uint32(duckdb_prepared_statement prepared_statement, idx_t param_idx, uint32_t val); - bool Equals(const BaseExpression *other) const override; - hash_t Hash() const override; +/*! +Binds an uint64_t value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_uint64(duckdb_prepared_statement prepared_statement, idx_t param_idx, uint64_t val); - unique_ptr Copy() override; -}; -} // namespace duckdb +/*! +Binds an float value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_float(duckdb_prepared_statement prepared_statement, idx_t param_idx, float val); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_comparison_expression.hpp -// -// -//===----------------------------------------------------------------------===// +/*! +Binds an double value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_double(duckdb_prepared_statement prepared_statement, idx_t param_idx, double val); +/*! +Binds a duckdb_date value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_date(duckdb_prepared_statement prepared_statement, idx_t param_idx, + duckdb_date val); +/*! +Binds a duckdb_time value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_time(duckdb_prepared_statement prepared_statement, idx_t param_idx, + duckdb_time val); +/*! +Binds a duckdb_timestamp value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_timestamp(duckdb_prepared_statement prepared_statement, idx_t param_idx, + duckdb_timestamp val); +/*! +Binds a duckdb_interval value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_interval(duckdb_prepared_statement prepared_statement, idx_t param_idx, + duckdb_interval val); -namespace duckdb { +/*! +Binds a null-terminated varchar value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_varchar(duckdb_prepared_statement prepared_statement, idx_t param_idx, + const char *val); -class BoundComparisonExpression : public Expression { -public: - BoundComparisonExpression(ExpressionType type, unique_ptr left, unique_ptr right); +/*! +Binds a varchar value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_varchar_length(duckdb_prepared_statement prepared_statement, idx_t param_idx, + const char *val, idx_t length); - unique_ptr left; - unique_ptr right; +/*! +Binds a blob value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_blob(duckdb_prepared_statement prepared_statement, idx_t param_idx, + const void *data, idx_t length); -public: - string ToString() const override; +/*! +Binds a NULL value to the prepared statement at the specified index. +*/ +DUCKDB_API duckdb_state duckdb_bind_null(duckdb_prepared_statement prepared_statement, idx_t param_idx); - bool Equals(const BaseExpression *other) const override; +/*! +Executes the prepared statement with the given bound parameters, and returns a materialized query result. - unique_ptr Copy() override; +This method can be called multiple times for each prepared statement, and the parameters can be modified +between calls to this function. -public: - static LogicalType BindComparison(LogicalType left_type, LogicalType right_type); -}; -} // namespace duckdb +* prepared_statement: The prepared statement to execute. +* out_result: The query result. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_execute_prepared(duckdb_prepared_statement prepared_statement, + duckdb_result *out_result); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_conjunction_expression.hpp -// -// -//===----------------------------------------------------------------------===// +/*! +Executes the prepared statement with the given bound parameters, and returns an arrow query result. +* prepared_statement: The prepared statement to execute. +* out_result: The query result. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_execute_prepared_arrow(duckdb_prepared_statement prepared_statement, + duckdb_arrow *out_result); +//===--------------------------------------------------------------------===// +// Value Interface +//===--------------------------------------------------------------------===// +/*! +Destroys the value and de-allocates all memory allocated for that type. +* value: The value to destroy. +*/ +DUCKDB_API void duckdb_destroy_value(duckdb_value *value); +/*! +Creates a value from a null-terminated string -namespace duckdb { +* value: The null-terminated string +* returns: The value. This must be destroyed with `duckdb_destroy_value`. +*/ +DUCKDB_API duckdb_value duckdb_create_varchar(const char *text); -class BoundConjunctionExpression : public Expression { -public: - explicit BoundConjunctionExpression(ExpressionType type); - BoundConjunctionExpression(ExpressionType type, unique_ptr left, unique_ptr right); +/*! +Creates a value from a string - vector> children; +* value: The text +* length: The length of the text +* returns: The value. This must be destroyed with `duckdb_destroy_value`. +*/ +DUCKDB_API duckdb_value duckdb_create_varchar_length(const char *text, idx_t length); -public: - string ToString() const override; +/*! +Creates a value from an int64 - bool Equals(const BaseExpression *other) const override; +* value: The bigint value +* returns: The value. This must be destroyed with `duckdb_destroy_value`. +*/ +DUCKDB_API duckdb_value duckdb_create_int64(int64_t val); - unique_ptr Copy() override; -}; -} // namespace duckdb +/*! +Obtains a string representation of the given value. +The result must be destroyed with `duckdb_free`. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_constant_expression.hpp -// -// -//===----------------------------------------------------------------------===// +* value: The value +* returns: The string value. This must be destroyed with `duckdb_free`. +*/ +DUCKDB_API char *duckdb_get_varchar(duckdb_value value); +/*! +Obtains an int64 of the given value. +* value: The value +* returns: The int64 value, or 0 if no conversion is possible +*/ +DUCKDB_API int64_t duckdb_get_int64(duckdb_value value); +//===--------------------------------------------------------------------===// +// Logical Type Interface +//===--------------------------------------------------------------------===// +/*! +Creates a `duckdb_logical_type` from a standard primitive type. +The resulting type should be destroyed with `duckdb_destroy_logical_type`. +This should not be used with `DUCKDB_TYPE_DECIMAL`. -namespace duckdb { +* type: The primitive type to create. +* returns: The logical type. +*/ +DUCKDB_API duckdb_logical_type duckdb_create_logical_type(duckdb_type type); -class BoundConstantExpression : public Expression { -public: - explicit BoundConstantExpression(Value value); +/*! +Creates a `duckdb_logical_type` of type decimal with the specified width and scale +The resulting type should be destroyed with `duckdb_destroy_logical_type`. - Value value; +* width: The width of the decimal type +* scale: The scale of the decimal type +* returns: The logical type. +*/ +DUCKDB_API duckdb_logical_type duckdb_create_decimal_type(uint8_t width, uint8_t scale); -public: - string ToString() const override; +/*! +Retrieves the type class of a `duckdb_logical_type`. - bool Equals(const BaseExpression *other) const override; - hash_t Hash() const override; +* type: The logical type object +* returns: The type id +*/ +DUCKDB_API duckdb_type duckdb_get_type_id(duckdb_logical_type type); - unique_ptr Copy() override; -}; -} // namespace duckdb +/*! +Retrieves the width of a decimal type. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_default_expression.hpp -// -// -//===----------------------------------------------------------------------===// +* type: The logical type object +* returns: The width of the decimal type +*/ +DUCKDB_API uint8_t duckdb_decimal_width(duckdb_logical_type type); +/*! +Retrieves the scale of a decimal type. +* type: The logical type object +* returns: The scale of the decimal type +*/ +DUCKDB_API uint8_t duckdb_decimal_scale(duckdb_logical_type type); +/*! +Retrieves the internal storage type of a decimal type. +* type: The logical type object +* returns: The internal type of the decimal type +*/ +DUCKDB_API duckdb_type duckdb_decimal_internal_type(duckdb_logical_type type); -namespace duckdb { +/*! +Retrieves the internal storage type of an enum type. -class BoundDefaultExpression : public Expression { -public: - explicit BoundDefaultExpression(LogicalType type = LogicalType()) - : Expression(ExpressionType::VALUE_DEFAULT, ExpressionClass::BOUND_DEFAULT, type) { - } +* type: The logical type object +* returns: The internal type of the enum type +*/ +DUCKDB_API duckdb_type duckdb_enum_internal_type(duckdb_logical_type type); -public: - bool IsScalar() const override { - return false; - } - bool IsFoldable() const override { - return false; - } +/*! +Retrieves the dictionary size of the enum type - string ToString() const override { - return "DEFAULT"; - } +* type: The logical type object +* returns: The dictionary size of the enum type +*/ +DUCKDB_API uint32_t duckdb_enum_dictionary_size(duckdb_logical_type type); - unique_ptr Copy() override { - return make_unique(return_type); - } -}; -} // namespace duckdb +/*! +Retrieves the dictionary value at the specified position from the enum. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_function_expression.hpp -// -// -//===----------------------------------------------------------------------===// +The result must be freed with `duckdb_free` +* type: The logical type object +* index: The index in the dictionary +* returns: The string value of the enum type. Must be freed with `duckdb_free`. +*/ +DUCKDB_API char *duckdb_enum_dictionary_value(duckdb_logical_type type, idx_t index); +/*! +Retrieves the child type of the given list type. +The result must be freed with `duckdb_destroy_logical_type` +* type: The logical type object +* returns: The child type of the list type. Must be destroyed with `duckdb_destroy_logical_type`. +*/ +DUCKDB_API duckdb_logical_type duckdb_list_type_child_type(duckdb_logical_type type); +/*! +Returns the number of children of a struct type. -namespace duckdb { -class ScalarFunctionCatalogEntry; +* type: The logical type object +* returns: The number of children of a struct type. +*/ +DUCKDB_API idx_t duckdb_struct_type_child_count(duckdb_logical_type type); -//! Represents a function call that has been bound to a base function -class BoundFunctionExpression : public Expression { -public: - BoundFunctionExpression(LogicalType return_type, ScalarFunction bound_function, - vector> arguments, unique_ptr bind_info, - bool is_operator = false); +/*! +Retrieves the name of the struct child. - // The bound function expression - ScalarFunction function; - //! List of child-expressions of the function - vector> children; - //! The bound function data (if any) - unique_ptr bind_info; - //! Whether or not the function is an operator, only used for rendering - bool is_operator; +The result must be freed with `duckdb_free` -public: - bool HasSideEffects() const override; - bool IsFoldable() const override; - string ToString() const override; +* type: The logical type object +* index: The child index +* returns: The name of the struct type. Must be freed with `duckdb_free`. +*/ +DUCKDB_API char *duckdb_struct_type_child_name(duckdb_logical_type type, idx_t index); - hash_t Hash() const override; - bool Equals(const BaseExpression *other) const override; +/*! +Retrieves the child type of the given struct type at the specified index. - unique_ptr Copy() override; -}; -} // namespace duckdb +The result must be freed with `duckdb_destroy_logical_type` -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_operator_expression.hpp -// -// -//===----------------------------------------------------------------------===// +* type: The logical type object +* index: The child index +* returns: The child type of the struct type. Must be destroyed with `duckdb_destroy_logical_type`. +*/ +DUCKDB_API duckdb_logical_type duckdb_struct_type_child_type(duckdb_logical_type type, idx_t index); + +/*! +Destroys the logical type and de-allocates all memory allocated for that type. +* type: The logical type to destroy. +*/ +DUCKDB_API void duckdb_destroy_logical_type(duckdb_logical_type *type); +//===--------------------------------------------------------------------===// +// Data Chunk Interface +//===--------------------------------------------------------------------===// +/*! +Creates an empty DataChunk with the specified set of types. +* types: An array of types of the data chunk. +* column_count: The number of columns. +* returns: The data chunk. +*/ +DUCKDB_API duckdb_data_chunk duckdb_create_data_chunk(duckdb_logical_type *types, idx_t column_count); +/*! +Destroys the data chunk and de-allocates all memory allocated for that chunk. -namespace duckdb { +* chunk: The data chunk to destroy. +*/ +DUCKDB_API void duckdb_destroy_data_chunk(duckdb_data_chunk *chunk); -class BoundOperatorExpression : public Expression { -public: - BoundOperatorExpression(ExpressionType type, LogicalType return_type); +/*! +Resets a data chunk, clearing the validity masks and setting the cardinality of the data chunk to 0. - vector> children; +* chunk: The data chunk to reset. +*/ +DUCKDB_API void duckdb_data_chunk_reset(duckdb_data_chunk chunk); -public: - string ToString() const override; +/*! +Retrieves the number of columns in a data chunk. - bool Equals(const BaseExpression *other) const override; +* chunk: The data chunk to get the data from +* returns: The number of columns in the data chunk +*/ +DUCKDB_API idx_t duckdb_data_chunk_get_column_count(duckdb_data_chunk chunk); - unique_ptr Copy() override; -}; -} // namespace duckdb +/*! +Retrieves the vector at the specified column index in the data chunk. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_parameter_expression.hpp -// -// -//===----------------------------------------------------------------------===// +The pointer to the vector is valid for as long as the chunk is alive. +It does NOT need to be destroyed. +* chunk: The data chunk to get the data from +* returns: The vector +*/ +DUCKDB_API duckdb_vector duckdb_data_chunk_get_vector(duckdb_data_chunk chunk, idx_t col_idx); +/*! +Retrieves the current number of tuples in a data chunk. +* chunk: The data chunk to get the data from +* returns: The number of tuples in the data chunk +*/ +DUCKDB_API idx_t duckdb_data_chunk_get_size(duckdb_data_chunk chunk); +/*! +Sets the current number of tuples in a data chunk. +* chunk: The data chunk to set the size in +* size: The number of tuples in the data chunk +*/ +DUCKDB_API void duckdb_data_chunk_set_size(duckdb_data_chunk chunk, idx_t size); -namespace duckdb { +//===--------------------------------------------------------------------===// +// Vector Interface +//===--------------------------------------------------------------------===// +/*! +Retrieves the column type of the specified vector. -class BoundParameterExpression : public Expression { -public: - explicit BoundParameterExpression(idx_t parameter_nr); +The result must be destroyed with `duckdb_destroy_logical_type`. - idx_t parameter_nr; - Value *value; +* vector: The vector get the data from +* returns: The type of the vector +*/ +DUCKDB_API duckdb_logical_type duckdb_vector_get_column_type(duckdb_vector vector); -public: - bool IsScalar() const override; - bool HasParameter() const override; - bool IsFoldable() const override; +/*! +Retrieves the data pointer of the vector. - string ToString() const override; +The data pointer can be used to read or write values from the vector. +How to read or write values depends on the type of the vector. - bool Equals(const BaseExpression *other) const override; - hash_t Hash() const override; +* vector: The vector to get the data from +* returns: The data pointer +*/ +DUCKDB_API void *duckdb_vector_get_data(duckdb_vector vector); - unique_ptr Copy() override; -}; -} // namespace duckdb +/*! +Retrieves the validity mask pointer of the specified vector. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_reference_expression.hpp -// -// -//===----------------------------------------------------------------------===// +If all values are valid, this function MIGHT return NULL! +The validity mask is a bitset that signifies null-ness within the data chunk. +It is a series of uint64_t values, where each uint64_t value contains validity for 64 tuples. +The bit is set to 1 if the value is valid (i.e. not NULL) or 0 if the value is invalid (i.e. NULL). +Validity of a specific value can be obtained like this: +idx_t entry_idx = row_idx / 64; +idx_t idx_in_entry = row_idx % 64; +bool is_valid = validity_mask[entry_idx] & (1 << idx_in_entry); +Alternatively, the (slower) duckdb_validity_row_is_valid function can be used. -namespace duckdb { +* vector: The vector to get the data from +* returns: The pointer to the validity mask, or NULL if no validity mask is present +*/ +DUCKDB_API uint64_t *duckdb_vector_get_validity(duckdb_vector vector); -//! A BoundReferenceExpression represents a physical index into a DataChunk -class BoundReferenceExpression : public Expression { -public: - BoundReferenceExpression(string alias, LogicalType type, idx_t index); - BoundReferenceExpression(LogicalType type, idx_t index); +/*! +Ensures the validity mask is writable by allocating it. - //! Index used to access data in the chunks - idx_t index; +After this function is called, `duckdb_vector_get_validity` will ALWAYS return non-NULL. +This allows null values to be written to the vector, regardless of whether a validity mask was present before. -public: - bool IsScalar() const override { - return false; - } - bool IsFoldable() const override { - return false; - } +* vector: The vector to alter +*/ +DUCKDB_API void duckdb_vector_ensure_validity_writable(duckdb_vector vector); - string ToString() const override; +/*! +Assigns a string element in the vector at the specified location. - hash_t Hash() const override; - bool Equals(const BaseExpression *other) const override; +* vector: The vector to alter +* index: The row position in the vector to assign the string to +* str: The null-terminated string +*/ +DUCKDB_API void duckdb_vector_assign_string_element(duckdb_vector vector, idx_t index, const char *str); - unique_ptr Copy() override; -}; -} // namespace duckdb +/*! +Assigns a string element in the vector at the specified location. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression/bound_subquery_expression.hpp -// -// -//===----------------------------------------------------------------------===// +* vector: The vector to alter +* index: The row position in the vector to assign the string to +* str: The string +* str_len: The length of the string (in bytes) +*/ +DUCKDB_API void duckdb_vector_assign_string_element_len(duckdb_vector vector, idx_t index, const char *str, + idx_t str_len); +/*! +Retrieves the child vector of a list vector. +The resulting vector is valid as long as the parent vector is valid. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/enums/subquery_type.hpp -// -// -//===----------------------------------------------------------------------===// +* vector: The vector +* returns: The child vector +*/ +DUCKDB_API duckdb_vector duckdb_list_vector_get_child(duckdb_vector vector); +/*! +Returns the size of the child vector of the list +* vector: The vector +* returns: The size of the child list +*/ +DUCKDB_API idx_t duckdb_list_vector_get_size(duckdb_vector vector); +/*! +Retrieves the child vector of a struct vector. +The resulting vector is valid as long as the parent vector is valid. -namespace duckdb { +* vector: The vector +* index: The child index +* returns: The child vector +*/ +DUCKDB_API duckdb_vector duckdb_struct_vector_get_child(duckdb_vector vector, idx_t index); //===--------------------------------------------------------------------===// -// Subquery Types +// Validity Mask Functions //===--------------------------------------------------------------------===// -enum class SubqueryType : uint8_t { - INVALID = 0, - SCALAR = 1, // Regular scalar subquery - EXISTS = 2, // EXISTS (SELECT...) - NOT_EXISTS = 3, // NOT EXISTS(SELECT...) - ANY = 4, // x = ANY(SELECT...) OR x IN (SELECT...) -}; +/*! +Returns whether or not a row is valid (i.e. not NULL) in the given validity mask. -} // namespace duckdb +* validity: The validity mask, as obtained through `duckdb_data_chunk_get_validity` +* row: The row index +* returns: true if the row is valid, false otherwise +*/ +DUCKDB_API bool duckdb_validity_row_is_valid(uint64_t *validity, idx_t row); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/binder.hpp -// -// -//===----------------------------------------------------------------------===// +/*! +In a validity mask, sets a specific row to either valid or invalid. +Note that `duckdb_data_chunk_ensure_validity_writable` should be called before calling `duckdb_data_chunk_get_validity`, +to ensure that there is a validity mask to write to. +* validity: The validity mask, as obtained through `duckdb_data_chunk_get_validity`. +* row: The row index +* valid: Whether or not to set the row to valid, or invalid +*/ +DUCKDB_API void duckdb_validity_set_row_validity(uint64_t *validity, idx_t row, bool valid); +/*! +In a validity mask, sets a specific row to invalid. +Equivalent to `duckdb_validity_set_row_validity` with valid set to false. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/tokens.hpp -// -// -//===----------------------------------------------------------------------===// +* validity: The validity mask +* row: The row index +*/ +DUCKDB_API void duckdb_validity_set_row_invalid(uint64_t *validity, idx_t row); +/*! +In a validity mask, sets a specific row to valid. +Equivalent to `duckdb_validity_set_row_validity` with valid set to true. -namespace duckdb { +* validity: The validity mask +* row: The row index +*/ +DUCKDB_API void duckdb_validity_set_row_valid(uint64_t *validity, idx_t row); //===--------------------------------------------------------------------===// -// Statements +// Table Functions //===--------------------------------------------------------------------===// -class SQLStatement; +typedef void *duckdb_table_function; +typedef void *duckdb_bind_info; +typedef void *duckdb_init_info; +typedef void *duckdb_function_info; -class AlterStatement; -class CallStatement; -class CopyStatement; -class CreateStatement; -class DeleteStatement; -class DropStatement; -class InsertStatement; -class SelectStatement; -class TransactionStatement; -class UpdateStatement; -class PrepareStatement; -class ExecuteStatement; -class PragmaStatement; -class ShowStatement; -class ExplainStatement; -class ExportStatement; -class VacuumStatement; -class RelationStatement; -class SetStatement; -class LoadStatement; +typedef void (*duckdb_table_function_bind_t)(duckdb_bind_info info); +typedef void (*duckdb_table_function_init_t)(duckdb_init_info info); +typedef void (*duckdb_table_function_t)(duckdb_function_info info, duckdb_data_chunk output); +typedef void (*duckdb_delete_callback_t)(void *data); -//===--------------------------------------------------------------------===// -// Query Node -//===--------------------------------------------------------------------===// -class QueryNode; -class SelectNode; -class SetOperationNode; -class RecursiveCTENode; +/*! +Creates a new empty table function. -//===--------------------------------------------------------------------===// -// Expressions -//===--------------------------------------------------------------------===// -class ParsedExpression; +The return value should be destroyed with `duckdb_destroy_table_function`. -class BetweenExpression; -class CaseExpression; -class CastExpression; -class CollateExpression; -class ColumnRefExpression; -class ComparisonExpression; -class ConjunctionExpression; -class ConstantExpression; -class DefaultExpression; -class FunctionExpression; -class LambdaExpression; -class OperatorExpression; -class ParameterExpression; -class PositionalReferenceExpression; -class StarExpression; -class SubqueryExpression; -class WindowExpression; +* returns: The table function object. +*/ +DUCKDB_API duckdb_table_function duckdb_create_table_function(); -//===--------------------------------------------------------------------===// -// Constraints -//===--------------------------------------------------------------------===// -class Constraint; +/*! +Destroys the given table function object. -class NotNullConstraint; -class CheckConstraint; -class UniqueConstraint; +* table_function: The table function to destroy +*/ +DUCKDB_API void duckdb_destroy_table_function(duckdb_table_function *table_function); -//===--------------------------------------------------------------------===// -// TableRefs -//===--------------------------------------------------------------------===// -class TableRef; +/*! +Sets the name of the given table function. -class BaseTableRef; -class CrossProductRef; -class JoinRef; -class SubqueryRef; -class TableFunctionRef; -class EmptyTableRef; -class ExpressionListRef; +* table_function: The table function +* name: The name of the table function +*/ +DUCKDB_API void duckdb_table_function_set_name(duckdb_table_function table_function, const char *name); -//===--------------------------------------------------------------------===// -// Other -//===--------------------------------------------------------------------===// -struct SampleOptions; +/*! +Adds a parameter to the table function. -} // namespace duckdb +* table_function: The table function +* type: The type of the parameter to add. +*/ +DUCKDB_API void duckdb_table_function_add_parameter(duckdb_table_function table_function, duckdb_logical_type type); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/bind_context.hpp -// -// -//===----------------------------------------------------------------------===// +/*! +Assigns extra information to the table function that can be fetched during binding, etc. +* table_function: The table function +* extra_info: The extra information +* destroy: The callback that will be called to destroy the bind data (if any) +*/ +DUCKDB_API void duckdb_table_function_set_extra_info(duckdb_table_function table_function, void *extra_info, + duckdb_delete_callback_t destroy); +/*! +Sets the bind function of the table function +* table_function: The table function +* bind: The bind function +*/ +DUCKDB_API void duckdb_table_function_set_bind(duckdb_table_function table_function, duckdb_table_function_bind_t bind); +/*! +Sets the init function of the table function -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/catalog/catalog_entry/table_function_catalog_entry.hpp -// -// -//===----------------------------------------------------------------------===// +* table_function: The table function +* init: The init function +*/ +DUCKDB_API void duckdb_table_function_set_init(duckdb_table_function table_function, duckdb_table_function_init_t init); +/*! +Sets the main function of the table function +* table_function: The table function +* function: The function +*/ +DUCKDB_API void duckdb_table_function_set_function(duckdb_table_function table_function, + duckdb_table_function_t function); +/*! +Sets whether or not the given table function supports projection pushdown. +If this is set to true, the system will provide a list of all required columns in the `init` stage through +the `duckdb_init_get_column_count` and `duckdb_init_get_column_index` functions. +If this is set to false (the default), the system will expect all columns to be projected. +* table_function: The table function +* pushdown: True if the table function supports projection pushdown, false otherwise. +*/ +DUCKDB_API void duckdb_table_function_supports_projection_pushdown(duckdb_table_function table_function, bool pushdown); +/*! +Register the table function object within the given connection. -namespace duckdb { +The function requires at least a name, a bind function, an init function and a main function. -class Catalog; -class Constraint; +If the function is incomplete or a function with this name already exists DuckDBError is returned. -struct CreateTableFunctionInfo; +* con: The connection to register it in. +* function: The function pointer +* returns: Whether or not the registration was successful. +*/ +DUCKDB_API duckdb_state duckdb_register_table_function(duckdb_connection con, duckdb_table_function function); -//! A table function in the catalog -class TableFunctionCatalogEntry : public StandardEntry { -public: - TableFunctionCatalogEntry(Catalog *catalog, SchemaCatalogEntry *schema, CreateTableFunctionInfo *info); +//===--------------------------------------------------------------------===// +// Table Function Bind +//===--------------------------------------------------------------------===// +/*! +Retrieves the extra info of the function as set in `duckdb_table_function_set_extra_info` - //! The table function - vector functions; -}; -} // namespace duckdb +* info: The info object +* returns: The extra info +*/ +DUCKDB_API void *duckdb_bind_get_extra_info(duckdb_bind_info info); + +/*! +Adds a result column to the output of the table function. + +* info: The info object +* name: The name of the column +* type: The logical type of the column +*/ +DUCKDB_API void duckdb_bind_add_result_column(duckdb_bind_info info, const char *name, duckdb_logical_type type); +/*! +Retrieves the number of regular (non-named) parameters to the function. +* info: The info object +* returns: The number of parameters +*/ +DUCKDB_API idx_t duckdb_bind_get_parameter_count(duckdb_bind_info info); +/*! +Retrieves the parameter at the given index. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/expression/columnref_expression.hpp -// -// -//===----------------------------------------------------------------------===// +The result must be destroyed with `duckdb_destroy_value`. + +* info: The info object +* index: The index of the parameter to get +* returns: The value of the parameter. Must be destroyed with `duckdb_destroy_value`. +*/ +DUCKDB_API duckdb_value duckdb_bind_get_parameter(duckdb_bind_info info, idx_t index); + +/*! +Sets the user-provided bind data in the bind object. This object can be retrieved again during execution. + +* info: The info object +* extra_data: The bind data object. +* destroy: The callback that will be called to destroy the bind data (if any) +*/ +DUCKDB_API void duckdb_bind_set_bind_data(duckdb_bind_info info, void *bind_data, duckdb_delete_callback_t destroy); +/*! +Report that an error has occurred while calling bind. +* info: The info object +* error: The error message +*/ +DUCKDB_API void duckdb_bind_set_error(duckdb_bind_info info, const char *error); +//===--------------------------------------------------------------------===// +// Table Function Init +//===--------------------------------------------------------------------===// +/*! +Retrieves the extra info of the function as set in `duckdb_table_function_set_extra_info` +* info: The info object +* returns: The extra info +*/ +DUCKDB_API void *duckdb_init_get_extra_info(duckdb_init_info info); -namespace duckdb { +/*! +Gets the bind data set by `duckdb_bind_set_bind_data` during the bind. -//! Represents a reference to a column from either the FROM clause or from an -//! alias -class ColumnRefExpression : public ParsedExpression { -public: - //! Specify both the column and table name - ColumnRefExpression(string column_name, string table_name); - //! Only specify the column name, the table name will be derived later - explicit ColumnRefExpression(string column_name); - //! Specify a set of names - explicit ColumnRefExpression(vector column_names); +Note that the bind data should be considered as read-only. +For tracking state, use the init data instead. - //! The stack of names in order of which they appear (column_names[0].column_names[1].column_names[2]....) - vector column_names; +* info: The info object +* returns: The bind data object +*/ +DUCKDB_API void *duckdb_init_get_bind_data(duckdb_init_info info); -public: - bool IsQualified() const; - const string &GetColumnName() const; - const string &GetTableName() const; - bool IsScalar() const override { - return false; - } +/*! +Sets the user-provided init data in the init object. This object can be retrieved again during execution. - string GetName() const override; - string ToString() const override; +* info: The info object +* extra_data: The init data object. +* destroy: The callback that will be called to destroy the init data (if any) +*/ +DUCKDB_API void duckdb_init_set_init_data(duckdb_init_info info, void *init_data, duckdb_delete_callback_t destroy); - static bool Equals(const ColumnRefExpression *a, const ColumnRefExpression *b); - hash_t Hash() const override; +/*! +Returns the number of projected columns. - unique_ptr Copy() const override; +This function must be used if projection pushdown is enabled to figure out which columns to emit. - void Serialize(FieldWriter &writer) const override; - static unique_ptr Deserialize(ExpressionType type, FieldReader &source); -}; -} // namespace duckdb +* info: The info object +* returns: The number of projected columns. +*/ +DUCKDB_API idx_t duckdb_init_get_column_count(duckdb_init_info info); +/*! +Returns the column index of the projected column at the specified position. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/qualified_name_set.hpp -// -// -//===----------------------------------------------------------------------===// +This function must be used if projection pushdown is enabled to figure out which columns to emit. +* info: The info object +* column_index: The index at which to get the projected column index, from 0..duckdb_init_get_column_count(info) +* returns: The column index of the projected column. +*/ +DUCKDB_API idx_t duckdb_init_get_column_index(duckdb_init_info info, idx_t column_index); +/*! +Report that an error has occurred while calling init. -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/qualified_name.hpp -// -// -//===----------------------------------------------------------------------===// +* info: The info object +* error: The error message +*/ +DUCKDB_API void duckdb_init_set_error(duckdb_init_info info, const char *error); +//===--------------------------------------------------------------------===// +// Table Function +//===--------------------------------------------------------------------===// +/*! +Retrieves the extra info of the function as set in `duckdb_table_function_set_extra_info` +* info: The info object +* returns: The extra info +*/ +DUCKDB_API void *duckdb_function_get_extra_info(duckdb_function_info info); +/*! +Gets the bind data set by `duckdb_bind_set_bind_data` during the bind. +Note that the bind data should be considered as read-only. +For tracking state, use the init data instead. +* info: The info object +* returns: The bind data object +*/ +DUCKDB_API void *duckdb_function_get_bind_data(duckdb_function_info info); -namespace duckdb { +/*! +Gets the init data set by `duckdb_bind_set_init_data` during the bind. -struct QualifiedName { - string schema; - string name; +* info: The info object +* returns: The init data object +*/ +DUCKDB_API void *duckdb_function_get_init_data(duckdb_function_info info); - //! Parse the (optional) schema and a name from a string in the format of e.g. "schema"."table"; if there is no dot - //! the schema will be set to INVALID_SCHEMA - static QualifiedName Parse(string input) { - string schema; - string name; - idx_t idx = 0; - vector entries; - string entry; - normal: - //! quote - for (; idx < input.size(); idx++) { - if (input[idx] == '"') { - idx++; - goto quoted; - } else if (input[idx] == '.') { - goto separator; - } - entry += input[idx]; - } - goto end; - separator: - entries.push_back(entry); - entry = ""; - idx++; - goto normal; - quoted: - //! look for another quote - for (; idx < input.size(); idx++) { - if (input[idx] == '"') { - //! unquote - idx++; - goto normal; - } - entry += input[idx]; - } - throw ParserException("Unterminated quote in qualified name!"); - end: - if (entries.empty()) { - schema = INVALID_SCHEMA; - name = entry; - } else if (entries.size() == 1) { - schema = entries[0]; - name = entry; - } else { - throw ParserException("Expected schema.entry or entry: too many entries found"); - } - return QualifiedName {schema, name}; - } -}; +/*! +Report that an error has occurred while executing the function. -struct QualifiedColumnName { - QualifiedColumnName() { - } - QualifiedColumnName(string table_p, string column_p) : table(move(table_p)), column(move(column_p)) { - } +* info: The info object +* error: The error message +*/ +DUCKDB_API void duckdb_function_set_error(duckdb_function_info info, const char *error); - string schema; - string table; - string column; -}; +//===--------------------------------------------------------------------===// +// Replacement Scans +//===--------------------------------------------------------------------===// +typedef void *duckdb_replacement_scan_info; -} // namespace duckdb +typedef void (*duckdb_replacement_callback_t)(duckdb_replacement_scan_info info, const char *table_name, void *data); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/types/hash.hpp -// -// -//===----------------------------------------------------------------------===// +/*! +Add a replacement scan definition to the specified database +* db: The database object to add the replacement scan to +* replacement: The replacement scan callback +* extra_data: Extra data that is passed back into the specified callback +* delete_callback: The delete callback to call on the extra data, if any +*/ +DUCKDB_API void duckdb_add_replacement_scan(duckdb_database db, duckdb_replacement_callback_t replacement, + void *extra_data, duckdb_delete_callback_t delete_callback); +/*! +Sets the replacement function name to use. If this function is called in the replacement callback, + the replacement scan is performed. If it is not called, the replacement callback is not performed. +* info: The info object +* function_name: The function name to substitute. +*/ +DUCKDB_API void duckdb_replacement_scan_set_function_name(duckdb_replacement_scan_info info, const char *function_name); +/*! +Adds a parameter to the replacement scan function. +* info: The info object +* parameter: The parameter to add. +*/ +DUCKDB_API void duckdb_replacement_scan_add_parameter(duckdb_replacement_scan_info info, duckdb_value parameter); -namespace duckdb { +//===--------------------------------------------------------------------===// +// Appender +//===--------------------------------------------------------------------===// -struct string_t; +// Appenders are the most efficient way of loading data into DuckDB from within the C interface, and are recommended for +// fast data loading. The appender is much faster than using prepared statements or individual `INSERT INTO` statements. -// efficient hash function that maximizes the avalanche effect and minimizes -// bias -// see: https://nullprogram.com/blog/2018/07/31/ +// Appends are made in row-wise format. For every column, a `duckdb_append_[type]` call should be made, after which +// the row should be finished by calling `duckdb_appender_end_row`. After all rows have been appended, +// `duckdb_appender_destroy` should be used to finalize the appender and clean up the resulting memory. -inline hash_t murmurhash64(uint64_t x) { - return x * UINT64_C(0xbf58476d1ce4e5b9); -} +// Note that `duckdb_appender_destroy` should always be called on the resulting appender, even if the function returns +// `DuckDBError`. -inline hash_t murmurhash32(uint32_t x) { - return murmurhash64(x); -} +/*! +Creates an appender object. -template -hash_t Hash(T value) { - return murmurhash32(value); -} +* connection: The connection context to create the appender in. +* schema: The schema of the table to append to, or `nullptr` for the default schema. +* table: The table name to append to. +* out_appender: The resulting appender object. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_appender_create(duckdb_connection connection, const char *schema, const char *table, + duckdb_appender *out_appender); -//! Combine two hashes by XORing them -inline hash_t CombineHash(hash_t left, hash_t right) { - return left ^ right; -} +/*! +Returns the error message associated with the given appender. +If the appender has no error message, this returns `nullptr` instead. -template <> -hash_t Hash(uint64_t val); -template <> -hash_t Hash(int64_t val); -template <> -hash_t Hash(hugeint_t val); -template <> -hash_t Hash(float val); -template <> -hash_t Hash(double val); -template <> -hash_t Hash(const char *val); -template <> -hash_t Hash(char *val); -template <> -hash_t Hash(string_t val); -template <> -hash_t Hash(interval_t val); -hash_t Hash(const char *val, size_t size); -hash_t Hash(uint8_t *val, size_t size); +The error message should not be freed. It will be de-allocated when `duckdb_appender_destroy` is called. -} // namespace duckdb +* appender: The appender to get the error from. +* returns: The error message, or `nullptr` if there is none. +*/ +DUCKDB_API const char *duckdb_appender_error(duckdb_appender appender); +/*! +Flush the appender to the table, forcing the cache of the appender to be cleared and the data to be appended to the +base table. +This should generally not be used unless you know what you are doing. Instead, call `duckdb_appender_destroy` when you +are done with the appender. -namespace duckdb { +* appender: The appender to flush. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_appender_flush(duckdb_appender appender); -struct QualifiedColumnHashFunction { - uint64_t operator()(const QualifiedColumnName &a) const { - std::hash str_hasher; - return str_hasher(a.schema) ^ str_hasher(a.table) ^ str_hasher(a.column); - } -}; +/*! +Close the appender, flushing all intermediate state in the appender to the table and closing it for further appends. -struct QualifiedColumnEquality { - bool operator()(const QualifiedColumnName &a, const QualifiedColumnName &b) const { - return a.schema == b.schema && a.table == b.table && a.column == b.column; - } -}; +This is generally not necessary. Call `duckdb_appender_destroy` instead. -using qualified_column_set_t = unordered_set; +* appender: The appender to flush and close. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_appender_close(duckdb_appender appender); -} // namespace duckdb +/*! +Close the appender and destroy it. Flushing all intermediate state in the appender to the table, and de-allocating +all memory associated with the appender. +* appender: The appender to flush, close and destroy. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_appender_destroy(duckdb_appender *appender); + +/*! +A nop function, provided for backwards compatibility reasons. Does nothing. Only `duckdb_appender_end_row` is required. +*/ +DUCKDB_API duckdb_state duckdb_appender_begin_row(duckdb_appender appender); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/expression_binder.hpp -// -// -//===----------------------------------------------------------------------===// +/*! +Finish the current row of appends. After end_row is called, the next row can be appended. +* appender: The appender. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_appender_end_row(duckdb_appender appender); +/*! +Append a bool value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_bool(duckdb_appender appender, bool value); +/*! +Append an int8_t value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_int8(duckdb_appender appender, int8_t value); +/*! +Append an int16_t value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_int16(duckdb_appender appender, int16_t value); +/*! +Append an int32_t value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_int32(duckdb_appender appender, int32_t value); +/*! +Append an int64_t value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_int64(duckdb_appender appender, int64_t value); +/*! +Append a duckdb_hugeint value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_hugeint(duckdb_appender appender, duckdb_hugeint value); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/expression/bound_expression.hpp -// -// -//===----------------------------------------------------------------------===// +/*! +Append a uint8_t value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_uint8(duckdb_appender appender, uint8_t value); +/*! +Append a uint16_t value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_uint16(duckdb_appender appender, uint16_t value); +/*! +Append a uint32_t value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_uint32(duckdb_appender appender, uint32_t value); +/*! +Append a uint64_t value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_uint64(duckdb_appender appender, uint64_t value); +/*! +Append a float value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_float(duckdb_appender appender, float value); +/*! +Append a double value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_double(duckdb_appender appender, double value); +/*! +Append a duckdb_date value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_date(duckdb_appender appender, duckdb_date value); +/*! +Append a duckdb_time value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_time(duckdb_appender appender, duckdb_time value); +/*! +Append a duckdb_timestamp value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_timestamp(duckdb_appender appender, duckdb_timestamp value); +/*! +Append a duckdb_interval value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_interval(duckdb_appender appender, duckdb_interval value); +/*! +Append a varchar value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_varchar(duckdb_appender appender, const char *val); +/*! +Append a varchar value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_varchar_length(duckdb_appender appender, const char *val, idx_t length); +/*! +Append a blob value to the appender. +*/ +DUCKDB_API duckdb_state duckdb_append_blob(duckdb_appender appender, const void *data, idx_t length); +/*! +Append a NULL value to the appender (of any type). +*/ +DUCKDB_API duckdb_state duckdb_append_null(duckdb_appender appender); +/*! +Appends a pre-filled data chunk to the specified appender. +The types of the data chunk must exactly match the types of the table, no casting is performed. +If the types do not match or the appender is in an invalid state, DuckDBError is returned. +If the append is successful, DuckDBSuccess is returned. +* appender: The appender to append to. +* chunk: The data chunk to append. +* returns: The return state. +*/ +DUCKDB_API duckdb_state duckdb_append_data_chunk(duckdb_appender appender, duckdb_data_chunk chunk); -namespace duckdb { +//===--------------------------------------------------------------------===// +// Arrow Interface +//===--------------------------------------------------------------------===// +/*! +Executes a SQL query within a connection and stores the full (materialized) result in an arrow structure. +If the query fails to execute, DuckDBError is returned and the error message can be retrieved by calling +`duckdb_query_arrow_error`. -//! BoundExpression is an intermediate dummy class used by the binder. It is a ParsedExpression but holds an Expression. -//! It represents a successfully bound expression. It is used in the Binder to prevent re-binding of already bound parts -//! when dealing with subqueries. -class BoundExpression : public ParsedExpression { -public: - BoundExpression(unique_ptr expr) - : ParsedExpression(ExpressionType::INVALID, ExpressionClass::BOUND_EXPRESSION), expr(move(expr)) { - } +Note that after running `duckdb_query_arrow`, `duckdb_destroy_arrow` must be called on the result object even if the +query fails, otherwise the error stored within the result will not be freed correctly. - unique_ptr expr; +* connection: The connection to perform the query in. +* query: The SQL query to run. +* out_result: The query result. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_query_arrow(duckdb_connection connection, const char *query, duckdb_arrow *out_result); -public: - string ToString() const override { - return expr->ToString(); - } +/*! +Fetch the internal arrow schema from the arrow result. - bool Equals(const BaseExpression *other) const override { - return false; - } - hash_t Hash() const override { - return 0; - } +* result: The result to fetch the schema from. +* out_schema: The output schema. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_query_arrow_schema(duckdb_arrow result, duckdb_arrow_schema *out_schema); - unique_ptr Copy() const override { - throw SerializationException("Cannot copy or serialize bound expression"); - } +/*! +Fetch an internal arrow array from the arrow result. - void Serialize(FieldWriter &writer) const override { - throw SerializationException("Cannot copy or serialize bound expression"); - } -}; +This function can be called multiple time to get next chunks, which will free the previous out_array. +So consume the out_array before calling this function again. -} // namespace duckdb +* result: The result to fetch the array from. +* out_array: The output array. +* returns: `DuckDBSuccess` on success or `DuckDBError` on failure. +*/ +DUCKDB_API duckdb_state duckdb_query_arrow_array(duckdb_arrow result, duckdb_arrow_array *out_array); +/*! +Returns the number of columns present in a the arrow result object. +* result: The result object. +* returns: The number of columns present in the result object. +*/ +DUCKDB_API idx_t duckdb_arrow_column_count(duckdb_arrow result); +/*! +Returns the number of rows present in a the arrow result object. +* result: The result object. +* returns: The number of rows present in the result object. +*/ +DUCKDB_API idx_t duckdb_arrow_row_count(duckdb_arrow result); +/*! +Returns the number of rows changed by the query stored in the arrow result. This is relevant only for +INSERT/UPDATE/DELETE queries. For other queries the rows_changed will be 0. -namespace duckdb { +* result: The result object. +* returns: The number of rows changed. +*/ +DUCKDB_API idx_t duckdb_arrow_rows_changed(duckdb_arrow result); -class Binder; -class ClientContext; -class QueryNode; +/*! +Returns the error message contained within the result. The error is only set if `duckdb_query_arrow` returns +`DuckDBError`. -class ScalarFunctionCatalogEntry; -class AggregateFunctionCatalogEntry; -class MacroCatalogEntry; -class CatalogEntry; -class SimpleFunction; +The error message should not be freed. It will be de-allocated when `duckdb_destroy_arrow` is called. -struct MacroBinding; +* result: The result object to fetch the nullmask from. +* returns: The error of the result. +*/ +DUCKDB_API const char *duckdb_query_arrow_error(duckdb_arrow result); -struct BoundColumnReferenceInfo { - string name; - idx_t query_location; -}; +/*! +Closes the result and de-allocates all memory allocated for the arrow result. -struct BindResult { - BindResult() { - } - explicit BindResult(string error) : error(error) { - } - explicit BindResult(unique_ptr expr) : expression(move(expr)) { - } +* result: The result to destroy. +*/ +DUCKDB_API void duckdb_destroy_arrow(duckdb_arrow *result); - bool HasError() { - return !error.empty(); - } +#ifdef __cplusplus +} +#endif - unique_ptr expression; - string error; -}; -class ExpressionBinder { -public: - ExpressionBinder(Binder &binder, ClientContext &context, bool replace_binder = false); - virtual ~ExpressionBinder(); - //! The target type that should result from the binder. If the result is not of this type, a cast to this type will - //! be added. Defaults to INVALID. - LogicalType target_type; +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/profiler.hpp +// +// +//===----------------------------------------------------------------------===// -public: - unique_ptr Bind(unique_ptr &expr, LogicalType *result_type = nullptr, - bool root_expression = true); - //! Returns whether or not any columns have been bound by the expression binder - bool HasBoundColumns() { - return !bound_columns.empty(); - } - const vector &GetBoundColumns() { - return bound_columns; - } - string Bind(unique_ptr *expr, idx_t depth, bool root_expression = false); - unique_ptr CreateStructExtract(unique_ptr base, string field_name); - BindResult BindQualifiedColumnName(ColumnRefExpression &colref, const string &table_name); - unique_ptr QualifyColumnName(const string &column_name, string &error_message); - unique_ptr QualifyColumnName(ColumnRefExpression &colref, string &error_message); - // Bind table names to ColumnRefExpressions - void QualifyColumnNames(unique_ptr &expr); - static void QualifyColumnNames(Binder &binder, unique_ptr &expr); +namespace duckdb { - static unique_ptr PushCollation(ClientContext &context, unique_ptr source, - const string &collation, bool equality_only = false); - static void TestCollation(ClientContext &context, const string &collation); +//! The profiler can be used to measure elapsed time +template +class BaseProfiler { +public: + //! Starts the timer + void Start() { + finished = false; + start = Tick(); + } + //! Finishes timing + void End() { + end = Tick(); + finished = true; + } - bool BindCorrelatedColumns(unique_ptr &expr); + //! Returns the elapsed time in seconds. If End() has been called, returns + //! the total elapsed time. Otherwise returns how far along the timer is + //! right now. + double Elapsed() const { + auto _end = finished ? end : Tick(); + return std::chrono::duration_cast>(_end - start).count(); + } - void BindChild(unique_ptr &expr, idx_t depth, string &error); - static void ExtractCorrelatedExpressions(Binder &binder, Expression &expr); +private: + time_point Tick() const { + return T::now(); + } + time_point start; + time_point end; + bool finished = false; +}; - static bool ContainsNullType(const LogicalType &type); - static LogicalType ExchangeNullType(const LogicalType &type); - static bool ContainsType(const LogicalType &type, LogicalTypeId target); - static LogicalType ExchangeType(const LogicalType &type, LogicalTypeId target, LogicalType new_type); +using Profiler = BaseProfiler; - static void ResolveParameterType(LogicalType &type); - static void ResolveParameterType(unique_ptr &expr); +} // namespace duckdb - //! Bind the given expresion. Unlike Bind(), this does *not* mute the given ParsedExpression. - //! Exposed to be used from sub-binders that aren't subclasses of ExpressionBinder. - virtual BindResult BindExpression(unique_ptr *expr_ptr, idx_t depth, - bool root_expression = false); -protected: - BindResult BindExpression(BetweenExpression &expr, idx_t depth); - BindResult BindExpression(CaseExpression &expr, idx_t depth); - BindResult BindExpression(CollateExpression &expr, idx_t depth); - BindResult BindExpression(CastExpression &expr, idx_t depth); - BindResult BindExpression(ColumnRefExpression &expr, idx_t depth); - BindResult BindExpression(ComparisonExpression &expr, idx_t depth); - BindResult BindExpression(ConjunctionExpression &expr, idx_t depth); - BindResult BindExpression(ConstantExpression &expr, idx_t depth); - BindResult BindExpression(FunctionExpression &expr, idx_t depth, unique_ptr *expr_ptr); - BindResult BindExpression(LambdaExpression &expr, idx_t depth); - BindResult BindExpression(OperatorExpression &expr, idx_t depth); - BindResult BindExpression(ParameterExpression &expr, idx_t depth); - BindResult BindExpression(PositionalReferenceExpression &ref, idx_t depth); - BindResult BindExpression(StarExpression &expr, idx_t depth); - BindResult BindExpression(SubqueryExpression &expr, idx_t depth); +namespace duckdb { -protected: - virtual BindResult BindGroupingFunction(OperatorExpression &op, idx_t depth); - virtual BindResult BindFunction(FunctionExpression &expr, ScalarFunctionCatalogEntry *function, idx_t depth); - virtual BindResult BindAggregate(FunctionExpression &expr, AggregateFunctionCatalogEntry *function, idx_t depth); - virtual BindResult BindUnnest(FunctionExpression &expr, idx_t depth); - virtual BindResult BindMacro(FunctionExpression &expr, MacroCatalogEntry *macro, idx_t depth, - unique_ptr *expr_ptr); +class ProgressBar { +public: + explicit ProgressBar(Executor &executor, idx_t show_progress_after); - void ReplaceMacroParametersRecursive(unique_ptr &expr); + //! Starts the thread + void Start(); + //! Updates the progress bar and prints it to the screen + void Update(bool final); + //! Gets current percentage + double GetCurrentPercentage(); - virtual string UnsupportedAggregateMessage(); - virtual string UnsupportedUnnestMessage(); +private: + const string PROGRESS_BAR_STRING = "============================================================"; + static constexpr const idx_t PROGRESS_BAR_WIDTH = 60; - Binder &binder; - ClientContext &context; - ExpressionBinder *stored_binder; - MacroBinding *macro_binding; - vector bound_columns; +private: + //! The executor + Executor &executor; + //! The profiler used to measure the time since the progress bar was started + Profiler profiler; + //! The time in ms after which to start displaying the progress bar + idx_t show_progress_after; + //! The current progress percentage + double current_percentage; + //! Whether or not profiling is supported for the current query + bool supported = true; }; - } // namespace duckdb + + //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/planner/table_binding.hpp +// duckdb/main/stream_query_result.hpp // // //===----------------------------------------------------------------------===// @@ -15617,816 +16941,937 @@ class ExpressionBinder { - - - namespace duckdb { -class BindContext; -class BoundQueryNode; -class ColumnRefExpression; -class SubqueryRef; -class LogicalGet; -class TableCatalogEntry; -class TableFunctionCatalogEntry; -class BoundTableFunction; -//! A Binding represents a binding to a table, table-producing function or subquery with a specified table index. -struct Binding { - Binding(const string &alias, vector types, vector names, idx_t index); - virtual ~Binding() = default; +class ClientContext; +class ClientContextLock; +class Executor; +class MaterializedQueryResult; +class PreparedStatementData; - //! The alias of the binding - string alias; - //! The table index of the binding - idx_t index; - vector types; - //! Column names of the subquery - vector names; - //! Name -> index for the names - case_insensitive_map_t name_map; +class StreamQueryResult : public QueryResult { + friend class ClientContext; public: - bool TryGetBindingIndex(const string &column_name, column_t &column_index); - column_t GetBindingIndex(const string &column_name); - bool HasMatchingBinding(const string &column_name); - virtual string ColumnNotFoundError(const string &column_name) const; - virtual BindResult Bind(ColumnRefExpression &colref, idx_t depth); - virtual TableCatalogEntry *GetTableEntry(); -}; - -//! TableBinding is exactly like the Binding, except it keeps track of which columns were bound in the linked LogicalGet -//! node for projection pushdown purposes. -struct TableBinding : public Binding { - TableBinding(const string &alias, vector types, vector names, LogicalGet &get, idx_t index, - bool add_row_id = false); - - //! the underlying LogicalGet - LogicalGet &get; + //! Create a successful StreamQueryResult. StreamQueryResults should always be successful initially (it makes no + //! sense to stream an error). + DUCKDB_API StreamQueryResult(StatementType statement_type, shared_ptr context, + vector types, vector names); + DUCKDB_API ~StreamQueryResult() override; public: - BindResult Bind(ColumnRefExpression &colref, idx_t depth) override; - TableCatalogEntry *GetTableEntry() override; - string ColumnNotFoundError(const string &column_name) const override; -}; - -//! MacroBinding is like the Binding, except the alias and index are set by default. Used for binding Macro -//! Params/Arguments. -struct MacroBinding : public Binding { - static constexpr const char *MACRO_NAME = "0_macro_parameters"; + //! Fetches a DataChunk from the query result. + DUCKDB_API unique_ptr FetchRaw() override; + //! Converts the QueryResult to a string + DUCKDB_API string ToString() override; + //! Materializes the query result and turns it into a materialized query result + DUCKDB_API unique_ptr Materialize(); -public: - MacroBinding(vector types_p, vector names_p, string macro_name); + DUCKDB_API bool IsOpen(); - //! Arguments - vector> arguments; - //! The name of the macro - string macro_name; + //! Closes the StreamQueryResult + DUCKDB_API void Close(); -public: - BindResult Bind(ColumnRefExpression &colref, idx_t depth) override; +private: + //! The client context this StreamQueryResult belongs to + shared_ptr context; - //! Given the parameter colref, returns a copy of the argument that was supplied for this parameter - unique_ptr ParamToArg(ColumnRefExpression &colref); +private: + unique_ptr LockContext(); + void CheckExecutableInternal(ClientContextLock &lock); + bool IsOpenInternal(ClientContextLock &lock); }; } // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/main/table_description.hpp +// +// +//===----------------------------------------------------------------------===// -namespace duckdb { -class Binder; -class LogicalGet; -class BoundQueryNode; - -class StarExpression; -struct UsingColumnSet { - string primary_binding; - unordered_set bindings; -}; -//! The BindContext object keeps track of all the tables and columns that are -//! encountered during the binding process. -class BindContext { -public: - //! Keep track of recursive CTE references - case_insensitive_map_t> cte_references; -public: - //! Given a column name, find the matching table it belongs to. Throws an - //! exception if no table has a column of the given name. - string GetMatchingBinding(const string &column_name); - //! Like GetMatchingBinding, but instead of throwing an error if multiple tables have the same binding it will - //! return a list of all the matching ones - unordered_set GetMatchingBindings(const string &column_name); - //! Like GetMatchingBindings, but returns the top 3 most similar bindings (in levenshtein distance) instead of the - //! matching ones - vector GetSimilarBindings(const string &column_name); +namespace duckdb { - Binding *GetCTEBinding(const string &ctename); - //! Binds a column expression to the base table. Returns the bound expression - //! or throws an exception if the column could not be bound. - BindResult BindColumn(ColumnRefExpression &colref, idx_t depth); - string BindColumn(PositionalReferenceExpression &ref, string &table_name, string &column_name); - BindResult BindColumn(PositionalReferenceExpression &ref, idx_t depth); +struct TableDescription { + //! The schema of the table + string schema; + //! The table name of the table + string table; + //! The columns of the table + vector columns; +}; - unique_ptr CreateColumnReference(const string &table_name, const string &column_name); - unique_ptr CreateColumnReference(const string &schema_name, const string &table_name, - const string &column_name); +} // namespace duckdb - //! Generate column expressions for all columns that are present in the - //! referenced tables. This is used to resolve the * expression in a - //! selection list. - void GenerateAllColumnExpressions(StarExpression &expr, vector> &new_select_list); - //! Check if the given (binding, column_name) is in the exclusion/replacement lists. - //! Returns true if it is in one of these lists, and should therefore be skipped. - bool CheckExclusionList(StarExpression &expr, Binding *binding, const string &column_name, - vector> &new_select_list, - case_insensitive_set_t &excluded_columns); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/transaction/transaction_context.hpp +// +// +//===----------------------------------------------------------------------===// - const vector> &GetBindingsList() { - return bindings_list; - } - //! Adds a base table with the given alias to the BindContext. - void AddBaseTable(idx_t index, const string &alias, const vector &names, const vector &types, - LogicalGet &get); - //! Adds a call to a table function with the given alias to the BindContext. - void AddTableFunction(idx_t index, const string &alias, const vector &names, - const vector &types, LogicalGet &get); - //! Adds a subquery with a given alias to the BindContext. - void AddSubquery(idx_t index, const string &alias, SubqueryRef &ref, BoundQueryNode &subquery); - //! Adds a base table with the given alias to the BindContext. - void AddGenericBinding(idx_t index, const string &alias, const vector &names, - const vector &types); - //! Adds a base table with the given alias to the CTE BindContext. - //! We need this to correctly bind recursive CTEs with multiple references. - void AddCTEBinding(idx_t index, const string &alias, const vector &names, const vector &types); - //! Add an implicit join condition (e.g. USING (x)) - void AddUsingBinding(const string &column_name, UsingColumnSet *set); - void AddUsingBindingSet(unique_ptr set); - //! Returns any using column set for the given column name, or nullptr if there is none. On conflict (multiple using - //! column sets with the same name) throw an exception. - UsingColumnSet *GetUsingBinding(const string &column_name); - //! Returns any using column set for the given column name, or nullptr if there is none - UsingColumnSet *GetUsingBinding(const string &column_name, const string &binding_name); - //! Erase a using binding from the set of using bindings - void RemoveUsingBinding(const string &column_name, UsingColumnSet *set); - //! Finds the using bindings for a given column. Returns true if any exists, false otherwise. - bool FindUsingBinding(const string &column_name, unordered_set **using_columns); - //! Transfer a using binding from one bind context to this bind context - void TransferUsingBinding(BindContext ¤t_context, UsingColumnSet *current_set, UsingColumnSet *new_set, - const string &binding, const string &using_column); +namespace duckdb { - //! Fetch the actual column name from the given binding, or throws if none exists - //! This can be different from "column_name" because of case insensitivity - //! (e.g. "column_name" might return "COLUMN_NAME") - string GetActualColumnName(const string &binding, const string &column_name); +class ClientContext; +class Transaction; +class TransactionManager; - case_insensitive_map_t> GetCTEBindings() { - return cte_bindings; +//! The transaction context keeps track of all the information relating to the +//! current transaction +class TransactionContext { +public: + TransactionContext(TransactionManager &transaction_manager, ClientContext &context) + : transaction_manager(transaction_manager), context(context), auto_commit(true), current_transaction(nullptr) { } - void SetCTEBindings(case_insensitive_map_t> bindings) { - cte_bindings = bindings; + ~TransactionContext(); + + Transaction &ActiveTransaction() { + D_ASSERT(current_transaction); + return *current_transaction; } - //! Alias a set of column names for the specified table, using the original names if there are not enough aliases - //! specified. - static vector AliasColumnNames(const string &table_name, const vector &names, - const vector &column_aliases); + bool HasActiveTransaction() { + return !!current_transaction; + } - //! Add all the bindings from a BindContext to this BindContext. The other BindContext is destroyed in the process. - void AddContext(BindContext other); + void RecordQuery(string query); + void BeginTransaction(); + void Commit(); + void Rollback(); + void ClearTransaction(); - //! Gets a binding of the specified name. Returns a nullptr and sets the out_error if the binding could not be - //! found. - Binding *GetBinding(const string &name, string &out_error); + void SetAutoCommit(bool value); + bool IsAutoCommit() { + return auto_commit; + } private: - void AddBinding(const string &alias, unique_ptr binding); + TransactionManager &transaction_manager; + ClientContext &context; + bool auto_commit; -private: - //! The set of bindings - case_insensitive_map_t> bindings; - //! The list of bindings in insertion order - vector> bindings_list; - //! The set of columns used in USING join conditions - case_insensitive_map_t> using_columns; - //! Using column sets - vector> using_column_sets; + Transaction *current_transaction; - //! The set of CTE bindings - case_insensitive_map_t> cte_bindings; + TransactionContext(const TransactionContext &) = delete; }; + } // namespace duckdb +#include + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/main/client_config.hpp +// +// +//===----------------------------------------------------------------------===// + + + + +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/enums/output_type.hpp +// +// +//===----------------------------------------------------------------------===// namespace duckdb { -class BoundResultModifier; -class BoundSelectNode; + +enum class ExplainOutputType : uint8_t { ALL = 0, OPTIMIZED_ONLY = 1, PHYSICAL_ONLY = 2 }; + +} // namespace duckdb + + + + +namespace duckdb { class ClientContext; -class ExpressionBinder; -class LimitModifier; -class OrderBinder; -class TableCatalogEntry; -class ViewCatalogEntry; -struct CreateInfo; -struct BoundCreateTableInfo; -struct BoundCreateFunctionInfo; -struct CommonTableExpressionInfo; +struct ClientConfig { + //! If the query profiler is enabled or not. + bool enable_profiler = false; + //! If detailed query profiling is enabled + bool enable_detailed_profiling = false; + //! The format to automatically print query profiling information in (default: disabled) + ProfilerPrintFormat profiler_print_format = ProfilerPrintFormat::NONE; + //! The file to save query profiling information to, instead of printing it to the console + //! (empty = print to console) + string profiler_save_location; -enum class BindingMode : uint8_t { STANDARD_BINDING, EXTRACT_NAMES }; + //! If the progress bar is enabled or not. + bool enable_progress_bar = false; + //! If the print of the progress bar is enabled + bool print_progress_bar = true; + //! The wait time before showing the progress bar + int wait_time = 2000; -struct CorrelatedColumnInfo { - ColumnBinding binding; - LogicalType type; - string name; - idx_t depth; + //! Preserve identifier case while parsing. + //! If false, all unquoted identifiers are lower-cased (e.g. "MyTable" -> "mytable"). + bool preserve_identifier_case = true; - explicit CorrelatedColumnInfo(BoundColumnRefExpression &expr) - : binding(expr.binding), type(expr.return_type), name(expr.GetName()), depth(expr.depth) { - } + // Whether or not aggressive query verification is enabled + bool query_verification_enabled = false; + //! Enable the running of optimizers + bool enable_optimizer = true; + //! Force parallelism of small tables, used for testing + bool verify_parallelism = false; + //! Force index join independent of table cardinality, used for testing + bool force_index_join = false; + //! Force out-of-core computation for operators that support it, used for testing + bool force_external = false; + //! Maximum bits allowed for using a perfect hash table (i.e. the perfect HT can hold up to 2^perfect_ht_threshold + //! elements) + idx_t perfect_ht_threshold = 12; - bool operator==(const CorrelatedColumnInfo &rhs) const { - return binding == rhs.binding; - } + //! The explain output type used when none is specified (default: PHYSICAL_ONLY) + ExplainOutputType explain_output_type = ExplainOutputType::PHYSICAL_ONLY; + + //! Generic options + case_insensitive_map_t set_variables; + +public: + static ClientConfig &GetConfig(ClientContext &context); }; -//! Bind the parsed query tree to the actual columns present in the catalog. -/*! - The binder is responsible for binding tables and columns to actual physical - tables and columns in the catalog. In the process, it also resolves types of - all expressions. -*/ -class Binder : public std::enable_shared_from_this { - friend class ExpressionBinder; - friend class SelectBinder; - friend class RecursiveSubqueryPlanner; +} // namespace duckdb + + +namespace duckdb { +class Appender; +class Catalog; +class CatalogSearchPath; +class ChunkCollection; +class DatabaseInstance; +class FileOpener; +class LogicalOperator; +class PreparedStatementData; +class Relation; +class BufferedFileWriter; +class QueryProfiler; +class QueryProfilerHistory; +class ClientContextLock; +struct CreateScalarFunctionInfo; +class ScalarFunctionCatalogEntry; +struct ActiveQueryContext; +struct ParserOptions; + +//! The ClientContext holds information relevant to the current client session +//! during execution +class ClientContext : public std::enable_shared_from_this { + friend class PendingQueryResult; + friend class StreamQueryResult; + friend class TransactionManager; public: - static shared_ptr CreateBinder(ClientContext &context, Binder *parent = nullptr, bool inherit_ctes = true); + DUCKDB_API explicit ClientContext(shared_ptr db); + DUCKDB_API ~ClientContext(); - //! The client context - ClientContext &context; - //! A mapping of names to common table expressions - case_insensitive_map_t CTE_bindings; - //! The CTEs that have already been bound - unordered_set bound_ctes; - //! The bind context - BindContext bind_context; - //! The set of correlated columns bound by this binder (FIXME: this should probably be an unordered_set and not a - //! vector) - vector correlated_columns; - //! The set of parameter expressions bound by this binder - vector *parameters; - //! Whether or not the bound statement is read-only - bool read_only; - //! Whether or not the statement requires a valid transaction to run - bool requires_valid_transaction; - //! Whether or not the statement can be streamed to the client - bool allow_stream_result; - //! The alias for the currently processing subquery, if it exists - string alias; - //! Macro parameter bindings (if any) - MacroBinding *macro_binding = nullptr; + //! Query profiler + shared_ptr profiler; + //! QueryProfiler History + unique_ptr query_profiler_history; + //! The database that this client is connected to + shared_ptr db; + //! Data for the currently running transaction + TransactionContext transaction; + //! Whether or not the query is interrupted + atomic interrupted; -public: - BoundStatement Bind(SQLStatement &statement); - BoundStatement Bind(QueryNode &node); + unique_ptr temporary_objects; + unordered_map> prepared_statements; - unique_ptr BindCreateTableInfo(unique_ptr info); - void BindCreateViewInfo(CreateViewInfo &base); - SchemaCatalogEntry *BindSchema(CreateInfo &info); - SchemaCatalogEntry *BindCreateFunctionInfo(CreateInfo &info); + //! The writer used to log queries (if logging is enabled) + unique_ptr log_query_writer; + //! The random generator used by random(). Its seed value can be set by setseed(). + std::mt19937 random_engine; - //! Check usage, and cast named parameters to their types - static void BindNamedParameters(named_parameter_type_map_t &types, named_parameter_map_t &values, - QueryErrorContext &error_context, string &func_name); + const unique_ptr catalog_search_path; - unique_ptr Bind(TableRef &ref); - unique_ptr CreatePlan(BoundTableRef &ref); + unique_ptr file_opener; - //! Generates an unused index for a table - idx_t GenerateTableIndex(); + //! The client configuration + ClientConfig config; - //! Add a common table expression to the binder - void AddCTE(const string &name, CommonTableExpressionInfo *cte); - //! Find a common table expression by name; returns nullptr if none exists - CommonTableExpressionInfo *FindCTE(const string &name, bool skip = false); +public: + DUCKDB_API Transaction &ActiveTransaction() { + return transaction.ActiveTransaction(); + } - bool CTEIsAlreadyBound(CommonTableExpressionInfo *cte); + //! Interrupt execution of a query + DUCKDB_API void Interrupt(); + //! Enable query profiling + DUCKDB_API void EnableProfiling(); + //! Disable query profiling + DUCKDB_API void DisableProfiling(); - //! Add the view to the set of currently bound views - used for detecting recursive view definitions - void AddBoundView(ViewCatalogEntry *view); + //! Issue a query, returning a QueryResult. The QueryResult can be either a StreamQueryResult or a + //! MaterializedQueryResult. The StreamQueryResult will only be returned in the case of a successful SELECT + //! statement. + DUCKDB_API unique_ptr Query(const string &query, bool allow_stream_result); + DUCKDB_API unique_ptr Query(unique_ptr statement, bool allow_stream_result); - void PushExpressionBinder(ExpressionBinder *binder); - void PopExpressionBinder(); - void SetActiveBinder(ExpressionBinder *binder); - ExpressionBinder *GetActiveBinder(); - bool HasActiveBinder(); + //! Issues a query to the database and returns a Pending Query Result. Note that "query" may only contain + //! a single statement. + DUCKDB_API unique_ptr PendingQuery(const string &query); + //! Issues a query to the database and returns a Pending Query Result + DUCKDB_API unique_ptr PendingQuery(unique_ptr statement); - vector &GetActiveBinders(); + //! Destroy the client context + DUCKDB_API void Destroy(); - void MergeCorrelatedColumns(vector &other); - //! Add a correlated column to this binder (if it does not exist) - void AddCorrelatedColumn(const CorrelatedColumnInfo &info); + //! Get the table info of a specific table, or nullptr if it cannot be found + DUCKDB_API unique_ptr TableInfo(const string &schema_name, const string &table_name); + //! Appends a DataChunk to the specified table. Returns whether or not the append was successful. + DUCKDB_API void Append(TableDescription &description, ChunkCollection &collection); + //! Try to bind a relation in the current client context; either throws an exception or fills the result_columns + //! list with the set of returned columns + DUCKDB_API void TryBindRelation(Relation &relation, vector &result_columns); - string FormatError(ParsedExpression &expr_context, const string &message); - string FormatError(TableRef &ref_context, const string &message); + //! Execute a relation + DUCKDB_API unique_ptr Execute(const shared_ptr &relation); - string FormatErrorRecursive(idx_t query_location, const string &message, vector &values); - template - string FormatErrorRecursive(idx_t query_location, const string &msg, vector &values, T param, - Args... params) { - values.push_back(ExceptionFormatValue::CreateFormatValue(param)); - return FormatErrorRecursive(query_location, msg, values, params...); - } + //! Prepare a query + DUCKDB_API unique_ptr Prepare(const string &query); + //! Directly prepare a SQL statement + DUCKDB_API unique_ptr Prepare(unique_ptr statement); - template - string FormatError(idx_t query_location, const string &msg, Args... params) { - vector values; - return FormatErrorRecursive(query_location, msg, values, params...); - } + //! Create a pending query result from a prepared statement with the given name and set of parameters + //! It is possible that the prepared statement will be re-bound. This will generally happen if the catalog is + //! modified in between the prepared statement being bound and the prepared statement being run. + DUCKDB_API unique_ptr + PendingQuery(const string &query, shared_ptr &prepared, vector &values); - static void BindLogicalType(ClientContext &context, LogicalType &type, const string &schema = ""); + //! Execute a prepared statement with the given name and set of parameters + //! It is possible that the prepared statement will be re-bound. This will generally happen if the catalog is + //! modified in between the prepared statement being bound and the prepared statement being run. + DUCKDB_API unique_ptr Execute(const string &query, shared_ptr &prepared, + vector &values, bool allow_stream_result = true); - bool HasMatchingBinding(const string &table_name, const string &column_name, string &error_message); - bool HasMatchingBinding(const string &schema_name, const string &table_name, const string &column_name, - string &error_message); + //! Gets current percentage of the query's progress, returns 0 in case the progress bar is disabled. + DUCKDB_API double GetProgress(); - void SetBindingMode(BindingMode mode); - BindingMode GetBindingMode(); - void AddTableName(string table_name); - const unordered_set &GetTableNames(); + //! Register function in the temporary schema + DUCKDB_API void RegisterFunction(CreateFunctionInfo *info); -private: - //! The parent binder (if any) - shared_ptr parent; - //! The vector of active binders - vector active_binders; - //! The count of bound_tables - idx_t bound_tables; - //! Whether or not the binder has any unplanned subqueries that still need to be planned - bool has_unplanned_subqueries = false; - //! Whether or not subqueries should be planned already - bool plan_subquery = true; - //! Whether CTEs should reference the parent binder (if it exists) - bool inherit_ctes = true; - //! Whether or not the binder can contain NULLs as the root of expressions - bool can_contain_nulls = false; - //! The root statement of the query that is currently being parsed - SQLStatement *root_statement = nullptr; - //! Binding mode - BindingMode mode = BindingMode::STANDARD_BINDING; - //! Table names extracted for BindingMode::EXTRACT_NAMES - unordered_set table_names; - //! The set of bound views - unordered_set bound_views; + //! Parse statements from a query + DUCKDB_API vector> ParseStatements(const string &query); -private: - //! Bind the default values of the columns of a table - void BindDefaultValues(vector &columns, vector> &bound_defaults); - //! Bind a delimiter value (LIMIT or OFFSET) - unique_ptr BindDelimiter(ClientContext &context, unique_ptr delimiter, - const LogicalType &type, Value &delimiter_value); + //! Extract the logical plan of a query + DUCKDB_API unique_ptr ExtractPlan(const string &query); + DUCKDB_API void HandlePragmaStatements(vector> &statements); - //! Move correlated expressions from the child binder to this binder - void MoveCorrelatedExpressions(Binder &other); + //! Runs a function with a valid transaction context, potentially starting a transaction if the context is in auto + //! commit mode. + DUCKDB_API void RunFunctionInTransaction(const std::function &fun, + bool requires_valid_transaction = true); + //! Same as RunFunctionInTransaction, but does not obtain a lock on the client context or check for validation + DUCKDB_API void RunFunctionInTransactionInternal(ClientContextLock &lock, const std::function &fun, + bool requires_valid_transaction = true); - BoundStatement Bind(SelectStatement &stmt); - BoundStatement Bind(InsertStatement &stmt); - BoundStatement Bind(CopyStatement &stmt); - BoundStatement Bind(DeleteStatement &stmt); - BoundStatement Bind(UpdateStatement &stmt); - BoundStatement Bind(CreateStatement &stmt); - BoundStatement Bind(DropStatement &stmt); - BoundStatement Bind(AlterStatement &stmt); - BoundStatement Bind(TransactionStatement &stmt); - BoundStatement Bind(PragmaStatement &stmt); - BoundStatement Bind(ExplainStatement &stmt); - BoundStatement Bind(VacuumStatement &stmt); - BoundStatement Bind(RelationStatement &stmt); - BoundStatement Bind(ShowStatement &stmt); - BoundStatement Bind(CallStatement &stmt); - BoundStatement Bind(ExportStatement &stmt); - BoundStatement Bind(SetStatement &stmt); - BoundStatement Bind(LoadStatement &stmt); + //! Equivalent to CURRENT_SETTING(key) SQL function. + DUCKDB_API bool TryGetCurrentSetting(const std::string &key, Value &result); - unique_ptr BindNode(SelectNode &node); - unique_ptr BindNode(SetOperationNode &node); - unique_ptr BindNode(RecursiveCTENode &node); - unique_ptr BindNode(QueryNode &node); + //! Returns the parser options for this client context + DUCKDB_API ParserOptions GetParserOptions(); - unique_ptr VisitQueryNode(BoundQueryNode &node, unique_ptr root); - unique_ptr CreatePlan(BoundRecursiveCTENode &node); - unique_ptr CreatePlan(BoundSelectNode &statement); - unique_ptr CreatePlan(BoundSetOperationNode &node); - unique_ptr CreatePlan(BoundQueryNode &node); + DUCKDB_API unique_ptr Fetch(ClientContextLock &lock, StreamQueryResult &result); - unique_ptr Bind(BaseTableRef &ref); - unique_ptr Bind(CrossProductRef &ref); - unique_ptr Bind(JoinRef &ref); - unique_ptr Bind(SubqueryRef &ref, CommonTableExpressionInfo *cte = nullptr); - unique_ptr Bind(TableFunctionRef &ref); - unique_ptr Bind(EmptyTableRef &ref); - unique_ptr Bind(ExpressionListRef &ref); + //! Whether or not the given result object (streaming query result or pending query result) is active + DUCKDB_API bool IsActiveResult(ClientContextLock &lock, BaseQueryResult *result); - bool BindFunctionParameters(vector> &expressions, vector &arguments, - vector ¶meters, named_parameter_map_t &named_parameters, - unique_ptr &subquery, string &error); + //! Returns the current executor + Executor &GetExecutor(); - unique_ptr CreatePlan(BoundBaseTableRef &ref); - unique_ptr CreatePlan(BoundCrossProductRef &ref); - unique_ptr CreatePlan(BoundJoinRef &ref); - unique_ptr CreatePlan(BoundSubqueryRef &ref); - unique_ptr CreatePlan(BoundTableFunction &ref); - unique_ptr CreatePlan(BoundEmptyTableRef &ref); - unique_ptr CreatePlan(BoundExpressionListRef &ref); - unique_ptr CreatePlan(BoundCTERef &ref); + //! Returns the current query string (if any) + const string &GetCurrentQuery(); + + //! Fetch a list of table names that are required for a given query + DUCKDB_API unordered_set GetTableNames(const string &query); + +private: + //! Parse statements and resolve pragmas from a query + bool ParseStatements(ClientContextLock &lock, const string &query, vector> &result, + string &error); + //! Issues a query to the database and returns a Pending Query Result + unique_ptr PendingQueryInternal(ClientContextLock &lock, unique_ptr statement, + bool verify = true); + unique_ptr ExecutePendingQueryInternal(ClientContextLock &lock, PendingQueryResult &query, + bool allow_stream_result); + + //! Parse statements from a query + vector> ParseStatementsInternal(ClientContextLock &lock, const string &query); + //! Perform aggressive query verification of a SELECT statement. Only called when query_verification_enabled is + //! true. + string VerifyQuery(ClientContextLock &lock, const string &query, unique_ptr statement); + + void InitialCleanup(ClientContextLock &lock); + //! Internal clean up, does not lock. Caller must hold the context_lock. + void CleanupInternal(ClientContextLock &lock, BaseQueryResult *result = nullptr, + bool invalidate_transaction = false); + string FinalizeQuery(ClientContextLock &lock, bool success); + unique_ptr PendingStatementOrPreparedStatement(ClientContextLock &lock, const string &query, + unique_ptr statement, + shared_ptr &prepared, + vector *values); + unique_ptr PendingPreparedStatement(ClientContextLock &lock, + shared_ptr statement_p, + vector bound_values); - unique_ptr BindTable(TableCatalogEntry &table, BaseTableRef &ref); - unique_ptr BindView(ViewCatalogEntry &view, BaseTableRef &ref); - unique_ptr BindTableOrView(BaseTableRef &ref); + //! Internally prepare a SQL statement. Caller must hold the context_lock. + shared_ptr CreatePreparedStatement(ClientContextLock &lock, const string &query, + unique_ptr statement); + unique_ptr PendingStatementInternal(ClientContextLock &lock, const string &query, + unique_ptr statement); + unique_ptr RunStatementInternal(ClientContextLock &lock, const string &query, + unique_ptr statement, bool allow_stream_result, + bool verify = true); + unique_ptr PrepareInternal(ClientContextLock &lock, unique_ptr statement); + void LogQueryInternal(ClientContextLock &lock, const string &query); - BoundStatement BindCopyTo(CopyStatement &stmt); - BoundStatement BindCopyFrom(CopyStatement &stmt); + unique_ptr FetchResultInternal(ClientContextLock &lock, PendingQueryResult &pending, + bool allow_stream_result); + unique_ptr FetchInternal(ClientContextLock &lock, Executor &executor, BaseQueryResult &result); - void BindModifiers(OrderBinder &order_binder, QueryNode &statement, BoundQueryNode &result); - void BindModifierTypes(BoundQueryNode &result, const vector &sql_types, idx_t projection_index); + unique_ptr LockContext(); - BoundStatement BindSummarize(ShowStatement &stmt); - unique_ptr BindLimit(LimitModifier &limit_mod); - unique_ptr BindLimitPercent(LimitPercentModifier &limit_mod); - unique_ptr BindOrderExpression(OrderBinder &order_binder, unique_ptr expr); + bool UpdateFunctionInfoFromEntry(ScalarFunctionCatalogEntry *existing_function, CreateScalarFunctionInfo *new_info); - unique_ptr PlanFilter(unique_ptr condition, unique_ptr root); + void BeginTransactionInternal(ClientContextLock &lock, bool requires_valid_transaction); + void BeginQueryInternal(ClientContextLock &lock, const string &query); + string EndQueryInternal(ClientContextLock &lock, bool success, bool invalidate_transaction); - void PlanSubqueries(unique_ptr *expr, unique_ptr *root); - unique_ptr PlanSubquery(BoundSubqueryExpression &expr, unique_ptr &root); + PendingExecutionResult ExecuteTaskInternal(ClientContextLock &lock, PendingQueryResult &result); - unique_ptr CastLogicalOperatorToTypes(vector &source_types, - vector &target_types, - unique_ptr op); + unique_ptr + PendingStatementOrPreparedStatementInternal(ClientContextLock &lock, const string &query, + unique_ptr statement, + shared_ptr &prepared, vector *values); - string FindBinding(const string &using_column, const string &join_side); - bool TryFindBinding(const string &using_column, const string &join_side, string &result); + unique_ptr PendingQueryPreparedInternal(ClientContextLock &lock, const string &query, + shared_ptr &prepared, + vector &values); - void AddUsingBindingSet(unique_ptr set); - string RetrieveUsingBinding(Binder ¤t_binder, UsingColumnSet *current_set, const string &column_name, - const string &join_side, UsingColumnSet *new_set); +private: + //! Lock on using the ClientContext in parallel + mutex context_lock; + //! The currently active query context + unique_ptr active_query; + //! The current query progress + atomic query_progress; +}; +class ClientContextLock { public: - // This should really be a private constructor, but make_shared does not allow it... - // If you are thinking about calling this, you should probably call Binder::CreateBinder - Binder(bool I_know_what_I_am_doing, ClientContext &context, shared_ptr parent, bool inherit_ctes); + explicit ClientContextLock(mutex &context_lock) : client_guard(context_lock) { + } + + ~ClientContextLock() { + } + +private: + lock_guard client_guard; }; -} // namespace duckdb +class ClientContextWrapper { +public: + DUCKDB_API explicit ClientContextWrapper(const shared_ptr &context) + : client_context(context) { -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/planner/bound_query_node.hpp -// -// -//===----------------------------------------------------------------------===// + }; + shared_ptr GetContext() { + auto actual_context = client_context.lock(); + if (!actual_context) { + throw std::runtime_error("This connection is closed"); + } + return actual_context; + } +private: + std::weak_ptr client_context; +}; +} // namespace duckdb +#include -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/query_node.hpp -// -// -//===----------------------------------------------------------------------===// +namespace duckdb { +struct BoundStatement; +class ClientContextWrapper; +class Binder; +class LogicalOperator; +class QueryNode; +class TableRef; +class ExtraDependencies {}; +class Relation : public std::enable_shared_from_this { +public: + DUCKDB_API Relation(const std::shared_ptr &context, RelationType type) + : context(context), type(type) { + } + DUCKDB_API Relation(ClientContextWrapper &context, RelationType type) : context(context.GetContext()), type(type) { + } + DUCKDB_API virtual ~Relation() { + } + ClientContextWrapper context; + RelationType type; + unique_ptr extra_dependencies; -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/common_table_expression_info.hpp -// -// -//===----------------------------------------------------------------------===// +public: + DUCKDB_API virtual const vector &Columns() = 0; + DUCKDB_API virtual unique_ptr GetQueryNode(); + DUCKDB_API virtual BoundStatement Bind(Binder &binder); + DUCKDB_API virtual string GetAlias(); + DUCKDB_API unique_ptr Execute(); + DUCKDB_API string ToString(); + DUCKDB_API virtual string ToString(idx_t depth) = 0; + DUCKDB_API void Print(); + DUCKDB_API void Head(idx_t limit = 10); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/statement/select_statement.hpp -// -// -//===----------------------------------------------------------------------===// + DUCKDB_API shared_ptr CreateView(const string &name, bool replace = true, bool temporary = false); + DUCKDB_API unique_ptr Query(const string &sql); + DUCKDB_API unique_ptr Query(const string &name, const string &sql); + //! Explain the query plan of this relation + DUCKDB_API unique_ptr Explain(); + DUCKDB_API virtual unique_ptr GetTableRef(); + DUCKDB_API virtual bool IsReadOnly() { + return true; + } +public: + // PROJECT + DUCKDB_API shared_ptr Project(const string &select_list); + DUCKDB_API shared_ptr Project(const string &expression, const string &alias); + DUCKDB_API shared_ptr Project(const string &select_list, const vector &aliases); + DUCKDB_API shared_ptr Project(const vector &expressions); + DUCKDB_API shared_ptr Project(const vector &expressions, const vector &aliases); + // FILTER + DUCKDB_API shared_ptr Filter(const string &expression); + DUCKDB_API shared_ptr Filter(const vector &expressions); + // LIMIT + DUCKDB_API shared_ptr Limit(int64_t n, int64_t offset = 0); + // ORDER + DUCKDB_API shared_ptr Order(const string &expression); + DUCKDB_API shared_ptr Order(const vector &expressions); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/tableref.hpp -// -// -//===----------------------------------------------------------------------===// + // JOIN operation + DUCKDB_API shared_ptr Join(const shared_ptr &other, const string &condition, + JoinType type = JoinType::INNER); + // CROSS PRODUCT operation + DUCKDB_API shared_ptr CrossProduct(const shared_ptr &other); + // SET operations + DUCKDB_API shared_ptr Union(const shared_ptr &other); + DUCKDB_API shared_ptr Except(const shared_ptr &other); + DUCKDB_API shared_ptr Intersect(const shared_ptr &other); + // DISTINCT operation + DUCKDB_API shared_ptr Distinct(); -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/enums/tableref_type.hpp -// -// -//===----------------------------------------------------------------------===// + // AGGREGATES + DUCKDB_API shared_ptr Aggregate(const string &aggregate_list); + DUCKDB_API shared_ptr Aggregate(const vector &aggregates); + DUCKDB_API shared_ptr Aggregate(const string &aggregate_list, const string &group_list); + DUCKDB_API shared_ptr Aggregate(const vector &aggregates, const vector &groups); + // ALIAS + DUCKDB_API shared_ptr Alias(const string &alias); + //! Insert the data from this relation into a table + DUCKDB_API void Insert(const string &table_name); + DUCKDB_API void Insert(const string &schema_name, const string &table_name); + //! Insert a row (i.e.,list of values) into a table + DUCKDB_API void Insert(const vector> &values); + //! Create a table and insert the data from this relation into that table + DUCKDB_API void Create(const string &table_name); + DUCKDB_API void Create(const string &schema_name, const string &table_name); + //! Write a relation to a CSV file + DUCKDB_API void WriteCSV(const string &csv_file); + //! Update a table, can only be used on a TableRelation + DUCKDB_API virtual void Update(const string &update, const string &condition = string()); + //! Delete from a table, can only be used on a TableRelation + DUCKDB_API virtual void Delete(const string &condition = string()); + //! Create a relation from calling a table in/out function on the input relation + //! Create a relation from calling a table in/out function on the input relation + DUCKDB_API shared_ptr TableFunction(const std::string &fname, const vector &values); + DUCKDB_API shared_ptr TableFunction(const std::string &fname, const vector &values, + const named_parameter_map_t &named_parameters); -namespace duckdb { +public: + //! Whether or not the relation inherits column bindings from its child or not, only relevant for binding + DUCKDB_API virtual bool InheritsColumnBindings() { + return false; + } + DUCKDB_API virtual Relation *ChildRelation() { + return nullptr; + } -//===--------------------------------------------------------------------===// -// Table Reference Types -//===--------------------------------------------------------------------===// -enum class TableReferenceType : uint8_t { - INVALID = 0, // invalid table reference type - BASE_TABLE = 1, // base table reference - SUBQUERY = 2, // output of a subquery - JOIN = 3, // output of join - CROSS_PRODUCT = 4, // out of cartesian product - TABLE_FUNCTION = 5, // table producing function - EXPRESSION_LIST = 6, // expression list - CTE = 7, // Recursive CTE - EMPTY = 8 // placeholder for empty FROM +protected: + DUCKDB_API string RenderWhitespace(idx_t depth); }; } // namespace duckdb -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/parser/parsed_data/sample_options.hpp -// -// -//===----------------------------------------------------------------------===// - - - +namespace duckdb { +class ChunkCollection; +class ClientContext; -namespace duckdb { +class DatabaseInstance; +class DuckDB; +class LogicalOperator; +class SelectStatement; -enum class SampleMethod : uint8_t { SYSTEM_SAMPLE = 0, BERNOULLI_SAMPLE = 1, RESERVOIR_SAMPLE = 2 }; +typedef void (*warning_callback)(std::string); -string SampleMethodToString(SampleMethod method); +//! A connection to a database. This represents a (client) connection that can +//! be used to query the database. +class Connection { +public: + DUCKDB_API explicit Connection(DuckDB &database); + DUCKDB_API explicit Connection(DatabaseInstance &database); + DUCKDB_API ~Connection(); -struct SampleOptions { - Value sample_size; - bool is_percentage; - SampleMethod method; - int64_t seed = -1; + shared_ptr context; + warning_callback warning_cb; - unique_ptr Copy(); - void Serialize(Serializer &serializer); - static unique_ptr Deserialize(Deserializer &source); - static bool Equals(SampleOptions *a, SampleOptions *b); -}; +public: + //! Returns query profiling information for the current query + DUCKDB_API string GetProfilingInformation(ProfilerPrintFormat format = ProfilerPrintFormat::QUERY_TREE); -} // namespace duckdb + //! Interrupt execution of the current query + DUCKDB_API void Interrupt(); + //! Enable query profiling + DUCKDB_API void EnableProfiling(); + //! Disable query profiling + DUCKDB_API void DisableProfiling(); -namespace duckdb { -class Deserializer; -class Serializer; + DUCKDB_API void SetWarningCallback(warning_callback); -//! Represents a generic expression that returns a table. -class TableRef { -public: - explicit TableRef(TableReferenceType type) : type(type) { - } - virtual ~TableRef() { - } + //! Enable aggressive verification/testing of queries, should only be used in testing + DUCKDB_API void EnableQueryVerification(); + DUCKDB_API void DisableQueryVerification(); + //! Force parallel execution, even for smaller tables. Should only be used in testing. + DUCKDB_API void ForceParallelism(); - TableReferenceType type; - string alias; - //! Sample options (if any) - unique_ptr sample; - //! The location in the query (if any) - idx_t query_location = DConstants::INVALID_INDEX; + //! Issues a query to the database and returns a QueryResult. This result can be either a StreamQueryResult or a + //! MaterializedQueryResult. The result can be stepped through with calls to Fetch(). Note that there can only be + //! one active StreamQueryResult per Connection object. Calling SendQuery() will invalidate any previously existing + //! StreamQueryResult. + DUCKDB_API unique_ptr SendQuery(const string &query); + //! Issues a query to the database and materializes the result (if necessary). Always returns a + //! MaterializedQueryResult. + DUCKDB_API unique_ptr Query(const string &query); + //! Issues a query to the database and materializes the result (if necessary). Always returns a + //! MaterializedQueryResult. + DUCKDB_API unique_ptr Query(unique_ptr statement); + // prepared statements + template + unique_ptr Query(const string &query, Args... args) { + vector values; + return QueryParamsRecursive(query, values, args...); + } -public: - //! Convert the object to a string - virtual string ToString() const; - void Print(); + //! Issues a query to the database and returns a Pending Query Result. Note that "query" may only contain + //! a single statement. + DUCKDB_API unique_ptr PendingQuery(const string &query); + //! Issues a query to the database and returns a Pending Query Result + DUCKDB_API unique_ptr PendingQuery(unique_ptr statement); - virtual bool Equals(const TableRef *other) const; + //! Prepare the specified query, returning a prepared statement object + DUCKDB_API unique_ptr Prepare(const string &query); + //! Prepare the specified statement, returning a prepared statement object + DUCKDB_API unique_ptr Prepare(unique_ptr statement); - virtual unique_ptr Copy() = 0; + //! Get the table info of a specific table (in the default schema), or nullptr if it cannot be found + DUCKDB_API unique_ptr TableInfo(const string &table_name); + //! Get the table info of a specific table, or nullptr if it cannot be found + DUCKDB_API unique_ptr TableInfo(const string &schema_name, const string &table_name); - //! Serializes a TableRef to a stand-alone binary blob - DUCKDB_API void Serialize(Serializer &serializer) const; - //! Serializes a TableRef to a stand-alone binary blob - DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0; - //! Deserializes a blob back into a TableRef - DUCKDB_API static unique_ptr Deserialize(Deserializer &source); + //! Extract a set of SQL statements from a specific query + DUCKDB_API vector> ExtractStatements(const string &query); + //! Extract the logical plan that corresponds to a query + DUCKDB_API unique_ptr ExtractPlan(const string &query); - //! Copy the properties of this table ref to the target - void CopyProperties(TableRef &target) const; -}; -} // namespace duckdb + //! Appends a DataChunk to the specified table + DUCKDB_API void Append(TableDescription &description, DataChunk &chunk); + //! Appends a ChunkCollection to the specified table + DUCKDB_API void Append(TableDescription &description, ChunkCollection &collection); + //! Returns a relation that produces a table from this connection + DUCKDB_API shared_ptr Table(const string &tname); + DUCKDB_API shared_ptr Table(const string &schema_name, const string &table_name); + //! Returns a relation that produces a view from this connection + DUCKDB_API shared_ptr View(const string &tname); + DUCKDB_API shared_ptr View(const string &schema_name, const string &table_name); + //! Returns a relation that calls a specified table function + DUCKDB_API shared_ptr TableFunction(const string &tname); + DUCKDB_API shared_ptr TableFunction(const string &tname, const vector &values, + const named_parameter_map_t &named_parameters); + DUCKDB_API shared_ptr TableFunction(const string &tname, const vector &values); + //! Returns a relation that produces values + DUCKDB_API shared_ptr Values(const vector> &values); + DUCKDB_API shared_ptr Values(const vector> &values, const vector &column_names, + const string &alias = "values"); + DUCKDB_API shared_ptr Values(const string &values); + DUCKDB_API shared_ptr Values(const string &values, const vector &column_names, + const string &alias = "values"); + //! Reads CSV file + DUCKDB_API shared_ptr ReadCSV(const string &csv_file); + DUCKDB_API shared_ptr ReadCSV(const string &csv_file, const vector &columns); + //! Returns a relation from a query + DUCKDB_API shared_ptr RelationFromQuery(const string &query, const string &alias = "queryrelation", + const string &error = "Expected a single SELECT statement"); + DUCKDB_API shared_ptr RelationFromQuery(unique_ptr select_stmt, + const string &alias = "queryrelation"); -namespace duckdb { + DUCKDB_API void BeginTransaction(); + DUCKDB_API void Commit(); + DUCKDB_API void Rollback(); + DUCKDB_API void SetAutoCommit(bool auto_commit); + DUCKDB_API bool IsAutoCommit(); -class QueryNode; + //! Fetch a list of table names that are required for a given query + DUCKDB_API unordered_set GetTableNames(const string &query); -//! SelectStatement is a typical SELECT clause -class SelectStatement : public SQLStatement { -public: - SelectStatement() : SQLStatement(StatementType::SELECT_STATEMENT) { + template + void CreateScalarFunction(const string &name, TR (*udf_func)(Args...)) { + scalar_function_t function = UDFWrapper::CreateScalarFunction(name, udf_func); + UDFWrapper::RegisterFunction(name, function, *context); } - //! The main query node - unique_ptr node; - -protected: - SelectStatement(const SelectStatement &other); + template + void CreateScalarFunction(const string &name, vector args, LogicalType ret_type, + TR (*udf_func)(Args...)) { + scalar_function_t function = + UDFWrapper::CreateScalarFunction(name, args, move(ret_type), udf_func); + UDFWrapper::RegisterFunction(name, args, ret_type, function, *context); + } -public: - //! Create a copy of this SelectStatement - unique_ptr Copy() const override; - //! Serializes a SelectStatement to a stand-alone binary blob - void Serialize(Serializer &serializer) const; - //! Deserializes a blob back into a SelectStatement, returns nullptr if - //! deserialization is not possible - static unique_ptr Deserialize(Deserializer &source); - //! Whether or not the statements are equivalent - bool Equals(const SQLStatement *other) const; -}; -} // namespace duckdb + template + void CreateVectorizedFunction(const string &name, scalar_function_t udf_func, + LogicalType varargs = LogicalType::INVALID) { + UDFWrapper::RegisterFunction(name, udf_func, *context, move(varargs)); + } + DUCKDB_API void CreateVectorizedFunction(const string &name, vector args, LogicalType ret_type, + scalar_function_t udf_func, LogicalType varargs = LogicalType::INVALID) { + UDFWrapper::RegisterFunction(name, move(args), move(ret_type), udf_func, *context, move(varargs)); + } -namespace duckdb { + //------------------------------------- Aggreate Functions ----------------------------------------// + template + void CreateAggregateFunction(const string &name) { + AggregateFunction function = UDFWrapper::CreateAggregateFunction(name); + UDFWrapper::RegisterAggrFunction(function, *context); + } -class SelectStatement; + template + void CreateAggregateFunction(const string &name) { + AggregateFunction function = UDFWrapper::CreateAggregateFunction(name); + UDFWrapper::RegisterAggrFunction(function, *context); + } -struct CommonTableExpressionInfo { - vector aliases; - unique_ptr query; -}; + template + void CreateAggregateFunction(const string &name, LogicalType ret_type, LogicalType input_typeA) { + AggregateFunction function = + UDFWrapper::CreateAggregateFunction(name, ret_type, input_typeA); + UDFWrapper::RegisterAggrFunction(function, *context); + } -} // namespace duckdb + template + void CreateAggregateFunction(const string &name, LogicalType ret_type, LogicalType input_typeA, + LogicalType input_typeB) { + AggregateFunction function = + UDFWrapper::CreateAggregateFunction(name, ret_type, input_typeA, input_typeB); + UDFWrapper::RegisterAggrFunction(function, *context); + } + DUCKDB_API void CreateAggregateFunction(const string &name, vector arguments, LogicalType return_type, + aggregate_size_t state_size, aggregate_initialize_t initialize, + aggregate_update_t update, aggregate_combine_t combine, + aggregate_finalize_t finalize, + aggregate_simple_update_t simple_update = nullptr, + bind_aggregate_function_t bind = nullptr, + aggregate_destructor_t destructor = nullptr) { + AggregateFunction function = + UDFWrapper::CreateAggregateFunction(name, arguments, return_type, state_size, initialize, update, combine, + finalize, simple_update, bind, destructor); + UDFWrapper::RegisterAggrFunction(function, *context); + } -namespace duckdb { +private: + unique_ptr QueryParamsRecursive(const string &query, vector &values); -enum QueryNodeType : uint8_t { - SELECT_NODE = 1, - SET_OPERATION_NODE = 2, - BOUND_SUBQUERY_NODE = 3, - RECURSIVE_CTE_NODE = 4 + template + unique_ptr QueryParamsRecursive(const string &query, vector &values, T value, Args... args) { + values.push_back(Value::CreateValue(value)); + return QueryParamsRecursive(query, values, args...); + } }; -class QueryNode { -public: - explicit QueryNode(QueryNodeType type) : type(type) { - } - virtual ~QueryNode() { - } +} // namespace duckdb - //! The type of the query node, either SetOperation or Select - QueryNodeType type; - //! The set of result modifiers associated with this query node - vector> modifiers; - //! CTEs (used by SelectNode and SetOperationNode) - unordered_map> cte_map; +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/main/database.hpp +// +// +//===----------------------------------------------------------------------===// - virtual const vector> &GetSelectList() const = 0; -public: - virtual bool Equals(const QueryNode *other) const; - //! Create a copy of this QueryNode - virtual unique_ptr Copy() const = 0; - //! Serializes a QueryNode to a stand-alone binary blob - DUCKDB_API void Serialize(Serializer &serializer) const; - //! Serializes a QueryNode to a stand-alone binary blob - DUCKDB_API virtual void Serialize(FieldWriter &writer) const = 0; - //! Deserializes a blob back into a QueryNode - DUCKDB_API static unique_ptr Deserialize(Deserializer &source); -protected: - //! Copy base QueryNode properties from another expression to this one, - //! used in Copy method - void CopyProperties(QueryNode &other) const; -}; -} // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/main/config.hpp +// +// +//===----------------------------------------------------------------------===// -namespace duckdb { -//! Bound equivalent of QueryNode -class BoundQueryNode { -public: - explicit BoundQueryNode(QueryNodeType type) : type(type) { - } - virtual ~BoundQueryNode() { - } +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/allocator.hpp +// +// +//===----------------------------------------------------------------------===// - //! The type of the query node, either SetOperation or Select - QueryNodeType type; - //! The result modifiers that should be applied to this query node - vector> modifiers; - //! The names returned by this QueryNode. - vector names; - //! The types returned by this QueryNode. - vector types; -public: - virtual idx_t GetRootIndex() = 0; -}; -} // namespace duckdb +namespace duckdb { +class Allocator; +class ClientContext; +class DatabaseInstance; +struct PrivateAllocatorData { + virtual ~PrivateAllocatorData() { + } +}; -namespace duckdb { +typedef data_ptr_t (*allocate_function_ptr_t)(PrivateAllocatorData *private_data, idx_t size); +typedef void (*free_function_ptr_t)(PrivateAllocatorData *private_data, data_ptr_t pointer, idx_t size); +typedef data_ptr_t (*reallocate_function_ptr_t)(PrivateAllocatorData *private_data, data_ptr_t pointer, idx_t size); -class BoundSubqueryExpression : public Expression { +class AllocatedData { public: - explicit BoundSubqueryExpression(LogicalType return_type); + AllocatedData(Allocator &allocator, data_ptr_t pointer, idx_t allocated_size); + ~AllocatedData(); - bool IsCorrelated() { - return binder->correlated_columns.size() > 0; + data_ptr_t get() { + return pointer; + } + const_data_ptr_t get() const { + return pointer; } + idx_t GetSize() const { + return allocated_size; + } + void Reset(); - //! The binder used to bind the subquery node - shared_ptr binder; - //! The bound subquery node - unique_ptr subquery; - //! The subquery type - SubqueryType subquery_type; - //! the child expression to compare with (in case of IN, ANY, ALL operators) - unique_ptr child; - //! The comparison type of the child expression with the subquery (in case of ANY, ALL operators) - ExpressionType comparison_type; - //! The LogicalType of the subquery result. Only used for ANY expressions. - LogicalType child_type; - //! The target LogicalType of the subquery result (i.e. to which type it should be casted, if child_type <> - //! child_target). Only used for ANY expressions. - LogicalType child_target; +private: + Allocator &allocator; + data_ptr_t pointer; + idx_t allocated_size; +}; +class Allocator { public: - bool HasSubquery() const override { - return true; + Allocator(); + Allocator(allocate_function_ptr_t allocate_function_p, free_function_ptr_t free_function_p, + reallocate_function_ptr_t reallocate_function_p, unique_ptr private_data); + + data_ptr_t AllocateData(idx_t size); + void FreeData(data_ptr_t pointer, idx_t size); + data_ptr_t ReallocateData(data_ptr_t pointer, idx_t size); + + unique_ptr Allocate(idx_t size) { + return make_unique(*this, AllocateData(size), size); } - bool IsScalar() const override { - return false; + + static data_ptr_t DefaultAllocate(PrivateAllocatorData *private_data, idx_t size) { + return (data_ptr_t)malloc(size); } - bool IsFoldable() const override { - return false; + static void DefaultFree(PrivateAllocatorData *private_data, data_ptr_t pointer, idx_t size) { + free(pointer); + } + static data_ptr_t DefaultReallocate(PrivateAllocatorData *private_data, data_ptr_t pointer, idx_t size) { + return (data_ptr_t)realloc(pointer, size); } + static Allocator &Get(ClientContext &context); + static Allocator &Get(DatabaseInstance &db); - string ToString() const override; + PrivateAllocatorData *GetPrivateData() { + return private_data.get(); + } - bool Equals(const BaseExpression *other) const override; +private: + allocate_function_ptr_t allocate_function; + free_function_ptr_t free_function; + reallocate_function_ptr_t reallocate_function; - unique_ptr Copy() override; + unique_ptr private_data; }; + } // namespace duckdb + + + + + + + //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/planner/expression/bound_unnest_expression.hpp +// duckdb/function/replacement_scan.hpp // // //===----------------------------------------------------------------------===// @@ -16437,38 +17882,51 @@ class BoundSubqueryExpression : public Expression { namespace duckdb { -//! Represents a function call that has been bound to a base function -class BoundUnnestExpression : public Expression { -public: - explicit BoundUnnestExpression(LogicalType return_type); +class ClientContext; +class TableFunctionRef; - unique_ptr child; +struct ReplacementScanData { + virtual ~ReplacementScanData() { + } +}; -public: - bool IsFoldable() const override; - string ToString() const override; +typedef unique_ptr (*replacement_scan_t)(ClientContext &context, const string &table_name, + ReplacementScanData *data); - hash_t Hash() const override; - bool Equals(const BaseExpression *other) const override; +//! Replacement table scans are automatically attempted when a table name cannot be found in the schema +//! This allows you to do e.g. SELECT * FROM 'filename.csv', and automatically convert this into a CSV scan +struct ReplacementScan { + explicit ReplacementScan(replacement_scan_t function, unique_ptr data_p = nullptr) + : function(function), data(move(data_p)) { + } - unique_ptr Copy() override; + replacement_scan_t function; + unique_ptr data; }; + } // namespace duckdb //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/planner/expression/bound_window_expression.hpp +// duckdb/common/set.hpp // // //===----------------------------------------------------------------------===// +#include + +namespace duckdb { +using std::set; +} + + //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/parser/expression/window_expression.hpp +// duckdb/common/enums/optimizer_type.hpp // // //===----------------------------------------------------------------------===// @@ -16477,718 +17935,571 @@ class BoundUnnestExpression : public Expression { - namespace duckdb { -enum class WindowBoundary : uint8_t { +enum class OptimizerType : uint32_t { INVALID = 0, - UNBOUNDED_PRECEDING = 1, - UNBOUNDED_FOLLOWING = 2, - CURRENT_ROW_RANGE = 3, - CURRENT_ROW_ROWS = 4, - EXPR_PRECEDING_ROWS = 5, - EXPR_FOLLOWING_ROWS = 6, - EXPR_PRECEDING_RANGE = 7, - EXPR_FOLLOWING_RANGE = 8 -}; - -//! The WindowExpression represents a window function in the query. They are a special case of aggregates which is why -//! they inherit from them. -class WindowExpression : public ParsedExpression { -public: - WindowExpression(ExpressionType type, string schema_name, const string &function_name); - - //! Schema of the aggregate function - string schema; - //! Name of the aggregate function - string function_name; - //! The child expression of the main window aggregate - vector> children; - //! The set of expressions to partition by - vector> partitions; - //! The set of ordering clauses - vector orders; - //! True to ignore NULL values - bool ignore_nulls; - //! The window boundaries - WindowBoundary start = WindowBoundary::INVALID; - WindowBoundary end = WindowBoundary::INVALID; - - unique_ptr start_expr; - unique_ptr end_expr; - //! Offset and default expressions for WINDOW_LEAD and WINDOW_LAG functions - unique_ptr offset_expr; - unique_ptr default_expr; - -public: - bool IsWindow() const override { - return true; - } - - //! Get the name of the expression - string GetName() const override; - //! Convert the Expression to a String - string ToString() const override; - - static bool Equals(const WindowExpression *a, const WindowExpression *b); - - unique_ptr Copy() const override; - - void Serialize(FieldWriter &writer) const override; - static unique_ptr Deserialize(ExpressionType type, FieldReader &source); -}; -} // namespace duckdb - - - - - -namespace duckdb { -class AggregateFunction; - -class BoundWindowExpression : public Expression { -public: - BoundWindowExpression(ExpressionType type, LogicalType return_type, unique_ptr aggregate, - unique_ptr bind_info); - - //! The bound aggregate function - unique_ptr aggregate; - //! The bound function info - unique_ptr bind_info; - //! The child expressions of the main window aggregate - vector> children; - //! The set of expressions to partition by - vector> partitions; - //! Statistics belonging to the partitions expressions - vector> partitions_stats; - //! The set of ordering clauses - vector orders; - //! True to ignore NULL values - bool ignore_nulls; - //! The window boundaries - WindowBoundary start = WindowBoundary::INVALID; - WindowBoundary end = WindowBoundary::INVALID; + EXPRESSION_REWRITER, + FILTER_PULLUP, + FILTER_PUSHDOWN, + REGEX_RANGE, + IN_CLAUSE, + JOIN_ORDER, + DELIMINATOR, + UNUSED_COLUMNS, + STATISTICS_PROPAGATION, + COMMON_SUBEXPRESSIONS, + COMMON_AGGREGATE, + COLUMN_LIFETIME, + TOP_N, + REORDER_FILTER +}; - unique_ptr start_expr; - unique_ptr end_expr; - //! Offset and default expressions for WINDOW_LEAD and WINDOW_LAG functions - unique_ptr offset_expr; - unique_ptr default_expr; +string OptimizerTypeToString(OptimizerType type); +OptimizerType OptimizerTypeFromString(const string &str); -public: - bool IsWindow() const override { - return true; - } - bool IsFoldable() const override { - return false; - } +} // namespace duckdb - string ToString() const override; +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/enums/window_aggregation_mode.hpp +// +// +//===----------------------------------------------------------------------===// - bool KeysAreCompatible(const BoundWindowExpression *other) const; - bool Equals(const BaseExpression *other) const override; - unique_ptr Copy() override; -}; -} // namespace duckdb -#include namespace duckdb { -class AdaptiveFilter { -public: - explicit AdaptiveFilter(const Expression &expr); - explicit AdaptiveFilter(TableFilterSet *table_filters); - void AdaptRuntimeStatistics(double duration); - vector permutation; - -private: - //! used for adaptive expression reordering - idx_t iteration_count; - idx_t swap_idx; - idx_t right_random_border; - idx_t observe_interval; - idx_t execute_interval; - double runtime_sum; - double prev_mean; - bool observe; - bool warmup; - vector swap_likeliness; - std::default_random_engine generator; +enum class WindowAggregationMode : uint32_t { + //! Use the window aggregate API if available + WINDOW = 0, + //! Don't use window, but use combine if available + COMBINE, + //! Don't use combine or window (compute each frame separately) + SEPARATE }; + } // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/enums/set_scope.hpp +// +// +//===----------------------------------------------------------------------===// -namespace duckdb { -class ColumnSegment; -class LocalTableStorage; -class Index; -class RowGroup; -class UpdateSegment; -class TableScanState; -class ColumnSegment; -class ValiditySegment; -class TableFilterSet; -struct SegmentScanState { - virtual ~SegmentScanState() { - } -}; -struct IndexScanState { - virtual ~IndexScanState() { - } -}; -typedef unordered_map> buffer_handle_set_t; -struct ColumnScanState { - //! The column segment that is currently being scanned - ColumnSegment *current; - //! The current row index of the scan - idx_t row_index; - //! The internal row index (i.e. the position of the SegmentScanState) - idx_t internal_index; - //! Segment scan state - unique_ptr scan_state; - //! Child states of the vector - vector child_states; - //! Whether or not InitializeState has been called for this segment - bool initialized = false; - //! If this segment has already been checked for skipping purposes - bool segment_checked = false; +namespace duckdb { -public: - //! Move the scan state forward by "count" rows (including all child states) - void Next(idx_t count); - //! Move ONLY this state forward by "count" rows (i.e. not the child states) - void NextInternal(idx_t count); - //! Move the scan state forward by STANDARD_VECTOR_SIZE rows - void NextVector(); +enum class SetScope : uint8_t { + AUTOMATIC = 0, + LOCAL = 1, /* unused */ + SESSION = 2, + GLOBAL = 3 }; -struct ColumnFetchState { - //! The set of pinned block handles for this set of fetches - buffer_handle_set_t handles; - //! Any child states of the fetch - vector> child_states; -}; +} // namespace duckdb -struct LocalScanState { - ~LocalScanState(); - void SetStorage(LocalTableStorage *storage); - LocalTableStorage *GetStorage() { - return storage; - } +namespace duckdb { +class ClientContext; +class TableFunctionRef; +class CompressionFunction; - idx_t chunk_index; - idx_t max_index; - idx_t last_chunk_count; - TableFilterSet *table_filters; +struct CompressionFunctionSet; +struct DBConfig; -private: - LocalTableStorage *storage = nullptr; -}; +enum class AccessMode : uint8_t { UNDEFINED = 0, AUTOMATIC = 1, READ_ONLY = 2, READ_WRITE = 3 }; -class RowGroupScanState { -public: - RowGroupScanState(TableScanState &parent_p) : parent(parent_p), vector_index(0), max_row(0) { - } +enum class CheckpointAbort : uint8_t { + NO_ABORT = 0, + DEBUG_ABORT_BEFORE_TRUNCATE = 1, + DEBUG_ABORT_BEFORE_HEADER = 2, + DEBUG_ABORT_AFTER_FREE_LIST_WRITE = 3 +}; - //! The parent scan state - TableScanState &parent; - //! The current row_group we are scanning - RowGroup *row_group; - //! The vector index within the row_group - idx_t vector_index; - //! The maximum row index of this row_group scan - idx_t max_row; - //! Child column scans - unique_ptr column_scans; +typedef void (*set_global_function_t)(DatabaseInstance *db, DBConfig &config, const Value ¶meter); +typedef void (*set_local_function_t)(ClientContext &context, const Value ¶meter); +typedef Value (*get_setting_function_t)(ClientContext &context); -public: - //! Move to the next vector, skipping past the current one - void NextVector(); +struct ConfigurationOption { + const char *name; + const char *description; + LogicalTypeId parameter_type; + set_global_function_t set_global; + set_local_function_t set_local; + get_setting_function_t get_setting; }; -class TableScanState { -public: - TableScanState() : row_group_scan_state(*this), max_row(0) {}; +typedef void (*set_option_callback_t)(ClientContext &context, SetScope scope, Value ¶meter); - //! The row_group scan state - RowGroupScanState row_group_scan_state; - //! The total maximum row index - idx_t max_row; - //! The column identifiers of the scan - vector column_ids; - //! The table filters (if any) - TableFilterSet *table_filters = nullptr; - //! Adaptive filter info (if any) - unique_ptr adaptive_filter; - //! Transaction-local scan state - LocalScanState local_state; +struct ExtensionOption { + ExtensionOption(string description_p, LogicalType type_p, set_option_callback_t set_function_p) + : description(move(description_p)), type(move(type_p)), set_function(set_function_p) { + } -public: - //! Move to the next vector - void NextVector(); + string description; + LogicalType type; + set_option_callback_t set_function; }; -class CreateIndexScanState : public TableScanState { +struct DBConfig { + friend class DatabaseInstance; + friend class StorageManager; + public: - vector> locks; - unique_lock append_lock; - unique_lock delete_lock; -}; + DUCKDB_API DBConfig(); + DUCKDB_API ~DBConfig(); -} // namespace duckdb + //! Access mode of the database (AUTOMATIC, READ_ONLY or READ_WRITE) + AccessMode access_mode = AccessMode::AUTOMATIC; + //! The allocator used by the system + Allocator allocator; + // Checkpoint when WAL reaches this size (default: 16MB) + idx_t checkpoint_wal_size = 1 << 24; + //! Whether or not to use Direct IO, bypassing operating system buffers + bool use_direct_io = false; + //! Whether extensions should be loaded on start-up + bool load_extensions = true; + //! The FileSystem to use, can be overwritten to allow for injecting custom file systems for testing purposes (e.g. + //! RamFS or something similar) + unique_ptr file_system; + //! The maximum memory used by the database system (in bytes). Default: 80% of System available memory + idx_t maximum_memory = (idx_t)-1; + //! The maximum amount of CPU threads used by the database system. Default: all available. + idx_t maximum_threads = (idx_t)-1; + //! Whether or not to create and use a temporary directory to store intermediates that do not fit in memory + bool use_temporary_directory = true; + //! Directory to store temporary structures that do not fit in memory + string temporary_directory; + //! The collation type of the database + string collation = string(); + //! The order type used when none is specified (default: ASC) + OrderType default_order_type = OrderType::ASCENDING; + //! Null ordering used when none is specified (default: NULLS FIRST) + OrderByNullType default_null_order = OrderByNullType::NULLS_FIRST; + //! enable COPY and related commands + bool enable_external_access = true; + //! Whether or not object cache is used + bool object_cache_enable = false; + //! Force checkpoint when CHECKPOINT is called or on shutdown, even if no changes have been made + bool force_checkpoint = false; + //! Run a checkpoint on successful shutdown and delete the WAL, to leave only a single database file behind + bool checkpoint_on_shutdown = true; + //! Debug flag that decides when a checkpoing should be aborted. Only used for testing purposes. + CheckpointAbort checkpoint_abort = CheckpointAbort::NO_ABORT; + //! Replacement table scans are automatically attempted when a table name cannot be found in the schema + vector replacement_scans; + //! Initialize the database with the standard set of DuckDB functions + //! You should probably not touch this unless you know what you are doing + bool initialize_default_database = true; + //! The set of disabled optimizers (default empty) + set disabled_optimizers; + //! Force a specific compression method to be used when checkpointing (if available) + CompressionType force_compression = CompressionType::COMPRESSION_AUTO; + //! Debug flag that adds additional (unnecessary) free_list blocks to the storage + bool debug_many_free_list_blocks = false; + //! Debug setting for window aggregation mode: (window, combine, separate) + WindowAggregationMode window_mode = WindowAggregationMode::WINDOW; + //! Extra parameters that can be SET for loaded extensions + case_insensitive_map_t extension_parameters; + //! Database configuration variables as controlled by SET + case_insensitive_map_t set_variables; -namespace duckdb { -class DataTable; -class WriteAheadLog; -struct TableAppendState; + DUCKDB_API void AddExtensionOption(string name, string description, LogicalType parameter, + set_option_callback_t function = nullptr); -class LocalTableStorage { public: - explicit LocalTableStorage(DataTable &table); - ~LocalTableStorage(); - - DataTable &table; - //! The main chunk collection holding the data - ChunkCollection collection; - //! The set of unique indexes - vector> indexes; - //! The set of deleted entries - unordered_map> deleted_entries; - //! The number of deleted rows - idx_t deleted_rows; - //! The number of active scans - atomic active_scans; + DUCKDB_API static DBConfig &GetConfig(ClientContext &context); + DUCKDB_API static DBConfig &GetConfig(DatabaseInstance &db); + DUCKDB_API static vector GetOptions(); + DUCKDB_API static idx_t GetOptionCount(); -public: - void InitializeScan(LocalScanState &state, TableFilterSet *table_filters = nullptr); - idx_t EstimatedSize(); + //! Fetch an option by index. Returns a pointer to the option, or nullptr if out of range + DUCKDB_API static ConfigurationOption *GetOptionByIndex(idx_t index); + //! Fetch an option by name. Returns a pointer to the option, or nullptr if none exists. + DUCKDB_API static ConfigurationOption *GetOptionByName(const string &name); - void Clear(); -}; + DUCKDB_API void SetOption(const ConfigurationOption &option, const Value &value); -//! The LocalStorage class holds appends that have not been committed yet -class LocalStorage { -public: - struct CommitState { - unordered_map> append_states; - }; + DUCKDB_API static idx_t ParseMemoryLimit(const string &arg); -public: - explicit LocalStorage(Transaction &transaction) : transaction(transaction) { - } + //! Return the list of possible compression functions for the specific physical type + DUCKDB_API vector GetCompressionFunctions(PhysicalType data_type); + //! Return the compression function for the specified compression type/physical type combo + DUCKDB_API CompressionFunction *GetCompressionFunction(CompressionType type, PhysicalType data_type); - //! Initialize a scan of the local storage - void InitializeScan(DataTable *table, LocalScanState &state, TableFilterSet *table_filters); - //! Scan - void Scan(LocalScanState &state, const vector &column_ids, DataChunk &result); +private: + unique_ptr compression_functions; +}; - //! Append a chunk to the local storage - void Append(DataTable *table, DataChunk &chunk); - //! Delete a set of rows from the local storage - idx_t Delete(DataTable *table, Vector &row_ids, idx_t count); - //! Update a set of rows in the local storage - void Update(DataTable *table, Vector &row_ids, const vector &column_ids, DataChunk &data); +} // namespace duckdb - //! Commits the local storage, writing it to the WAL and completing the commit - void Commit(LocalStorage::CommitState &commit_state, Transaction &transaction, WriteAheadLog *log, - transaction_t commit_id); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/main/extension.hpp +// +// +//===----------------------------------------------------------------------===// - bool ChangesMade() noexcept { - return table_storage.size() > 0; - } - idx_t EstimatedSize(); - bool Find(DataTable *table) { - return table_storage.find(table) != table_storage.end(); - } - idx_t AddedRows(DataTable *table) { - auto entry = table_storage.find(table); - if (entry == table_storage.end()) { - return 0; - } - return entry->second->collection.Count() - entry->second->deleted_rows; - } - void AddColumn(DataTable *old_dt, DataTable *new_dt, ColumnDefinition &new_column, Expression *default_value); - void ChangeType(DataTable *old_dt, DataTable *new_dt, idx_t changed_idx, const LogicalType &target_type, - const vector &bound_columns, Expression &cast_expr); -private: - LocalTableStorage *GetStorage(DataTable *table); - template - bool ScanTableStorage(DataTable &table, LocalTableStorage &storage, T &&fun); +namespace duckdb { +class DuckDB; -private: - Transaction &transaction; - unordered_map> table_storage; +//! The Extension class is the base class used to define extensions +class Extension { +public: + DUCKDB_API virtual ~Extension(); - void Flush(DataTable &table, LocalTableStorage &storage); + DUCKDB_API virtual void Load(DuckDB &db) = 0; + DUCKDB_API virtual std::string Name() = 0; }; } // namespace duckdb - - namespace duckdb { -class SequenceCatalogEntry; - -class ColumnData; -class ClientContext; -class CatalogEntry; -class DataTable; -class DatabaseInstance; -class WriteAheadLog; - -class ChunkVectorInfo; - -struct DeleteInfo; -struct UpdateInfo; +class StorageManager; +class Catalog; +class TransactionManager; +class ConnectionManager; +class FileSystem; +class TaskScheduler; +class ObjectCache; -//! The transaction object holds information about a currently running or past -//! transaction +class DatabaseInstance : public std::enable_shared_from_this { + friend class DuckDB; -class Transaction { public: - Transaction(weak_ptr context, transaction_t start_time, transaction_t transaction_id, - timestamp_t start_timestamp, idx_t catalog_version) - : context(move(context)), start_time(start_time), transaction_id(transaction_id), commit_id(0), - highest_active_query(0), active_query(MAXIMUM_QUERY_ID), start_timestamp(start_timestamp), - catalog_version(catalog_version), storage(*this), is_invalidated(false) { - } + DUCKDB_API DatabaseInstance(); + DUCKDB_API ~DatabaseInstance(); - weak_ptr context; - //! The start timestamp of this transaction - transaction_t start_time; - //! The transaction id of this transaction - transaction_t transaction_id; - //! The commit id of this transaction, if it has successfully been committed - transaction_t commit_id; - //! Highest active query when the transaction finished, used for cleaning up - transaction_t highest_active_query; - //! The current active query for the transaction. Set to MAXIMUM_QUERY_ID if - //! no query is active. - atomic active_query; - //! The timestamp when the transaction started - timestamp_t start_timestamp; - //! The catalog version when the transaction was started - idx_t catalog_version; - //! The set of uncommitted appends for the transaction - LocalStorage storage; - //! Map of all sequences that were used during the transaction and the value they had in this transaction - unordered_map sequence_usage; - //! Whether or not the transaction has been invalidated - bool is_invalidated; + DBConfig config; public: - static Transaction &GetTransaction(ClientContext &context); - - void PushCatalogEntry(CatalogEntry *entry, data_ptr_t extra_data = nullptr, idx_t extra_data_size = 0); - - //! Commit the current transaction with the given commit identifier. Returns an error message if the transaction - //! commit failed, or an empty string if the commit was sucessful - string Commit(DatabaseInstance &db, transaction_t commit_id, bool checkpoint) noexcept; - //! Returns whether or not a commit of this transaction should trigger an automatic checkpoint - bool AutomaticCheckpoint(DatabaseInstance &db); + DUCKDB_API StorageManager &GetStorageManager(); + DUCKDB_API Catalog &GetCatalog(); + DUCKDB_API FileSystem &GetFileSystem(); + DUCKDB_API TransactionManager &GetTransactionManager(); + DUCKDB_API TaskScheduler &GetScheduler(); + DUCKDB_API ObjectCache &GetObjectCache(); + DUCKDB_API ConnectionManager &GetConnectionManager(); - //! Rollback - void Rollback() noexcept { - undo_buffer.Rollback(); - } - //! Cleanup the undo buffer - void Cleanup() { - undo_buffer.Cleanup(); - } + idx_t NumberOfThreads(); - void Invalidate() { - is_invalidated = true; - } - bool IsInvalidated() { - return is_invalidated; - } - bool ChangesMade(); + DUCKDB_API static DatabaseInstance &GetDatabase(ClientContext &context); - timestamp_t GetCurrentTransactionStartTimestamp() { - return start_timestamp; - } +private: + void Initialize(const char *path, DBConfig *config); - void PushDelete(DataTable *table, ChunkVectorInfo *vinfo, row_t rows[], idx_t count, idx_t base_row); - void PushAppend(DataTable *table, idx_t row_start, idx_t row_count); - UpdateInfo *CreateUpdateInfo(idx_t type_size, idx_t entries); + void Configure(DBConfig &config); private: - //! The undo buffer is used to store old versions of rows that are updated - //! or deleted - UndoBuffer undo_buffer; - - Transaction(const Transaction &) = delete; + unique_ptr storage; + unique_ptr catalog; + unique_ptr transaction_manager; + unique_ptr scheduler; + unique_ptr object_cache; + unique_ptr connection_manager; + unordered_set loaded_extensions; }; -} // namespace duckdb - -#include -#include - -namespace duckdb { -struct AlterInfo; +//! The database object. This object holds the catalog and all the +//! database-specific meta information. +class DuckDB { +public: + DUCKDB_API explicit DuckDB(const char *path = nullptr, DBConfig *config = nullptr); + DUCKDB_API explicit DuckDB(const string &path, DBConfig *config = nullptr); + DUCKDB_API explicit DuckDB(DatabaseInstance &instance); -class ClientContext; + DUCKDB_API ~DuckDB(); -typedef unordered_map> set_lock_map_t; + //! Reference to the actual database instance + shared_ptr instance; -struct MappingValue { - explicit MappingValue(idx_t index_) : index(index_), timestamp(0), deleted(false), parent(nullptr) { +public: + template + void LoadExtension() { + T extension; + if (ExtensionIsLoaded(extension.Name())) { + return; + } + extension.Load(*this); + SetExtensionLoaded(extension.Name()); } - idx_t index; - transaction_t timestamp; - bool deleted; - unique_ptr child; - MappingValue *parent; + DUCKDB_API FileSystem &GetFileSystem(); + + DUCKDB_API idx_t NumberOfThreads(); + DUCKDB_API static const char *SourceID(); + DUCKDB_API static const char *LibraryVersion(); + DUCKDB_API static string Platform(); + DUCKDB_API bool ExtensionIsLoaded(const std::string &name); + DUCKDB_API void SetExtensionLoaded(const std::string &name); }; -//! The Catalog Set stores (key, value) map of a set of CatalogEntries -class CatalogSet { - friend class DependencyManager; - friend class EntryDropper; - -public: - DUCKDB_API explicit CatalogSet(Catalog &catalog, unique_ptr defaults = nullptr); +} // namespace duckdb - //! Create an entry in the catalog set. Returns whether or not it was - //! successful. - DUCKDB_API bool CreateEntry(ClientContext &context, const string &name, unique_ptr value, - unordered_set &dependencies); - DUCKDB_API bool AlterEntry(ClientContext &context, const string &name, AlterInfo *alter_info); +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/main/loadable_extension.hpp +// +// +//===----------------------------------------------------------------------===// - DUCKDB_API bool DropEntry(ClientContext &context, const string &name, bool cascade); - bool AlterOwnership(ClientContext &context, ChangeOwnershipInfo *info); - void CleanupEntry(CatalogEntry *catalog_entry); +#if defined(DUCKDB_BUILD_LOADABLE_EXTENSION) && defined(DUCKDB_EXTENSION_MAIN) +#ifdef _WIN32 +#ifndef NOMINMAX +#define NOMINMAX +#endif - //! Returns the entry with the specified name - DUCKDB_API CatalogEntry *GetEntry(ClientContext &context, const string &name); +#ifndef _WINSOCKAPI_ +#define _WINSOCKAPI_ +#endif +#include - //! Gets the entry that is most similar to the given name (i.e. smallest levenshtein distance), or empty string if - //! none is found. The returned pair consists of the entry name and the distance (smaller means closer). - pair SimilarEntry(ClientContext &context, const string &name); +#undef CreateDirectory +#undef MoveFile +#undef RemoveDirectory - //! Rollback to be the currently valid entry for a certain catalog - //! entry - void Undo(CatalogEntry *entry); +#include - //! Scan the catalog set, invoking the callback method for every committed entry - DUCKDB_API void Scan(const std::function &callback); - //! Scan the catalog set, invoking the callback method for every entry - DUCKDB_API void Scan(ClientContext &context, const std::function &callback); +extern "C" { +/* +This is interesting: Windows would normally require a duckdb.dll being on the DLL search path when we load an extension +using LoadLibrary(). However, there is likely no such dll, because DuckDB was statically linked, or is running as part +of an R or Python module with a completely different name (that we don't know) or something of the sorts. Amazingly, +Windows supports lazy-loading DLLs by linking them with /DELAYLOAD. Then a callback will be triggered whenever we access +symbols in the extension. Since DuckDB is already running in the host process (hopefully), we can use +GetModuleHandle(NULL) to return the current process so the symbols are looked for there. See here for another +explanation of this crazy process: - template - vector GetEntries(ClientContext &context) { - vector result; - Scan(context, [&](CatalogEntry *entry) { result.push_back((T *)entry); }); - return result; +* https://docs.microsoft.com/en-us/cpp/build/reference/linker-support-for-delay-loaded-dlls?view=msvc-160 +* https://docs.microsoft.com/en-us/cpp/build/reference/understanding-the-helper-function?view=msvc-160 +*/ +FARPROC WINAPI duckdb_dllimport_delay_hook(unsigned dliNotify, PDelayLoadInfo pdli) { + switch (dliNotify) { + case dliNotePreLoadLibrary: + if (strcmp(pdli->szDll, "duckdb.dll") != 0) { + return NULL; + } + return (FARPROC)GetModuleHandle(NULL); + default: + return NULL; } - DUCKDB_API static bool HasConflict(ClientContext &context, transaction_t timestamp); - DUCKDB_API static bool UseTimestamp(ClientContext &context, transaction_t timestamp); - - CatalogEntry *GetEntryFromIndex(idx_t index); - void UpdateTimestamp(CatalogEntry *entry, transaction_t timestamp); - -private: - //! Adjusts table dependencies on the event of an UNDO - void AdjustTableDependencies(CatalogEntry *entry); - //! Adjust one dependency - void AdjustDependency(CatalogEntry *entry, TableCatalogEntry *table, ColumnDefinition &column, bool remove); - //! Adjust Enum dependency - void AdjustEnumDependency(CatalogEntry *entry, ColumnDefinition &column, bool remove); - //! Given a root entry, gets the entry valid for this transaction - CatalogEntry *GetEntryForTransaction(ClientContext &context, CatalogEntry *current); - CatalogEntry *GetCommittedEntry(CatalogEntry *current); - bool GetEntryInternal(ClientContext &context, const string &name, idx_t &entry_index, CatalogEntry *&entry); - bool GetEntryInternal(ClientContext &context, idx_t entry_index, CatalogEntry *&entry); - //! Drops an entry from the catalog set; must hold the catalog_lock to safely call this - void DropEntryInternal(ClientContext &context, idx_t entry_index, CatalogEntry &entry, bool cascade); - CatalogEntry *CreateEntryInternal(ClientContext &context, unique_ptr entry); - MappingValue *GetMapping(ClientContext &context, const string &name, bool get_latest = false); - void PutMapping(ClientContext &context, const string &name, idx_t entry_index); - void DeleteMapping(ClientContext &context, const string &name); - void DropEntryDependencies(ClientContext &context, idx_t entry_index, CatalogEntry &entry, bool cascade); + return NULL; +} -private: - Catalog &catalog; - //! The catalog lock is used to make changes to the data - mutex catalog_lock; - //! Mapping of string to catalog entry - case_insensitive_map_t> mapping; - //! The set of catalog entries - unordered_map> entries; - //! The current catalog entry index - idx_t current_entry = 0; - //! The generator used to generate default internal entries - unique_ptr defaults; -}; -} // namespace duckdb +ExternC const PfnDliHook __pfnDliNotifyHook2 = duckdb_dllimport_delay_hook; +ExternC const PfnDliHook __pfnDliFailureHook2 = duckdb_dllimport_delay_hook; +} +#endif +#endif +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/types/date.hpp +// +// +//===----------------------------------------------------------------------===// -namespace duckdb { -class ClientContext; -class StandardEntry; -class TableCatalogEntry; -class TableFunctionCatalogEntry; -class SequenceCatalogEntry; -class Serializer; -class Deserializer; -enum class OnCreateConflict : uint8_t; -struct AlterTableInfo; -struct CreateIndexInfo; -struct CreateFunctionInfo; -struct CreateCollationInfo; -struct CreateViewInfo; -struct BoundCreateTableInfo; -struct CreatePragmaFunctionInfo; -struct CreateSequenceInfo; -struct CreateSchemaInfo; -struct CreateTableFunctionInfo; -struct CreateCopyFunctionInfo; -struct CreateTypeInfo; -struct DropInfo; -//! A schema in the catalog -class SchemaCatalogEntry : public CatalogEntry { - friend class Catalog; +namespace duckdb { +//! The Date class is a static class that holds helper functions for the Date type. +class Date { public: - SchemaCatalogEntry(Catalog *catalog, string name, bool is_internal); - -private: - //! The catalog set holding the tables - CatalogSet tables; - //! The catalog set holding the indexes - CatalogSet indexes; - //! The catalog set holding the table functions - CatalogSet table_functions; - //! The catalog set holding the copy functions - CatalogSet copy_functions; - //! The catalog set holding the pragma functions - CatalogSet pragma_functions; - //! The catalog set holding the scalar and aggregate functions - CatalogSet functions; - //! The catalog set holding the sequences - CatalogSet sequences; - //! The catalog set holding the collations - CatalogSet collations; - //! The catalog set holding the types - CatalogSet types; + static const string_t MONTH_NAMES[12]; + static const string_t MONTH_NAMES_ABBREVIATED[12]; + static const string_t DAY_NAMES[7]; + static const string_t DAY_NAMES_ABBREVIATED[7]; + static const int32_t NORMAL_DAYS[13]; + static const int32_t CUMULATIVE_DAYS[13]; + static const int32_t LEAP_DAYS[13]; + static const int32_t CUMULATIVE_LEAP_DAYS[13]; + static const int32_t CUMULATIVE_YEAR_DAYS[401]; + static const int8_t MONTH_PER_DAY_OF_YEAR[365]; + static const int8_t LEAP_MONTH_PER_DAY_OF_YEAR[366]; -public: - //! Scan the specified catalog set, invoking the callback method for every entry - void Scan(ClientContext &context, CatalogType type, const std::function &callback); - //! Scan the specified catalog set, invoking the callback method for every committed entry - void Scan(CatalogType type, const std::function &callback); + // min date is 5877642-06-23 (BC) (-2^31) + constexpr static const int32_t DATE_MIN_YEAR = -5877641; + constexpr static const int32_t DATE_MIN_MONTH = 6; + constexpr static const int32_t DATE_MIN_DAY = 23; + // max date is 5881580-07-11 (2^31) + constexpr static const int32_t DATE_MAX_YEAR = 5881580; + constexpr static const int32_t DATE_MAX_MONTH = 7; + constexpr static const int32_t DATE_MAX_DAY = 11; + constexpr static const int32_t EPOCH_YEAR = 1970; - //! Serialize the meta information of the SchemaCatalogEntry a serializer - virtual void Serialize(Serializer &serializer); - //! Deserializes to a CreateSchemaInfo - static unique_ptr Deserialize(Deserializer &source); + constexpr static const int32_t YEAR_INTERVAL = 400; + constexpr static const int32_t DAYS_PER_YEAR_INTERVAL = 146097; - string ToSQL() override; +public: + //! Convert a string in the format "YYYY-MM-DD" to a date object + DUCKDB_API static date_t FromString(const string &str, bool strict = false); + //! Convert a string in the format "YYYY-MM-DD" to a date object + DUCKDB_API static date_t FromCString(const char *str, idx_t len, bool strict = false); + //! Convert a date object to a string in the format "YYYY-MM-DD" + DUCKDB_API static string ToString(date_t date); + //! Try to convert text in a buffer to a date; returns true if parsing was successful + DUCKDB_API static bool TryConvertDate(const char *buf, idx_t len, idx_t &pos, date_t &result, bool strict = false); - //! Creates an index with the given name in the schema - CatalogEntry *CreateIndex(ClientContext &context, CreateIndexInfo *info, TableCatalogEntry *table); + //! Create a string "YYYY-MM-DD" from a specified (year, month, day) + //! combination + DUCKDB_API static string Format(int32_t year, int32_t month, int32_t day); -private: - //! Create a scalar or aggregate function within the given schema - CatalogEntry *CreateFunction(ClientContext &context, CreateFunctionInfo *info); - //! Creates a table with the given name in the schema - CatalogEntry *CreateTable(ClientContext &context, BoundCreateTableInfo *info); - //! Creates a view with the given name in the schema - CatalogEntry *CreateView(ClientContext &context, CreateViewInfo *info); - //! Creates a sequence with the given name in the schema - CatalogEntry *CreateSequence(ClientContext &context, CreateSequenceInfo *info); - //! Create a table function within the given schema - CatalogEntry *CreateTableFunction(ClientContext &context, CreateTableFunctionInfo *info); - //! Create a copy function within the given schema - CatalogEntry *CreateCopyFunction(ClientContext &context, CreateCopyFunctionInfo *info); - //! Create a pragma function within the given schema - CatalogEntry *CreatePragmaFunction(ClientContext &context, CreatePragmaFunctionInfo *info); - //! Create a collation within the given schema - CatalogEntry *CreateCollation(ClientContext &context, CreateCollationInfo *info); - //! Create a enum within the given schema - CatalogEntry *CreateType(ClientContext &context, CreateTypeInfo *info); + //! Extract the year, month and day from a given date object + DUCKDB_API static void Convert(date_t date, int32_t &out_year, int32_t &out_month, int32_t &out_day); + //! Create a Date object from a specified (year, month, day) combination + DUCKDB_API static date_t FromDate(int32_t year, int32_t month, int32_t day); + DUCKDB_API static bool TryFromDate(int32_t year, int32_t month, int32_t day, date_t &result); - //! Drops an entry from the schema - void DropEntry(ClientContext &context, DropInfo *info); + //! Returns true if (year) is a leap year, and false otherwise + DUCKDB_API static bool IsLeapYear(int32_t year); - //! Append a scalar or aggregate function within the given schema - CatalogEntry *AddFunction(ClientContext &context, CreateFunctionInfo *info); + //! Returns true if the specified (year, month, day) combination is a valid + //! date + DUCKDB_API static bool IsValid(int32_t year, int32_t month, int32_t day); - //! Alters a catalog entry - void Alter(ClientContext &context, AlterInfo *info); + //! The max number of days in a month of a given year + DUCKDB_API static int32_t MonthDays(int32_t year, int32_t month); - //! Add a catalog entry to this schema - CatalogEntry *AddEntry(ClientContext &context, unique_ptr entry, OnCreateConflict on_conflict); - //! Add a catalog entry to this schema - CatalogEntry *AddEntry(ClientContext &context, unique_ptr entry, OnCreateConflict on_conflict, - unordered_set dependencies); + //! Extract the epoch from the date (seconds since 1970-01-01) + DUCKDB_API static int64_t Epoch(date_t date); + //! Extract the epoch from the date (nanoseconds since 1970-01-01) + DUCKDB_API static int64_t EpochNanoseconds(date_t date); + //! Convert the epoch (seconds since 1970-01-01) to a date_t + DUCKDB_API static date_t EpochToDate(int64_t epoch); - //! Get the catalog set for the specified type - CatalogSet &GetCatalogSet(CatalogType type); -}; -} // namespace duckdb + //! Extract the number of days since epoch (days since 1970-01-01) + DUCKDB_API static int32_t EpochDays(date_t date); + //! Convert the epoch number of days to a date_t + DUCKDB_API static date_t EpochDaysToDate(int32_t epoch); + + //! Extract year of a date entry + DUCKDB_API static int32_t ExtractYear(date_t date); + //! Extract year of a date entry, but optimized to first try the last year found + DUCKDB_API static int32_t ExtractYear(date_t date, int32_t *last_year); + DUCKDB_API static int32_t ExtractYear(timestamp_t ts, int32_t *last_year); + //! Extract month of a date entry + DUCKDB_API static int32_t ExtractMonth(date_t date); + //! Extract day of a date entry + DUCKDB_API static int32_t ExtractDay(date_t date); + //! Extract the day of the week (1-7) + DUCKDB_API static int32_t ExtractISODayOfTheWeek(date_t date); + //! Extract the day of the year + DUCKDB_API static int32_t ExtractDayOfTheYear(date_t date); + //! Extract the ISO week number + //! ISO weeks start on Monday and the first week of a year + //! contains January 4 of that year. + //! In the ISO week-numbering system, it is possible for early-January dates + //! to be part of the 52nd or 53rd week of the previous year. + DUCKDB_API static void ExtractISOYearWeek(date_t date, int32_t &year, int32_t &week); + DUCKDB_API static int32_t ExtractISOWeekNumber(date_t date); + DUCKDB_API static int32_t ExtractISOYearNumber(date_t date); + //! Extract the week number as Python handles it. + //! Either Monday or Sunday is the first day of the week, + //! and any date before the first Monday/Sunday returns week 0 + //! This is a bit more consistent because week numbers in a year are always incrementing + DUCKDB_API static int32_t ExtractWeekNumberRegular(date_t date, bool monday_first = true); + //! Returns the date of the monday of the current week. + DUCKDB_API static date_t GetMondayOfCurrentWeek(date_t date); + //! Helper function to parse two digits from a string (e.g. "30" -> 30, "03" -> 3, "3" -> 3) + DUCKDB_API static bool ParseDoubleDigit(const char *buf, idx_t len, idx_t &pos, int32_t &result); + DUCKDB_API static string ConversionError(const string &str); + DUCKDB_API static string ConversionError(string_t str); +private: + static void ExtractYearOffset(int32_t &n, int32_t &year, int32_t &year_offset); +}; +} // namespace duckdb //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/common/deque.hpp +// duckdb/common/types/blob.hpp // // //===----------------------------------------------------------------------===// -#include -namespace duckdb { -using std::deque; -} -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/progress_bar.hpp -// -// -//===----------------------------------------------------------------------===// +namespace duckdb { +//! The Blob class is a static class that holds helper functions for the Blob type. +class Blob { +public: + // map of integer -> hex value + static constexpr const char *HEX_TABLE = "0123456789ABCDEF"; + // reverse map of byte -> integer value, or -1 for invalid hex values + static const int HEX_MAP[256]; + //! map of index -> base64 character + static constexpr const char *BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + //! padding character used in base64 encoding + static constexpr const char BASE64_PADDING = '='; +public: + //! Returns the string size of a blob -> string conversion + static idx_t GetStringSize(string_t blob); + //! Converts a blob to a string, writing the output to the designated output string. + //! The string needs to have space for at least GetStringSize(blob) bytes. + static void ToString(string_t blob, char *output); + //! Convert a blob object to a string + static string ToString(string_t blob); + //! Returns the blob size of a string -> blob conversion + static bool TryGetBlobSize(string_t str, idx_t &result_size, string *error_message); + static idx_t GetBlobSize(string_t str); + //! Convert a string to a blob. This function should ONLY be called after calling GetBlobSize, since it does NOT + //! perform data validation. + static void ToBlob(string_t str, data_ptr_t output); + //! Convert a string object to a blob + static string ToBlob(string_t str); + // base 64 conversion functions + //! Returns the string size of a blob -> base64 conversion + static idx_t ToBase64Size(string_t blob); + //! Converts a blob to a base64 string, output should have space for at least ToBase64Size(blob) bytes + static void ToBase64(string_t blob, char *output); + //! Returns the string size of a base64 string -> blob conversion + static idx_t FromBase64Size(string_t str); + //! Converts a base64 string to a blob, output should have space for at least FromBase64Size(blob) bytes + static void FromBase64(string_t str, data_ptr_t output, idx_t output_size); +}; +} // namespace duckdb //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/common/profiler.hpp +// duckdb/common/types/decimal.hpp // // //===----------------------------------------------------------------------===// @@ -17197,85 +18508,28 @@ using std::deque; - namespace duckdb { -//! The profiler can be used to measure elapsed time -template -class BaseProfiler { +//! The Decimal class is a static class that holds helper functions for the Decimal type +class Decimal { public: - //! Starts the timer - void Start() { - finished = false; - start = Tick(); - } - //! Finishes timing - void End() { - end = Tick(); - finished = true; - } - - //! Returns the elapsed time in seconds. If End() has been called, returns - //! the total elapsed time. Otherwise returns how far along the timer is - //! right now. - double Elapsed() const { - auto _end = finished ? end : Tick(); - return std::chrono::duration_cast>(_end - start).count(); - } - -private: - time_point Tick() const { - return T::now(); - } - time_point start; - time_point end; - bool finished = false; -}; - -using Profiler = BaseProfiler; - -} // namespace duckdb - - -namespace duckdb { + static constexpr uint8_t MAX_WIDTH_INT16 = 4; + static constexpr uint8_t MAX_WIDTH_INT32 = 9; + static constexpr uint8_t MAX_WIDTH_INT64 = 18; + static constexpr uint8_t MAX_WIDTH_INT128 = 38; + static constexpr uint8_t MAX_WIDTH_DECIMAL = MAX_WIDTH_INT128; -class ProgressBar { public: - explicit ProgressBar(Executor &executor, idx_t show_progress_after); - - //! Starts the thread - void Start(); - //! Updates the progress bar and prints it to the screen - void Update(bool final); - //! Gets current percentage - double GetCurrentPercentage(); - -private: - const string PROGRESS_BAR_STRING = "============================================================"; - static constexpr const idx_t PROGRESS_BAR_WIDTH = 60; - -private: - //! The executor - Executor &executor; - //! The profiler used to measure the time since the progress bar was started - Profiler profiler; - //! The time in ms after which to start displaying the progress bar - idx_t show_progress_after; - //! The current progress percentage - double current_percentage; - //! Whether or not profiling is supported for the current query - bool supported = true; + static string ToString(int16_t value, uint8_t scale); + static string ToString(int32_t value, uint8_t scale); + static string ToString(int64_t value, uint8_t scale); + static string ToString(hugeint_t value, uint8_t scale); }; } // namespace duckdb - - - - - //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/transaction/transaction_context.hpp +// duckdb/common/types/uuid.hpp // // //===----------------------------------------------------------------------===// @@ -17287,58 +18541,38 @@ class ProgressBar { namespace duckdb { -class ClientContext; -class Transaction; -class TransactionManager; - -//! The transaction context keeps track of all the information relating to the -//! current transaction -class TransactionContext { +//! The UUID class contains static operations for the UUID type +class UUID { public: - TransactionContext(TransactionManager &transaction_manager, ClientContext &context) - : transaction_manager(transaction_manager), context(context), auto_commit(true), current_transaction(nullptr) { - } - ~TransactionContext(); - - Transaction &ActiveTransaction() { - D_ASSERT(current_transaction); - return *current_transaction; - } - - bool HasActiveTransaction() { - return !!current_transaction; - } - - void RecordQuery(string query); - void BeginTransaction(); - void Commit(); - void Rollback(); - void ClearTransaction(); - - void SetAutoCommit(bool value); - bool IsAutoCommit() { - return auto_commit; + constexpr static const uint8_t STRING_SIZE = 36; + //! Convert a uuid string to a hugeint object + static bool FromString(string str, hugeint_t &result); + //! Convert a uuid string to a hugeint object + static bool FromCString(const char *str, idx_t len, hugeint_t &result) { + return FromString(string(str, 0, len), result); } + //! Convert a hugeint object to a uuid style string + static void ToString(hugeint_t input, char *buf); -private: - TransactionManager &transaction_manager; - ClientContext &context; - bool auto_commit; - - Transaction *current_transaction; + //! Convert a hugeint object to a uuid style string + static string ToString(hugeint_t input) { + char buff[STRING_SIZE]; + ToString(input, buff); + return string(buff, STRING_SIZE); + } - TransactionContext(const TransactionContext &) = delete; + static hugeint_t FromString(string str) { + hugeint_t result; + FromString(str, result); + return result; + } }; } // namespace duckdb - - -#include - //===----------------------------------------------------------------------===// // DuckDB // -// duckdb/main/client_config.hpp +// duckdb/common/types/timestamp.hpp // // //===----------------------------------------------------------------------===// @@ -17347,315 +18581,337 @@ class TransactionContext { -//===----------------------------------------------------------------------===// -// DuckDB -// -// duckdb/common/enums/output_type.hpp -// -// -//===----------------------------------------------------------------------===// +namespace duckdb { + +struct timestamp_struct { + int32_t year; + int8_t month; + int8_t day; + int8_t hour; + int8_t min; + int8_t sec; + int16_t msec; +}; +//! The Timestamp class is a static class that holds helper functions for the Timestamp +//! type. +class Timestamp { +public: + // min timestamp is 290308-12-22 (BC) + constexpr static const int32_t MIN_YEAR = -290308; + constexpr static const int32_t MIN_MONTH = 12; + constexpr static const int32_t MIN_DAY = 22; +public: + //! Convert a string in the format "YYYY-MM-DD hh:mm:ss" to a timestamp object + DUCKDB_API static timestamp_t FromString(const string &str); + DUCKDB_API static bool TryConvertTimestamp(const char *str, idx_t len, timestamp_t &result); + DUCKDB_API static timestamp_t FromCString(const char *str, idx_t len); + //! Convert a date object to a string in the format "YYYY-MM-DD hh:mm:ss" + DUCKDB_API static string ToString(timestamp_t timestamp); + DUCKDB_API static date_t GetDate(timestamp_t timestamp); -namespace duckdb { + DUCKDB_API static dtime_t GetTime(timestamp_t timestamp); + //! Create a Timestamp object from a specified (date, time) combination + DUCKDB_API static timestamp_t FromDatetime(date_t date, dtime_t time); + DUCKDB_API static bool TryFromDatetime(date_t date, dtime_t time, timestamp_t &result); -enum class ExplainOutputType : uint8_t { ALL = 0, OPTIMIZED_ONLY = 1, PHYSICAL_ONLY = 2 }; + //! Extract the date and time from a given timestamp object + DUCKDB_API static void Convert(timestamp_t date, date_t &out_date, dtime_t &out_time); + //! Returns current timestamp + DUCKDB_API static timestamp_t GetCurrentTimestamp(); -} // namespace duckdb + //! Convert the epoch (in sec) to a timestamp + DUCKDB_API static timestamp_t FromEpochSeconds(int64_t ms); + //! Convert the epoch (in ms) to a timestamp + DUCKDB_API static timestamp_t FromEpochMs(int64_t ms); + //! Convert the epoch (in microseconds) to a timestamp + DUCKDB_API static timestamp_t FromEpochMicroSeconds(int64_t micros); + //! Convert the epoch (in nanoseconds) to a timestamp + DUCKDB_API static timestamp_t FromEpochNanoSeconds(int64_t micros); + //! Convert the epoch (in seconds) to a timestamp + DUCKDB_API static int64_t GetEpochSeconds(timestamp_t timestamp); + //! Convert the epoch (in ms) to a timestamp + DUCKDB_API static int64_t GetEpochMs(timestamp_t timestamp); + //! Convert a timestamp to epoch (in microseconds) + DUCKDB_API static int64_t GetEpochMicroSeconds(timestamp_t timestamp); + //! Convert a timestamp to epoch (in nanoseconds) + DUCKDB_API static int64_t GetEpochNanoSeconds(timestamp_t timestamp); + DUCKDB_API static bool TryParseUTCOffset(const char *str, idx_t &pos, idx_t len, int &hour_offset, + int &minute_offset); + DUCKDB_API static string ConversionError(const string &str); + DUCKDB_API static string ConversionError(string_t str); +}; +} // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/types/time.hpp +// +// +//===----------------------------------------------------------------------===// -namespace duckdb { -class ClientContext; -struct ClientConfig { - //! If the query profiler is enabled or not. - bool enable_profiler = false; - //! If detailed query profiling is enabled - bool enable_detailed_profiling = false; - //! The format to automatically print query profiling information in (default: disabled) - ProfilerPrintFormat profiler_print_format = ProfilerPrintFormat::NONE; - //! The file to save query profiling information to, instead of printing it to the console - //! (empty = print to console) - string profiler_save_location; - //! If the progress bar is enabled or not. - bool enable_progress_bar = false; - //! If the print of the progress bar is enabled - bool print_progress_bar = true; - //! The wait time before showing the progress bar - int wait_time = 2000; - //! Preserve identifier case while parsing. - //! If false, all unquoted identifiers are lower-cased (e.g. "MyTable" -> "mytable"). - bool preserve_identifier_case = true; - // Whether or not aggressive query verification is enabled - bool query_verification_enabled = false; - //! Enable the running of optimizers - bool enable_optimizer = true; - //! Force parallelism of small tables, used for testing - bool verify_parallelism = false; - //! Force index join independent of table cardinality, used for testing - bool force_index_join = false; - //! Force out-of-core computation for operators that support it, used for testing - bool force_external = false; - //! Maximum bits allowed for using a perfect hash table (i.e. the perfect HT can hold up to 2^perfect_ht_threshold - //! elements) - idx_t perfect_ht_threshold = 12; - //! The explain output type used when none is specified (default: PHYSICAL_ONLY) - ExplainOutputType explain_output_type = ExplainOutputType::PHYSICAL_ONLY; - //! Generic options - case_insensitive_map_t set_variables; +namespace duckdb { +//! The Time class is a static class that holds helper functions for the Time +//! type. +class Time { public: - static ClientConfig &GetConfig(ClientContext &context); -}; + //! Convert a string in the format "hh:mm:ss" to a time object + DUCKDB_API static dtime_t FromString(const string &str, bool strict = false); + DUCKDB_API static dtime_t FromCString(const char *buf, idx_t len, bool strict = false); + DUCKDB_API static bool TryConvertTime(const char *buf, idx_t len, idx_t &pos, dtime_t &result, bool strict = false); -} // namespace duckdb + //! Convert a time object to a string in the format "hh:mm:ss" + DUCKDB_API static string ToString(dtime_t time); + //! Convert a UTC offset to ±HH[:MM] + DUCKDB_API static string ToUTCOffset(int hour_offset, int minute_offset); + DUCKDB_API static dtime_t FromTime(int32_t hour, int32_t minute, int32_t second, int32_t microseconds = 0); -namespace duckdb { -class Appender; -class Catalog; -class CatalogSearchPath; -class ChunkCollection; -class DatabaseInstance; -class FileOpener; -class LogicalOperator; -class PreparedStatementData; -class Relation; -class BufferedFileWriter; -class QueryProfiler; -class QueryProfilerHistory; -class ClientContextLock; -struct CreateScalarFunctionInfo; -class ScalarFunctionCatalogEntry; -struct ActiveQueryContext; -struct ParserOptions; + //! Extract the time from a given timestamp object + DUCKDB_API static void Convert(dtime_t time, int32_t &out_hour, int32_t &out_min, int32_t &out_sec, + int32_t &out_micros); -//! The ClientContext holds information relevant to the current client session -//! during execution -class ClientContext : public std::enable_shared_from_this { - friend class PendingQueryResult; - friend class StreamQueryResult; - friend class TransactionManager; + DUCKDB_API static string ConversionError(const string &str); + DUCKDB_API static string ConversionError(string_t str); -public: - DUCKDB_API explicit ClientContext(shared_ptr db); - DUCKDB_API ~ClientContext(); +private: + static bool TryConvertInternal(const char *buf, idx_t len, idx_t &pos, dtime_t &result, bool strict); +}; - //! Query profiler - shared_ptr profiler; - //! QueryProfiler History - unique_ptr query_profiler_history; - //! The database that this client is connected to - shared_ptr db; - //! Data for the currently running transaction - TransactionContext transaction; - //! Whether or not the query is interrupted - atomic interrupted; +} // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/common/serializer/buffered_serializer.hpp +// +// +//===----------------------------------------------------------------------===// - unique_ptr temporary_objects; - unordered_map> prepared_statements; - //! The writer used to log queries (if logging is enabled) - unique_ptr log_query_writer; - //! The random generator used by random(). Its seed value can be set by setseed(). - std::mt19937 random_engine; - const unique_ptr catalog_search_path; - unique_ptr file_opener; - //! The client configuration - ClientConfig config; +namespace duckdb { -public: - DUCKDB_API Transaction &ActiveTransaction() { - return transaction.ActiveTransaction(); - } +#define SERIALIZER_DEFAULT_SIZE 1024 - //! Interrupt execution of a query - DUCKDB_API void Interrupt(); - //! Enable query profiling - DUCKDB_API void EnableProfiling(); - //! Disable query profiling - DUCKDB_API void DisableProfiling(); +struct BinaryData { + unique_ptr data; + idx_t size; +}; - //! Issue a query, returning a QueryResult. The QueryResult can be either a StreamQueryResult or a - //! MaterializedQueryResult. The StreamQueryResult will only be returned in the case of a successful SELECT - //! statement. - DUCKDB_API unique_ptr Query(const string &query, bool allow_stream_result); - DUCKDB_API unique_ptr Query(unique_ptr statement, bool allow_stream_result); +class BufferedSerializer : public Serializer { +public: + //! Serializes to a buffer allocated by the serializer, will expand when + //! writing past the initial threshold + explicit BufferedSerializer(idx_t maximum_size = SERIALIZER_DEFAULT_SIZE); + //! Serializes to a provided (owned) data pointer + BufferedSerializer(unique_ptr data, idx_t size); + BufferedSerializer(data_ptr_t data, idx_t size); - //! Issues a query to the database and returns a Pending Query Result. Note that "query" may only contain - //! a single statement. - DUCKDB_API unique_ptr PendingQuery(const string &query); - //! Issues a query to the database and returns a Pending Query Result - DUCKDB_API unique_ptr PendingQuery(unique_ptr statement); + idx_t maximum_size; + data_ptr_t data; - //! Destroy the client context - DUCKDB_API void Destroy(); + BinaryData blob; - //! Get the table info of a specific table, or nullptr if it cannot be found - DUCKDB_API unique_ptr TableInfo(const string &schema_name, const string &table_name); - //! Appends a DataChunk to the specified table. Returns whether or not the append was successful. - DUCKDB_API void Append(TableDescription &description, ChunkCollection &collection); - //! Try to bind a relation in the current client context; either throws an exception or fills the result_columns - //! list with the set of returned columns - DUCKDB_API void TryBindRelation(Relation &relation, vector &result_columns); +public: + void WriteData(const_data_ptr_t buffer, uint64_t write_size) override; + + //! Retrieves the data after the writing has been completed + BinaryData GetData() { + return std::move(blob); + } - //! Execute a relation - DUCKDB_API unique_ptr Execute(const shared_ptr &relation); + void Reset() { + blob.size = 0; + } +}; - //! Prepare a query - DUCKDB_API unique_ptr Prepare(const string &query); - //! Directly prepare a SQL statement - DUCKDB_API unique_ptr Prepare(unique_ptr statement); +} // namespace duckdb +//===----------------------------------------------------------------------===// +// DuckDB +// +// duckdb/main/appender.hpp +// +// +//===----------------------------------------------------------------------===// - //! Create a pending query result from a prepared statement with the given name and set of parameters - //! It is possible that the prepared statement will be re-bound. This will generally happen if the catalog is - //! modified in between the prepared statement being bound and the prepared statement being run. - DUCKDB_API unique_ptr - PendingQuery(const string &query, shared_ptr &prepared, vector &values); - //! Execute a prepared statement with the given name and set of parameters - //! It is possible that the prepared statement will be re-bound. This will generally happen if the catalog is - //! modified in between the prepared statement being bound and the prepared statement being run. - DUCKDB_API unique_ptr Execute(const string &query, shared_ptr &prepared, - vector &values, bool allow_stream_result = true); - //! Gets current percentage of the query's progress, returns 0 in case the progress bar is disabled. - DUCKDB_API double GetProgress(); - //! Register function in the temporary schema - DUCKDB_API void RegisterFunction(CreateFunctionInfo *info); - //! Parse statements from a query - DUCKDB_API vector> ParseStatements(const string &query); - //! Extract the logical plan of a query - DUCKDB_API unique_ptr ExtractPlan(const string &query); - DUCKDB_API void HandlePragmaStatements(vector> &statements); - //! Runs a function with a valid transaction context, potentially starting a transaction if the context is in auto - //! commit mode. - DUCKDB_API void RunFunctionInTransaction(const std::function &fun, - bool requires_valid_transaction = true); - //! Same as RunFunctionInTransaction, but does not obtain a lock on the client context or check for validation - DUCKDB_API void RunFunctionInTransactionInternal(ClientContextLock &lock, const std::function &fun, - bool requires_valid_transaction = true); - //! Equivalent to CURRENT_SETTING(key) SQL function. - DUCKDB_API bool TryGetCurrentSetting(const std::string &key, Value &result); +namespace duckdb { - //! Returns the parser options for this client context - DUCKDB_API ParserOptions GetParserOptions(); +class ClientContext; +class DuckDB; +class TableCatalogEntry; +class Connection; - DUCKDB_API unique_ptr Fetch(ClientContextLock &lock, StreamQueryResult &result); +//! The Appender class can be used to append elements to a table. +class BaseAppender { +protected: + //! The amount of chunks that will be gathered in the chunk collection before flushing + static constexpr const idx_t FLUSH_COUNT = 100; - //! Whether or not the given result object (streaming query result or pending query result) is active - DUCKDB_API bool IsActiveResult(ClientContextLock &lock, BaseQueryResult *result); + //! The append types + vector types; + //! The buffered data for the append + ChunkCollection collection; + //! Internal chunk used for appends + unique_ptr chunk; + //! The current column to append to + idx_t column = 0; - //! Returns the current executor - Executor &GetExecutor(); +public: + DUCKDB_API BaseAppender(); + DUCKDB_API BaseAppender(vector types); + DUCKDB_API virtual ~BaseAppender(); - //! Returns the current query string (if any) - const string &GetCurrentQuery(); + //! Begins a new row append, after calling this the other AppendX() functions + //! should be called the correct amount of times. After that, + //! EndRow() should be called. + DUCKDB_API void BeginRow(); + //! Finishes appending the current row. + DUCKDB_API void EndRow(); - //! Fetch a list of table names that are required for a given query - DUCKDB_API unordered_set GetTableNames(const string &query); + // Append functions + template + void Append(T value) { + throw Exception("Undefined type for Appender::Append!"); + } -private: - //! Parse statements and resolve pragmas from a query - bool ParseStatements(ClientContextLock &lock, const string &query, vector> &result, - string &error); - //! Issues a query to the database and returns a Pending Query Result - unique_ptr PendingQueryInternal(ClientContextLock &lock, unique_ptr statement, - bool verify = true); - unique_ptr ExecutePendingQueryInternal(ClientContextLock &lock, PendingQueryResult &query, - bool allow_stream_result); + DUCKDB_API void Append(const char *value, uint32_t length); - //! Parse statements from a query - vector> ParseStatementsInternal(ClientContextLock &lock, const string &query); - //! Perform aggressive query verification of a SELECT statement. Only called when query_verification_enabled is - //! true. - string VerifyQuery(ClientContextLock &lock, const string &query, unique_ptr statement); + // prepared statements + template + void AppendRow(Args... args) { + BeginRow(); + AppendRowRecursive(args...); + } - void InitialCleanup(ClientContextLock &lock); - //! Internal clean up, does not lock. Caller must hold the context_lock. - void CleanupInternal(ClientContextLock &lock, BaseQueryResult *result = nullptr, - bool invalidate_transaction = false); - string FinalizeQuery(ClientContextLock &lock, bool success); - unique_ptr PendingStatementOrPreparedStatement(ClientContextLock &lock, const string &query, - unique_ptr statement, - shared_ptr &prepared, - vector *values); - unique_ptr PendingPreparedStatement(ClientContextLock &lock, - shared_ptr statement_p, - vector bound_values); + //! Commit the changes made by the appender. + DUCKDB_API void Flush(); + //! Flush the changes made by the appender and close it. The appender cannot be used after this point + DUCKDB_API void Close(); - //! Internally prepare a SQL statement. Caller must hold the context_lock. - shared_ptr CreatePreparedStatement(ClientContextLock &lock, const string &query, - unique_ptr statement); - unique_ptr PendingStatementInternal(ClientContextLock &lock, const string &query, - unique_ptr statement); - unique_ptr RunStatementInternal(ClientContextLock &lock, const string &query, - unique_ptr statement, bool allow_stream_result, - bool verify = true); - unique_ptr PrepareInternal(ClientContextLock &lock, unique_ptr statement); - void LogQueryInternal(ClientContextLock &lock, const string &query); + DUCKDB_API vector &GetTypes() { + return types; + } + DUCKDB_API idx_t CurrentColumn() { + return column; + } + DUCKDB_API void AppendDataChunk(DataChunk &value); - unique_ptr FetchResultInternal(ClientContextLock &lock, PendingQueryResult &pending, - bool allow_stream_result); - unique_ptr FetchInternal(ClientContextLock &lock, Executor &executor, BaseQueryResult &result); +protected: + void Destructor(); + virtual void FlushInternal(ChunkCollection &collection) = 0; + void InitializeChunk(); + void FlushChunk(); - unique_ptr LockContext(); + template + void AppendValueInternal(T value); + template + void AppendValueInternal(Vector &vector, SRC input); - bool UpdateFunctionInfoFromEntry(ScalarFunctionCatalogEntry *existing_function, CreateScalarFunctionInfo *new_info); + void AppendRowRecursive() { + EndRow(); + } - void BeginTransactionInternal(ClientContextLock &lock, bool requires_valid_transaction); - void BeginQueryInternal(ClientContextLock &lock, const string &query); - string EndQueryInternal(ClientContextLock &lock, bool success, bool invalidate_transaction); + template + void AppendRowRecursive(T value, Args... args) { + Append(value); + AppendRowRecursive(args...); + } - PendingExecutionResult ExecuteTaskInternal(ClientContextLock &lock, PendingQueryResult &result); + void AppendValue(const Value &value); +}; - unique_ptr - PendingStatementOrPreparedStatementInternal(ClientContextLock &lock, const string &query, - unique_ptr statement, - shared_ptr &prepared, vector *values); +class Appender : public BaseAppender { + //! A reference to a database connection that created this appender + shared_ptr context; + //! The table description (including column names) + unique_ptr description; - unique_ptr PendingQueryPreparedInternal(ClientContextLock &lock, const string &query, - shared_ptr &prepared, - vector &values); +public: + DUCKDB_API Appender(Connection &con, const string &schema_name, const string &table_name); + DUCKDB_API Appender(Connection &con, const string &table_name); + DUCKDB_API ~Appender() override; -private: - //! Lock on using the ClientContext in parallel - mutex context_lock; - //! The currently active query context - unique_ptr active_query; - //! The current query progress - atomic query_progress; +protected: + void FlushInternal(ChunkCollection &collection) override; }; -class ClientContextLock { -public: - explicit ClientContextLock(mutex &context_lock) : client_guard(context_lock) { - } +class InternalAppender : public BaseAppender { + //! The client context + ClientContext &context; + //! The internal table entry to append to + TableCatalogEntry &table; - ~ClientContextLock() { - } +public: + DUCKDB_API InternalAppender(ClientContext &context, TableCatalogEntry &table); + DUCKDB_API ~InternalAppender() override; -private: - lock_guard client_guard; +protected: + void FlushInternal(ChunkCollection &collection) override; }; +template <> +DUCKDB_API void BaseAppender::Append(bool value); +template <> +DUCKDB_API void BaseAppender::Append(int8_t value); +template <> +DUCKDB_API void BaseAppender::Append(int16_t value); +template <> +DUCKDB_API void BaseAppender::Append(int32_t value); +template <> +DUCKDB_API void BaseAppender::Append(int64_t value); +template <> +DUCKDB_API void BaseAppender::Append(hugeint_t value); +template <> +DUCKDB_API void BaseAppender::Append(uint8_t value); +template <> +DUCKDB_API void BaseAppender::Append(uint16_t value); +template <> +DUCKDB_API void BaseAppender::Append(uint32_t value); +template <> +DUCKDB_API void BaseAppender::Append(uint64_t value); +template <> +DUCKDB_API void BaseAppender::Append(float value); +template <> +DUCKDB_API void BaseAppender::Append(double value); +template <> +DUCKDB_API void BaseAppender::Append(date_t value); +template <> +DUCKDB_API void BaseAppender::Append(dtime_t value); +template <> +DUCKDB_API void BaseAppender::Append(timestamp_t value); +template <> +DUCKDB_API void BaseAppender::Append(interval_t value); +template <> +DUCKDB_API void BaseAppender::Append(const char *value); +template <> +DUCKDB_API void BaseAppender::Append(string_t value); +template <> +DUCKDB_API void BaseAppender::Append(Value value); +template <> +DUCKDB_API void BaseAppender::Append(std::nullptr_t value); + } // namespace duckdb //===----------------------------------------------------------------------===// // DuckDB @@ -17686,7 +18942,7 @@ struct CreateFunctionInfo : public CreateInfo { explicit CreateFunctionInfo(CatalogType type, string schema = DEFAULT_SCHEMA) : CreateInfo(type, schema) { D_ASSERT(type == CatalogType::SCALAR_FUNCTION_ENTRY || type == CatalogType::AGGREGATE_FUNCTION_ENTRY || type == CatalogType::TABLE_FUNCTION_ENTRY || type == CatalogType::PRAGMA_FUNCTION_ENTRY || - type == CatalogType::MACRO_ENTRY); + type == CatalogType::MACRO_ENTRY || type == CatalogType::TABLE_MACRO_ENTRY); } //! Function name @@ -17868,7 +19124,8 @@ struct GlobalFunctionData { typedef unique_ptr (*copy_to_bind_t)(ClientContext &context, CopyInfo &info, vector &names, vector &sql_types); typedef unique_ptr (*copy_to_initialize_local_t)(ClientContext &context, FunctionData &bind_data); -typedef unique_ptr (*copy_to_initialize_global_t)(ClientContext &context, FunctionData &bind_data); +typedef unique_ptr (*copy_to_initialize_global_t)(ClientContext &context, FunctionData &bind_data, + const string &file_path); typedef void (*copy_to_sink_t)(ClientContext &context, FunctionData &bind_data, GlobalFunctionData &gstate, LocalFunctionData &lstate, DataChunk &input); typedef void (*copy_to_combine_t)(ClientContext &context, FunctionData &bind_data, GlobalFunctionData &gstate, diff --git a/libduckdb-sys/upgrade.sh b/libduckdb-sys/upgrade.sh index 478d9d43..17d2dfdf 100755 --- a/libduckdb-sys/upgrade.sh +++ b/libduckdb-sys/upgrade.sh @@ -10,7 +10,7 @@ export DUCKDB_LIB_DIR="$SCRIPT_DIR/duckdb" export DU_INCLUDE_DIR="$DUCKDB_LIB_DIR" # Download and extract amalgamation -DUCKDB_VERSION=v0.3.2 +DUCKDB_VERSION=v0.3.3 wget -T 20 "https://github.com/duckdb/duckdb/releases/download/$DUCKDB_VERSION/libduckdb-src.zip" unzip -o libduckdb-src.zip -d duckdb rm -f libduckdb-src.zip diff --git a/src/appender.rs b/src/appender.rs index f0d9eae6..2262a469 100644 --- a/src/appender.rs +++ b/src/appender.rs @@ -7,6 +7,7 @@ use std::os::raw::c_char; use crate::error::result_from_duckdb_appender; use crate::types::{ToSql, ToSqlOutput}; +use crate::Error; /// Appender for fast import data pub struct Appender<'conn> { @@ -91,7 +92,7 @@ impl Appender<'_> { // NOTE: we ignore the return value here // because if anything failed, end_row will fail // TODO: append more - let _ = match value { + let rc = match value { ValueRef::Null => unsafe { ffi::duckdb_append_null(ptr) }, ValueRef::Boolean(i) => unsafe { ffi::duckdb_append_bool(ptr, i) }, ValueRef::TinyInt(i) => unsafe { ffi::duckdb_append_int8(ptr, i) }, @@ -110,6 +111,9 @@ impl Appender<'_> { ValueRef::Blob(b) => unsafe { ffi::duckdb_append_blob(ptr, b.as_ptr() as *const c_void, b.len() as u64) }, _ => unreachable!("not supported"), }; + if rc != 0 { + return Err(Error::AppendError); + } Ok(()) } diff --git a/src/error.rs b/src/error.rs index e54cc5b7..8fecc8e1 100644 --- a/src/error.rs +++ b/src/error.rs @@ -79,6 +79,9 @@ pub enum Error { /// parameters in the query. The first `usize` is how many parameters were /// given, the 2nd is how many were expected. InvalidParameterCount(usize, usize), + + /// Apppend Error + AppendError, } impl PartialEq for Error { @@ -180,6 +183,7 @@ impl fmt::Display for Error { Error::ToSqlConversionFailure(ref err) => err.fmt(f), Error::InvalidQuery => write!(f, "Query is not read-only"), Error::MultipleStatement => write!(f, "Multiple statements provided"), + Error::AppendError => write!(f, "Append error"), } } } @@ -202,6 +206,7 @@ impl error::Error for Error { | Error::InvalidParameterCount(..) | Error::StatementChangedRows(_) | Error::InvalidQuery + | Error::AppendError | Error::MultipleStatement => None, Error::FromSqlConversionFailure(_, _, ref err) | Error::ToSqlConversionFailure(ref err) => Some(&**err), } diff --git a/src/r2d2.rs b/src/r2d2.rs index 0f747246..01f8a50e 100644 --- a/src/r2d2.rs +++ b/src/r2d2.rs @@ -110,7 +110,7 @@ mod test { #[test] fn test_basic() -> Result<()> { - let manager = DuckdbConnectionManager::file("file.db")?; + let manager = DuckdbConnectionManager::file(":memory:")?; let pool = r2d2::Pool::builder().max_size(2).build(manager).unwrap(); let (s1, r1) = mpsc::channel(); @@ -141,7 +141,7 @@ mod test { #[test] fn test_file() -> Result<()> { - let manager = DuckdbConnectionManager::file("file.db")?; + let manager = DuckdbConnectionManager::file(":memory:")?; let pool = r2d2::Pool::builder().max_size(2).build(manager).unwrap(); let (s1, r1) = mpsc::channel(); @@ -172,7 +172,7 @@ mod test { #[test] fn test_is_valid() -> Result<()> { - let manager = DuckdbConnectionManager::file("file.db")?; + let manager = DuckdbConnectionManager::file(":memory:")?; let pool = r2d2::Pool::builder() .max_size(1) .test_on_check_out(true) @@ -202,7 +202,7 @@ mod test { .enable_object_cache(false)? .max_memory("2GB")? .threads(4)?; - let manager = DuckdbConnectionManager::file_with_flags("file.db", config)?; + let manager = DuckdbConnectionManager::file_with_flags(":memory:", config)?; let pool = r2d2::Pool::builder().max_size(2).build(manager).unwrap(); let conn = pool.get().unwrap(); conn.execute_batch("CREATE TABLE foo(x Text)")?;