use of com.mysql.cj.xdevapi.Session in project aws-mysql-jdbc by awslabs.
the class CollectionTest method testArrayIndex009.
@Test
public void testArrayIndex009() throws Exception {
assumeTrue(mysqlVersionMeetsMinimum(this.baseUrl, ServerVersion.parseVersion("8.0.17")), "MySQL 8.0.17+ is required to run this test.");
String collname = "coll1";
Session sess = null;
try {
sess = new SessionFactory().getSession(this.baseUrl);
Schema sch = sess.getDefaultSchema();
sch.dropCollection(collname);
Collection coll = sch.createCollection(collname, true);
/* create basic index */
coll.createIndex("intArrayIndex", "{\"fields\": [{\"field\": \"$.intField\", \"type\": \"UNSIGNED\", \"array\" : true}], \"type\" : \"INDEX\"}");
coll.createIndex("dateArrayIndex", "{\"fields\": [{\"field\": \"$.dateField\", \"type\": \"DATE\", \"array\" : true}], \"type\" : \"INDEX\"}");
coll.createIndex("charArrayIndex", "{\"fields\": [{\"field\": \"$.charField\", \"type\": \"CHAR(255)\", \"array\" : true}], \"type\" : \"INDEX\"}");
coll.createIndex("timeArrayIndex", "{\"fields\": [{\"field\": \"$.timeField\", \"type\": \"TIME\", \"array\" : true}], \"type\" : \"INDEX\"}");
validateArrayIndex("intArrayIndex", "coll1", 1);
validateArrayIndex("dateArrayIndex", "coll1", 1);
validateArrayIndex("charArrayIndex", "coll1", 1);
validateArrayIndex("timeArrayIndex", "coll1", 1);
coll.add("{\"intField\" : [1,2,3], \"dateField\" : [\"2019-1-1\", \"2019-2-1\", \"2019-3-1\"], \"charField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"], \"timeField\" : [\"10.30\", \"11.30\", \"12.30\"]}").execute();
coll.add("{\"intField\" : [11,12,3], \"dateField\" : [\"2019-1-1\", \"2019-2-1\", \"2019-3-1\"], \"charField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"], \"timeField\" : [\"10.30\", \"11.30\", \"12.30\"]}").execute();
coll.add("{\"intField\" : [12,23,34], \"dateField\" : [\"2019-1-1\", \"2019-2-1\", \"2019-3-1\"], \"charField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"], \"timeField\" : [\"10.30\", \"11.30\", \"12.30\"]}").execute();
coll.add("{\"dateField\" : [\"2019-1-1\", \"2019-2-1\", \"2019-3-1\"], \"charField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"], \"timeField\" : [\"10.30\", \"11.30\", \"12.30\"]}").execute();
coll.add("{\"intField\" : [1,2,3], \"charField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"], \"timeField\" : [\"10.30\", \"11.30\", \"12.30\"]}").execute();
coll.add("{\"intField\" : [11,12,3], \"dateField\" : [\"2019-1-1\", \"2019-2-1\", \"2019-3-1\"], \"timeField\" : [\"10.30\", \"11.30\", \"12.30\"]}").execute();
coll.add("{\"intField\" : [11,12,3], \"dateField\" : [\"2019-1-1\", \"2019-2-1\", \"2019-3-1\"], \"charField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"]}").execute();
try {
coll.add("{\"intField\" : \"[12,23,34]\", \"dateField\" : [\"2019-1-1\", \"2019-2-1\", \"2019-3-1\"], \"charField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"], \"timeField\" : [\"10.30\", \"11.30\", \"12.30\"]}").execute();
assertTrue(false);
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("functional index"));
}
sch.dropCollection(collname);
} finally {
if (sess != null) {
sess.close();
sess = null;
}
}
}
use of com.mysql.cj.xdevapi.Session in project aws-mysql-jdbc by awslabs.
the class CollectionTest method testArrayIndex008.
@Test
public void testArrayIndex008() throws Exception {
assumeTrue(mysqlVersionMeetsMinimum(this.baseUrl, ServerVersion.parseVersion("8.0.17")), "MySQL 8.0.17+ is required to run this test.");
String collname = "coll1";
Session sess = null;
try {
sess = new SessionFactory().getSession(this.baseUrl);
Schema sch = sess.getDefaultSchema();
sch.dropCollection(collname);
Collection coll = sch.createCollection(collname, true);
try {
coll.createIndex("textArrayIndex", "{\"fields\": [{\"field\": \"$.textField\", \"type\": \"TEXT\", \"array\": true}]}");
assertTrue(false);
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("index"));
}
try {
coll.createIndex("boolArrayIndex", "{\"fields\": [{\"field\": \"$.boolField\", \"type\": \"BOOL\", \"array\": true}]}");
assertTrue(false);
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("index"));
}
try {
coll.createIndex("blobIndex", "{\"fields\": [{\"field\": \"$.blobField\", \"type\": \"BLOB\", \"array\": true}]}");
assertTrue(false);
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("index"));
}
try {
coll.createIndex("sintIndex", "{\"fields\": [{\"field\": \"$.sinField\", \"type\": \"SMALLINT\", \"array\": true}]}");
assertTrue(false);
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("index"));
}
sch.dropCollection(collname);
} finally {
if (sess != null) {
sess.close();
sess = null;
}
}
}
use of com.mysql.cj.xdevapi.Session in project aws-mysql-jdbc by awslabs.
the class CollectionTest method validateArrayIndex.
private void validateArrayIndex(String keydName, String collName, int noFields) throws Exception {
int indexFound = 0;
boolean arrayExpr = false;
Session sess = null;
try {
sess = new SessionFactory().getSession(this.baseUrl);
SqlResult res = sess.sql("show index from `" + collName + "`").execute();
assertTrue(res.hasNext());
for (Row row : res.fetchAll()) {
if (keydName.equals(row.getString("Key_name"))) {
indexFound++;
assertEquals(collName, row.getString("Table"));
String expr = row.getString("Expression");
System.out.println(expr);
if (expr != null) {
arrayExpr = true;
}
}
}
} finally {
if (sess != null) {
sess.close();
sess = null;
}
}
if ((indexFound != noFields) || (!arrayExpr)) {
throw new Exception("Index not matching");
}
}
use of com.mysql.cj.xdevapi.Session in project aws-mysql-jdbc by awslabs.
the class CollectionTest method testArrayIndex014.
@Test
public void testArrayIndex014() throws Exception {
assumeTrue(mysqlVersionMeetsMinimum(this.baseUrl, ServerVersion.parseVersion("8.0.17")), "MySQL 8.0.17+ is required to run this test.");
String collname = "coll1";
DbDoc doc = null;
Session sess = null;
try {
sess = new SessionFactory().getSession(this.baseUrl);
Schema sch = sess.getDefaultSchema();
sch.dropCollection(collname);
Collection coll = sch.createCollection(collname, true);
/* create basic index */
coll.createIndex("intArrayIndex", "{\"fields\": [{\"field\": \"$.intField\", \"type\": \"SIGNED INTEGER\", \"array\": true}]}");
coll.createIndex("uintArrayIndex", "{\"fields\": [{\"field\": \"$.uintField\", \"type\": \"UNSIGNED INTEGER\", \"array\": true}]}");
coll.createIndex("floatArrayIndex", "{\"fields\": [{\"field\": \"$.floatField\", \"type\": \"DECIMAL(10,2)\", \"array\": true}]}");
coll.createIndex("dateArrayIndex", "{\"fields\": [{\"field\": \"$.dateField\", \"type\": \"DATE\", \"array\": true}]}");
coll.createIndex("datetimeArrayIndex", "{\"fields\": [{\"field\": \"$.datetimeField\", \"type\": \"DATETIME\", \"array\": true}]}");
coll.createIndex("timeArrayIndex", "{\"fields\": [{\"field\": \"$.timeField\", \"type\": \"TIME\", \"array\": true}]}");
coll.createIndex("charArrayIndex", "{\"fields\": [{\"field\": \"$.charField\", \"type\": \"CHAR(256)\", \"array\": true}]}");
coll.createIndex("binaryArrayIndex", "{\"fields\": [{\"field\": \"$.binaryField\", \"type\": \"BINARY(256)\", \"array\": true}]}");
validateArrayIndex("intArrayIndex", "coll1", 1);
validateArrayIndex("uintArrayIndex", "coll1", 1);
validateArrayIndex("floatArrayIndex", "coll1", 1);
validateArrayIndex("dateArrayIndex", "coll1", 1);
validateArrayIndex("datetimeArrayIndex", "coll1", 1);
validateArrayIndex("timeArrayIndex", "coll1", 1);
validateArrayIndex("charArrayIndex", "coll1", 1);
validateArrayIndex("binaryArrayIndex", "coll1", 1);
coll.remove("true").execute();
coll.add("{\"intField\" : [1,2,3], \"uintField\" : [51,52,53], \"dateField\" : [\"2019-1-1\", \"2019-2-1\", \"2019-3-1\"], \"datetimeField\" : [\"9999-12-30 23:59:59\", \"9999-12-31 23:59:59\", \"9999-12-31 23:59:59\"], \"charField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"], \"binaryField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"],\"timeField\" : [\"10.30\", \"11.30\", \"12.30\"], \"floatField\" : [51.2,52.4,53.6],\"dateFieldWOI\" : \"2019-1-1\"}").execute();
coll.add("{\"intField\" : [11,12,3], \"uintField\" : [51,52,53], \"dateField\" : [\"2019-1-1\", \"2019-2-1\", \"2019-3-1\"], \"datetimeField\" : [\"9999-12-30 23:59:59\", \"9999-12-29 23:59:59\", \"9999-12-31 23:59:59\"], \"charField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"], \"binaryField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"], \"timeField\" : [\"10.30\", \"11.30\", \"12.30\"], \"floatField\" : [51.1,52.9,53.0],\"dateFieldWOI\" : \"2019-1-1\"}").execute();
coll.add("{\"intField\" : [12,23,34], \"uintField\" : [51,52,53], \"dateField\" : [\"2019-1-1\", \"2019-2-1\", \"2019-3-1\"], \"datetimeField\" : [\"9999-12-31 23:59:59\", \"9999-12-31 23:59:59\", \"9999-12-7 23:59:59\"], \"charField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"], \"binaryField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"], \"timeField\" : [\"10.30\", \"7.30\", \"12.30\"], \"floatField\" : [51.2,52.7,53.6],\"dateFieldWOI\" : \"2019-2-1\"}").execute();
try {
coll.add("{\"intField\" : \"[1,2,3]\", \"uintField\" : [51,52,53], \"dateField\" : [\"2019-1-1\", \"2019-2-1\", \"2019-3-1\"], \"datetimeField\" : [\"9999-12-30 23:59:59\", \"9999-12-31 23:59:59\", \"9999-12-31 23:59:59\"], \"charField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"], \"binaryField\" : [\"abcd1\", \"abcd1\", \"abcd2\", \"abcd4\"],\"timeField\" : [\"10.30\", \"11.30\", \"12.30\"], \"floatField\" : [51.2,52.4,53.6]}").execute();
assertTrue(false);
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("functional index"));
}
DocResult docs = coll.find(":intField in $.intField").bind("intField", 12).execute();
doc = null;
int i = 0;
while (docs.hasNext()) {
doc = docs.next();
i++;
}
assertTrue(i == 2);
docs = coll.find(":uintField in $.uintField").bind("uintField", 52).execute();
doc = null;
i = 0;
while (docs.hasNext()) {
doc = docs.next();
i++;
}
assertTrue(i == 3);
docs = coll.find(":charField in $.charField").bind("charField", "abcd1").execute();
doc = null;
i = 0;
while (docs.hasNext()) {
doc = docs.next();
i++;
}
assertTrue(i == 3);
docs = coll.find(":binaryField in $.binaryField").bind("binaryField", "abcd1").execute();
doc = null;
i = 0;
while (docs.hasNext()) {
doc = docs.next();
i++;
}
assertTrue(i == 3);
docs = coll.find(":floatField in $.floatField").bind("floatField", 51.2).execute();
doc = null;
i = 0;
while (docs.hasNext()) {
doc = docs.next();
i++;
}
System.out.println("Count = " + i);
assertTrue(i == 2);
docs = coll.find("CAST(CAST('2019-2-1' as DATE) as JSON) in $.dateField").execute();
doc = null;
i = 0;
while (docs.hasNext()) {
doc = docs.next();
i++;
}
System.out.println("Count = " + i);
assertTrue(i == 3);
docs = coll.find("CAST(CAST('2019-2-1' as DATE) as JSON) not in $.dateField").execute();
doc = null;
i = 0;
while (docs.hasNext()) {
doc = docs.next();
i++;
}
System.out.println("Using NOT IN");
System.out.println("Count = " + i);
// assertTrue(i == 0);
docs = coll.find("'2019-1-1' not in $.dateFieldWOI").execute();
doc = null;
i = 0;
while (docs.hasNext()) {
doc = docs.next();
System.out.println((((JsonString) doc.get("dateFieldWOI")).getString()));
i++;
}
System.out.println("Using NOT IN Without Index");
System.out.println("Count = " + i);
docs = coll.find("CAST(CAST('2019-2-1' as DATE) as JSON) overlaps $.dateField").execute();
doc = null;
i = 0;
while (docs.hasNext()) {
doc = docs.next();
i++;
}
System.out.println("Count = " + i);
assertTrue(i == 3);
docs = coll.find("CAST(CAST('2019-2-1' as DATE) as JSON) not overlaps $.dateField").execute();
doc = null;
i = 0;
while (docs.hasNext()) {
doc = docs.next();
i++;
}
System.out.println("Using NOT OVERLAPS");
System.out.println("Count = " + i);
// assertTrue(i == 0);
docs = coll.find("CAST(CAST(:datetimeField as DATETIME) as JSON) in $.datetimeField").bind("datetimeField", "9999-12-30 23:59:59").execute();
doc = null;
i = 0;
while (docs.hasNext()) {
doc = docs.next();
i++;
}
System.out.println("Count = " + i);
assertTrue(i == 2);
docs = coll.find("CAST(CAST(:timeField as TIME) as JSON) in $.timeField").bind("timeField", "7.30").execute();
doc = null;
i = 0;
while (docs.hasNext()) {
doc = docs.next();
i++;
}
System.out.println("Count = " + i);
assertTrue(i == 1);
// Integration scenarios between Index and Overlaps. Explicit casting added due to server Bug#29752056. NOT IN and NOT OVERLAPS doesn't require explicit casting
docs = coll.find("CAST(CAST('2019-2-1' as DATE) as JSON) in $.dateField").execute();
// System.out.println("Number of rows using IN with indexed array = "+docs.count());
assertTrue(docs.count() == 3);
docs = coll.find("'2019-2-1' not in $.dateField").execute();
// System.out.println("Number of rows using NOT IN without casting = "+docs.count());
assertTrue(docs.count() == 0);
docs = coll.find("CAST(CAST('2019-2-1' as DATE) as JSON) overlaps $.dateField").execute();
// System.out.println("Number of rows using OVERLAPS with indexed array = "+docs.count());
assertTrue(docs.count() == 3);
docs = coll.find("'2019-2-1' not overlaps $.dateField").execute();
// System.out.println("Number of rows using NOT OVERLAPS without casting = "+docs.count());
assertTrue(docs.count() == 0);
// Integration scenarios for time
docs = coll.find("CAST(CAST(:timeField as TIME) as JSON) in $.timeField").bind("timeField", "7.30").execute();
assertTrue(docs.count() == 1);
docs = coll.find(":timeField not in $.timeField").bind("timeField", "7.30").execute();
assertTrue(docs.count() == 2);
docs = coll.find("CAST(CAST(:timeField as TIME) as JSON) overlaps $.timeField").bind("timeField", "7.30").execute();
assertTrue(docs.count() == 1);
docs = coll.find(":timeField not overlaps $.timeField").bind("timeField", "7.30").execute();
assertTrue(docs.count() == 2);
// Integration scenarios for datetime
docs = coll.find("CAST(CAST(:datetimeField as DATETIME) as JSON) in $.datetimeField").bind("datetimeField", "9999-12-30 23:59:59").execute();
assertTrue(docs.count() == 2);
docs = coll.find(":datetimeField NOT IN $.datetimeField").bind("datetimeField", "9999-12-30 23:59:59").execute();
assertTrue(docs.count() == 1);
docs = coll.find("CAST(CAST(:datetimeField as DATETIME) as JSON) OVERLAPS $.datetimeField").bind("datetimeField", "9999-12-30 23:59:59").execute();
assertTrue(docs.count() == 2);
docs = coll.find(":datetimeField NOT OVERLAPS $.datetimeField").bind("datetimeField", "9999-12-30 23:59:59").execute();
assertTrue(docs.count() == 1);
// Integration scenaris of Integer
docs = coll.find(":intField not in $.intField").bind("intField", 12).execute();
assertTrue(docs.count() == 1);
docs = coll.find(":intField overlaps $.intField").bind("intField", 12).execute();
assertTrue(docs.count() == 2);
docs = coll.find(":intField not overlaps $.intField").bind("intField", 12).execute();
assertTrue(docs.count() == 1);
// Integration scenaris of unsigned integer
docs = coll.find(":uintField not in $.uintField").bind("uintField", 52).execute();
assertTrue(docs.count() == 0);
docs = coll.find(":uintField overlaps $.uintField").bind("uintField", 52).execute();
assertTrue(docs.count() == 3);
docs = coll.find(":uintField not overlaps $.uintField").bind("uintField", 52).execute();
assertTrue(docs.count() == 0);
// Integration scenaris of character type
docs = coll.find(":charField not in $.charField").bind("charField", "abcd1").execute();
assertTrue(docs.count() == 0);
docs = coll.find(":charField overlaps $.charField").bind("charField", "abcd1").execute();
assertTrue(docs.count() == 3);
docs = coll.find(":charField not overlaps $.charField").bind("charField", "abcd1").execute();
assertTrue(docs.count() == 0);
// Integration scenarios of binary type
docs = coll.find(":binaryField not in $.binaryField").bind("binaryField", "abcd1").execute();
assertTrue(docs.count() == 0);
docs = coll.find(":binaryField overlaps $.binaryField").bind("binaryField", "abcd1").execute();
assertTrue(docs.count() == 3);
docs = coll.find(":binaryField not overlaps $.binaryField").bind("binaryField", "abcd1").execute();
assertTrue(docs.count() == 0);
sch.dropCollection(collname);
} finally {
if (sess != null) {
sess.close();
sess = null;
}
}
}
use of com.mysql.cj.xdevapi.Session in project aws-mysql-jdbc by awslabs.
the class CollectionTest method testArrayIndex012.
/**
* START testArrayIndexBasic tests
*
* @throws Exception
*/
@Test
public void testArrayIndex012() throws Exception {
System.out.println("testCreateIndexSanity");
String collname = "coll1";
Session sess = null;
try {
sess = new SessionFactory().getSession(this.baseUrl);
Schema sch = sess.getDefaultSchema();
sch.dropCollection(collname);
Collection coll = sch.createCollection(collname, true);
try {
coll.createIndex("intArrayIndex", "{\"fields\": [{\"field\": \"$.intField\", \"type\": \"SIGNED INTEGER\", \"array\": \"\"}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("uintArrayIndex", "{\"fields\": [{\"field\": \"$.uintField\", \"type\": \"UNSIGNED INTEGER\", \"array\": \"\"}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("floatArrayIndex", "{\"fields\": [{\"field\": \"$.floatField\", \"type\": \"DECIMAL(10,2)\", \"array\": \"\"}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("dateArrayIndex", "{\"fields\": [{\"field\": \"$.dateField\", \"type\": \"DATE\", \"array\": \"\"}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("datetimeArrayIndex", "{\"fields\": [{\"field\": \"$.datetimeField\", \"type\": \"DATETIME\", \"array\": \"\"}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("timeArrayIndex", "{\"fields\": [{\"field\": \"$.timeField\", \"type\": \"TIME\", \"array\": \"\"}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("charArrayIndex", "{\"fields\": [{\"field\": \"$.charField\", \"type\": \"CHAR(256)\", \"array\": \"\"}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("binaryArrayIndex", "{\"fields\": [{\"field\": \"$.binaryField\", \"type\": \"BINARY(256)\", \"array\": \"\"}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("intArrayIndex", "{\"fields\": [{\"field\": \"$.intField\", \"type\": \"SIGNED INTEGER\", \"array\": null}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("uintArrayIndex", "{\"fields\": [{\"field\": \"$.uintField\", \"type\": \"UNSIGNED INTEGER\", \"array\": null}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("floatArrayIndex", "{\"fields\": [{\"field\": \"$.floatField\", \"type\": \"DECIMAL(10,2)\", \"array\": null}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("dateArrayIndex", "{\"fields\": [{\"field\": \"$.dateField\", \"type\": \"DATE\", \"array\": null}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("datetimeArrayIndex", "{\"fields\": [{\"field\": \"$.datetimeField\", \"type\": \"DATETIME\", \"array\": null}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("timeArrayIndex", "{\"fields\": [{\"field\": \"$.timeField\", \"type\": \"TIME\", \"array\": null}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("charArrayIndex", "{\"fields\": [{\"field\": \"$.charField\", \"type\": \"CHAR(256)\", \"array\": null}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("binaryArrayIndex", "{\"fields\": [{\"field\": \"$.binaryField\", \"type\": \"BINARY(256)\", \"array\": null}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("intArrayIndex", "{\"fields\": [{\"field\": \"$.intField\", \"type\": \"SIGNED INTEGER\", \"array\": []}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("uintArrayIndex", "{\"fields\": [{\"field\": \"$.uintField\", \"type\": \"UNSIGNED INTEGER\", \"array\": []}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("floatArrayIndex", "{\"fields\": [{\"field\": \"$.floatField\", \"type\": \"DECIMAL(10,2)\", \"array\": []}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("dateArrayIndex", "{\"fields\": [{\"field\": \"$.dateField\", \"type\": \"DATE\", \"array\": []}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("datetimeArrayIndex", "{\"fields\": [{\"field\": \"$.datetimeField\", \"type\": \"DATETIME\", \"array\": []}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("timeArrayIndex", "{\"fields\": [{\"field\": \"$.timeField\", \"type\": \"TIME\", \"array\": []}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("charArrayIndex", "{\"fields\": [{\"field\": \"$.charField\", \"type\": \"CHAR(256)\", \"array\": []}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
try {
coll.createIndex("binaryArrayIndex", "{\"fields\": [{\"field\": \"$.binaryField\", \"type\": \"BINARY(256)\", \"array\": []}]}");
} catch (Exception e) {
System.out.println("ERROR : " + e.getMessage());
assertTrue(e.getMessage().contains("Index field 'array' member must be boolean."));
}
sch.dropCollection(collname);
} finally {
if (sess != null) {
sess.close();
sess = null;
}
}
}
Aggregations