'C++/parquet: How to write "Map" data (nested type)?

Based on the "StreamWriter" example (stream_reader_writer), I'm trying to add another column to the parquet schema which I want to write "Map-Data" (Map<Integer, String>) to.

According to this source, maps are supported by the C++ implementation. However, it's not clear to me how to ...

  • correctly add/define another column of type "Map" to the parquet schema. According to the previous link, Maps are "Logical Types", so my best try so far is

    fields.push_back(parquet::schema::PrimitiveNode::Make("Map", parquet::Repetition::REQUIRED, parquet::LogicalType::Map(), parquet::Type::INT64));

This compiles without error but I'm uncertain about the last parameter "primitive_type" (parquet::Type::INT64).

  • how to define and write actual Map values. Again, the second links provides a general description of a parquet Map:

Map

The github repo is missing a C++ example (or test case) on how to use a Map/Logical Types. I'm looking for advice/an C++ example, how to define and use a Map.



Solution 1:[1]

Another way to do it - set it as Daemon after calling super().__init__().

class A_Class(threading.Thread):
    def __init__(self):
        super().__init__()
        self.daemon = True

    def __del__(self):
        print('deleted')

    def run(self):
        while True:
            print("running", self.isDaemon())
            time.sleep(1)

Or use a keyword parameter:

class A_Class(threading.Thread):
    def __init__(self,*args,**kwargs):
        super().__init__(**kwargs)

    def __del__(self):
        print('deleted')

    def run(self):
        while True:
            print("running", self.isDaemon())
            time.sleep(1)

a_obj = A_Class(daemon=True)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 wwii