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
CREATE EXTERNAL TABLE `flows`( | |
`version` int, | |
`account` string, | |
`interfaceid` string, | |
`sourceaddress` string, | |
`destinationaddress` string, | |
`sourceport` int, | |
`destinationport` int, | |
`protocol` int, | |
`packets` int, |
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
SELECT | |
destinationaddress, | |
SUM(bytes) AS totalBytes | |
FROM flows | |
GROUP BY destinationaddress | |
ORDER BY totalBytes DESC LIMIT 10 |
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
SELECT sourceaddress, | |
destinationaddress, | |
SUM(bytes) AS totalBytes | |
FROM flows | |
GROUP BY sourceaddress, destinationaddress | |
ORDER BY totalBytes DESC LIMIT 10 |
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
SELECT destinationport, | |
COUNT(*) AS total | |
FROM flows | |
WHERE action = ‘REJECT’ | |
GROUP BY destinationport | |
ORDER BY total DESC LIMIT 10 |
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
SELECT corr(bytes,packets), action FROM flows GROUP BY action |
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
SELECT sum(packets) AS total, | |
split_part(sourceaddress,’.’, 1) = ‘10’ AS isInternal, | |
action | |
FROM flows | |
GROUP BY 2, action | |
ORDER BY total DESC LIMIT 10 |
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
SELECT destinationaddress, | |
SUM(bytes) AS totalBytes | |
FROM flows TABLESAMPLE SYSTEM (10) | |
GROUP BY destinationaddress | |
ORDER BY totalBytes DESC LIMIT 10 |
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.json.JSONObject; | |
import org.json.JSONTokener; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.net.ServerSocket; | |
import java.net.Socket; | |
public class Test { |
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
func communicateJava(input interface{}) (interface{}, error) { | |
inBytes, err := json.Marshal(input) | |
inputStr := string(inBytes) | |
goRequest <- inputStr | |
respStr := <-javaResponse | |
var resp interface{} | |
err = json.Unmarshal([]byte(respStr), &resp) | |
} | |
//export Java_Test_start |
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
System.loadLibrary("Hello"); | |
start(); | |
while (true) { | |
String request = readRequest(); | |
KMeansResult response = kMeans.calculate(request); | |
String response = response.toString(); | |
writeResponse(response); | |
} | |
} |