data-generation

Build numbers table on the fly in Oracle

陌路散爱 提交于 2020-01-11 10:34:06
问题 How do I return a rowset consisting of the last four years based on the current date? If this query runs on 12/31/2010 it should return: 2007 2008 2009 2010 But if it is run on 1/1/2011 it should return: 2008 2009 2010 2011 Here's what I started with, two queries that return the starting year. I prefer the second as converting to string feels a bit dirty to me. SELECT TO_CHAR(TRUNC(sysdate, 'YY') - INTERVAL '3' YEAR, 'YYYY') FROM DUAL; SELECT EXTRACT (YEAR FROM sysdate) - 3 FROM DUAL; But I

Discrepancy in running Apache Beam Data Generator with DirectRunner and FlinkRunner

大憨熊 提交于 2020-01-06 07:12:42
问题 This question is related to my earlier post about benchmarking Apache Beam with an on-the-fly data generator. I have the following code to generate data within my pipeline: PCollection<Long> data = pipeline.apply(GenerateSequence.from(1) .withMaxReadTime(Duration.millis(3000))); //Print generated data data.apply(ParDo.of(new DoFn<Long, String>() { @ProcessElement public void processElement(@Element Long input) { System.out.println(input); } })); pipeline.run(); If I run this code with

Does a fake data generator exists in Java? [closed]

浪子不回头ぞ 提交于 2019-12-31 08:02:43
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I would like to know if a fake data generator exists for Java. In Perl exists Data::Faker and there's a port to Ruby called faker, for JavaScript faker.js . Someone know about a fake data generator for Java, that can provide random names, phone number, P.O. box number, etc... 回答1: If you're using Hibernate, try

Does a fake data generator exists in Java? [closed]

让人想犯罪 __ 提交于 2019-12-31 08:02:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I would like to know if a fake data generator exists for Java. In Perl exists Data::Faker and there's a port to Ruby called faker, for JavaScript faker.js . Someone know about a fake data generator for Java, that can provide random names, phone number, P.O. box number, etc... 回答1: If you're using Hibernate, try

Is there a lib to generate data according to a regexp? (Python or other)

£可爱£侵袭症+ 提交于 2019-12-21 04:18:10
问题 Given a regexp, I would like to generate random data x number of time to test something. e.g. >>> print generate_date('\d{2,3}') 13 >>> print generate_date('\d{2,3}') 422 Of course the objective is to do something a bit more complicated than that such as phone numbers and email addresses. Does something like this exists? If it does, does it exists for Python? If not, any clue/theory I could use to do that? 回答1: Pyparsing includes this regex inverter, which returns a generator of all

How do I generate text matching a regular expression from a regular expression? [closed]

别来无恙 提交于 2019-12-18 10:37:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Yup, you read that right. I needs something that is capable of generating random text from a regular expression. So the text should be random, but be matched by the regular expression. It seems it doesn't exist, but I could be wrong. Just a an example: that library would be capable of taking ' [ab]*c ' as input,

Java 8 Stream IllegalStateException: Stream has already been operated on or closed

可紊 提交于 2019-12-17 07:43:19
问题 I'm trying to generate Order instances using the Stream API. I have a factory function that creates the order, and a DoubleStream is used to initialize the amount of the order. private DoubleStream doubleStream = new Random().doubles(50.0, 200.0); private Order createOrder() { return new Order(doubleStream.findFirst().getAsDouble()); } @Test public void test() { Stream<Order> orderStream = Stream.generate(() -> { return createOrder(); }); orderStream.limit(10).forEach(System.out::println); If