Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 64 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,6 @@
<artifactId>event-experimental</artifactId>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>jmx-http-rpc-experimental</artifactId>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>log</artifactId>
Expand All @@ -67,11 +62,23 @@
<dependency>
<groupId>io.airlift</groupId>
<artifactId>http-server</artifactId>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>jaxrs</artifactId>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.orbit</groupId>
<artifactId>javax.servlet</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -136,4 +143,56 @@
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.5</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>standalone</shadedClassifierName>

<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>${main-class}</Main-Class>
</manifestEntries>
</transformer>
</transformers>
<artifactSet>
<excludes>
<exclude>io.airlift:launcher</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.skife.maven</groupId>
<artifactId>really-executable-jar-maven-plugin</artifactId>
<version>1.0.5</version>
<configuration>
<flags>-Xmx1G</flags>
</configuration>

<executions>
<execution>
<phase>package</phase>
<goals>
<goal>really-executable-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
19 changes: 16 additions & 3 deletions src/main/java/com/facebook/presto/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ public void run()
@Command(name = "csv", description = "Convert CSB to columns")
public static class ConvertCsv extends BaseCommand
{
@Option(name = {"--column-separator"}, description = "Column separator")
public char columnSeparator = ',';
@Option(name = {"-d", "--column-delimiter"}, description = "Column delimiter character")
public String columnSeparator = ",";

@Option(name = {"-o", "--output-dir"}, description = "Output dir")
public String outputDir = "data";
Expand Down Expand Up @@ -115,7 +115,20 @@ public InputStreamReader getInput()
}
};
}
Csv.processCsv(inputSupplier, columnSeparator, processors.build());
Csv.processCsv(inputSupplier, toChar(columnSeparator), processors.build());
}

private char toChar(String string)
{
Preconditions.checkArgument(!string.isEmpty(), "String is empty");
if (string.length() == 1) {
return string.charAt(0);
}
if (string.length() == 6 && string.startsWith("\\u")) {
int value = Integer.parseInt(string.substring(2), 16);
return (char) value;
}
throw new IllegalArgumentException(String.format("Can not convert '%s' to a char", string));
}

private OutputSupplier<FileOutputStream> newCreateDirectoryOutputStreamSupplier(final File file)
Expand Down