Search in sources :

Example 1 with AsterixClientConfig

use of org.apache.asterix.api.common.AsterixClientConfig in project asterixdb by apache.

the class AsterixClientDriver method main.

public static void main(String[] args) throws Exception {
    AsterixClientConfig acc = new AsterixClientConfig();
    CmdLineParser cmdParser = new CmdLineParser(acc);
    try {
        cmdParser.parseArgument(args);
    } catch (Exception e) {
        cmdParser.printUsage(System.err);
        throw e;
    }
    if (acc.getArguments().isEmpty()) {
        System.err.println("Please specify the file containing the query.");
        return;
    }
    if (acc.getArguments().size() > 1) {
        System.err.print("Too many arguments. ");
        System.err.println("Only the file contained the query needs to be specified.");
        return;
    }
    boolean exec = new Boolean(acc.execute);
    IHyracksClientConnection hcc = exec ? new HyracksConnection("localhost", acc.hyracksPort) : null;
    AsterixJavaClient q = compileQuery(hcc, acc.getArguments().get(0), new Boolean(acc.optimize), new Boolean(acc.onlyPhysical), exec || new Boolean(acc.hyracksJob));
    if (exec) {
        q.execute();
    }
}
Also used : AsterixClientConfig(org.apache.asterix.api.common.AsterixClientConfig) IHyracksClientConnection(org.apache.hyracks.api.client.IHyracksClientConnection) CmdLineParser(org.kohsuke.args4j.CmdLineParser) HyracksConnection(org.apache.hyracks.api.client.HyracksConnection) AsterixJavaClient(org.apache.asterix.api.java.AsterixJavaClient)

Aggregations

AsterixClientConfig (org.apache.asterix.api.common.AsterixClientConfig)1 AsterixJavaClient (org.apache.asterix.api.java.AsterixJavaClient)1 HyracksConnection (org.apache.hyracks.api.client.HyracksConnection)1 IHyracksClientConnection (org.apache.hyracks.api.client.IHyracksClientConnection)1 CmdLineParser (org.kohsuke.args4j.CmdLineParser)1