ClouderaAdaptive-specific resources
Use ClouderaAdaptive resources to create your policy. The resources include the
ClouderaAdaptive.jexl script and the ClouderaAdaptive.json
file.
ClouderaAdaptive.jexl
The Lakehouse Optimizer contains the default ClouderaAdaptive.jexl file which is a policy script.
Add or modify the script elements as necessary. Each action builder statement generates a maintenance action.
Curl command to fetch the default ClouderaAdaptive.jexl file contents
curl --location 'https://[***LAKEHOUSE OPTIMIZER ENDPOINT***]/clo/api/v1/policies/resource?uri=dlm%3A%2F%2Ftps%3Adefault%2FClouderaAdaptive'
\ --header 'Authorization: Bearer ey'
Table statistics
- The
#pragma dlm.statistics truestatement ensures the pre-computation of statistics before the evaluation phase. - The
const stats = statistics($table)method gets the table statistics.
Viewing the table properties in the default JEXL file
ClouderaAdaptive.json
Curl command to fetch the contents of the default ClouderaAdaptive.json file
curl --location 'https://[***LAKEHOUSE OPTIMIZER ENDPOINT***]/clo/api/v1/policies/resource?uri=dlm%3A%2F%2Ftpp%3Adefault%2FClouderaAdaptive'
\
--header 'Authorization: Bearer ey'
Use the default action arguments and values as-is. If your use case requires more arguments in addition to the default action arguments or you want to tune the existing default arguments, then use the default JSON file as a template to add or modify the arguments, upload the modified file as a new JSON file, and reschedule the namespace.
ClouderaAdaptive.json file contents
{
"expireSnapshot": {
"expireOlderThan": 432000000,
"retainLast": 50,
"snapshotsDurationDeltaMax": 432000000
},
"rewriteManifest" : {
"useCaching": true,
"fileCountMax": 100,
"manifestFileSize": 8388608,
"smallFileRatioMax": 0.5
},
"rewriteDataFiles" : {
"targetFileSize": 536870912,
"filesCountDrop": 0.15,
"minInputFiles": 5,
"partialProgressEnabled": false
},
"rewritePositionDelete" : {
"enabled" : true,
"targetFileSize": 67108864,
"maxConcurrentGroupRewrite": 10,
"minInputFiles": 6
},
"deleteOrphanFiles" : {
"olderThan": 259200000
},
"label": "Cloudera Adaptive policy"
}Action arguments in the default JSON file
| Action argument | Value | Can be overwritten by specified table properties | Description |
|---|---|---|---|
| expireSnapshot | |||
snapshotsDurationDeltaMax |
Default is 600000 ms | snapshotsDurationDeltaMax |
Defines the maximum time duration between the latest and oldest snapshot duration in milliseconds. |
| rewriteManifest | |||
fileCountMax |
Default is 5 | fileCountMax |
Defines the maximum manifest file count to trigger the rewrite action. |
manifestFileSize |
Default is 8388608 |
write.manifest.target-size-bytes |
Defines the file size of a manifest file. Any manifest file that is less than the defined size is considered to be a small manifest file. |
smallFileRatioMax |
Default is 0.5 | smallFileRatioMax |
Determines the threshold for small manifest files count ratio. A manifest
file is considered to be small if it is less than the
manifestFileSize value. The ratio is calculated using the
smallManifestFileCount divided by
totalManifestCount equation. |
| rewriteDataFiles | |||
filesCountDrop |
Default is 0.15 | filesCountDrop |
Determines the threshold for file count reduction ratio per partition. A
partition is eligible for compaction when the file count drop ratio is greater
than the specified value. The ratio is calculated using the
(totalFiles –
expectedFileCount) /
totalFiles equation. For example, run the
compaction task only when more than 15% reduction is possible. |
zOrderColumns |
- | zOrderColumns |
Specifies the Z-order column to be use during the data file compaction process. |
where |
- | where |
Specifies the filter criteria to rewrite the data files during the compaction process. |
sort |
- | sort |
Determines how to sort the data files. |
CRON expression to schedule the table maintenance
The default ClouderaAdaptive.json file does not have a schedule. Upload a JSON file with the required CRON expression to define the schedule of the evaluation phase. Alternatively, you can perform manual table maintenance.
For example, the "cron": "0 0 * * * ?" expression runs the evaluation phase every hour. For more information about using CRON expressions, see CRON expression generator.
curl --location --request PUT 'https://[***LAKEHOUSE OPTIMIZER ENDPOINT***]/clo/api/v1/policies/resource?uri=dlm%3A%2F%2Ftpp%2F%2FClouderaAdaptive' \
--header 'Authorization: Bearer ey' \
--form 'resource=@"/Users/test/Desktop/ClouderaAdaptive.json"
In this scenario, the ClouderaAdaptive.json file only
contains the following CRON expression: {
"cron": "0 2 * * *"
}
