forked from treasure-data/embulk-input-marketo
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from trocco-io/marge-treasure-data-v0.6.24
Marge treasure data v0.6.24
- Loading branch information
Showing
23 changed files
with
939 additions
and
180 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 |
---|---|---|
|
@@ -4,7 +4,7 @@ on: | |
workflow_dispatch: | ||
push: | ||
tags: | ||
- 'v*' | ||
- '*' | ||
|
||
jobs: | ||
build: | ||
|
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
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
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
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
10 changes: 9 additions & 1 deletion
10
src/main/java/org/embulk/input/marketo/MarketoInputPlugin.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
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
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
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
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
108 changes: 108 additions & 0 deletions
108
src/main/java/org/embulk/input/marketo/bulk_extract/AllStringJacksonServiceRecord.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,108 @@ | ||
package org.embulk.input.marketo.bulk_extract; | ||
|
||
import com.fasterxml.jackson.databind.node.ObjectNode; | ||
import org.embulk.base.restclient.jackson.JacksonServiceRecord; | ||
import org.embulk.base.restclient.jackson.JacksonServiceValue; | ||
import org.embulk.base.restclient.record.ValueLocator; | ||
import org.embulk.util.json.JsonParser; | ||
import org.embulk.util.timestamp.TimestampFormatter; | ||
import org.msgpack.value.Value; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.time.Instant; | ||
|
||
public class AllStringJacksonServiceRecord extends JacksonServiceRecord | ||
{ | ||
private static final Logger LOGGER = LoggerFactory.getLogger(AllStringJacksonServiceRecord.class); | ||
|
||
public AllStringJacksonServiceRecord(ObjectNode record) | ||
{ | ||
super(record); | ||
} | ||
|
||
@Override | ||
public JacksonServiceValue getValue(ValueLocator locator) | ||
{ | ||
// We know that this thing only contain text. | ||
JacksonServiceValue value = super.getValue(locator); | ||
return new StringConverterJacksonServiceRecord(value.stringValue()); | ||
} | ||
|
||
private class StringConverterJacksonServiceRecord extends JacksonServiceValue | ||
{ | ||
private final String textValue; | ||
|
||
public StringConverterJacksonServiceRecord(String textValue) | ||
{ | ||
super(null); | ||
this.textValue = textValue; | ||
} | ||
|
||
@Override | ||
public boolean isNull() | ||
{ | ||
return textValue == null || textValue.equals("null"); | ||
} | ||
|
||
@Override | ||
public boolean booleanValue() | ||
{ | ||
return Boolean.parseBoolean(textValue); | ||
} | ||
|
||
@Override | ||
public double doubleValue() | ||
{ | ||
try { | ||
return Double.parseDouble(textValue); | ||
} | ||
catch (Exception e) { | ||
LOGGER.info("skipped to parse Double: " + textValue); | ||
return Double.NaN; | ||
} | ||
} | ||
|
||
@Override | ||
public Value jsonValue(JsonParser jsonParser) | ||
{ | ||
try { | ||
return jsonParser.parse(textValue); | ||
} | ||
catch (Exception e) { | ||
LOGGER.info("skipped to parse JSON: " + textValue); | ||
return jsonParser.parse("{}"); | ||
} | ||
} | ||
|
||
@Override | ||
public long longValue() | ||
{ | ||
try { | ||
return Long.parseLong(textValue); | ||
} | ||
catch (Exception e) { | ||
LOGGER.info("skipped to parse Long: " + textValue); | ||
return Long.MIN_VALUE; | ||
} | ||
} | ||
|
||
@Override | ||
public String stringValue() | ||
{ | ||
return textValue; | ||
} | ||
|
||
@Override | ||
public Instant timestampValue(TimestampFormatter timestampFormatter) | ||
{ | ||
try { | ||
return timestampFormatter.parse(textValue); | ||
} | ||
catch (Exception e) { | ||
LOGGER.info("skipped to parse Timestamp: " + textValue); | ||
return null; | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.