當前位置: 首頁>>代碼示例>>Java>>正文


Java TestStructInMap類代碼示例

本文整理匯總了Java中com.twitter.elephantbird.thrift.test.TestStructInMap的典型用法代碼示例。如果您正苦於以下問題:Java TestStructInMap類的具體用法?Java TestStructInMap怎麽用?Java TestStructInMap使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TestStructInMap類屬於com.twitter.elephantbird.thrift.test包,在下文中一共展示了TestStructInMap類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testFieldsPath

import com.twitter.elephantbird.thrift.test.TestStructInMap; //導入依賴的package包/類
@Test
public void testFieldsPath() {
  StructType person = ThriftSchemaConverter.toStructType(Person.class);

  List<String> paths = PrimitivePathVisitor.visit(person, ".");
  assertEquals(Arrays.asList("name.first_name", "name.last_name", "id", "email", "phones.number", "phones.type"),
      paths);

  paths = PrimitivePathVisitor.visit(person, "/");
  assertEquals(Arrays.asList("name/first_name", "name/last_name", "id", "email", "phones/number", "phones/type"),
      paths);

  StructType structInMap = ThriftSchemaConverter.toStructType(TestStructInMap.class);

  paths = PrimitivePathVisitor.visit(structInMap, ".");
  assertEquals(Arrays.asList("name", "names.key", "names.value.name.first_name", "names.value.name.last_name",
          "names.value.phones.key", "names.value.phones.value", "name_to_id.key", "name_to_id.value"), paths);

  paths = PrimitivePathVisitor.visit(structInMap, "/");
  assertEquals(Arrays.asList("name", "names/key", "names/value/name/first_name", "names/value/name/last_name",
      "names/value/phones/key", "names/value/phones/value", "name_to_id/key", "name_to_id/value"), paths);

}
 
開發者ID:apache,項目名稱:parquet-mr,代碼行數:24,代碼來源:TestFieldsPath.java

示例2: testProjectOnlyKeyInMap

import com.twitter.elephantbird.thrift.test.TestStructInMap; //導入依賴的package包/類
@Test
public void testProjectOnlyKeyInMap() {
  shouldGetProjectedSchema("name;names/key", "name;names.key", "message ParquetSchema {\n" +
          "  optional binary name (UTF8) = 1;\n" +
          "  optional group names (MAP) = 2 {\n" +
          "    repeated group map (MAP_KEY_VALUE) {\n" +
          "      required binary key (UTF8);\n" +
          "      optional group value {\n" +
          "        optional group name = 1 {\n" +
          "          optional binary first_name (UTF8) = 1;\n" +
          "        }\n" +
          "      }" +
          "    }\n" +
          "  }\n" +
          "}",TestStructInMap.class);
}
 
開發者ID:apache,項目名稱:parquet-mr,代碼行數:17,代碼來源:TestThriftSchemaConverter.java

示例3: testStructInMap

import com.twitter.elephantbird.thrift.test.TestStructInMap; //導入依賴的package包/類
@Test
public void testStructInMap() throws Exception {
  final Map<String, TestPerson> map = new HashMap<String, TestPerson>();
  map.put("foo", new TestPerson(new TestName("john", "johnson"), new HashMap<TestPhoneType, String>()));
  final Map<String, Integer> stringToIntMap = Collections.singletonMap("bar", 10);
  TestStructInMap testMap = new TestStructInMap("map_name", map, stringToIntMap);
  validate(testMap);
}
 
開發者ID:apache,項目名稱:parquet-mr,代碼行數:9,代碼來源:TestParquetReadProtocol.java

示例4: testProjectMapThriftType

import com.twitter.elephantbird.thrift.test.TestStructInMap; //導入依賴的package包/類
@Test
public void testProjectMapThriftType() {
  //project nested map
  shouldGetProjectedSchema("name;names/key*;names/value/**", "name;names.key*;names.value", "message ParquetSchema {\n" +
          "  optional binary name (UTF8) = 1;\n" +
          "  optional group names (MAP) = 2 {\n" +
          "    repeated group map (MAP_KEY_VALUE) {\n" +
          "      required binary key (UTF8);\n" +
          "      optional group value {\n" +
          "        optional group name = 1 {\n" +
          "          optional binary first_name (UTF8) = 1;\n" +
          "          optional binary last_name (UTF8) = 2;\n" +
          "        }\n" +
          "        optional group phones (MAP) = 2 {\n" +
          "          repeated group map (MAP_KEY_VALUE) {\n" +
          "            required binary key (ENUM);\n" +
          "            optional binary value (UTF8);\n" +
          "          }\n" +
          "        }\n" +
          "      }\n" +
          "    }\n" +
          "  }\n" +
          "}", TestStructInMap.class);

  //project only one level of nested map
  shouldGetProjectedSchema("name;names/key;names/value/name/*", "name;names.key;names.value.name","message ParquetSchema {\n" +
          "  optional binary name (UTF8) = 1;\n" +
          "  optional group names (MAP) = 2 {\n" +
          "    repeated group map (MAP_KEY_VALUE) {\n" +
          "      required binary key (UTF8);\n" +
          "      optional group value {\n" +
          "        optional group name = 1 {\n" +
          "          optional binary first_name (UTF8) = 1;\n" +
          "          optional binary last_name (UTF8) = 2;\n" +
          "        }\n" +
          "      }\n" +
          "    }\n" +
          "  }\n" +
          "}", TestStructInMap.class);
}
 
開發者ID:apache,項目名稱:parquet-mr,代碼行數:41,代碼來源:TestThriftSchemaConverter.java

示例5: testThrowWhenProjectionFilterMatchesNothing

import com.twitter.elephantbird.thrift.test.TestStructInMap; //導入依賴的package包/類
@Test
public void testThrowWhenProjectionFilterMatchesNothing() {
  shouldThrowWhenProjectionFilterMatchesNothing("name;non_existing", "non_existing", TestStructInMap.class);
  shouldThrowWhenProjectionFilterMatchesNothing("**;non_existing", "non_existing", TestStructInMap.class);
  shouldThrowWhenProjectionFilterMatchesNothing("**;names/non_existing", "names/non_existing", TestStructInMap.class);
  shouldThrowWhenProjectionFilterMatchesNothing("**;names/non_existing;non_existing", "names/non_existing\nnon_existing", TestStructInMap.class);
}
 
開發者ID:apache,項目名稱:parquet-mr,代碼行數:8,代碼來源:TestThriftSchemaConverter.java

示例6: testStructInMap

import com.twitter.elephantbird.thrift.test.TestStructInMap; //導入依賴的package包/類
@Test
public void testStructInMap() throws Exception {

  final Map<String, TestPerson> map = new HashMap<String, TestPerson>();
  map.put("foo", new TestPerson(new TestName("john", "johnson"), new HashMap<TestPhoneType, String>()));
  final Map<String, Integer> stringToIntMap = Collections.singletonMap("bar", 10);
  TestStructInMap testMap = new TestStructInMap("map_name", map, stringToIntMap);
  validateSameTupleAsEB(testMap);
}
 
開發者ID:apache,項目名稱:parquet-mr,代碼行數:10,代碼來源:TestThriftToPigCompatibility.java

示例7: testStructInMap

import com.twitter.elephantbird.thrift.test.TestStructInMap; //導入依賴的package包/類
@Test
public void testStructInMap() throws Exception {
  String[] expectations = {
      "startMessage()",
        "startField(name, 0)",
          "addBinary(map_name)",
        "endField(name, 0)",
        "startField(names, 1)",
          "startGroup()",
            "startField(map, 0)",
              "startGroup()",
                "startField(key, 0)",
                  "addBinary(foo)",
                "endField(key, 0)",
                "startField(value, 1)",
                  "startGroup()",
                    "startField(name, 0)",
                      "startGroup()",
                        "startField(first_name, 0)",
                          "addBinary(john)",
                        "endField(first_name, 0)",
                        "startField(last_name, 1)",
                          "addBinary(johnson)",
                        "endField(last_name, 1)",
                      "endGroup()",
                    "endField(name, 0)",
                    "startField(phones, 1)",
                      "startGroup()",
                      "endGroup()",
                    "endField(phones, 1)",
                  "endGroup()",
                "endField(value, 1)",
              "endGroup()",
            "endField(map, 0)",
          "endGroup()",
        "endField(names, 1)",
        "startField(name_to_id, 2)",
          "startGroup()",
            "startField(map, 0)",
              "startGroup()",
                "startField(key, 0)",
                  "addBinary(bar)",
                "endField(key, 0)",
                "startField(value, 1)",
                  "addInt(10)",
                "endField(value, 1)",
              "endGroup()",
            "endField(map, 0)",
          "endGroup()",
        "endField(name_to_id, 2)",
      "endMessage()"
  };

  final Map<String, TestPerson> map = new HashMap<String, TestPerson>();
  map.put("foo", new TestPerson(new TestName("john", "johnson"), new HashMap<TestPhoneType, String>()));
  final Map<String, Integer> stringToIntMap = Collections.singletonMap("bar", 10);
  TestStructInMap testMap = new TestStructInMap("map_name", map, stringToIntMap);
  validatePig(expectations, testMap);
  validateThrift(expectations, testMap);
}
 
開發者ID:apache,項目名稱:parquet-mr,代碼行數:61,代碼來源:TestParquetWriteProtocol.java

示例8: testThrowWhenNoColumnsAreSelected

import com.twitter.elephantbird.thrift.test.TestStructInMap; //導入依賴的package包/類
@Test
public void testThrowWhenNoColumnsAreSelected() {
  shouldThrowWhenNoColumnsAreSelected("non_existing", TestStructInMap.class);
}
 
開發者ID:apache,項目名稱:parquet-mr,代碼行數:5,代碼來源:TestThriftSchemaConverter.java


注:本文中的com.twitter.elephantbird.thrift.test.TestStructInMap類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。