Changeset: 222c6823450f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=222c6823450f
Modified Files:
monetdb5/modules/mal/orderidx.c
sql/test/BugTracker-2017/Tests/oidx-on-strings.Bug-6202.stable.err
sql/test/orderidx/Tests/oidx_all_types.stable.err
sql/test/orderidx/Tests/oidx_all_types.stable.out
Branch: Jul2017
Log Message:
Support creating ordered index on all (linear) types.
We already did by using an ORDER BY on the column, but now also by
using CREATE ORDERED INDEX.
Note that types that are not compatible with the builtin integer and
floating types don't get processed in parallel.
diffs (202 lines):
diff --git a/monetdb5/modules/mal/orderidx.c b/monetdb5/modules/mal/orderidx.c
--- a/monetdb5/modules/mal/orderidx.c
+++ b/monetdb5/modules/mal/orderidx.c
@@ -60,35 +60,33 @@ OIDXcreateImplementation(Client cntxt, i
#endif
case TYPE_flt:
case TYPE_dbl:
- break;
- case TYPE_str:
- /* TODO: support strings etc. */
- case TYPE_void:
- case TYPE_ptr:
+ if (GDKnr_threads > 1 && BATcount(b) >= 2 * MIN_PIECE &&
(GDKdebug & FORCEMITOMASK) == 0)
+ break;
+ /* fall through */
default:
- throw(MAL, "bat.orderidx", TYPE_NOT_SUPPORTED);
+ if (BATorderidx(b, 1) != GDK_SUCCEED)
+ throw(MAL, "bat.orderidx", TYPE_NOT_SUPPORTED);
+ return MAL_SUCCEED;
}
if( pieces <= 0 ){
if (GDKnr_threads <= 1) {
pieces = 1;
+ } else if (GDKdebug & FORCEMITOMASK) {
+ /* we want many pieces, even tiny ones */
+ if (BATcount(b) < 4)
+ pieces = 1;
+ else if (BATcount(b) / 2 < (BUN) GDKnr_threads)
+ pieces = (int) (BATcount(b) / 2);
+ else
+ pieces = GDKnr_threads;
} else {
- if (GDKdebug & FORCEMITOMASK) {
- /* we want many pieces, even tiny ones */
- if (BATcount(b) < 4)
- pieces = 1;
- else if (BATcount(b) / 2 < (BUN) GDKnr_threads)
- pieces = (int) (BATcount(b) / 2);
- else
- pieces = GDKnr_threads;
- } else {
- if (BATcount(b) < 2 * MIN_PIECE)
- pieces = 1;
- else if (BATcount(b) / MIN_PIECE < (BUN)
GDKnr_threads)
- pieces = (int) (BATcount(b) /
MIN_PIECE);
- else
- pieces = GDKnr_threads;
- }
+ if (BATcount(b) < 2 * MIN_PIECE)
+ pieces = 1;
+ else if (BATcount(b) / MIN_PIECE < (BUN) GDKnr_threads)
+ pieces = (int) (BATcount(b) / MIN_PIECE);
+ else
+ pieces = GDKnr_threads;
}
} else if (BATcount(b) < (BUN) pieces || BATcount(b) < MIN_PIECE) {
pieces = 1;
diff --git a/sql/test/BugTracker-2017/Tests/oidx-on-strings.Bug-6202.stable.err
b/sql/test/BugTracker-2017/Tests/oidx-on-strings.Bug-6202.stable.err
--- a/sql/test/BugTracker-2017/Tests/oidx-on-strings.Bug-6202.stable.err
+++ b/sql/test/BugTracker-2017/Tests/oidx-on-strings.Bug-6202.stable.err
@@ -29,35 +29,8 @@ stderr of test 'oidx-on-strings.Bug-6202
# 17:01:35 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-19864" "--port=34473"
# 17:01:35 >
-MAPI = (monetdb) /var/tmp/mtest-19864/.s.monetdb.34473
-QUERY = create ordered index test_oidx1 on test_oidx (c2);
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-19864/.s.monetdb.34473
-QUERY = drop index test_oidx1;
-ERROR = !DROP INDEX: no such index 'test_oidx1'
-
-MAPI = (monetdb) /var/tmp/mtest-19864/.s.monetdb.34473
-QUERY = create ordered index test_oidx1 on test_oidx (c2);
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-19864/.s.monetdb.34473
-QUERY = drop index test_oidx1;
-ERROR = !DROP INDEX: no such index 'test_oidx1'
-MAPI = (monetdb) /var/tmp/mtest-19864/.s.monetdb.34473
-QUERY = create ordered index test_oidx1 on test_oidx (c2);
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-19864/.s.monetdb.34473
-QUERY = drop index test_oidx1;
-ERROR = !DROP INDEX: no such index 'test_oidx1'
+# 15:46:55 >
+# 15:46:55 > "Done."
+# 15:46:55 >
-MAPI = (monetdb) /var/tmp/mtest-19864/.s.monetdb.34473
-QUERY = create ordered index test_oidx1 on test_oidx (c2);
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-19864/.s.monetdb.34473
-QUERY = drop index test_oidx1;
-ERROR = !DROP INDEX: no such index 'test_oidx1'
-
-# 17:01:36 >
-# 17:01:36 > "Done."
-# 17:01:36 >
-
diff --git a/sql/test/orderidx/Tests/oidx_all_types.stable.err
b/sql/test/orderidx/Tests/oidx_all_types.stable.err
--- a/sql/test/orderidx/Tests/oidx_all_types.stable.err
+++ b/sql/test/orderidx/Tests/oidx_all_types.stable.err
@@ -27,55 +27,7 @@ stderr of test 'oidx_all_types` in direc
-
-# 15:05:54 >
-# 15:05:54 > "mclient" "-lsql" "-ftest" "-Eutf-8" "-i" "-e"
"--host=/var/tmp/mtest-13546" "--port=31953"
-# 15:05:54 >
+# 16:00:30 >
+# 16:00:30 > "Done."
+# 16:00:30 >
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_blob" on all_types ("blob");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_blob100" on all_types ("blob100");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_clob" on all_types ("clob");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_clob100" on all_types ("clob100");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_character" on all_types ("character");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_varchar100" on all_types ("varchar100");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_character10" on all_types ("character10");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_inet" on all_types ("inet");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_inet9" on all_types ("inet9");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_json" on all_types ("json");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_json10" on all_types ("json10");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_url" on all_types ("url");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_url55" on all_types ("url55");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-MAPI = (monetdb) /var/tmp/mtest-13546/.s.monetdb.31953
-QUERY = create ordered index "oidx_uuid" on all_types ("uuid");
-ERROR = !CREATE ORDERED INDEX: MALException:bat.orderidx:Type is not supported
-
-# 15:05:55 >
-# 15:05:55 > "Done."
-# 15:05:55 >
-
diff --git a/sql/test/orderidx/Tests/oidx_all_types.stable.out
b/sql/test/orderidx/Tests/oidx_all_types.stable.out
--- a/sql/test/orderidx/Tests/oidx_all_types.stable.out
+++ b/sql/test/orderidx/Tests/oidx_all_types.stable.out
@@ -135,7 +135,7 @@ Ready.
% 9, 4, 1, 5, 1, 1, 0 # length
[ "all_types", 2000, 0, false, 0, 0, NULL ]
#select 'create ordered index "oidx_'||name||'" on all_types ("'||name||'");'
as stmt from _columns where table_id in (select id from _tables where name =
'all_types') order by number;
-% .L10 # table_name
+% .L5 # table_name
% stmt # name
% varchar # type
% 75 # length
@@ -224,7 +224,7 @@ Ready.
#create ordered index "oidx_timezone" on all_types ("timezone");
#create ordered index "oidx_time5zone" on all_types ("time5zone");
#select 'select "'||name||'" from all_types order by "'||name||'" ASC;' as
stmt from _columns where table_id in (select id from _tables where name =
'all_types') order by number;
-% .L10 # table_name
+% .L5 # table_name
% stmt # name
% varchar # type
% 69 # length
@@ -719,7 +719,7 @@ Ready.
[ ae106ad4-81fd-4f1a-85e8-5efface60da4 ]
[ ae106ad4-81fd-4f1a-85e8-5efface60da4 ]
#select 'select "'||name||'" from all_types order by "'||name||'" DESC;' as
stmt from _columns where table_id in (select id from _tables where name =
'all_types') order by number;
-% .L10 # table_name
+% .L5 # table_name
% stmt # name
% varchar # type
% 70 # length
@@ -1229,7 +1229,7 @@ Ready.
[ true, 10, 10000, 1000000, 10000000000, 1e+30, 1e+20,
1.000, 123456789, 12345.678, 3.1415, 3.1415, 3.1415, 2009-04-15,
24, 18, 3, 1728000.000, 108000.000, 120000.000,
100000.000, 36000.000, 6000.000, 2000.000, 600.000,
100.000, 10.000, 1995-07-15 07:30:00.000000, 1995-07-15
07:30:00.00000, 1995-07-15 08:30:00.000000+01:00, 1995-07-15
08:30:00.00000+01:00, 07:30:00, 07:30:00.00000, 08:30:00+01:00,
08:30:00.00000+01:00, 123456, 123456, "123456", "123456", "x",
"varchar", "0123456789", 127.0.0.0, 127.127.127.255,
"{\"a\": 123}", "{\"b\": 456}",
www.monetdb.org/Documentation/Manuals/SQLreference/BuiltinTypes,
www.monetdb.org/Documentation/Manuals/SQLreference/URLtype,
ae106ad4-81fd-4f1a-85e8-5efface60da4 ]
[ true, 10, 10000, 1000000, 10000000000, 1e+30, 1e+20,
1.000, 123456789, 12345.678, 3.1415, 3.1415, 3.1415, 2009-04-15,
24, 18, 3, 1728000.000, 108000.000, 120000.000,
100000.000, 36000.000, 6000.000, 2000.000, 600.000,
100.000, 10.000, 1995-07-15 07:30:00.000000, 1995-07-15
07:30:00.00000, 1995-07-15 08:30:00.000000+01:00, 1995-07-15
08:30:00.00000+01:00, 07:30:00, 07:30:00.00000, 08:30:00+01:00,
08:30:00.00000+01:00, 123456, 123456, "123456", "123456", "x",
"varchar", "0123456789", 127.0.0.0, 127.127.127.255,
"{\"a\": 123}", "{\"b\": 456}",
www.monetdb.org/Documentation/Manuals/SQLreference/BuiltinTypes,
www.monetdb.org/Documentation/Manuals/SQLreference/URLtype,
ae106ad4-81fd-4f1a-85e8-5efface60da4 ]
#select 'drop index "oidx_'||name||'";' as stmt from _columns where table_id
in (select id from _tables where name = 'all_types') order by number;
-% .L10 # table_name
+% .L5 # table_name
% stmt # name
% varchar # type
% 33 # length
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list