Skip to content

Homework - #5

Open
a-filippo wants to merge 3 commits into
polis-vk:masterfrom
a-filippo:master
Open

Homework#5
a-filippo wants to merge 3 commits into
polis-vk:masterfrom
a-filippo:master

Conversation

@a-filippo

Copy link
Copy Markdown

No description provided.

@a-filippo

Copy link
Copy Markdown
Author

Коммит с подсчетом времени без комбайнера: f1470da
Коммит с комбайнером: 8d8cd04


@Override
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
final String[] line = value.toString().trim().split("\t", 2);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

По моему мнению, regex - последнее что нужно использовать в системах, который пытаются быть производительными.
Расскажите: почему вы использовали регекспы

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Наташа скинула регулярку и сказала сделать по ней, чтоб результаты сошлись с ее результатами

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

окей, это аргумент 😄
а почему нет использования uppercase или lowercase?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В этом вордкаунте мы считаем, что "слово" и "Слово" - разные слова
на базе этого в дальнейшем строится определение, является ли слово именем)
да и просто, это более гибкая штука, результаты можно потом обработать так, как нам нужно


int pos = line.indexOf(0x09);

String inputString = line.substring(0, pos);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

проверка на валидность pos была бы кстати

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ну вообще, наверное, да

String inputString = line.substring(0, pos);
int inputCount = Integer.valueOf(line.substring(pos+1));

context.write(new Text(inputString.toLowerCase()), new IntWritable(inputCount));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

job.setOutputValueClass(IntWritable.class);

// читаем из выходной папки wordcount
FileInputFormat.addInputPath(job, new Path(args[0]));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

что будет, если args не валидное?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

эксепшн)
мы не заморачивались с этим
это же учебный курс, мы делали акцент на других вещах

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants