forked from alibaba/mdrill
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2,669 changed files
with
773,584 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<%@ page contentType="text/html; charset=utf-8" %><%@ page import="java.io.*" %><%@ page import="javax.servlet.*" %><%@ page import="java.net.*" %><%@ page import="java.util.*" %><%@ page import="java.util.regex.*" %><%@ page import="java.text.*" %><%@ page import="com.alimama.web.*" %> | ||
|
||
<% | ||
String resultstr=TableJoin.getAllKmeans(); | ||
%><%=resultstr%> |
56 changes: 56 additions & 0 deletions
56
trunk/adhoc-internal/src/main/java/com/alimama/mdrill/ui/service/AdhocHiveTmpTable.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package com.alimama.mdrill.ui.service; | ||
|
||
|
||
public class AdhocHiveTmpTable { | ||
public static String createTmpTable(String tablename,String[] cols,String split) | ||
{ | ||
StringBuffer buffer=new StringBuffer(); | ||
buffer.append("CREATE EXTERNAL TABLE IF NOT EXISTS "+tablename); | ||
buffer.append(" ("); | ||
String joinchar=""; | ||
for(String s:cols) | ||
{ | ||
buffer.append(joinchar); | ||
buffer.append(s+" String "); | ||
joinchar=","; | ||
} | ||
|
||
buffer.append(")"); | ||
buffer.append(" PARTITIONED BY (ppp string) "); | ||
buffer.append(" ROW FORMAT DELIMITED "); | ||
buffer.append(" FIELDS TERMINATED BY '"+parseSplit(split)+"' "); | ||
buffer.append(" LINES TERMINATED BY '\\n' "); | ||
buffer.append(" STORED AS TextFile "); | ||
return buffer.toString(); | ||
} | ||
|
||
private static String parseSplit(String split) | ||
{ | ||
if(split.equals("\001")) | ||
{ | ||
return "\\001"; | ||
} | ||
|
||
|
||
return split; | ||
} | ||
|
||
|
||
public static String addData(String tablename,String storepath) | ||
{ | ||
StringBuffer buffer=new StringBuffer(); | ||
buffer.append("ALTER TABLE "+tablename+" ADD IF NOT EXISTS PARTITION (ppp='"+System.currentTimeMillis()+"') "); | ||
buffer.append(" LOCATION '"+storepath+"'"); | ||
return buffer.toString(); | ||
} | ||
|
||
|
||
public static String dropTable(String tablename) | ||
{ | ||
StringBuffer buffer=new StringBuffer(); | ||
buffer.append("drop TABLE "+tablename+" "); | ||
return buffer.toString(); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.