public static WorkUnit queryResultMaterializationWorkUnit ( String query , HiveConverterUtils . StorageFormat storageFormat , StageableTableMetadata destinationTable ) { WorkUnit workUnit = new WorkUnit ( ) ; workUnit . setProp ( MATERIALIZER_MODE_KEY , MaterializerMode . QUERY_RESULT_MATERIALIZATION . name ( ) ) ; workUnit . setProp ( STORAGE_FORMAT_KEY , storageFormat . name ( ) ) ; workUnit . setProp ( QUERY_RESULT_TO_MATERIALIZE_KEY , query ) ; workUnit . setProp ( STAGEABLE_TABLE_METADATA_KEY , HiveSource . GENERICS_AWARE_GSON . toJson ( destinationTable ) ) ; TaskUtils . setTaskFactoryClass ( workUnit , HiveMaterializerTaskFactory . class ) ; HiveTask . disableHiveWatermarker ( workUnit ) ; return workUnit ; }
Create a work unit to materialize a query to a target table using a staging table in between .