Search in sources :

Example 1 with TwoDimTableV3

use of water.api.schemas3.TwoDimTableV3 in project h2o-3 by h2oai.

the class TwoDimTableTest method run4.

@Test
public void run4() {
    TwoDimTable table = new TwoDimTable("All numbers", "yada", new String[] { "R1", "R2", "R3", "R4" }, new String[] { "Num1", "Num2", "Num3" }, new String[] { "double", "double", "double" }, new String[] { "%f", "%f", "%f" }, "", new String[4][], new double[][] { new double[] { 1.123, 3.42, 3200034.00001 }, new double[] { 123.34, emptyDouble, 1.0 }, new double[] { emptyDouble, emptyDouble, 3234.00001 }, new double[] { 3.33420923423423, 83.32, 3.40234234 } });
    String ts = table.toString();
    assertTrue(ts.length() > 0);
    Log.info(ts);
    String json = new TwoDimTableV3().fillFromImpl(table).toJsonString();
    Log.info(json);
}
Also used : TwoDimTable(water.util.TwoDimTable) TwoDimTableV3(water.api.schemas3.TwoDimTableV3) Test(org.junit.Test) ParserTest(water.parser.ParserTest)

Example 2 with TwoDimTableV3

use of water.api.schemas3.TwoDimTableV3 in project h2o-3 by h2oai.

the class TwoDimTableTest method run5.

@Test
public void run5() {
    TwoDimTable table = new TwoDimTable("All strings", null, new String[] { "R1", "R2", "R3", "R4" }, new String[] { "S1", "S2", "S3", "S4" }, new String[] { "string", "string", "string", "string" }, new String[] { "%s", "%s", "%s", "%s" }, "", new String[][] { new String[] { "a", "b", "c", "d" }, new String[] { "a", "b", "c", "d" }, new String[] { "a", null, "c", "d" }, new String[] { "a", "b", "c", null } }, new double[4][]);
    String ts = table.toString();
    assertTrue(ts.length() > 0);
    Log.info(ts);
    String json = new TwoDimTableV3().fillFromImpl(table).toJsonString();
    Log.info(json);
}
Also used : TwoDimTable(water.util.TwoDimTable) TwoDimTableV3(water.api.schemas3.TwoDimTableV3) Test(org.junit.Test) ParserTest(water.parser.ParserTest)

Example 3 with TwoDimTableV3

use of water.api.schemas3.TwoDimTableV3 in project h2o-3 by h2oai.

the class TwoDimTableTest method run8.

@Test
public void run8() {
    TwoDimTable table = new TwoDimTable("Mixed", "description", new String[1000], new String[] { "C0", "C1", "C2", "C3" }, new String[] { "double", "float", "int", "long" }, new String[] { "%f", "%f", "%d", "%d" }, "");
    for (int i = 0; i < 1000; ++i) {
        table.set(i, 0, Double.NEGATIVE_INFINITY);
        table.set(i, 1, Double.POSITIVE_INFINITY);
        table.set(i, 2, i);
        table.set(i, 3, -234234);
    }
    String ts = table.toString(1, false);
    assertTrue(ts.length() > 0);
    Log.info(ts);
    String json = new TwoDimTableV3().fillFromImpl(table).toJsonString();
    Log.info(json);
}
Also used : TwoDimTable(water.util.TwoDimTable) TwoDimTableV3(water.api.schemas3.TwoDimTableV3) Test(org.junit.Test) ParserTest(water.parser.ParserTest)

Example 4 with TwoDimTableV3

use of water.api.schemas3.TwoDimTableV3 in project h2o-3 by h2oai.

the class TwoDimTableTest method run6.

@Test
public void run6() {
    TwoDimTable table = new TwoDimTable("Mixed", "stuff", new String[] { "R0", "R1", "R2", "R3" }, new String[] { "C0", "C1", "C2", "C3" }, new String[] { "string", "string", "string", "string" }, new String[] { "%s", "%s", "%s", "%s" }, "");
    table.set(3, 3, "a33");
    table.set(0, 1, "a01");
    table.set(1, 2, 1.2);
    table.set(0, 2, "a02");
    table.set(3, 0, "a30");
    String ts = table.toString();
    assertTrue(ts.length() > 0);
    Log.info(ts);
    assertTrue(table.get(3, 0).equals("a30"));
    assertTrue(table.get(1, 2).equals("1.2"));
    assertTrue(table.get(1, 3) == null);
    String json = new TwoDimTableV3().fillFromImpl(table).toJsonString();
    Log.info(json);
}
Also used : TwoDimTable(water.util.TwoDimTable) TwoDimTableV3(water.api.schemas3.TwoDimTableV3) Test(org.junit.Test) ParserTest(water.parser.ParserTest)

Example 5 with TwoDimTableV3

use of water.api.schemas3.TwoDimTableV3 in project h2o-3 by h2oai.

the class TwoDimTableTest method run0.

@Test
public void run0() {
    TwoDimTable table = new TwoDimTable("My foo bar table", null, new String[4], new String[] { "DoubleValue", "S2", "My Terrible Percent Value" }, new String[] { "double", "string", "double" }, new String[] { "%5.8e", "%s", "%5.8g %%" }, "", new String[][] { new String[] { null, "One", null }, new String[] { null, null, null }, new String[] { null, "Three", null }, new String[] { null, "FooBar", null } }, new double[][] { new double[] { 1.123, emptyDouble, 3200034.00001 }, new double[] { 123.34, emptyDouble, 1.0 }, new double[] { emptyDouble, emptyDouble, 3234.00001 }, new double[] { 3.33420923423423, emptyDouble, 3.40234234 } });
    String ts = table.toString();
    assertTrue(ts.length() > 0);
    Log.info(ts);
    String json = new TwoDimTableV3().fillFromImpl(table).toJsonString();
    Log.info(json);
}
Also used : TwoDimTable(water.util.TwoDimTable) TwoDimTableV3(water.api.schemas3.TwoDimTableV3) Test(org.junit.Test) ParserTest(water.parser.ParserTest)

Aggregations

Test (org.junit.Test)9 TwoDimTableV3 (water.api.schemas3.TwoDimTableV3)9 ParserTest (water.parser.ParserTest)8 TwoDimTable (water.util.TwoDimTable)8 CreateFrame (hex.CreateFrame)1 Futures (water.Futures)1 FrameKeyV3 (water.api.schemas3.KeyV3.FrameKeyV3)1 ByteVec (water.fvec.ByteVec)1 Vec (water.fvec.Vec)1 ChunkSummary (water.util.ChunkSummary)1 PrettyPrint (water.util.PrettyPrint)1