Changeset: 4ca08fa2f48e for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/4ca08fa2f48e Modified Files: clients/Tests/MAL-signatures-hge.test clients/Tests/MAL-signatures.test clients/Tests/exports.stable.out clients/mapiclient/mclient.c monetdb5/mal/mal_dataflow.c monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_session.c sql/backends/monet5/sql_gencode.c sql/backends/monet5/sql_scenario.c Branch: simplify_scenario Log Message:
merged with default diffs (truncated from 3432 to 300 lines): diff --git a/.editorconfig b/.editorconfig --- a/.editorconfig +++ b/.editorconfig @@ -23,3 +23,7 @@ charset = utf-8 indent_style = space indent_size = 2 trim_trailing_whitespace = true + +[{clients/{mapilib,odbc},gdk}/**.{c,h}{,.in}] +tab_width = 8 +max_line_length = 72 diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -787,6 +787,7 @@ 44e45c9a451f6afd933773094ec25723f713d3be 44e45c9a451f6afd933773094ec25723f713d3be Jan2022_SP5_release 43d4a717410d6f6692a16a878640fc7e0f248725 Jan2022_25 43d4a717410d6f6692a16a878640fc7e0f248725 Jan2022_SP6_release +700e099bfee85318da09aabcd78ec7ea6e8fb6ef Jul2021_29 5c50a4071c86d1621e20a885a51cc36f2f23eec4 Sep2022_9 41ca60d96bd0198ca5d74937630a442a5fbaf1cd Sep2022_11 41ca60d96bd0198ca5d74937630a442a5fbaf1cd Sep2022_SP1_release diff --git a/clients/Tests/MAL-signatures-hge.test b/clients/Tests/MAL-signatures-hge.test --- a/clients/Tests/MAL-signatures-hge.test +++ b/clients/Tests/MAL-signatures-hge.test @@ -49699,6 +49699,21 @@ unsafe pattern sql.setVariable(X_0:int, setVariable; Set the value of a session variable sql +sql +set_count_distinct +unsafe pattern sql.set_count_distinct(X_0:str, X_1:str, X_2:str, X_3:lng):void +sql_set_count_distinct; +Set count distinct for column +sql +set_max +unsafe pattern sql.set_max(X_0:str, X_1:str, X_2:str, X_3:any_1):void +sql_set_max; +Set max for column +sql +set_min +unsafe pattern sql.set_min(X_0:str, X_1:str, X_2:str, X_3:any_1):void +sql_set_min; +Set min for column set_protocol unsafe pattern sql.set_protocol(X_0:int):int SQLset_protocol; diff --git a/clients/Tests/MAL-signatures.test b/clients/Tests/MAL-signatures.test --- a/clients/Tests/MAL-signatures.test +++ b/clients/Tests/MAL-signatures.test @@ -38079,6 +38079,21 @@ unsafe pattern sql.setVariable(X_0:int, setVariable; Set the value of a session variable sql +set_count_distinct +unsafe pattern sql.set_count_distinct(X_0:str, X_1:str, X_2:str, X_3:lng):void +sql_set_count_distinct; +Set count distinct for column +sql +set_max +unsafe pattern sql.set_max(X_0:str, X_1:str, X_2:str, X_3:any_1):void +sql_set_max; +Set max for column +sql +set_min +unsafe pattern sql.set_min(X_0:str, X_1:str, X_2:str, X_3:any_1):void +sql_set_min; +Set min for column +sql set_protocol unsafe pattern sql.set_protocol(X_0:int):int SQLset_protocol; diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -1622,6 +1622,7 @@ char *buffer_get_buf(buffer *b); void buffer_init(buffer *restrict b, char *restrict buf, size_t size); stream *buffer_rastream(buffer *restrict b, const char *restrict name); stream *buffer_wastream(buffer *restrict b, const char *restrict name); +stream *byte_counting_stream(stream *wrapped, uint64_t *counter); stream *bz2_stream(stream *inner, int preset); stream *callback_stream(void *restrict priv, ssize_t (*read)(void *restrict priv, void *restrict buf, size_t elmsize, size_t cnt), ssize_t (*write)(void *restrict priv, const void *restrict buf, size_t elmsize, size_t cnt), void (*close)(void *priv), void (*destroy)(void *priv), const char *restrict name); void close_stream(stream *s); diff --git a/clients/examples/C/bincopydata.c b/clients/examples/C/bincopydata.c --- a/clients/examples/C/bincopydata.c +++ b/clients/examples/C/bincopydata.c @@ -212,6 +212,35 @@ gen_null_strings(FILE *f, bool byteswap, } static void +gen_null_blobs(FILE *f, bool byteswap, long nrecs) +{ + uint8_t *buffer = malloc(nrecs); + for (long i = 0; i < nrecs; i++) { + buffer[i] = 0xD0 + 3 - (i % 3); + } + + for (long i = 0; i < nrecs; i++) { + uint64_t header; + size_t n; + if (i % 3 == 2) { + // null + n = 0; + header = (uint64_t)-1; + } else { + n = (i % 1000); + header = n; + } + if (byteswap) + copy_binary_convert64(&header); + assert(sizeof(header) == 8); + fwrite(&header, sizeof(header), 1, f); + if (n > 0) + fwrite(buffer, 1, n, f); + } + free(buffer); +} + +static void gen_json(FILE *f, bool byteswap, long nrecs) { (void)byteswap; @@ -247,6 +276,7 @@ static struct gen { { "broken_strings", gen_broken_strings }, { "newline_strings", gen_newline_strings }, { "null_strings", gen_null_strings }, + { "null_blobs", gen_null_blobs }, // { "timestamps", gen_timestamps }, { "timestamp_times", gen_timestamp_times }, diff --git a/clients/examples/C/bincopytemporaldata.c b/clients/examples/C/bincopytemporaldata.c --- a/clients/examples/C/bincopytemporaldata.c +++ b/clients/examples/C/bincopytemporaldata.c @@ -10,11 +10,32 @@ #include "bincopydata.h" +static const copy_binary_timestamp binary_nil_timestamp = { + .time = { + .ms = 0xFFFFFFFF, + .seconds = 255, + .minutes = 255, + .hours = 255, + .padding = 255, + }, + .date = { + .day = 255, + .month = 255, + .year =-1, + }, +}; + static copy_binary_timestamp random_timestamp(struct rng *rng) { + copy_binary_timestamp ts; + if (rng_next(rng) % 10 == 9) { + ts = binary_nil_timestamp; + return ts; + } + // the % trick gives a little skew but we don't care - copy_binary_timestamp ts = { + ts = (copy_binary_timestamp){ .time = { .ms = rng_next(rng) % 1000000, .seconds = rng_next(rng) % 60, // 61 ?? @@ -62,7 +83,7 @@ gen_timestamps(FILE *f, bool byteswap, l } } -#define GEN_TIMESTAMP_FIELD(name, fld) \ +#define GEN_TIMESTAMP_FIELD(name, typ, fld, nilvalue) \ void name \ (FILE *f, bool byteswap, long nrecs) \ { \ @@ -70,20 +91,22 @@ gen_timestamps(FILE *f, bool byteswap, l \ for (long i = 0; i < nrecs; i++) { \ copy_binary_timestamp ts = random_timestamp(&rng); \ + typ *p = &ts.fld; \ + typ tmp = ts.date.day == 255 ? nilvalue : *p; \ if (byteswap) { \ copy_binary_convert_timestamp(&ts); \ } \ - fwrite(&ts.fld, sizeof(ts.fld), 1, f); \ + fwrite(&tmp, sizeof(tmp), 1, f); \ } \ } -GEN_TIMESTAMP_FIELD(gen_timestamp_times, time) -GEN_TIMESTAMP_FIELD(gen_timestamp_dates, date) +GEN_TIMESTAMP_FIELD(gen_timestamp_times, copy_binary_time, time, binary_nil_timestamp.time) +GEN_TIMESTAMP_FIELD(gen_timestamp_dates, copy_binary_date, date, binary_nil_timestamp.date) -GEN_TIMESTAMP_FIELD(gen_timestamp_ms, time.ms) -GEN_TIMESTAMP_FIELD(gen_timestamp_seconds, time.seconds) -GEN_TIMESTAMP_FIELD(gen_timestamp_minutes, time.minutes) -GEN_TIMESTAMP_FIELD(gen_timestamp_hours, time.hours) -GEN_TIMESTAMP_FIELD(gen_timestamp_days, date.day) -GEN_TIMESTAMP_FIELD(gen_timestamp_months, date.month) -GEN_TIMESTAMP_FIELD(gen_timestamp_years, date.year) +GEN_TIMESTAMP_FIELD(gen_timestamp_ms, uint32_t, time.ms, 0x80) +GEN_TIMESTAMP_FIELD(gen_timestamp_seconds, uint8_t, time.seconds, 0x80) +GEN_TIMESTAMP_FIELD(gen_timestamp_minutes, uint8_t, time.minutes, 0x80) +GEN_TIMESTAMP_FIELD(gen_timestamp_hours, uint8_t, time.hours, 0x80) +GEN_TIMESTAMP_FIELD(gen_timestamp_days, uint8_t, date.day, 0x80) +GEN_TIMESTAMP_FIELD(gen_timestamp_months, uint8_t, date.month, 0x80) +GEN_TIMESTAMP_FIELD(gen_timestamp_years, int16_t, date.year, -1) diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c --- a/clients/mapiclient/mclient.c +++ b/clients/mapiclient/mclient.c @@ -2859,7 +2859,8 @@ doFile(Mapi mid, stream *fp, bool useins } } else { setFormatter(line); - mapi_set_size_header(mid, strcmp(line, "raw") == 0); + if (mode == SQL) + mapi_set_size_header(mid, strcmp(line, "raw") == 0); } continue; case 't': @@ -3543,12 +3544,17 @@ main(int argc, char **argv) mapi_setAutocommit(mid, autocommit); if (mode == SQL && !settz) mapi_set_time_zone(mid, 0); - - if (mode == SQL) { - if (output) { + if (output) { + setFormatter(output); + if (mode == SQL) mapi_set_size_header(mid, strcmp(output, "raw") == 0); + free(output); + } else { + if (mode == SQL) { + setFormatter("sql"); + mapi_set_size_header(mid, false); } else { - mapi_set_size_header(mid, false); + setFormatter("raw"); } } @@ -3579,16 +3585,6 @@ main(int argc, char **argv) mapi_log(mid, logfile); mapi_trace(mid, trace); - if (output) { - setFormatter(output); - free(output); - } else { - if (mode == SQL) { - setFormatter("sql"); - } else { - setFormatter("raw"); - } - } /* give the user a welcome message with some general info */ if (!has_fileargs && command == NULL && isatty(fileno(stdin))) { char *lang; diff --git a/clients/mapilib/.editorconfig b/clients/mapilib/.editorconfig deleted file mode 100644 --- a/clients/mapilib/.editorconfig +++ /dev/null @@ -1,3 +0,0 @@ -[*.{c,h}] -tab_width = 8 -max_line_length = 72 diff --git a/clients/odbc/.editorconfig b/clients/odbc/.editorconfig deleted file mode 100644 --- a/clients/odbc/.editorconfig +++ /dev/null @@ -1,3 +0,0 @@ -[*.{c,h}] -tab_width = 8 -max_line_length = 72 diff --git a/common/stream/CMakeLists.txt b/common/stream/CMakeLists.txt --- a/common/stream/CMakeLists.txt +++ b/common/stream/CMakeLists.txt @@ -66,7 +66,6 @@ target_link_libraries(stream $<$<BOOL:${CURL_FOUND}>:CURL::libcurl> $<$<BOOL:${LIBLZMA_FOUND}>:LibLZMA::LibLZMA> $<$<BOOL:${LZ4_FOUND}>:LZ4::LZ4> - $<$<BOOL:${SNAPPY_FOUND}>:SNAPPY::SNAPPY> $<$<BOOL:${Iconv_FOUND}>:Iconv::Iconv> matomic monetdb_config_header @@ -100,10 +99,6 @@ if (NOT WIN32) set(PKG_LZMA "liblzma") endif() - if(SNAPPY_FOUND) - set(PKG_SNAPPY "snappy") - endif() - if(ICONV_FOUND AND NOT Iconv_IS_BUILT_IN) get_filename_component(ICONV_LIBRARIES_PATH "${ICONV_LIBRARIES}" diff --git a/common/stream/mapi_stream.c b/common/stream/mapi_stream.c _______________________________________________ checkin-list mailing list -- checkin-list@monetdb.org To unsubscribe send an email to checkin-list-le...@monetdb.org