This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # Simulates mixed workload on HBase using YCSB | |
| # Author: Ashrith (ashrith at cloudwick dot com) | |
| # Date: Wed, 16 2014 | |
| # | |
| # | |
| # You may want to tweak these variables to change the workload's behavior | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random | |
| # Original array | |
| array = [ | |
| "category1/1", "category1/2", "category1/3", "category1/4", "category1/5", "category1/6", | |
| "category2/1", "category2/2", "category2/3", "category2/4", | |
| "category3/1", "category3/2" | |
| ] | |
| # Separate elements by category |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.apache.hadoop.fs.{FileSystem, Path} | |
| def removeFilesExceptFirstN(directory: String, prefix: String, n: Int): Unit = { | |
| val fs = FileSystem.get(sparkContext.hadoopConfiguration) | |
| val files = fs.globStatus(new Path(s"$directory/$prefix*")).map(_.getPath.toString).sorted | |
| files.drop(n).foreach({ file => | |
| fs.delete(new Path(file), true) | |
| }) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import subprocess | |
| # Define the BTEQ script | |
| bteq_script = ''' | |
| .LOGON <Teradata_Hostname>/<Username>,<Password>; | |
| SELECT InfoData FROM DBC.DBCInfo WHERE InfoKey = 'RELEASE'; | |
| .LOGOFF; | |
| .EXIT; | |
| ''' |