use of com.teradata.jaqy.VariableManager in project jaqy by Teradata.
the class S3Utils method setSecret.
public static void setSecret(String secret, JaqyInterpreter interpreter) {
VariableManager vm = interpreter.getVariableManager();
vm.setVariable(S3SECRET_VAR, secret);
// clear the current s3 client
vm.setVariable(S3CLIENT_VAR, null);
}
use of com.teradata.jaqy.VariableManager in project jaqy by Teradata.
the class S3Utils method setAccess.
public static void setAccess(String access, JaqyInterpreter interpreter) {
VariableManager vm = interpreter.getVariableManager();
vm.setVariable(S3ACCESS_VAR, access);
// clear the current s3 client
vm.setVariable(S3CLIENT_VAR, null);
}
use of com.teradata.jaqy.VariableManager in project jaqy by Teradata.
the class S3Utils method getS3Builder.
public static AmazonS3ClientBuilder getS3Builder(JaqyInterpreter interpreter) {
VariableManager vm = interpreter.getVariableManager();
Variable var = vm.getVariable(S3BUILDER_VAR);
if (var != null) {
Object o = var.get();
if (o instanceof AmazonS3ClientBuilder)
return (AmazonS3ClientBuilder) o;
}
AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard();
builder.withPathStyleAccessEnabled(true);
vm.setVariable(S3BUILDER_VAR, builder);
return builder;
}
use of com.teradata.jaqy.VariableManager in project jaqy by Teradata.
the class WhereParserTest method test3.
@Test
public void test3() throws Exception {
Globals globals = new Globals();
JaqyInterpreter interpreter = new JaqyInterpreter(globals, null, null);
VariableManager vm = interpreter.getVariableManager();
ExpNode exp;
exp = WhereParser.getExp("1 is NULL");
exp.bind(null, vm, interpreter);
Assert.assertFalse((Boolean) exp.get());
exp = WhereParser.getExp("1 is not NULL");
exp.bind(null, vm, interpreter);
Assert.assertTrue((Boolean) exp.get());
}
use of com.teradata.jaqy.VariableManager in project jaqy by Teradata.
the class WhereParserTest method test2.
@Test
public void test2() throws Exception {
Globals globals = new Globals();
JaqyInterpreter interpreter = new JaqyInterpreter(globals, null, null);
VariableManager vm = interpreter.getVariableManager();
ExpNode exp;
exp = WhereParser.getExp("1 < any (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertTrue((Boolean) exp.get());
exp = WhereParser.getExp("1 < some (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertTrue((Boolean) exp.get());
exp = WhereParser.getExp("1 <= some (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertTrue((Boolean) exp.get());
exp = WhereParser.getExp("1 = some (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertTrue((Boolean) exp.get());
exp = WhereParser.getExp("1 <> some (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertTrue((Boolean) exp.get());
exp = WhereParser.getExp("1 > some (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertFalse((Boolean) exp.get());
exp = WhereParser.getExp("1 >= some (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertTrue((Boolean) exp.get());
exp = WhereParser.getExp("1 < ALL (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertFalse((Boolean) exp.get());
exp = WhereParser.getExp("1 <= ALL (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertTrue((Boolean) exp.get());
exp = WhereParser.getExp("1 = ALL (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertFalse((Boolean) exp.get());
exp = WhereParser.getExp("1 <> ALL (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertFalse((Boolean) exp.get());
exp = WhereParser.getExp("1 > ALL (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertFalse((Boolean) exp.get());
exp = WhereParser.getExp("1 >= ALL (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertFalse((Boolean) exp.get());
exp = WhereParser.getExp("1 IN (1, 2)");
exp.bind(null, vm, interpreter);
Assert.assertTrue((Boolean) exp.get());
exp = WhereParser.getExp("'abc' like 'a'");
exp.bind(null, vm, interpreter);
Assert.assertTrue((Boolean) exp.get());
exp = WhereParser.getExp("'abc' like 'a$'");
exp.bind(null, vm, interpreter);
Assert.assertFalse((Boolean) exp.get());
exp = WhereParser.getExp("'abc' like 'a.*'");
exp.bind(null, vm, interpreter);
Assert.assertTrue((Boolean) exp.get());
}
Aggregations